Add modal confirmation before delete fluentd

This commit is contained in:
uu59 2014-06-02 16:20:51 +09:00
parent 1ce231bdc8
commit 76daf0bd60
4 changed files with 41 additions and 1 deletions

View File

@ -19,8 +19,17 @@
= "fluentd ##{d.id}" = "fluentd ##{d.id}"
- unless d.agent.running? - unless d.agent.running?
= link_to t(".edit"), edit_fluentd_path(d) = link_to t(".edit"), edit_fluentd_path(d)
= link_to t(".destroy"), fluentd_path(d), method: :delete %button{class: "btn btn-danger", data: {toggle: "modal", target:" #modal-destroy"}}
= t ".destroy"
%div.panel-body %div.panel-body
:ruby
locals = {
head: t('.destroy_confirm_title', target: d.label),
body: t('.destroy_confirm_body'),
primary_button: link_to(t(".destroy"), fluentd_path(d), method: :delete, class: "btn btn-danger")
}
= render partial: "shared/modal", locals: locals
%h4 %h4
- if d.agent.running? - if d.agent.running?
= icon("fa-play") = icon("fa-play")

View File

@ -0,0 +1,25 @@
<% primary_button ||= "Save changes" %>
<!-- Modal -->
<div class="modal fade" id="modal-destroy" tabindex="-1" role="dialog" aria-labelledby="modal-destroyLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel"><%= head %></h4>
</div>
<div class="modal-body">
<%= body %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<%= primary_button %>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->

View File

@ -27,6 +27,9 @@ en:
installing: "Installing: %{target}" installing: "Installing: %{target}"
uninstalling: "Uninstalling: %{target}" uninstalling: "Uninstalling: %{target}"
search: Search search: Search
destroy_confirm_title: "%{target} Deletion"
destroy_confirm_body: |
Really delete?
plugins: plugins:
common: &plugin_common common: &plugin_common

View File

@ -27,6 +27,9 @@ ja:
installing: "インストール中: %{target}" installing: "インストール中: %{target}"
uninstalling: "アンインストール中: %{target}" uninstalling: "アンインストール中: %{target}"
search: 検索 search: 検索
destroy_confirm_title: "%{target}を削除"
destroy_confirm_body: |
削除しますか?
plugins: plugins:
common: &plugin_common common: &plugin_common