BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
wikis_controller.rb
app/controllers/wikis_controller.rb
+8
-8
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