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
Léo-Paul Géneau
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
Show 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
...
@@ -4,14 +4,14 @@ class WikisController < ProjectResourceController
...
@@ -4,14 +4,14 @@ class WikisController < ProjectResourceController
before_filter
:authorize_admin_wiki!
,
only: :destroy
before_filter
:authorize_admin_wiki!
,
only: :destroy
def
pages
def
pages
@wiki
s
=
@project
.
wikis
.
group
(
:slug
).
order
(
"created_at"
)
@wiki
_pages
=
@project
.
wikis
.
group
(
:slug
).
ordered
end
end
def
show
def
show
if
params
[
:
old_page
_id
]
if
params
[
:
version
_id
]
@wiki
=
@project
.
wikis
.
find
(
params
[
:
old_page
_id
])
@wiki
=
@project
.
wikis
.
find
(
params
[
:
version
_id
])
else
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
end
@note
=
@project
.
notes
.
new
(
noteable:
@wiki
)
@note
=
@project
.
notes
.
new
(
noteable:
@wiki
)
...
@@ -29,7 +29,7 @@ class WikisController < ProjectResourceController
...
@@ -29,7 +29,7 @@ class WikisController < ProjectResourceController
end
end
def
edit
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
@wiki
=
Wiki
.
regenerate_from
@wiki
end
end
...
@@ -47,7 +47,7 @@ class WikisController < ProjectResourceController
...
@@ -47,7 +47,7 @@ class WikisController < ProjectResourceController
end
end
def
history
def
history
@wiki
s
=
@project
.
wikis
.
where
(
slug:
params
[
:id
]).
order
(
"created_at"
)
@wiki
_pages
=
@project
.
wikis
.
where
(
slug:
params
[
:id
]).
ordered
end
end
def
destroy
def
destroy
...
...
app/models/wiki.rb
View file @
167f26b9
...
@@ -25,6 +25,8 @@ class Wiki < ActiveRecord::Base
...
@@ -25,6 +25,8 @@ class Wiki < ActiveRecord::Base
before_update
:set_slug
before_update
:set_slug
scope
:ordered
,
order
(
"created_at DESC"
)
def
to_param
def
to_param
slug
slug
end
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