Commit 57f3409bcc6a4bee6bc29f8cd03f501c117655b0

Authored by Dmitriy Zaporozhets
1 parent f3dfd229

move Wall to own resource

app/controllers/projects_controller.rb
... ... @@ -68,22 +68,6 @@ class ProjectsController < ProjectResourceController
68 68 end
69 69 end
70 70  
71   - #
72   - # Wall
73   - #
74   -
75   - def wall
76   - return render_404 unless @project.wall_enabled
77   -
78   - @target_type = :wall
79   - @target_id = nil
80   - @note = @project.notes.new
81   -
82   - respond_to do |format|
83   - format.html
84   - end
85   - end
86   -
87 71 def destroy
88 72 return access_denied! unless can?(current_user, :remove_project, project)
89 73  
... ...
app/controllers/walls_controller.rb 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +class WallsController < ProjectResourceController
  2 + before_filter :module_enabled
  3 +
  4 + respond_to :js, :html
  5 +
  6 + def show
  7 + @note = @project.notes.new
  8 +
  9 + respond_to do |format|
  10 + format.html
  11 + end
  12 + end
  13 +
  14 + protected
  15 +
  16 + def module_enabled
  17 + return render_404 unless @project.wall_enabled
  18 + end
  19 +end
  20 +
... ...
app/helpers/application_helper.rb
... ... @@ -105,7 +105,7 @@ module ApplicationHelper
105 105 { label: "#{simple_sanitize(@project.name_with_namespace)} - Snippets", url: project_snippets_path(@project) },
106 106 { label: "#{simple_sanitize(@project.name_with_namespace)} - Team", url: project_team_index_path(@project) },
107 107 { label: "#{simple_sanitize(@project.name_with_namespace)} - Tree", url: project_tree_path(@project, @ref || @project.repository.root_ref) },
108   - { label: "#{simple_sanitize(@project.name_with_namespace)} - Wall", url: wall_project_path(@project) },
  108 + { label: "#{simple_sanitize(@project.name_with_namespace)} - Wall", url: project_wall_path(@project) },
109 109 { label: "#{simple_sanitize(@project.name_with_namespace)} - Wiki", url: project_wikis_path(@project) },
110 110 ]
111 111 end
... ...
app/views/layouts/project_resource.html.haml
... ... @@ -41,7 +41,7 @@
41 41  
42 42 - if @project.wall_enabled
43 43 = nav_link(path: 'projects#wall') do
44   - = link_to 'Wall', wall_project_path(@project)
  44 + = link_to 'Wall', project_wall_path(@project)
45 45  
46 46 - if @project.snippets_enabled
47 47 = nav_link(controller: :snippets) do
... ...
app/views/projects/wall.html.haml
... ... @@ -1,2 +0,0 @@
1   -%div.wall_page
2   - = render "notes/reversed_notes_with_form"
app/views/walls/show.html.haml 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +%div.wall-page
  2 + %ul.well-list.notes
  3 + .notes-busy.js-notes-busy
  4 +
  5 + .js-main-target-form
  6 + = render "notes/form"
  7 +
  8 +:javascript
  9 + $(function(){
  10 + Wall.init(#{@project.id});
  11 + });
... ...
config/routes.rb
... ... @@ -167,11 +167,6 @@ Gitlab::Application.routes.draw do
167 167 # Project Area
168 168 #
169 169 resources :projects, constraints: { id: /(?:[a-zA-Z.0-9_\-]+\/)?[a-zA-Z.0-9_\-]+/ }, except: [:new, :create, :index], path: "/" do
170   - member do
171   - get "wall"
172   - get "files"
173   - end
174   -
175 170 resources :blob, only: [:show], constraints: {id: /.+/}
176 171 resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/}
177 172 resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
... ... @@ -194,6 +189,12 @@ Gitlab::Application.routes.draw do
194 189 end
195 190 end
196 191  
  192 + resource :wall, only: [:show] do
  193 + member do
  194 + get 'notes'
  195 + end
  196 + end
  197 +
197 198 resource :repository do
198 199 member do
199 200 get "branches"
... ...