From 35ad4fe7db13f3974ca8f0bbce2b39a1b2357b5c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 15 Mar 2013 14:20:03 +0200 Subject: [PATCH] Use wiki tab for wiki, wall, snippets --- app/assets/javascripts/main.js.coffee | 6 ------ app/helpers/tab_helper.rb | 2 +- app/views/layouts/project_resource.html.haml | 2 +- app/views/projects/files.html.haml | 41 +++++++++++++++++++---------------------- app/views/projects/wall.html.haml | 9 +++------ app/views/snippets/index.html.haml | 41 +++++++++++++++++++---------------------- app/views/wikis/_nav.html.haml | 14 ++++++++++++++ app/views/wikis/pages.html.haml | 45 +++++++++++++++++++++------------------------ app/views/wikis/show.html.haml | 48 +++++++++++++++++++++--------------------------- app/views/writeboards/_nav.html.haml | 14 -------------- spec/features/gitlab_flavored_markdown_spec.rb | 2 +- 11 files changed, 100 insertions(+), 124 deletions(-) create mode 100644 app/views/wikis/_nav.html.haml delete mode 100644 app/views/writeboards/_nav.html.haml diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee index 8d139f2..d707657 100644 --- a/app/assets/javascripts/main.js.coffee +++ b/app/assets/javascripts/main.js.coffee @@ -53,12 +53,6 @@ $ -> $('.trigger-submit').on 'change', -> $(@).parents('form').submit() - # Wiki resizer - $('.wiki-fullscreen').on 'click', -> - $('.writeboards-menu').toggleClass('hide') - $('.writeboards-content').toggleClass('span9').toggleClass('span12') - - # Flash if (flash = $(".flash-container")).length > 0 flash.click -> $(@).fadeOut() diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb index 3465bf4..62a380e 100644 --- a/app/helpers/tab_helper.rb +++ b/app/helpers/tab_helper.rb @@ -80,7 +80,7 @@ module TabHelper end end - def project_writeboards_tab_class + def project_wiki_tab_class [:files, :wall].each do |action| return "active" if current_page?(controller: "projects", action: action, id: @project) end diff --git a/app/views/layouts/project_resource.html.haml b/app/views/layouts/project_resource.html.haml index 8dd84f7..e4558b6 100644 --- a/app/views/layouts/project_resource.html.haml +++ b/app/views/layouts/project_resource.html.haml @@ -35,7 +35,7 @@ Merge Requests %span.count.merge_counter= @project.merge_requests.opened.count - = nav_link(html_options: {class: "#{project_writeboards_tab_class}"}) do + = nav_link(html_options: {class: "#{project_wiki_tab_class}"}) do = link_to 'Wiki', project_wiki_path(@project, :index) - if can? current_user, :admin_project, @project diff --git a/app/views/projects/files.html.haml b/app/views/projects/files.html.haml index b483681..3402e06 100644 --- a/app/views/projects/files.html.haml +++ b/app/views/projects/files.html.haml @@ -1,25 +1,22 @@ -.row - .span3 - = render 'writeboards/nav' - .span9 - - unless @notes.empty? - %table - %thead - %tr - %th File name - %th += render 'wikis/nav' +- unless @notes.empty? + %table + %thead + %tr + %th File name + %th - - @notes.each do |note| - %tr - %td - = link_to note.attachment.secure_url, target: "_blank" do - = image_tag gravatar_icon(note.author_email), class: "avatar s24" - = note.attachment_identifier - %td - Added - = time_ago_in_words(note.created_at) - ago - - else - %p.slead All files attached to project wall, issues etc will be displayed here + - @notes.each do |note| + %tr + %td + = link_to note.attachment.secure_url, target: "_blank" do + = image_tag gravatar_icon(note.author_email), class: "avatar s24" + = note.attachment_identifier + %td + Added + = time_ago_in_words(note.created_at) + ago +- else + %p.slead All files attached to project wall, issues etc will be displayed here diff --git a/app/views/projects/wall.html.haml b/app/views/projects/wall.html.haml index 33af924..1c2d907 100644 --- a/app/views/projects/wall.html.haml +++ b/app/views/projects/wall.html.haml @@ -1,6 +1,3 @@ -.row - .span3 - = render 'writeboards/nav' - .span9 - %div.wall_page - = render "notes/reversed_notes_with_form" += render 'wikis/nav' +%div.wall_page + = render "notes/reversed_notes_with_form" diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index e2b7594..5dd00be 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -1,23 +1,20 @@ -.row - .span3 - = render 'writeboards/nav' - .span9 - %h3.page_title - Snippets - %small share code pastes with others out of git repository += render 'wikis/nav' +%h3.page_title + Snippets + %small share code pastes with others out of git repository - - if can? current_user, :write_snippet, @project - = link_to new_project_snippet_path(@project), class: "btn btn-small add_new pull-right", title: "New Snippet" do - Add new snippet - %br - %table - %thead - %tr - %th Title - %th File Name - %th Expires At - = render @snippets - - if @snippets.empty? - %tr - %td{colspan: 3} - %h3.nothing_here_message Nothing here. + - if can? current_user, :write_snippet, @project + = link_to new_project_snippet_path(@project), class: "btn btn-small add_new pull-right", title: "New Snippet" do + Add new snippet +%br +%table + %thead + %tr + %th Title + %th File Name + %th Expires At + = render @snippets + - if @snippets.empty? + %tr + %td{colspan: 3} + %h3.nothing_here_message Nothing here. diff --git a/app/views/wikis/_nav.html.haml b/app/views/wikis/_nav.html.haml new file mode 100644 index 0000000..36ab105 --- /dev/null +++ b/app/views/wikis/_nav.html.haml @@ -0,0 +1,14 @@ +%ul.nav.nav-tabs + - if @project.wiki_enabled + = nav_link(controller: 'wikis') do + = link_to 'Wiki', project_wiki_path(@project, :index) + + - if @project.wall_enabled + = nav_link(path: 'projects#wall') do + = link_to 'Wall', wall_project_path(@project) + + = nav_link(path: 'projects#files') do + = link_to 'Attachments', files_project_path(@project), class: "files-tab tab" + + = nav_link(controller: :snippets) do + = link_to 'Snippets', project_snippets_path(@project), class: "snippets-tab tab" diff --git a/app/views/wikis/pages.html.haml b/app/views/wikis/pages.html.haml index d3215f8..7bf57ad 100644 --- a/app/views/wikis/pages.html.haml +++ b/app/views/wikis/pages.html.haml @@ -1,24 +1,21 @@ -.row - .span3 - = render 'writeboards/nav' - .span9 - %h3.page_title All Pages - %br - %table - %thead - %tr - %th Title - %th Slug - %th Last updated - %th Updated by - %tbody - - @wiki_pages.each do |wiki_page| - %tr - %td - %strong= link_to wiki_page.title, project_wiki_path(@project, wiki_page) - %td= wiki_page.slug - %td - = wiki_page.created_at.to_s(:short) do - (#{time_ago_in_words(wiki_page.created_at)} - ago) - %td= link_to_member(@project, wiki_page.user) += render 'wikis/nav' +%h3.page_title All Pages +%br +%table + %thead + %tr + %th Title + %th Slug + %th Last updated + %th Updated by + %tbody + - @wiki_pages.each do |wiki_page| + %tr + %td + %strong= link_to wiki_page.title, project_wiki_path(@project, wiki_page) + %td= wiki_page.slug + %td + = wiki_page.created_at.to_s(:short) do + (#{time_ago_in_words(wiki_page.created_at)} + ago) + %td= link_to_member(@project, wiki_page.user) diff --git a/app/views/wikis/show.html.haml b/app/views/wikis/show.html.haml index ff18541..ea8de15 100644 --- a/app/views/wikis/show.html.haml +++ b/app/views/wikis/show.html.haml @@ -1,30 +1,24 @@ -.row - .span3.writeboards-menu - = render 'writeboards/nav' - .span9.writeboards-content - - if @wiki != @most_recent_wiki - .alert - This is an old version of this page. - 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)}. += render 'wikis/nav' +- if @wiki != @most_recent_wiki + .alert + This is an old version of this page. + 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)}. - .file_holder - .file_title - = link_to '#', class: 'wiki-fullscreen' do - %i.icon-resize-horizontal -   - = @wiki.title - %span.options - = link_to pages_project_wikis_path(@project), class: "btn btn-tiny grouped" do - Pages - - if can? current_user, :write_wiki, @project - = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-tiny grouped" do - History - = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-tiny grouped" do - %i.icon-edit - Edit +.file_holder + .file_title + = @wiki.title + %span.options + = link_to pages_project_wikis_path(@project), class: "btn btn-tiny grouped" do + Pages + - if can? current_user, :write_wiki, @project + = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-tiny grouped" do + History + = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-tiny grouped" do + %i.icon-edit + Edit - .file_content.wiki - = preserve do - = markdown @wiki.content + .file_content.wiki + = preserve do + = markdown @wiki.content - %p.time Last edited by #{link_to_member @project, @wiki.user}, #{time_ago_in_words @wiki.created_at} ago +%p.time Last edited by #{link_to_member @project, @wiki.user}, #{time_ago_in_words @wiki.created_at} ago diff --git a/app/views/writeboards/_nav.html.haml b/app/views/writeboards/_nav.html.haml deleted file mode 100644 index f511177..0000000 --- a/app/views/writeboards/_nav.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%ul.nav.nav-pills.nav-stacked - - if @project.wiki_enabled - = nav_link(controller: 'wikis') do - = link_to 'Wiki', project_wiki_path(@project, :index) - - - if @project.wall_enabled - = nav_link(path: 'projects#wall') do - = link_to 'Wall', wall_project_path(@project) - - = nav_link(path: 'projects#files') do - = link_to 'Attachments', files_project_path(@project), class: "files-tab tab" - - = nav_link(controller: :snippets) do - = link_to 'Snippets', project_snippets_path(@project), class: "snippets-tab tab" diff --git a/spec/features/gitlab_flavored_markdown_spec.rb b/spec/features/gitlab_flavored_markdown_spec.rb index 769fcd6..1da1827 100644 --- a/spec/features/gitlab_flavored_markdown_spec.rb +++ b/spec/features/gitlab_flavored_markdown_spec.rb @@ -218,7 +218,7 @@ describe "Gitlab Flavored Markdown" do end it "should NOT render title in wikis#show" do - within(".content h3") do # page title + within(".content .file_title") do # page title page.should have_content("Circumvent ##{issue.id}") page.should_not have_link("##{issue.id}") end -- libgit2 0.21.2