Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
167f26b9
Commit
167f26b9
authored
Jan 11, 2013
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an ordering scope to Wiki
parent
5aada8cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
app/controllers/wikis_controller.rb
app/controllers/wikis_controller.rb
+8
-8
app/models/wiki.rb
app/models/wiki.rb
+2
-0
No files found.
app/controllers/wikis_controller.rb
View file @
167f26b9
...
...
@@ -2,16 +2,16 @@ class WikisController < ProjectResourceController
before_filter
:authorize_read_wiki!
before_filter
:authorize_write_wiki!
,
only:
[
:edit
,
:create
,
:history
]
before_filter
:authorize_admin_wiki!
,
only: :destroy
def
pages
@wiki
s
=
@project
.
wikis
.
group
(
:slug
).
order
(
"created_at"
)
@wiki
_pages
=
@project
.
wikis
.
group
(
:slug
).
ordered
end
def
show
if
params
[
:
old_page
_id
]
@wiki
=
@project
.
wikis
.
find
(
params
[
:
old_page
_id
])
if
params
[
:
version
_id
]
@wiki
=
@project
.
wikis
.
find
(
params
[
:
version
_id
])
else
@wiki
=
@project
.
wikis
.
where
(
slug:
params
[
:id
]).
order
(
"created_at"
).
la
st
@wiki
=
@project
.
wikis
.
where
(
slug:
params
[
:id
]).
order
ed
.
fir
st
end
@note
=
@project
.
notes
.
new
(
noteable:
@wiki
)
...
...
@@ -29,7 +29,7 @@ class WikisController < ProjectResourceController
end
def
edit
@wiki
=
@project
.
wikis
.
where
(
slug:
params
[
:id
]).
order
(
"created_at"
).
la
st
@wiki
=
@project
.
wikis
.
where
(
slug:
params
[
:id
]).
order
ed
.
fir
st
@wiki
=
Wiki
.
regenerate_from
@wiki
end
...
...
@@ -47,9 +47,9 @@ class WikisController < ProjectResourceController
end
def
history
@wiki
s
=
@project
.
wikis
.
where
(
slug:
params
[
:id
]).
order
(
"created_at"
)
@wiki
_pages
=
@project
.
wikis
.
where
(
slug:
params
[
:id
]).
ordered
end
def
destroy
@wikis
=
@project
.
wikis
.
where
(
slug:
params
[
:id
]).
delete_all
...
...
app/models/wiki.rb
View file @
167f26b9
...
...
@@ -25,6 +25,8 @@ class Wiki < ActiveRecord::Base
before_update
:set_slug
scope
:ordered
,
order
(
"created_at DESC"
)
def
to_param
slug
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment