Commit 35ad4fe7db13f3974ca8f0bbce2b39a1b2357b5c

Authored by Dmitriy Zaporozhets
1 parent 39bbdc46

Use wiki tab for wiki, wall, snippets

app/assets/javascripts/main.js.coffee
... ... @@ -53,12 +53,6 @@ $ ->
53 53 $('.trigger-submit').on 'change', ->
54 54 $(@).parents('form').submit()
55 55  
56   - # Wiki resizer
57   - $('.wiki-fullscreen').on 'click', ->
58   - $('.writeboards-menu').toggleClass('hide')
59   - $('.writeboards-content').toggleClass('span9').toggleClass('span12')
60   -
61   -
62 56 # Flash
63 57 if (flash = $(".flash-container")).length > 0
64 58 flash.click -> $(@).fadeOut()
... ...
app/helpers/tab_helper.rb
... ... @@ -80,7 +80,7 @@ module TabHelper
80 80 end
81 81 end
82 82  
83   - def project_writeboards_tab_class
  83 + def project_wiki_tab_class
84 84 [:files, :wall].each do |action|
85 85 return "active" if current_page?(controller: "projects", action: action, id: @project)
86 86 end
... ...
app/views/layouts/project_resource.html.haml
... ... @@ -35,7 +35,7 @@
35 35 Merge Requests
36 36 %span.count.merge_counter= @project.merge_requests.opened.count
37 37  
38   - = nav_link(html_options: {class: "#{project_writeboards_tab_class}"}) do
  38 + = nav_link(html_options: {class: "#{project_wiki_tab_class}"}) do
39 39 = link_to 'Wiki', project_wiki_path(@project, :index)
40 40  
41 41 - if can? current_user, :admin_project, @project
... ...
app/views/projects/files.html.haml
1   -.row
2   - .span3
3   - = render 'writeboards/nav'
4   - .span9
5   - - unless @notes.empty?
6   - %table
7   - %thead
8   - %tr
9   - %th File name
10   - %th
  1 += render 'wikis/nav'
  2 +- unless @notes.empty?
  3 + %table
  4 + %thead
  5 + %tr
  6 + %th File name
  7 + %th
11 8  
12   - - @notes.each do |note|
13   - %tr
14   - %td
15   - = link_to note.attachment.secure_url, target: "_blank" do
16   - = image_tag gravatar_icon(note.author_email), class: "avatar s24"
17   - = note.attachment_identifier
18   - %td
19   - Added
20   - = time_ago_in_words(note.created_at)
21   - ago
22   - - else
23   - %p.slead All files attached to project wall, issues etc will be displayed here
  9 + - @notes.each do |note|
  10 + %tr
  11 + %td
  12 + = link_to note.attachment.secure_url, target: "_blank" do
  13 + = image_tag gravatar_icon(note.author_email), class: "avatar s24"
  14 + = note.attachment_identifier
  15 + %td
  16 + Added
  17 + = time_ago_in_words(note.created_at)
  18 + ago
  19 +- else
  20 + %p.slead All files attached to project wall, issues etc will be displayed here
24 21  
25 22  
... ...
app/views/projects/wall.html.haml
1   -.row
2   - .span3
3   - = render 'writeboards/nav'
4   - .span9
5   - %div.wall_page
6   - = render "notes/reversed_notes_with_form"
  1 += render 'wikis/nav'
  2 +%div.wall_page
  3 + = render "notes/reversed_notes_with_form"
... ...
app/views/snippets/index.html.haml
1   -.row
2   - .span3
3   - = render 'writeboards/nav'
4   - .span9
5   - %h3.page_title
6   - Snippets
7   - %small share code pastes with others out of git repository
  1 += render 'wikis/nav'
  2 +%h3.page_title
  3 + Snippets
  4 + %small share code pastes with others out of git repository
8 5  
9   - - if can? current_user, :write_snippet, @project
10   - = link_to new_project_snippet_path(@project), class: "btn btn-small add_new pull-right", title: "New Snippet" do
11   - Add new snippet
12   - %br
13   - %table
14   - %thead
15   - %tr
16   - %th Title
17   - %th File Name
18   - %th Expires At
19   - = render @snippets
20   - - if @snippets.empty?
21   - %tr
22   - %td{colspan: 3}
23   - %h3.nothing_here_message Nothing here.
  6 + - if can? current_user, :write_snippet, @project
  7 + = link_to new_project_snippet_path(@project), class: "btn btn-small add_new pull-right", title: "New Snippet" do
  8 + Add new snippet
  9 +%br
  10 +%table
  11 + %thead
  12 + %tr
  13 + %th Title
  14 + %th File Name
  15 + %th Expires At
  16 + = render @snippets
  17 + - if @snippets.empty?
  18 + %tr
  19 + %td{colspan: 3}
  20 + %h3.nothing_here_message Nothing here.
... ...
app/views/wikis/_nav.html.haml 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +%ul.nav.nav-tabs
  2 + - if @project.wiki_enabled
  3 + = nav_link(controller: 'wikis') do
  4 + = link_to 'Wiki', project_wiki_path(@project, :index)
  5 +
  6 + - if @project.wall_enabled
  7 + = nav_link(path: 'projects#wall') do
  8 + = link_to 'Wall', wall_project_path(@project)
  9 +
  10 + = nav_link(path: 'projects#files') do
  11 + = link_to 'Attachments', files_project_path(@project), class: "files-tab tab"
  12 +
  13 + = nav_link(controller: :snippets) do
  14 + = link_to 'Snippets', project_snippets_path(@project), class: "snippets-tab tab"
