Commit ae06a0aab8be3ea3bad8066d2e19c12d86b85ad8

Authored by Dmitriy Zaporozhets
1 parent 6956f1f6

Return own tab for wall. Improve Wiki nav. Removed attachments listing page

app/contexts/projects/create_context.rb
@@ -32,6 +32,9 @@ module Projects @@ -32,6 +32,9 @@ module Projects
32 @project.namespace_id = current_user.namespace_id 32 @project.namespace_id = current_user.namespace_id
33 end 33 end
34 34
  35 + # Disable wall by default
  36 + @project.wall_enabled = false
  37 +
35 @project.creator = current_user 38 @project.creator = current_user
36 39
37 # Import project from cloneable resource 40 # Import project from cloneable resource
app/controllers/projects_controller.rb
@@ -68,10 +68,6 @@ class ProjectsController < ProjectResourceController @@ -68,10 +68,6 @@ class ProjectsController < ProjectResourceController
68 end 68 end
69 end 69 end
70 70
71 - def files  
72 - @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100)  
73 - end  
74 -  
75 # 71 #
76 # Wall 72 # Wall
77 # 73 #
app/helpers/tab_helper.rb
@@ -80,16 +80,6 @@ module TabHelper @@ -80,16 +80,6 @@ module TabHelper
80 end 80 end
81 end 81 end
82 82
83 - def project_wiki_tab_class  
84 - [:files, :wall].each do |action|  
85 - return "active" if current_page?(controller: "projects", action: action, id: @project)  
86 - end  
87 -  
88 - if ['wikis', 'snippets'].include? controller.controller_name  
89 - "active"  
90 - end  
91 - end  
92 -  
93 def branches_tab_class 83 def branches_tab_class
94 if current_page?(branches_project_repository_path(@project)) || 84 if current_page?(branches_project_repository_path(@project)) ||
95 current_controller?(:protected_branches) || 85 current_controller?(:protected_branches) ||
app/views/layouts/project_resource.html.haml
@@ -35,11 +35,17 @@ @@ -35,11 +35,17 @@
35 Merge Requests 35 Merge Requests
36 %span.count.merge_counter= @project.merge_requests.opened.count 36 %span.count.merge_counter= @project.merge_requests.opened.count
37 37
38 - = nav_link(html_options: {class: "#{project_wiki_tab_class}"}) do  
39 - = link_to 'Wiki', project_wiki_path(@project, :home) 38 + - if @project.wiki_enabled
  39 + = nav_link(controller: :wikis) do
  40 + = link_to 'Wiki', project_wiki_path(@project, :home)
  41 +
  42 + - if @project.wall_enabled
  43 + = nav_link(path: 'projects#wall') do
  44 + = link_to 'Wall', wall_project_path(@project)
40 45
41 - if can? current_user, :admin_project, @project 46 - if can? current_user, :admin_project, @project
42 = nav_link(html_options: {class: "#{project_tab_class}"}) do 47 = nav_link(html_options: {class: "#{project_tab_class}"}) do
43 = link_to edit_project_path(@project), class: "stat-tab tab " do 48 = link_to edit_project_path(@project), class: "stat-tab tab " do
44 Settings 49 Settings
  50 +
45 .content= yield 51 .content= yield
app/views/projects/files.html.haml
@@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
1 -= render 'wikis/nav'  
2 -- unless @notes.empty?  
3 - %table  
4 - %thead  
5 - %tr  
6 - %th File name  
7 - %th  
8 -  
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  
21 -  
22 -  
app/views/projects/wall.html.haml
1 -= render 'wikis/nav'  
2 %div.wall_page 1 %div.wall_page
3 = render "notes/reversed_notes_with_form" 2 = render "notes/reversed_notes_with_form"
app/views/snippets/index.html.haml
1 -= render 'wikis/nav'  
2 %h3.page_title 1 %h3.page_title
3 Snippets 2 Snippets
4 %small share code pastes with others out of git repository 3 %small share code pastes with others out of git repository
app/views/wikis/_main_links.html.haml
1 %span.pull-right 1 %span.pull-right
2 - = link_to project_wiki_path(@project, :home), class: "btn btn-small grouped" do  
3 - Home  
4 - = link_to pages_project_wikis_path(@project), class: "btn btn-small grouped" do  
5 - Pages  
6 - if (@wiki && @wiki.persisted?) 2 - if (@wiki && @wiki.persisted?)
7 = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do 3 = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do
8 - History  
9 - - if can?(current_user, :write_wiki, @project)  
10 - - if @wiki && @wiki.persisted? 4 + Page History
  5 + - if can?(current_user, :write_wiki, @project)
11 = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do 6 = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do
12 %i.icon-edit 7 %i.icon-edit
13 Edit 8 Edit
14 - = link_to git_access_project_wikis_path(@project), class: "btn btn-small grouped" do  
15 - %i.icon-download-alt  
16 - Git Access  
app/views/wikis/_nav.html.haml
1 %ul.nav.nav-tabs 1 %ul.nav.nav-tabs
2 - - if @project.wiki_enabled  
3 - = nav_link(controller: 'wikis') do  
4 - = link_to 'Wiki', project_wiki_path(@project, :home) 2 + = nav_link(html_options: {class: params[:id] == 'home' ? 'active' : '' }) do
  3 + = link_to 'Home', project_wiki_path(@project, :home)
5 4
6 - - if @project.wall_enabled  
7 - = nav_link(path: 'projects#wall') do  
8 - = link_to 'Wall', wall_project_path(@project) 5 + = nav_link(path: 'wikis#pages') do
  6 + = link_to 'Pages', pages_project_wikis_path(@project)
9 7
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" 8 + = nav_link(path: 'wikis#git_access') do
  9 + = link_to git_access_project_wikis_path(@project) do
  10 + %i.icon-download-alt
  11 + Git Access
app/views/wikis/edit.html.haml
  1 += render 'wikis/nav'
1 %h3.page_title 2 %h3.page_title
2 Editing page 3 Editing page
3 = render partial: 'main_links' 4 = render partial: 'main_links'
app/views/wikis/git_access.html.haml
  1 += render 'wikis/nav'
1 %h3.page_title 2 %h3.page_title
2 Git Access 3 Git Access
3 %strong= @gollum_wiki.path_with_namespace 4 %strong= @gollum_wiki.path_with_namespace
app/views/wikis/history.html.haml
  1 += render 'wikis/nav'
1 %h3.page_title 2 %h3.page_title
2 - %span.cgray History for 3 + %span.light History for
3 = @wiki.title.titleize 4 = @wiki.title.titleize
4 = render partial: 'main_links' 5 = render partial: 'main_links'
5 %br 6 %br