caboose-cms 0.9.79 → 0.9.80

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f3eaff5231a8427c3a7aded0962b8235f691469
4
- data.tar.gz: 236c9aa46e964d9bebda96b2a327dfb82a3a0504
3
+ metadata.gz: 77db39e6da1711c696ce60c146e98c421f3c4b95
4
+ data.tar.gz: e5c1d403697d8247bf95451bb9cf3a4b01f93b47
5
5
  SHA512:
6
- metadata.gz: 4d41728c2a73aacfc41bc3bc003be46dcf39162a3500afd6452173283bcd58331fc420856903edf62ada192fa8e58f60f336095f28d4ca0ee3a93d2f0f5bdfe9
7
- data.tar.gz: 4cad9ad3fd7c2dba703f19160aef157fb785d7fd9c570c34e87b6d57d463b62b2b3f70d4496238e106ade965fc4764104a100e9b31cb5aae3e489cac023c9604
6
+ metadata.gz: 340b5403884ed7f802d6611400e9a2201e7b0aad62606f77c4f69542c261d8a8d674ab9fb667047982d52dd85957060301e4a1b729b6495ed6d2b9ca389d0e09
7
+ data.tar.gz: d5a4e1582466182eb78380154a61576da2f8fa93ec960a3d44e9d15491064deb2c128181565830b595bfab548532ae0b3d40f87fe8db4a863e32b293bc4bf1f5
@@ -283,6 +283,23 @@ var BlockModalController = ModalController.extend({
283
283
  attributes: [h]
284
284
  });
285
285
  },
286
+
287
+ remove_media: function(block) {
288
+ var that = this;
289
+
290
+ $.ajax({
291
+ url: that.block_url(block) + '/remove-media',
292
+ type: 'put',
293
+ success: function(html) {
294
+ $('#the_modal img#block_' + block.id).attr('src','//placehold.it/150x150');
295
+ $('#the_modal div#block_' + block.id + ' p').html('Empty file.');
296
+ $('#the_modal #block_' + block.id).parent().find('.caboose-btn').remove();
297
+ that.parent_controller.render_blocks();
298
+ that.autosize();
299
+ },
300
+ });
301
+
302
+ },
286
303
 
287
304
  set_clickable: function(b)
288
305
  {
@@ -299,7 +316,28 @@ var BlockModalController = ModalController.extend({
299
316
  $('#the_modal #block_' + b.id).click(function(e) {
300
317
  e.stopPropagation();
301
318
  that.parent_controller.edit_block(b.id);
302
- });
319
+ });
320
+
321
+ if ( b.block_type && b.block_type.field_type == 'image' && b.rendered_value.indexOf('placehold') < 0 ) {
322
+ btn = $('<a href="#" class="caboose-btn">Remove</a>');
323
+ btn.css('position','relative').css('left','10px').css('bottom','10px').css('font-size','13px');
324
+ btn.on('click', function(e) {
325
+ e.preventDefault();
326
+ that.remove_media(b);
327
+ });
328
+ $('#the_modal #block_' + b.id).after(btn);
329
+ }
330
+
331
+ if ( b.block_type && b.block_type.field_type == 'file' && b.rendered_value.indexOf('Empty file') < 0 ) {
332
+ btn = $('<a href="#" class="caboose-btn">Remove</a>');
333
+ btn.css('margin-bottom','10px').css('font-size','13px');
334
+ btn.on('click', function(e) {
335
+ e.preventDefault();
336
+ that.remove_media(b);
337
+ });
338
+ $('#the_modal #block_' + b.id).after(btn);
339
+ }
340
+
303
341
  // var show_mouseover = true;
304
342
  // if (b.children && b.children.length > 0)
305
343
  // {
@@ -308,12 +308,12 @@ var BlockModalController = ModalController.extend({
308
308
  show_mouseover = false;
309
309
  that.set_clickable(b2);
310
310
  });
311
- }
312
- if (false && show_mouseover)
313
- {
314
- $('#the_modal #block_' + b.id).mouseover(function(el) { $('#the_modal #block_' + b.id).addClass( 'block_over'); });
315
- $('#the_modal #block_' + b.id).mouseout(function(el) { $('#the_modal #block_' + b.id).removeClass('block_over'); });
316
- }
311
+ }
312
+ // if (false && show_mouseover)
313
+ // {
314
+ // $('#the_modal #block_' + b.id).mouseover(function(el) { $('#the_modal #block_' + b.id).addClass( 'block_over'); });
315
+ // $('#the_modal #block_' + b.id).mouseout(function(el) { $('#the_modal #block_' + b.id).removeClass('block_over'); });
316
+ // }
317
317
  },
318
318
 