... ...
app/views/wikis/pages.html.haml
1   -.row
2   - .span3
3   - = render 'writeboards/nav'
4   - .span9
5   - %h3.page_title All Pages
6   - %br
7   - %table
8   - %thead
9   - %tr
10   - %th Title
11   - %th Slug
12   - %th Last updated
13   - %th Updated by
14   - %tbody
15   - - @wiki_pages.each do |wiki_page|
16   - %tr
17   - %td
18   - %strong= link_to wiki_page.title, project_wiki_path(@project, wiki_page)
19   - %td= wiki_page.slug
20   - %td
21   - = wiki_page.created_at.to_s(:short) do
22   - (#{time_ago_in_words(wiki_page.created_at)}
23   - ago)
24   - %td= link_to_member(@project, wiki_page.user)
  1 += render 'wikis/nav'
  2 +%h3.page_title All Pages
  3 +%br
  4 +%table
  5 + %thead
  6 + %tr
  7 + %th Title
  8 + %th Slug
  9 + %th Last updated
  10 + %th Updated by
  11 + %tbody
  12 + - @wiki_pages.each do |wiki_page|
  13 + %tr
  14 + %td
  15 + %strong= link_to wiki_page.title, project_wiki_path(@project, wiki_page)
  16 + %td= wiki_page.slug
  17 + %td
  18 + = wiki_page.created_at.to_s(:short) do
  19 + (#{time_ago_in_words(wiki_page.created_at)}
  20 + ago)
  21 + %td= link_to_member(@project, wiki_page.user)
... ...
app/views/wikis/show.html.haml
1   -.row
2   - .span3.writeboards-menu
3   - = render 'writeboards/nav'
4   - .span9.writeboards-content
5   - - if @wiki != @most_recent_wiki
6   - .alert
7   - This is an old version of this page.
8   - You can view the #{link_to "most recent version", project_wiki_path(@project, @wiki)} or browse the #{link_to "history", history_project_wiki_path(@project, @wiki)}.
  1 += render 'wikis/nav'
  2 +- if @wiki != @most_recent_wiki
  3 + .alert
  4 + This is an old version of this page.
  5 + You can view the #{link_to "most recent version", project_wiki_path(@project, @wiki)} or browse the #{link_to "history", history_project_wiki_path(@project, @wiki)}.
9 6  
10   - .file_holder
11   - .file_title
12   - = link_to '#', class: 'wiki-fullscreen' do
13   - %i.icon-resize-horizontal
14   -  
15   - = @wiki.title
16   - %span.options
17   - = link_to pages_project_wikis_path(@project), class: "btn btn-tiny grouped" do
18   - Pages
19   - - if can? current_user, :write_wiki, @project
20   - = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-tiny grouped" do
21   - History
22   - = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-tiny grouped" do
23   - %i.icon-edit
24   - Edit
  7 +.file_holder
  8 + .file_title
  9 + = @wiki.title
  10 + %span.options
  11 + = link_to pages_project_wikis_path(@project), class: "btn btn-tiny grouped" do
  12 + Pages
  13 + - if can? current_user, :write_wiki, @project
  14 + = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-tiny grouped" do
  15 + History
  16 + = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-tiny grouped" do
  17 + %i.icon-edit
  18 + Edit
25 19  
26   - .file_content.wiki
27   - = preserve do
28   - = markdown @wiki.content
  20 + .file_content.wiki
  21 + = preserve do
  22 + = markdown @wiki.content
29 23  
30   - %p.time Last edited by #{link_to_member @project, @wiki.user}, #{time_ago_in_words @wiki.created_at} ago
  24 +%p.time Last edited by #{link_to_member @project, @wiki.user}, #{time_ago_in_words @wiki.created_at} ago
... ...
app/views/writeboards/_nav.html.haml
... ... @@ -1,14 +0,0 @@
1   -%ul.nav.nav-pills.nav-stacked
2   - - if @project.wiki_enabled
3   - = nav_link(controller: 'wikis') do
4   - = link_to 'Wiki', project_wiki_path(@project, :index)
5   -
6   - - if @project.wall_enabled
7   - = nav_link(path: 'projects#wall') do
8   - = link_to 'Wall', wall_project_path(@project)
9   -
10   - = nav_link(path: 'projects#files') do
11   - = link_to 'Attachments', files_project_path(@project), class: "files-tab tab"
12   -
13   - = nav_link(controller: :snippets) do
14   - = link_to 'Snippets', project_snippets_path(@project), class: "snippets-tab tab"
spec/features/gitlab_flavored_markdown_spec.rb
... ... @@ -218,7 +218,7 @@ describe "Gitlab Flavored Markdown" do
218 218 end
219 219  
220 220 it "should NOT render title in wikis#show" do
221   - within(".content h3") do # page title
  221 + within(".content .file_title") do # page title
222 222 page.should have_content("Circumvent ##{issue.id}")
223 223 page.should_not have_link("##{issue.id}")
224 224 end
... ...