Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2016-08-13 17:56:20 +0100
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
baa260a03d872c59e8dd086a0969522df5e492d4
baa260a0
1 parent
b157a992
Started work on subdirectory support
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
21 deletions
app/Book.php
app/Chapter.php
app/Page.php
app/User.php
app/helpers.php
config/app.php
resources/views/base.blade.php
app/Book.php
View file @
baa260a
...
...
@@ -11,7 +11,7 @@ class Book extends Entity
*/
public
function
getUrl
()
{
return
'/books/'
.
$this
->
slug
;
return
baseUrl
(
'/books/'
.
$this
->
slug
)
;
}
/*
...
...
app/Chapter.php
View file @
baa260a
...
...
@@ -30,7 +30,7 @@ class Chapter extends Entity
public
function
getUrl
()
{
$bookSlug
=
$this
->
getAttribute
(
'bookSlug'
)
?
$this
->
getAttribute
(
'bookSlug'
)
:
$this
->
book
->
slug
;
return
'/books/'
.
$bookSlug
.
'/chapter/'
.
$this
->
slug
;
return
baseUrl
(
'/books/'
.
$bookSlug
.
'/chapter/'
.
$this
->
slug
)
;
}
/**
...
...
app/Page.php
View file @
baa260a
...
...
@@ -63,7 +63,7 @@ class Page extends Entity
$bookSlug
=
$this
->
getAttribute
(
'bookSlug'
)
?
$this
->
getAttribute
(
'bookSlug'
)
:
$this
->
book
->
slug
;
$midText
=
$this
->
draft
?
'/draft/'
:
'/page/'
;
$idComponent
=
$this
->
draft
?
$this
->
id
:
$this
->
slug
;
return
'/books/'
.
$bookSlug
.
$midText
.
$idComponent
;
return
baseUrl
(
'/books/'
.
$bookSlug
.
$midText
.
$idComponent
)
;
}
/**
...
...
app/User.php
View file @
baa260a
...
...
@@ -138,8 +138,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
*/
public
function
getAvatar
(
$size
=
50
)
{
if
(
$this
->
image_id
===
0
||
$this
->
image_id
===
'0'
||
$this
->
image_id
===
null
)
return
'/user_avatar.png'
;
return
$this
->
avatar
->
getThumb
(
$size
,
$size
,
false
);
if
(
$this
->
image_id
===
0
||
$this
->
image_id
===
'0'
||
$this
->
image_id
===
null
)
return
baseUrl
(
'/user_avatar.png'
)
;
return
baseUrl
(
$this
->
avatar
->
getThumb
(
$size
,
$size
,
false
)
);
}
/**
...
...
@@ -157,7 +157,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
*/
public
function
getEditUrl
()
{
return
'/settings/users/'
.
$this
->
id
;
return
baseUrl
(
'/settings/users/'
.
$this
->
id
)
;
}
/**
...
...
app/helpers.php
View file @
baa260a
...
...
@@ -20,11 +20,11 @@ if (!function_exists('versioned_asset')) {
}
if
(
isset
(
$manifest
[
$file
]))
{
return
'/'
.
$manifest
[
$file
]
;
return
baseUrl
(
$manifest
[
$file
])
;
}
if
(
file_exists
(
public_path
(
$file
)))
{
return
'/'
.
$file
;
return
baseUrl
(
$file
)
;
}
throw
new
InvalidArgumentException
(
"File
{
$file
}
not defined in asset manifest."
);
...
...
@@ -63,6 +63,17 @@ function setting($key, $default = false)
}
/**
* Helper to create url's relative to the applications root path.
* @param $path
* @return string
*/
function
baseUrl
(
$path
)
{
$path
=
trim
(
$path
,
'/'
);
return
rtrim
(
config
(
'app.url'
),
'/'
)
.
'/'
.
$path
;
}
/**
* Generate a url with multiple parameters for sorting purposes.
* Works out the logic to set the correct sorting direction
* Discards empty parameters and allows overriding.
...
...
config/app.php
View file @
baa260a
...
...
@@ -31,7 +31,7 @@ return [
|
*/
'url'
=>
env
(
'APP_URL'
,
'
http://localhost
'
),
'url'
=>
env
(
'APP_URL'
,
'
'
)
===
'http://bookstack.dev'
?
''
:
env
(
'APP_URL'
,
'
'
),
/*
|--------------------------------------------------------------------------
...
...
resources/views/base.blade.php
View file @
baa260a
...
...
@@ -11,11 +11,11 @@
<!-- Styles and Fonts -->
<link
rel=
"stylesheet"
href=
"{{ versioned_asset('css/styles.css') }}"
>
<link
rel=
"stylesheet"
media=
"print"
href=
"{{ versioned_asset('css/print-styles.css') }}"
>
<link
rel=
"stylesheet"
href=
"
/libs/material-design-iconic-font/css/material-design-iconic-font.min.css
"
>
<link
rel=
"stylesheet"
href=
"
{{ baseUrl('/libs/material-design-iconic-font/css/material-design-iconic-font.min.css') }}
"
>
<!-- Scripts -->
<script
src=
"
/libs/jquery/jquery.min.js?version=2.1.4
"
></script>
<script
src=
"
/libs/jquery/jquery-ui.min.js?version=1.11.4
"
></script>
<script
src=
"
{{ baseUrl('/libs/jquery/jquery.min.js?version=2.1.4') }}
"
></script>
<script
src=
"
{{ baseUrl('/libs/jquery/jquery-ui.min.js?version=1.11.4') }}
"
></script>
@yield('head')
...
...
@@ -34,15 +34,15 @@
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-lg-4 col-sm-4"
ng-non-bindable
>
<a
href=
"
/
"
class=
"logo"
>
<a
href=
"
{{ baseUrl('/') }}
"
class=
"logo"
>
@if(setting('app-logo', '') !== 'none')
<img
class=
"logo-image"
src=
"{{ setting('app-logo', '') === '' ?
'/logo.png' : setting('app-logo', ''
) }}"
alt=
"Logo"
>
<img
class=
"logo-image"
src=
"{{ setting('app-logo', '') === '' ?
baseUrl('/logo.png') : baseUrl(setting('app-logo', '')
) }}"
alt=
"Logo"
>
@endif
<span
class=
"logo-text"
>
{{ setting('app-name', 'BookStack') }}
</span>
</a>
</div>
<div
class=
"col-lg-4 col-sm-3 text-center"
>
<form
action=
"
/search/all
"
method=
"GET"
class=
"search-box"
>
<form
action=
"
{{ baseUrl('/search/all') }}
"
method=
"GET"
class=
"search-box"
>
<input
id=
"header-search-box-input"
type=
"text"
name=
"term"
tabindex=
"2"
value=
"{{ isset($searchTerm) ? $searchTerm : '' }}"
>
<button
id=
"header-search-box-button"
type=
"submit"
class=
"text-button"
><i
class=
"zmdi zmdi-search"
></i></button>
</form>
...
...
@@ -50,12 +50,12 @@
<div
class=
"col-lg-4 col-sm-5"
>
<div
class=
"float right"
>
<div
class=
"links text-center"
>
<a
href=
"
/books
"
><i
class=
"zmdi zmdi-book"
></i>
Books
</a>
<a
href=
"
{{ baseUrl('/books') }}
"
><i
class=
"zmdi zmdi-book"
></i>
Books
</a>
@if(isset($currentUser)
&&
userCan('settings-manage'))
<a
href=
"
/settings
"
><i
class=
"zmdi zmdi-settings"
></i>
Settings
</a>
<a
href=
"
{{ baseUrl('/settings') }}
"
><i
class=
"zmdi zmdi-settings"
></i>
Settings
</a>
@endif
@if(!isset($signedIn) || !$signedIn)
<a
href=
"
/login
"
><i
class=
"zmdi zmdi-sign-in"
></i>
Sign In
</a>
<a
href=
"
{{ baseUrl('/login') }}
"
><i
class=
"zmdi zmdi-sign-in"
></i>
Sign In
</a>
@endif
</div>
@if(isset($signedIn)
&&
$signedIn)
...
...
@@ -66,13 +66,13 @@
</span>
<ul>
<li>
<a
href=
"
/user/{{$currentUser->id
}}"
class=
"text-primary"
><i
class=
"zmdi zmdi-account zmdi-hc-fw zmdi-hc-lg"
></i>
View Profile
</a>
<a
href=
"
{{ baseUrl("
/
user
/{$
currentUser-
>
id}")
}}" class="text-primary">
<i
class=
"zmdi zmdi-account zmdi-hc-fw zmdi-hc-lg"
></i>
View Profile
</a>
</li>
<li>
<a
href=
"
/settings/users/{{$currentUser->id
}}"
class=
"text-primary"
><i
class=
"zmdi zmdi-edit zmdi-hc-fw zmdi-hc-lg"
></i>
Edit Profile
</a>
<a
href=
"
{{ baseUrl("
/
settings
/
users
/{$
currentUser-
>
id}")
}}" class="text-primary">
<i
class=
"zmdi zmdi-edit zmdi-hc-fw zmdi-hc-lg"
></i>
Edit Profile
</a>
</li>
<li>
<a
href=
"
/logout
"
class=
"text-neg"
><i
class=
"zmdi zmdi-run zmdi-hc-fw zmdi-hc-lg"
></i>
Logout
</a>
<a
href=
"
{{ baseUrl('/logout') }}
"
class=
"text-neg"
><i
class=
"zmdi zmdi-run zmdi-hc-fw zmdi-hc-lg"
></i>
Logout
</a>
</li>
</ul>
</div>
...
...
Please
register
or
sign in
to post a comment