Commit 195ac7880f2c803f27a882d28b2d26be323eb86f
1 parent
afc8b7df
add space for ion, add confirm message for delete row or coll
Showing
4 changed files
with
39 additions
and
34 deletions
| @@ -78,50 +78,54 @@ jQuery(document).ready(function(){ | @@ -78,50 +78,54 @@ jQuery(document).ready(function(){ | ||
| 78 | }); | 78 | }); |
| 79 | 79 | ||
| 80 | $('.html-generator').on('click', '.col-operation .col-remove', function(){ | 80 | $('.html-generator').on('click', '.col-operation .col-remove', function(){ |
| 81 | - var $this = $(this), | ||
| 82 | - $cell = $this.closest('.col'), | ||
| 83 | - $block = $cell.closest('.html-generator'), | ||
| 84 | - delete_cell_url = $block.data('delete_cell_url'); | ||
| 85 | - | ||
| 86 | - //$cell.data('id') | ||
| 87 | - | ||
| 88 | - jQuery.ajax({ | ||
| 89 | - type: 'POST', | ||
| 90 | - url: delete_cell_url, | ||
| 91 | - data: {structure_id: $cell.data('id')}, | ||
| 92 | - success: function (data) { | ||
| 93 | - $cell.remove(); | 81 | + var $this = $(this); |
| 82 | + bootbox.confirm('Are you sure?', function(result) { | ||
| 83 | + if (result) { | ||
| 84 | + var $cell = $this.closest('.col'), | ||
| 85 | + $block = $cell.closest('.html-generator'), | ||
| 86 | + delete_cell_url = $block.data('delete_cell_url'); | ||
| 87 | + | ||
| 88 | + //$cell.data('id') | ||
| 89 | + | ||
| 90 | + jQuery.ajax({ | ||
| 91 | + type: 'POST', | ||
| 92 | + url: delete_cell_url, | ||
| 93 | + data: {structure_id: $cell.data('id')}, | ||
| 94 | + success: function (data) { | ||
| 95 | + $cell.remove(); | ||
| 96 | + } | ||
| 97 | + }); | ||
| 94 | } | 98 | } |
| 95 | }); | 99 | }); |
| 96 | 100 | ||
| 97 | - | ||
| 98 | - | ||
| 99 | - | ||
| 100 | return false; | 101 | return false; |
| 101 | }); | 102 | }); |
| 102 | 103 | ||
| 103 | 104 | ||
| 104 | $('.html-generator').on('click', '.row-operation .row-remove', function(){ | 105 | $('.html-generator').on('click', '.row-operation .row-remove', function(){ |
| 105 | - var $this = $(this), | ||
| 106 | - $row = $this.closest('.row-fluid'), | ||
| 107 | - $block = $row.closest('.html-generator'), | ||
| 108 | - delete_cell_url = $block.data('delete_cell_url'), | ||
| 109 | - mas_cell_id = []; | ||
| 110 | - | ||
| 111 | - $row.find('.col').each(function(){ | ||
| 112 | - mas_cell_id.push($(this).data('id')); | ||
| 113 | - }); | 106 | + var $this = $(this); |
| 107 | + bootbox.confirm('Are you sure?', function(result) { | ||
| 108 | + if (result) { | ||
| 109 | + var $row = $this.closest('.row-fluid'), | ||
| 110 | + $block = $row.closest('.html-generator'), | ||
| 111 | + delete_cell_url = $block.data('delete_cell_url'), | ||
| 112 | + mas_cell_id = []; | ||
| 113 | + | ||
| 114 | + $row.find('.col').each(function(){ | ||
| 115 | + mas_cell_id.push($(this).data('id')); | ||
| 116 | + }); | ||
| 114 | 117 | ||
| 115 | - jQuery.ajax({ | ||
| 116 | - type: 'POST', | ||
| 117 | - url: delete_cell_url, | ||
| 118 | - data: {structure_ids: mas_cell_id}, | ||
| 119 | - success: function (data) { | ||
| 120 | - $row.remove(); | 118 | + jQuery.ajax({ |
| 119 | + type: 'POST', | ||
| 120 | + url: delete_cell_url, | ||
| 121 | + data: {structure_ids: mas_cell_id}, | ||
| 122 | + success: function (data) { | ||
| 123 | + $row.remove(); | ||
| 124 | + } | ||
| 125 | + }); | ||
| 121 | } | 126 | } |
| 122 | }); | 127 | }); |
| 123 | 128 | ||
| 124 | - | ||
| 125 | return false; | 129 | return false; |
| 126 | }); | 130 | }); |
| 127 | 131 |
| @@ -7,7 +7,7 @@ module Kanjai | @@ -7,7 +7,7 @@ module Kanjai | ||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | def show | 9 | def show |
| 10 | - if @page_data.page.block? | 10 | + if @page_data && @page_data.page.block? |
| 11 | render :template => 'kanjai/shared/401', status: 401, layout: false and return | 11 | render :template => 'kanjai/shared/401', status: 401, layout: false and return |
| 12 | end | 12 | end |
| 13 | #expires_in 10.minutes, :public => true | 13 | #expires_in 10.minutes, :public => true |