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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
85974948
Commit
85974948
authored
Feb 19, 2012
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wiki: history
parent
b565cd19
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
4 deletions
+41
-4
app/controllers/wikis_controller.rb
app/controllers/wikis_controller.rb
+10
-1
app/models/wiki.rb
app/models/wiki.rb
+2
-1
app/views/wikis/history.html.haml
app/views/wikis/history.html.haml
+14
-0
app/views/wikis/show.html.haml
app/views/wikis/show.html.haml
+2
-0
config/routes.rb
config/routes.rb
+5
-1
db/migrate/20120219193300_add_user_to_wiki.rb
db/migrate/20120219193300_add_user_to_wiki.rb
+6
-0
db/schema.rb
db/schema.rb
+2
-1
No files found.
app/controllers/wikis_controller.rb
View file @
85974948
...
@@ -4,7 +4,11 @@ class WikisController < ApplicationController
...
@@ -4,7 +4,11 @@ class WikisController < ApplicationController
layout
"project"
layout
"project"
def
show
def
show
@wiki
=
@project
.
wikis
.
where
(
:slug
=>
params
[
:id
]).
order
(
"created_at"
).
last
if
params
[
:old_page_id
]
@wiki
=
@project
.
wikis
.
find
(
params
[
:old_page_id
])
else
@wiki
=
@project
.
wikis
.
where
(
:slug
=>
params
[
:id
]).
order
(
"created_at"
).
last
end
respond_to
do
|
format
|
respond_to
do
|
format
|
if
@wiki
if
@wiki
format
.
html
format
.
html
...
@@ -22,6 +26,7 @@ class WikisController < ApplicationController
...
@@ -22,6 +26,7 @@ class WikisController < ApplicationController
def
create
def
create
@wiki
=
@project
.
wikis
.
new
(
params
[
:wiki
])
@wiki
=
@project
.
wikis
.
new
(
params
[
:wiki
])
@wiki
.
user
=
current_user
respond_to
do
|
format
|
respond_to
do
|
format
|
if
@wiki
.
save
if
@wiki
.
save
...
@@ -31,6 +36,10 @@ class WikisController < ApplicationController
...
@@ -31,6 +36,10 @@ class WikisController < ApplicationController
end
end
end
end
end
end
def
history
@wikis
=
@project
.
wikis
.
where
(
:slug
=>
params
[
:id
]).
order
(
"created_at"
)
end
def
destroy
def
destroy
@wiki
=
@project
.
wikis
.
find
(
params
[
:id
])
@wiki
=
@project
.
wikis
.
find
(
params
[
:id
])
...
...
app/models/wiki.rb
View file @
85974948
class
Wiki
<
ActiveRecord
::
Base
class
Wiki
<
ActiveRecord
::
Base
belongs_to
:project
belongs_to
:project
belongs_to
:user
validates
:content
,
:title
,
:presence
=>
true
validates
:content
,
:title
,
:
user_id
,
:
presence
=>
true
validates
:title
,
:length
=>
1
..
250
validates
:title
,
:length
=>
1
..
250
before_update
:set_slug
before_update
:set_slug
...
...
app/views/wikis/history.html.haml
0 → 100644
View file @
85974948
%h2
Versions
%table
%thead
%tr
%th
#
%th
last edit
%th
created by
%tbody
-
@wikis
.
each_with_index
do
|
wiki_page
,
i
|
%tr
%td
=
i
+
1
%td
=
link_to
wiki_page
.
created_at
.
to_s
(
:short
),
project_wiki_path
(
@project
,
wiki_page
,
:old_page_id
=>
wiki_page
.
id
)
%td
=
wiki_page
.
user
.
name
app/views/wikis/show.html.haml
View file @
85974948
%h3
%h3
=
@wiki
.
title
=
@wiki
.
title
-
if
can?
current_user
,
:write_wiki
,
@project
-
if
can?
current_user
,
:write_wiki
,
@project
=
link_to
history_project_wiki_path
(
@project
,
@wiki
),
:class
=>
"right btn small"
do
History
=
link_to
edit_project_wiki_path
(
@project
,
@wiki
),
:class
=>
"right btn small"
do
=
link_to
edit_project_wiki_path
(
@project
,
@wiki
),
:class
=>
"right btn small"
do
Edit
Edit
...
...
config/routes.rb
View file @
85974948
...
@@ -56,7 +56,11 @@ Gitlab::Application.routes.draw do
...
@@ -56,7 +56,11 @@ Gitlab::Application.routes.draw do
get
"files"
get
"files"
end
end
resources
:wikis
,
:only
=>
[
:show
,
:edit
,
:destroy
,
:create
]
resources
:wikis
,
:only
=>
[
:show
,
:edit
,
:destroy
,
:create
]
do
member
do
get
"history"
end
end
resource
:repository
do
resource
:repository
do
member
do
member
do
...
...
db/migrate/20120219193300_add_user_to_wiki.rb
0 → 100644
View file @
85974948
class
AddUserToWiki
<
ActiveRecord
::
Migration
def
change
add_column
:wikis
,
:user_id
,
:integer
end
end
db/schema.rb
View file @
85974948
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended to check this file into your version control system.
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
201202191
4081
0
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
201202191
9330
0
)
do
create_table
"issues"
,
:force
=>
true
do
|
t
|
create_table
"issues"
,
:force
=>
true
do
|
t
|
t
.
string
"title"
t
.
string
"title"
...
@@ -166,6 +166,7 @@ ActiveRecord::Schema.define(:version => 20120219140810) do
...
@@ -166,6 +166,7 @@ ActiveRecord::Schema.define(:version => 20120219140810) do
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
string
"slug"
t
.
string
"slug"
t
.
integer
"user_id"
end
end
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