Commit a685624d27a99a4d7ee9d607fcf2ccbc85eb7fc7
1 parent
753ecbdc
Exists in
master
and in
4 other branches
Merge wiki, wall & snippets under one tab - writeboards
Showing
14 changed files
with
128 additions
and
99 deletions
Show diff stats
app/assets/stylesheets/sections/notes.scss
app/helpers/tab_helper.rb
| ... | ... | @@ -73,11 +73,19 @@ module TabHelper |
| 73 | 73 | end |
| 74 | 74 | |
| 75 | 75 | def project_tab_class |
| 76 | - [:files, :edit].each do |action| | |
| 76 | + return "active" if current_page?(controller: "projects", action: :edit, id: @project) | |
| 77 | + | |
| 78 | + if ['services', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name | |
| 79 | + "active" | |
| 80 | + end | |
| 81 | + end | |
| 82 | + | |
| 83 | + def project_writeboards_tab_class | |
| 84 | + [:files, :wall].each do |action| | |
| 77 | 85 | return "active" if current_page?(controller: "projects", action: action, id: @project) |
| 78 | 86 | end |
| 79 | 87 | |
| 80 | - if ['snippets', 'services', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name | |
| 88 | + if ['wikis', 'snippets'].include? controller.controller_name | |
| 81 | 89 | "active" |
| 82 | 90 | end |
| 83 | 91 | end | ... | ... |
app/views/hooks/index.html.haml
app/views/layouts/project_resource.html.haml
| ... | ... | @@ -35,17 +35,11 @@ |
| 35 | 35 | Merge Requests |
| 36 | 36 | %span.count.merge_counter= @project.merge_requests.opened.count |
| 37 | 37 | |
| 38 | - - if @project.wall_enabled | |
| 39 | - = nav_link(path: 'projects#wall') do | |
| 40 | - = link_to 'Wall', wall_project_path(@project) | |
| 41 | - | |
| 42 | - - if @project.wiki_enabled | |
| 43 | - = nav_link(controller: :wikis) do | |
| 44 | - = link_to 'Wiki', project_wiki_path(@project, :index) | |
| 38 | + = nav_link(html_options: {class: "#{project_writeboards_tab_class}"}) do | |
| 39 | + = link_to 'Writeboards', project_wiki_path(@project, :index) | |
| 45 | 40 | |
| 46 | 41 | - if can? current_user, :admin_project, @project |
| 47 | 42 | = nav_link(html_options: {class: "#{project_tab_class}"}) do |
| 48 | 43 | = link_to edit_project_path(@project), class: "stat-tab tab " do |
| 49 | 44 | Settings |
| 50 | - | |
| 51 | 45 | .content= yield | ... | ... |
app/views/projects/files.html.haml
| 1 | -= render "project_head" | |
| 2 | -- unless @notes.empty? | |
| 3 | - %table | |
| 4 | - %thead | |
| 5 | - %tr | |
| 6 | - %th File name | |
| 7 | - %th | |
| 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 | |
| 8 | 11 | |
| 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 | |
| 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 | |
| 21 | 24 | |
| 22 | 25 | ... | ... |
app/views/projects/wall.html.haml
app/views/snippets/edit.html.haml
app/views/snippets/index.html.haml
| 1 | -= render "projects/project_head" | |
| 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 | |
| 2 | 8 | |
| 3 | -%h3.page_title | |
| 4 | - Snippets | |
| 5 | - %small share code pastes with others out of git repository | |
| 6 | - | |
| 7 | - - if can? current_user, :write_snippet, @project | |
| 8 | - = link_to new_project_snippet_path(@project), class: "btn btn-small add_new pull-right", title: "New Snippet" do | |
| 9 | - Add new snippet | |
| 10 | -%br | |
| 11 | -%table | |
| 12 | - %thead | |
| 13 | - %tr | |
| 14 | - %th Title | |
| 15 | - %th File Name | |
| 16 | - %th Expires At | |
| 17 | - = render @snippets | |
| 18 | - - if @snippets.empty? | |
| 19 | - %tr | |
| 20 | - %td{colspan: 3} | |
| 21 | - %h3.nothing_here_message Nothing here. | |
| 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. | ... | ... |
app/views/snippets/new.html.haml
app/views/snippets/show.html.haml
app/views/wikis/edit.html.haml
| ... | ... | @@ -5,4 +5,4 @@ |
| 5 | 5 | .pull-right |
| 6 | 6 | - if can? current_user, :admin_wiki, @project |
| 7 | 7 | = link_to project_wiki_path(@project, @wiki), confirm: "Are you sure you want to delete this page?", method: :delete, class: "btn btn-small btn-remove" do |
| 8 | - Delete this page | |
| 9 | 8 | \ No newline at end of file |
| 9 | + Delete this page | ... | ... |
app/views/wikis/pages.html.haml
| 1 | -%h3.page_title All Pages | |
| 2 | -%br | |
| 3 | -%table | |
| 4 | - %thead | |
| 5 | - %tr | |
| 6 | - %th Title | |
| 7 | - %th Slug | |
| 8 | - %th Last updated | |
| 9 | - %th Updated by | |
| 10 | - %tbody | |
| 11 | - - @wiki_pages.each do |wiki_page| | |
| 12 | - %tr | |
| 13 | - %td | |
| 14 | - %strong= link_to wiki_page.title, project_wiki_path(@project, wiki_page) | |
| 15 | - %td= wiki_page.slug | |
| 16 | - %td | |
| 17 | - = wiki_page.created_at.to_s(:short) do | |
| 18 | - (#{time_ago_in_words(wiki_page.created_at)} | |
| 19 | - ago) | |
| 20 | - %td= link_to_member(@project, wiki_page.user) | |
| 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) | ... | ... |
app/views/wikis/show.html.haml
| 1 | -%h3.page_title | |
| 2 | - = @wiki.title | |
| 3 | - %span.pull-right | |
| 4 | - = link_to pages_project_wikis_path(@project), class: "btn btn-small grouped" do | |
| 5 | - Pages | |
| 6 | - - if can? current_user, :write_wiki, @project | |
| 7 | - = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do | |
| 8 | - History | |
| 9 | - = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do | |
| 10 | - %i.icon-edit | |
| 11 | - Edit | |
| 12 | -%br | |
| 13 | -- if @wiki != @most_recent_wiki | |
| 14 | - .warning_message | |
| 15 | - This is an old version of this page. | |
| 16 | - 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 | +.row | |
| 2 | + .span3 | |
| 3 | + = render 'writeboards/nav' | |
| 4 | + .span9 | |
| 5 | + %h3.page_title | |
| 6 | + = @wiki.title | |
| 7 | + %span.pull-right | |
| 8 | + = link_to pages_project_wikis_path(@project), class: "btn btn-small grouped" do | |
| 9 | + Pages | |
| 10 | + - if can? current_user, :write_wiki, @project | |
| 11 | + = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do | |
| 12 | + History | |
| 13 | + = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do | |
| 14 | + %i.icon-edit | |
| 15 | + Edit | |
| 16 | + %br | |
| 17 | + - if @wiki != @most_recent_wiki | |
| 18 | + .warning_message | |
| 19 | + This is an old version of this page. | |
| 20 | + 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)}. | |
| 17 | 21 | |
| 18 | -.file_holder | |
| 19 | - .file_content.wiki | |
| 20 | - = preserve do | |
| 21 | - = markdown @wiki.content | |
| 22 | + .file_holder | |
| 23 | + .file_content.wiki | |
| 24 | + = preserve do | |
| 25 | + = markdown @wiki.content | |
| 22 | 26 | |
| 23 | -%p.time Last edited by #{link_to_member @project, @wiki.user}, #{time_ago_in_words @wiki.created_at} ago | |
| 27 | + %p.time Last edited by #{link_to_member @project, @wiki.user}, #{time_ago_in_words @wiki.created_at} ago | ... | ... |
| ... | ... | @@ -0,0 +1,14 @@ |
| 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" | ... | ... |