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
app/controllers/admin/broadcast_messages_controller.rb
... | ... | @@ -15,6 +15,15 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController |
15 | 15 | end |
16 | 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 | 27 | protected |
19 | 28 | |
20 | 29 | def broadcast_messages | ... | ... |
app/views/admin/broadcast_messages/index.html.haml
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | = f.submit "Add broadcast message", class: "btn btn-create" |
26 | 26 | |
27 | 27 | -if @broadcast_messages.any? |
28 | - %ul.bordered-list | |
28 | + %ul.bordered-list.broadcast-messages | |
29 | 29 | - @broadcast_messages.each do |broadcast_message| |
30 | 30 | %li |
31 | 31 | .pull-right |
... | ... | @@ -36,6 +36,11 @@ |
36 | 36 | - if broadcast_message.ends_at |
37 | 37 | %strong |
38 | 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 | 43 | .message= broadcast_message.message |
40 | 44 | |
45 | + | |
41 | 46 | = paginate @broadcast_messages | ... | ... |
config/routes.rb
... | ... | @@ -86,7 +86,7 @@ Gitlab::Application.routes.draw do |
86 | 86 | get :test |
87 | 87 | end |
88 | 88 | |
89 | - resources :broadcast_messages, only: [:index, :create] | |
89 | + resources :broadcast_messages, only: [:index, :create, :destroy] | |
90 | 90 | resource :logs, only: [:show] |
91 | 91 | resource :background_jobs, controller: 'background_jobs', only: [:show] |
92 | 92 | resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] | ... | ... |