Commit a43eb63545e3471e18e3b89c103039008b2d99a2
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'AI3279-block_store' into stable
Showing
3 changed files
with
16 additions
and
4 deletions
Show diff stats
app/helpers/boxes_helper.rb
| @@ -191,9 +191,8 @@ module BoxesHelper | @@ -191,9 +191,8 @@ module BoxesHelper | ||
| 191 | "before-block-#{block.id}" | 191 | "before-block-#{block.id}" |
| 192 | end | 192 | end |
| 193 | if block.nil? or modifiable?(block) | 193 | if block.nil? or modifiable?(block) |
| 194 | - draggable_id = "encodeURIComponent(jQuery(ui.draggable).attr('id'))" | ||
| 195 | - draggable_type = "encodeURIComponent(jQuery(ui.draggable).attr('data-block-type'))" | ||
| 196 | - content_tag('div', _('Drop Here'), :id => id, :class => 'block-target' ) + drop_receiving_element(id, :url => { :action => 'move_block', :target => id }, :accept => box.acceptable_blocks, :hoverclass => 'block-target-hover', :with => "'type='+"+draggable_type+"+'&id=' + "+draggable_id, :activeClass => 'block-target-active', :tolerance => 'pointer') | 194 | + url = url_for(:action => 'move_block', :target => id) |
| 195 | + content_tag('div', _('Drop Here'), :id => id, :class => 'block-target' ) + drop_receiving_element(id, :accept => box.acceptable_blocks, :hoverclass => 'block-target-hover', :activeClass => 'block-target-active', :tolerance => 'pointer', :onDrop => "function(ev, ui) { dropBlock('#{url}', '#{_('loading...')}', ev, ui);}") | ||
| 197 | else | 196 | else |
| 198 | "" | 197 | "" |
| 199 | end | 198 | end |
public/javascripts/block-store.js
| @@ -48,3 +48,16 @@ function initBlockStore() { | @@ -48,3 +48,16 @@ function initBlockStore() { | ||
| 48 | }); | 48 | }); |
| 49 | jQuery('#block-store #block-store-filter').keyup(filterBlocks); | 49 | jQuery('#block-store #block-store-filter').keyup(filterBlocks); |
| 50 | } | 50 | } |
| 51 | + | ||
| 52 | +function dropBlock(url, loadingMessage, ev, ui) { | ||
| 53 | + var blockType = jQuery(ui.draggable).attr('data-block-type'); | ||
| 54 | + var blockId = jQuery(ui.draggable).attr('id'); | ||
| 55 | + open_loading(loadingMessage); | ||
| 56 | + jQuery.ajax({ | ||
| 57 | + data: 'type='+encodeURIComponent(blockType)+'&id=' + encodeURIComponent(blockId), | ||
| 58 | + dataType: 'script', | ||
| 59 | + type: 'post', | ||
| 60 | + url: url, | ||
| 61 | + complete: close_loading, | ||
| 62 | + }) | ||
| 63 | +} |
public/stylesheets/slick-theme.css
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | /* Slider */ | 2 | /* Slider */ |
| 3 | .slick-loading .slick-list | 3 | .slick-loading .slick-list |
| 4 | { | 4 | { |
| 5 | - background: #fff url('./ajax-loader.gif') center center no-repeat; | 5 | + background: #fff url('/images/loading.gif') center center no-repeat; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | /* Icons */ | 8 | /* Icons */ |