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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a5625c74
Commit
a5625c74
authored
Dec 26, 2016
by
Alex Braha Stoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render wiki entries using a collection of WikiPage and WikiDirectory objects
parent
7bd68ae0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
24 deletions
+13
-24
app/controllers/projects/wikis_controller.rb
app/controllers/projects/wikis_controller.rb
+2
-2
app/views/projects/wikis/_sidebar.html.haml
app/views/projects/wikis/_sidebar.html.haml
+1
-9
app/views/projects/wikis/_sidebar_wiki_pages.html.haml
app/views/projects/wikis/_sidebar_wiki_pages.html.haml
+0
-4
app/views/projects/wikis/_wiki_directory.html.haml
app/views/projects/wikis/_wiki_directory.html.haml
+4
-0
app/views/projects/wikis/_wiki_page.html.haml
app/views/projects/wikis/_wiki_page.html.haml
+5
-1
app/views/projects/wikis/pages.html.haml
app/views/projects/wikis/pages.html.haml
+1
-8
No files found.
app/controllers/projects/wikis_controller.rb
View file @
a5625c74
...
@@ -8,7 +8,7 @@ class Projects::WikisController < Projects::ApplicationController
...
@@ -8,7 +8,7 @@ class Projects::WikisController < Projects::ApplicationController
def
pages
def
pages
@wiki_pages
=
Kaminari
.
paginate_array
(
@project_wiki
.
pages
).
page
(
params
[
:page
])
@wiki_pages
=
Kaminari
.
paginate_array
(
@project_wiki
.
pages
).
page
(
params
[
:page
])
@wiki_
directo
ries
=
WikiPage
.
group_by_directory
(
@wiki_pages
)
@wiki_
ent
ries
=
WikiPage
.
group_by_directory
(
@wiki_pages
)
end
end
def
show
def
show
...
@@ -117,7 +117,7 @@ class Projects::WikisController < Projects::ApplicationController
...
@@ -117,7 +117,7 @@ class Projects::WikisController < Projects::ApplicationController
# Call #wiki to make sure the Wiki Repo is initialized
# Call #wiki to make sure the Wiki Repo is initialized
@project_wiki
.
wiki
@project_wiki
.
wiki
@sidebar_wiki_
directo
ries
=
WikiPage
.
group_by_directory
(
@project_wiki
.
pages
.
first
(
15
))
@sidebar_wiki_
ent
ries
=
WikiPage
.
group_by_directory
(
@project_wiki
.
pages
.
first
(
15
))
rescue
ProjectWiki
::
CouldNotCreateWikiError
rescue
ProjectWiki
::
CouldNotCreateWikiError
flash
[
:notice
]
=
"Could not create Wiki Repository at this time. Please try again later."
flash
[
:notice
]
=
"Could not create Wiki Repository at this time. Please try again later."
redirect_to
project_path
(
@project
)
redirect_to
project_path
(
@project
)
...
...
app/views/projects/wikis/_sidebar.html.haml
View file @
a5625c74
...
@@ -12,15 +12,7 @@
...
@@ -12,15 +12,7 @@
.blocks-container
.blocks-container
.block.block-first
.block.block-first
%ul
.wiki-pages
%ul
.wiki-pages
-
@sidebar_wiki_directories
.
each
do
|
wiki_directory
,
wiki_pages
|
=
render
@sidebar_wiki_entries
,
context:
'sidebar'
-
if
wiki_directory
==
'/'
=
render
'sidebar_wiki_pages'
,
wiki_pages:
wiki_pages
-
else
%li
=
wiki_directory
%ul
=
render
'sidebar_wiki_pages'
,
wiki_pages:
wiki_pages
.block
.block
=
link_to
namespace_project_wikis_pages_path
(
@project
.
namespace
,
@project
),
class:
'btn btn-block'
do
=
link_to
namespace_project_wikis_pages_path
(
@project
.
namespace
,
@project
),
class:
'btn btn-block'
do
...
...
app/views/projects/wikis/_sidebar_wiki_pages.html.haml
deleted
100644 → 0
View file @
7bd68ae0
-
wiki_pages
.
each
do
|
wiki_page
|
%li
{
class:
params
[
:id
]
==
wiki_page
.
slug
?
'active'
:
''
}
=
link_to
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
wiki_page
)
do
=
wiki_page
.
title
.
capitalize
app/views/projects/wikis/_wiki_directory.html.haml
0 → 100644
View file @
a5625c74
%li
=
wiki_directory
.
slug
%ul
=
render
wiki_directory
.
pages
,
context:
context
app/views/projects/wikis/_wiki_page
s
.html.haml
→
app/views/projects/wikis/_wiki_page.html.haml
View file @
a5625c74
-
wiki_pages
.
each
do
|
wiki_page
|
-
if
context
==
'sidebar'
%li
{
class:
params
[
:id
]
==
wiki_page
.
slug
?
'active'
:
''
}
=
link_to
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
wiki_page
)
do
=
wiki_page
.
title
.
capitalize
-
else
%li
%li
=
link_to
wiki_page
.
title
,
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
wiki_page
)
=
link_to
wiki_page
.
title
,
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
wiki_page
)
%small
(
#{
wiki_page
.
format
}
)
%small
(
#{
wiki_page
.
format
}
)
...
...
app/views/projects/wikis/pages.html.haml
View file @
a5625c74
...
@@ -14,13 +14,6 @@
...
@@ -14,13 +14,6 @@
Clone repository
Clone repository
%ul
.wiki-pages-list.content-list
%ul
.wiki-pages-list.content-list
-
@wiki_directories
.
each
do
|
wiki_directory
,
wiki_pages
|
=
render
@wiki_entries
,
context:
'pages'
-
if
wiki_directory
==
'/'
=
render
'wiki_pages'
,
wiki_pages:
wiki_pages
-
else
%li
=
wiki_directory
%ul
=
render
'wiki_pages'
,
wiki_pages:
wiki_pages
=
paginate
@wiki_pages
,
theme:
'gitlab'
=
paginate
@wiki_pages
,
theme:
'gitlab'
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