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
c4b1a5f5
Commit
c4b1a5f5
authored
Apr 28, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow nested files in wiki.
parent
0050c07f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
4 deletions
+20
-4
app/models/project_wiki.rb
app/models/project_wiki.rb
+8
-1
app/models/wiki_page.rb
app/models/wiki_page.rb
+10
-1
app/views/projects/wikis/_new.html.haml
app/views/projects/wikis/_new.html.haml
+1
-1
config/routes.rb
config/routes.rb
+1
-1
No files found.
app/models/project_wiki.rb
View file @
c4b1a5f5
...
...
@@ -64,7 +64,8 @@ class ProjectWiki
#
# Returns an initialized WikiPage instance or nil
def
find_page
(
title
,
version
=
nil
)
if
page
=
wiki
.
page
(
title
,
version
)
page_title
,
page_dir
=
page_title_and_dir
(
title
)
if
page
=
wiki
.
page
(
page_title
,
version
,
page_dir
)
WikiPage
.
new
(
self
,
page
,
true
)
else
nil
...
...
@@ -90,6 +91,12 @@ class ProjectWiki
wiki
.
delete_page
(
page
,
commit_details
(
:deleted
,
message
,
page
.
title
))
end
def
page_title_and_dir
(
title
)
title_array
=
title
.
split
(
"/"
)
title
=
title_array
.
pop
[
title
.
gsub
(
/\.[^.]*$/
,
""
),
title_array
.
join
(
"/"
)]
end
private
def
create_repo!
...
...
app/models/wiki_page.rb
View file @
c4b1a5f5
...
...
@@ -175,8 +175,17 @@ class WikiPage
end
def
save
(
method
,
*
args
)
if
valid?
&&
wiki
.
send
(
method
,
*
args
)
@page
=
wiki
.
wiki
.
paged
(
title
)
page_details
=
if
method
==
:update_page
@page
.
path
else
title
end
page_title
,
page_dir
=
wiki
.
page_title_and_dir
(
page_details
)
@page
=
wiki
.
wiki
.
paged
(
page_title
,
page_dir
)
set_attributes
...
...
app/views/projects/wikis/_new.html.haml
View file @
c4b1a5f5
...
...
@@ -9,6 +9,6 @@
%span
Page slug
=
text_field_tag
:new_wiki_path
,
nil
,
placeholder:
'how-to-setup'
,
class:
'form-control'
,
required:
true
,
:'data-wikis-path'
=>
project_wikis_path
(
@project
)
%p
.hint
Please don't use spaces
and slashes
Please don't use spaces
.
.modal-footer
=
link_to
'Build'
,
'#'
,
class:
'build-new-wiki btn btn-create'
config/routes.rb
View file @
c4b1a5f5
...
...
@@ -204,7 +204,7 @@ Gitlab::Application.routes.draw do
end
end
resources
:wikis
,
only:
[
:show
,
:edit
,
:destroy
,
:create
],
constraints:
{
id:
/[a-zA-Z.0-9_\-]+/
}
do
resources
:wikis
,
only:
[
:show
,
:edit
,
:destroy
,
:create
],
constraints:
{
id:
/[a-zA-Z.0-9_\-
\/
]+/
}
do
collection
do
get
:pages
put
':id'
=>
'wikis#update'
...
...
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