caboose-cms 0.4.62 → 0.4.63

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTBmYzg5MzdlNjgzMDhkZmY3OTA4ZjVmNTM5YjhkODM2NWJlNjFmNA==
4
+ NDM0ZDYyZmZlNjM2OTU2ZTg1OTJiNGM0MjNmYTdlNmQ4ZjgxY2U0YQ==
5
5
  data.tar.gz: !binary |-
6
- MGZhMGIzNjczMjQ0YTQ0MmI2OTVkZGNjZTU3ZmYzZGI1YmE1ODU0MA==
6
+ NWE1ZGJmM2U0N2Y1NTNmMzUxNTM0YjYwYjg3YTU2NDM4YmRiZmIxZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2E4ZjNjZjE3MGE3MmE1MTUxMWMwZDQ1MzMyNTc4OGUwM2UxNDYyMTdiNGJl
10
- NTE5ZmJhNjdlOTE3MzczM2NmY2QwZDkwYTg2OTc5ZmZiNzhkNGJjZDczOWJh
11
- MGY0ZWFkODQ3NjY3YzViMzE5MzZhNjkwNmUzOGZlMGRmNTU4ZDg=
9
+ ODA5ZGIwYmY3ZjRjZTA4NWE4MGQwNWRmN2JhMWZmMzNmYzUwY2ViODQ3Zjlh
10
+ NmFhYTM0NGMxMmJhYjAzYzdjNWQ1MzU4NzliNDUyMWNkYzNhMzVkNjlkNjc1
11
+ OGY2YzU5YmY4NjY4MDNlMjM5N2FkNzBlN2I4MjViODlmM2I4MGM=
12
12
  data.tar.gz: !binary |-