319
319
  /*****************************************************************************
@@ -158,7 +158,18 @@ module Caboose
158
158
  }
159
159
  end
160
160
  return arr
161
- end
161
+ end
162
+
163
+ # @route PUT /admin/pages/:page_id/blocks/:id/remove-media
164
+ # @route PUT /admin/posts/:post_id/blocks/:id/remove-media
165
+ def admin_remove_media
166
+ return unless user_is_allowed('pages', 'edit')
167
+ resp = Caboose::StdClass.new
168
+ b = Block.find(params[:id])
169
+ b.media = nil
170
+ resp.success = b.save
171
+ render :json => resp
172
+ end
162
173
 
163
174
  # @route GET /admin/pages/:page_id/blocks/:id/render
164
175
  # @route GET /admin/posts/:post_id/blocks/:id/render
@@ -7,22 +7,22 @@ class Caboose::CorePlugin < Caboose::CaboosePlugin
7
7
  nav << { 'id' => 'my-account' , 'text' => 'My Account' , 'href' => '/my-account' , 'modal' => true }
8
8
 
9
9
  item = { 'id' => 'core', 'text' => 'Settings', 'children' => [] }
10
- item['children'] << { 'id' => 'blocktypes' , 'text' => 'AB Test Variants' , 'href' => '/admin/ab-variants' , 'modal' => false } if user.is_allowed('abvariants' , 'view')
11
- item['children'] << { 'id' => 'blocktypes' , 'text' => 'Block Types' , 'href' => '/admin/block-types' , 'modal' => false } if user.is_allowed('blocktypes' , 'view') if site.is_master == true
12
- item['children'] << { 'id' => 'fonts' , 'text' => 'Fonts' , 'href' => '/admin/fonts' , 'modal' => false } if user.is_allowed('fonts' , 'view') if site.use_fonts == true
10
+ # item['children'] << { 'id' => 'blocktypes' , 'text' => 'AB Test Variants' , 'href' => '/admin/ab-variants' , 'modal' => false } if user.is_allowed('abvariants' , 'view')
11
+ item['children'] << { 'id' => 'blocktypes' , 'text' => 'Block Types' , 'href' => '/admin/block-types' , 'modal' => false } if user.is_allowed('blocktypes' , 'view') && site.is_master == true
12
+ item['children'] << { 'id' => 'fonts' , 'text' => 'Fonts' , 'href' => '/admin/fonts' , 'modal' => false } if user.is_allowed('fonts' , 'view') && site.use_fonts == true
13
13
  item['children'] << { 'id' => 'redirects' , 'text' => 'Permanent Redirects' , 'href' => '/admin/redirects' , 'modal' => false } if user.is_allowed('redirects' , 'view')
14
14
  item['children'] << { 'id' => 'permissions' , 'text' => 'Permissions' , 'href' => '/admin/permissions' , 'modal' => false } if user.is_allowed('permissions' , 'view')
15
15
  item['children'] << { 'id' => 'pagecustomfields' , 'text' => 'Page Custom Fields' , 'href' => '/admin/page-custom-fields' , 'modal' => false } if user.is_allowed('pagecustomfields' , 'view')
16
16
  item['children'] << { 'id' => 'post_categories' , 'text' => 'Post Categories' , 'href' => '/admin/post-categories' , 'modal' => false } if user.is_allowed('post_categories' , 'view')
17
17
  item['children'] << { 'id' => 'postcustomfields' , 'text' => 'Post Custom Fields' , 'href' => '/admin/post-custom-fields' , 'modal' => false } if user.is_allowed('postcustomfields' , 'view')
18
18
  item['children'] << { 'id' => 'roles' , 'text' => 'Roles' , 'href' => '/admin/roles' , 'modal' => false } if user.is_allowed('roles' , 'view')
19
- item['children'] << { 'id' => 'sites' , 'text' => 'Sites' , 'href' => '/admin/sites' , 'modal' => false } if user.is_allowed('sites' , 'view') if site.is_master == true
19
+ item['children'] << { 'id' => 'sites' , 'text' => 'Sites' , 'href' => '/admin/sites' , 'modal' => false } if user.is_allowed('sites' , 'view') && site.is_master == true
20
20
  item['children'] << { 'id' => 'smtp' , 'text' => 'SMTP (Mail)' , 'href' => '/admin/smtp' , 'modal' => false } if user.is_allowed('smtp' , 'view')
21
21
  item['children'] << { 'id' => 'social' , 'text' => 'Social Media' , 'href' => '/admin/social' , 'modal' => false } if user.is_allowed('social' , 'view')
22
- item['children'] << { 'id' => 'store' , 'text' => 'Store' , 'href' => '/admin/store' , 'modal' => false } if user.is_allowed('store' , 'view') if site.use_store == true
22
+ item['children'] << { 'id' => 'store' , 'text' => 'Store' , 'href' => '/admin/store' , 'modal' => false } if user.is_allowed('store' , 'view') && site.use_store == true
23
23
  item['children'] << { 'id' => 'users' , 'text' => 'Users' , 'href' => '/admin/users' , 'modal' => false } if user.is_allowed('users' , 'view')
24
- item['children'] << { 'id' => 'subscriptions' , 'text' => 'Subscriptions' , 'href' => '/admin/subscriptions' , 'modal' => false } if user.is_allowed('subscriptions' , 'view')
25
- item['children'] << { 'id' => 'variables' , 'text' => 'Variables' , 'href' => '/admin/settings' , 'modal' => false } if user.is_allowed('settings' , 'view')
24
+ item['children'] << { 'id' => 'subscriptions' , 'text' => 'Subscriptions' , 'href' => '/admin/subscriptions' , 'modal' => false } if user.is_allowed('subscriptions' , 'view') && site.use_store == true
25
+ # item['children'] << { 'id' => 'variables' , 'text' => 'Variables' , 'href' => '/admin/settings' , 'modal' => false } if user.is_allowed('settings' , 'view')
26
26
  nav << item if item['children'].count > 0
27
27
 
28
28
  item = { 'id' => 'content', 'text' => 'Content', 'children' => [] }
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.79'
2
+ VERSION = '0.9.80'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.79
4
+ version: 0.9.80
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-10 00:00:00.000000000 Z
11
+ date: 2017-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg