Commit 13a66040300241caf234726bfc72ca90ef4c34fd
1 parent
c5b66735
Exists in
master
and in
4 other branches
Ability to remvoe broadcast messages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
4 changed files
with
22 additions
and
2 deletions
Show diff stats
app/assets/stylesheets/sections/admin.scss
@@ -21,3 +21,9 @@ | @@ -21,3 +21,9 @@ | ||
21 | .controls { margin-left: 130px; } | 21 | .controls { margin-left: 130px; } |
22 | .form-actions { padding-left: 130px; background: #fff } | 22 | .form-actions { padding-left: 130px; background: #fff } |
23 | } | 23 | } |
24 | + | ||
25 | +.broadcast-messages { | ||
26 | + .message { | ||
27 | + line-height: 2; | ||
28 | + } | ||
29 | +} |
app/controllers/admin/broadcast_messages_controller.rb
@@ -15,6 +15,15 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController | @@ -15,6 +15,15 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController | ||
15 | end | 15 | end |
16 | end | 16 | end |
17 | 17 | ||
18 | + def destroy | ||
19 | + BroadcastMessage.find(params[:id]).destroy | ||
20 | + | ||
21 | + respond_to do |format| | ||
22 | + format.html { redirect_to :back } | ||
23 | + format.js { render nothing: true } | ||
24 | + end | ||
25 | + end | ||
26 | + | ||
18 | protected | 27 | protected |
19 | 28 | ||
20 | def broadcast_messages | 29 | def broadcast_messages |
app/views/admin/broadcast_messages/index.html.haml
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | = f.submit "Add broadcast message", class: "btn btn-create" | 25 | = f.submit "Add broadcast message", class: "btn btn-create" |
26 | 26 | ||
27 | -if @broadcast_messages.any? | 27 | -if @broadcast_messages.any? |
28 | - %ul.bordered-list | 28 | + %ul.bordered-list.broadcast-messages |
29 | - @broadcast_messages.each do |broadcast_message| | 29 | - @broadcast_messages.each do |broadcast_message| |
30 | %li | 30 | %li |
31 | .pull-right | 31 | .pull-right |
@@ -36,6 +36,11 @@ | @@ -36,6 +36,11 @@ | ||
36 | - if broadcast_message.ends_at | 36 | - if broadcast_message.ends_at |
37 | %strong | 37 | %strong |
38 | #{broadcast_message.ends_at.to_s(:short)} | 38 | #{broadcast_message.ends_at.to_s(:short)} |
39 | + | ||
40 | + = link_to [:admin, broadcast_message], method: :delete, remote: true, class: 'remove-row btn btn-tiny' do | ||
41 | + %i.icon-remove.cred | ||
42 | + | ||
39 | .message= broadcast_message.message | 43 | .message= broadcast_message.message |
40 | 44 | ||
45 | + | ||
41 | = paginate @broadcast_messages | 46 | = paginate @broadcast_messages |
config/routes.rb
@@ -86,7 +86,7 @@ Gitlab::Application.routes.draw do | @@ -86,7 +86,7 @@ Gitlab::Application.routes.draw do | ||
86 | get :test | 86 | get :test |
87 | end | 87 | end |
88 | 88 | ||
89 | - resources :broadcast_messages, only: [:index, :create] | 89 | + resources :broadcast_messages, only: [:index, :create, :destroy] |
90 | resource :logs, only: [:show] | 90 | resource :logs, only: [:show] |
91 | resource :background_jobs, controller: 'background_jobs', only: [:show] | 91 | resource :background_jobs, controller: 'background_jobs', only: [:show] |
92 | resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] | 92 | resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] |