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
Younès EL BIACHE
2016-07-07 20:53:43 +0200
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
6bc72e157a346e708cee17d7c51560a0fdd084ff
6bc72e15
1 parent
10418323
edit summary
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
9 deletions
app/PageRevision.php
app/Repos/PageRepo.php
database/migrations/2016_07_07_181521_add_summary_to_page_revisions.php
resources/assets/sass/_grid.scss
resources/assets/sass/_pages.scss
resources/views/pages/form.blade.php
resources/views/pages/revisions.blade.php
app/PageRevision.php
View file @
6bc72e1
...
...
@@ -3,7 +3,7 @@
class
PageRevision
extends
Model
{
protected
$fillable
=
[
'name'
,
'html'
,
'text'
,
'markdown'
];
protected
$fillable
=
[
'name'
,
'html'
,
'text'
,
'markdown'
,
'summary'
];
/**
* Get the user that created the page revision
...
...
app/Repos/PageRepo.php
View file @
6bc72e1
...
...
@@ -310,7 +310,7 @@ class PageRepo extends EntityRepo
{
// Save a revision before updating
if
(
$page
->
html
!==
$input
[
'html'
]
||
$page
->
name
!==
$input
[
'name'
])
{
$this
->
saveRevision
(
$page
);
$this
->
saveRevision
(
$page
,
$input
[
'summary'
]
);
}
// Prevent slug being updated if no name change
...
...
@@ -362,7 +362,7 @@ class PageRepo extends EntityRepo
* @param Page $page
* @return $this
*/
public
function
saveRevision
(
Page
$page
)
public
function
saveRevision
(
Page
$page
,
$summary
=
null
)
{
$revision
=
$this
->
pageRevision
->
fill
(
$page
->
toArray
());
if
(
setting
(
'app-editor'
)
!==
'markdown'
)
$revision
->
markdown
=
''
;
...
...
@@ -372,6 +372,7 @@ class PageRepo extends EntityRepo
$revision
->
created_by
=
auth
()
->
user
()
->
id
;
$revision
->
created_at
=
$page
->
updated_at
;
$revision
->
type
=
'version'
;
$revision
->
summary
=
$summary
;
$revision
->
save
();
// Clear old revisions
if
(
$this
->
pageRevision
->
where
(
'page_id'
,
'='
,
$page
->
id
)
->
count
()
>
50
)
{
...
...
database/migrations/2016_07_07_181521_add_summary_to_page_revisions.php
0 → 100644
View file @
6bc72e1
<?php
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
AddSummaryToPageRevisions
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'page_revisions'
,
function
(
$table
)
{
$table
->
string
(
'summary'
)
->
nullable
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'page_revisions'
,
function
(
$table
)
{
$table
->
dropColumn
(
'summary'
);
});
}
}
resources/assets/sass/_grid.scss
View file @
6bc72e1
...
...
@@ -39,6 +39,9 @@ div[class^="col-"] img {
&
.fluid
{
max-width
:
100%
;
}
&
.medium
{
max-width
:
992px
;
}
&
.small
{
max-width
:
840px
;
}
...
...
resources/assets/sass/_pages.scss
View file @
6bc72e1
...
...
@@ -18,6 +18,9 @@
flex
:
1
;
flex-direction
:
column
;
}
#summary-input
{
width
:
140px
;
}
}
.page-style.editor
{
...
...
resources/views/pages/form.blade.php
View file @
6bc72e1
...
...
@@ -27,8 +27,8 @@
</div>
<div
class=
"col-sm-4 faded"
>
<div
class=
"action-buttons"
ng-cloak
>
<button
type=
"button"
ng-if=
"isUpdateDraft"
ng-click=
"discardDraft()"
class=
"text-button text-neg"
><i
class=
"zmdi zmdi-close-circle"
></i>
Discard Draft
</button>
<input
name=
"summary"
id=
"summary-input"
type=
"text"
placeholder=
"edit summary"
/>
<button
type=
"submit"
id=
"save-button"
class=
"text-button text-pos"
><i
class=
"zmdi zmdi-floppy"
></i>
Save Page
</button>
</div>
</div>
...
...
resources/views/pages/revisions.blade.php
View file @
6bc72e1
...
...
@@ -17,17 +17,18 @@
</div>
<div
class=
"container
small
"
ng-non-bindable
>
<div
class=
"container
medium
"
ng-non-bindable
>
<h1>
Page Revisions
<span
class=
"subheader"
>
For "{{ $page->name }}"
</span></h1>
@if(count($page->revisions) > 0)
<table
class=
"table"
>
<tr>
<th
width=
"40%"
>
Name
</th>
<th
colspan=
"2"
width=
"20%"
>
Created By
</th>
<th
width=
"20%"
>
Revision Date
</th>
<th
width=
"20%"
>
Actions
</th>
<th
width=
"30%"
>
Name
</th>
<th
colspan=
"2"
width=
"10%"
>
Created By
</th>
<th
width=
"15%"
>
Revision Date
</th>
<th
width=
"20%"
>
Summary
</th>
<th
width=
"15%"
>
Actions
</th>
</tr>
@foreach($page->revisions as $revision)
<tr>
...
...
@@ -39,6 +40,7 @@
</td>
<td>
@if($revision->createdBy) {{$revision->createdBy->name}} @else Deleted User @endif
</td>
<td><small>
{{$revision->created_at->format('jS F, Y H:i:s')}}
<br>
({{$revision->created_at->diffForHumans()}})
</small></td>
<td>
{{$revision->summary}}
</td>
<td>
<a
href=
"{{$revision->getUrl()}}"
target=
"_blank"
>
Preview
</a>
<span
class=
"text-muted"
>
|
</span>
...
...
Please
register
or
sign in
to post a comment