13
- NjBmNmE3NTBlZjA4YmE0YjI1MDA3N2ZkZWE2YzBjNDgxMGE0NWU5N2QxNjI2
14
- MDNhZWRkYzRhNDhiY2NlYTNjMTc2ZGZlYTRkOTM0MjY4NzdlOGU2MWRlOGM3
15
- ODUwMmIzYjFmMWY2YjNiNzc1MDc3Y2NhNzA3NDk0MzI1MjcxNGY=
13
+ ZTNmNjY2NjNlMTJlYjQzZTY0NzdhZTkxZjA2MjZiYmU3OGY0OGQyMjlhOTlh
14
+ YTczMmY1Mjg4MjIyYjE0YmI5NmE2MGQ5OWI5ZTdjM2VhZDQ3YjgyYTUzZGIy
15
+ MTY4MGZmYTQ0MDBhMzIzMzE0MWFhMDcwNzhmZmY1MTE2MDg5MDA=
@@ -5,6 +5,7 @@ PageContentController.prototype = {
5
5
 
6
6
  page_id: false,
7
7
  new_block_type_id: false,
8
+ selected_block_ids: [],
8
9
 
9
10
  init: function(page_id)
10
11
  {
@@ -79,27 +80,54 @@ PageContentController.prototype = {
79
80
  caboose_modal_url('/admin/pages/' + this.page_id + '/blocks/' + block_id + '/new');
80
81
  },
81
82
 
83
+ select_block: function(block_id)
84
+ {
85
+ i = this.selected_block_ids.indexOf(block_id);
86
+ if (i == -1) // Not there
87
+ {
88
+ this.selected_block_ids.push(block_id);
89
+ $('#block_' + block_id).addClass('selected');
90
+ }
91
+ else
92
+ {
93
+ this.selected_block_ids.splice(i, 1);
94
+ $('#block_' + block_id).removeClass('selected');
95
+ }
96
+ },
97
+
82
98
  delete_block: function(block_id, confirm)
83
99
  {
84
100
  var that = this;
85
101
  if (!confirm)
86
102
  {
103
+ if (this.selected_block_ids.indexOf(block_id) == -1)
104
+ this.selected_block_ids.push(block_id);
105
+ var other_count = this.selected_block_ids.length - 1;
106
+
107
+ var message = "Are you sure you want to delete this block";
108
+ if (other_count > 0)
109
+ message += " and the " + other_count + " other selected block" + (other_count == 1 ? '' : 's');
110
+ message += "?<br />";
111
+
87
112
  var p = $('<p/>')
88
113
  .addClass('caboose_note')
89
- .append("Are you sure you want to delete the block? ")
114
+ .append(message)
90
115
  .append($('<input/>').attr('type', 'button').val('Yes').click(function(e) { e.preventDefault(); e.stopPropagation(); that.delete_block(block_id, true); })).append(" ")
91
116
  .append($('<input/>').attr('type', 'button').val('No').click(function(e) { e.preventDefault(); e.stopPropagation(); that.render_blocks(); }));
92
117
  $('#block_' + block_id).attr('onclick','').unbind('click');
93
118
  $('#block_' + block_id).empty().append(p);
94
119
  return;
95
120
  }
96
- $.ajax({
97
- url: '/admin/pages/' + this.page_id + '/blocks/' + block_id,
98
- type: 'delete',
99
- success: function(resp) {
100
- that.render_blocks();
101
- }
102
- });
121
+ for (var i in this.selected_block_ids)
122
+ {
123
+ $.ajax({
124
+ url: '/admin/pages/' + this.page_id + '/blocks/' + this.selected_block_ids[i],
125
+ type: 'delete',
126
+ async: false,
127
+ success: function(resp) {}
128
+ });
129
+ }
130
+ that.render_blocks();
103
131
  },
104
132
 
105
133
  /*****************************************************************************
@@ -115,6 +143,7 @@ PageContentController.prototype = {
115
143
  $('#block_' + b.id).replaceWith(b.html);
116
144
  });
117
145
  that.set_clickable();
146
+ that.selected_block_ids = [];
118
147
  }
119
148
  });
120
149
  },
@@ -137,8 +166,9 @@ PageContentController.prototype = {
137
166
  var that = this;
138
167
 
139
168
  $('#block_' + b.id)
140
- .prepend($('<a/>').attr('id', 'block_' + b.id + '_sort_handle' ).addClass('sort_handle' ).append($('<span/>').addClass('ui-icon ui-icon-arrow-2-n-s')).click(function(e) { e.preventDefault(); e.stopPropagation(); }))
141
- .prepend($('<a/>').attr('id', 'block_' + b.id + '_delete_handle').addClass('delete_handle').append($('<span/>').addClass('ui-icon ui-icon-close' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.delete_block(b.id); }));
169
+ .prepend($('<a/>').attr('id', 'block_' + b.id + '_select_handle' ).addClass('select_handle' ).append($('<span/>').addClass('ui-icon ui-icon-check' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.select_block(b.id); }))
170
+ .prepend($('<a/>').attr('id', 'block_' + b.id + '_sort_handle' ).addClass('sort_handle' ).append($('<span/>').addClass('ui-icon ui-icon-arrow-2-n-s')).click(function(e) { e.preventDefault(); e.stopPropagation(); }))
171
+ .prepend($('<a/>').attr('id', 'block_' + b.id + '_delete_handle' ).addClass('delete_handle' ).append($('<span/>').addClass('ui-icon ui-icon-close' )).click(function(e) { e.preventDefault(); e.stopPropagation(); that.delete_block(b.id); }));
142
172
 
143
173
  if (parent_allows_child_blocks && (!b.name || b.name.length == 0))
144
174
  {
@@ -11,10 +11,13 @@
11
11
  #blocks .ui-selected { background: #fff799; }
12
12
  #blocks .sortable-placeholder { height: 40px; background: #fff799; border: #ccc 1px solid; }
13
13
 
14
+ #blocks li .select_handle { display: none; }
14
15
  #blocks li .sort_handle { display: none; }
15
16
  #blocks li .delete_handle { display: none; }
17
+ #blocks li:hover .select_handle { position: absolute; top: 0; right: 44px; display: block; width: 20px; height: 20px; background-color: #ccc; }
16
18
  #blocks li:hover .sort_handle { position: absolute; top: 0; right: 22px; display: block; width: 20px; height: 20px; background-color: #ccc; }
17
19
  #blocks li:hover .delete_handle { position: absolute; top: 0; right: 0px; display: block; width: 20px; height: 20px; background-color: #ccc; }
20
+ #blocks li:hover .select_handle span { margin: 2px 1px; }
18
21
  #blocks li:hover .sort_handle span { margin: 2px 1px; }
19
22
  #blocks li:hover .delete_handle span { margin: 2px 1px; }
20
23
 
@@ -21,13 +21,18 @@
21
21
  padding: 16px 10px;
22
22
  }
23
23
  .block_over { background: #e3e3e3; }
24
+ .select_handle { display: none; }
24
25
  .sort_handle { display: none; }
25
26
  .delete_handle { display: none; }
27
+ .block_over .select_handle { display: block; position: relative; }
26
28
  .block_over .sort_handle { display: block; position: relative; }
27
29
  .block_over .delete_handle { display: block; position: relative; }
30
+ .block_over .select_handle span { position: absolute; top: 0; right: 36px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
28
31
  .block_over .sort_handle span { position: absolute; top: 0; right: 18px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
29
32
  .block_over .delete_handle span { position: absolute; top: 0; right: 0px; width: 18px; height: 18px; background-color: #fff; border: #ccc 1px solid; }
30
33
 
34
+ .selected { background: #fff799; }
35
+
31
36
  .new_block_link { position: relative; width: 100%; }
32
37
  .new_block_link .line { position: absolute; top: -11px; width: 100%; height: 2px; background: transparent; }
33
38
  .new_block_link a { position: absolute; top: -20px; left: 45%; background: transparent; color: transparent; display: block; padding: 4px 8px; }
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.4.62'
2
+ VERSION = '0.4.63'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.62
4
+ version: 0.4.63
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry