noodall-ui 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Noodall
2
2
  module UI
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
@@ -210,7 +210,7 @@ function get_preview_html(e) {
210
210
  preview_form.appendTo("body");
211
211
  preview_form.submit();
212
212
  preview_form.remove();
213
- }
213
+ };
214
214
 
215
215
  function initComponentTable() {
216
216
  // Mark slots that have content as filled
@@ -309,8 +309,8 @@ var Browser = {
309
309
  Browser.allowed_types = [];
310
310
  }
311
311
  },
312
- toggle_added_asset: function(id) {
313
- id_in_array = Browser.assets_to_add.indexOf(id);
312
+ toggle_added_asset: function(id, e) {
313
+ id_in_array = $.inArray(id, Browser.assets_to_add);
314
314
  if (id_in_array == -1) {
315
315
  Browser.assets_to_add.push(id);
316
316
  Browser.assets_to_add_html[id] = $('#asset-' + asset_id ).clone();
@@ -319,14 +319,14 @@ var Browser = {
319
319
  Browser.assets_to_add_html.splice(id_in_array,1);
320
320
  }
321
321
  if (Browser.mode == 'single') {
322
- Browser.do_action_and_close();
322
+ Browser.do_action_and_close(e);
323
323
  }
324
324
  },
325
325
  toggle_from_link: function(e) {
326
326
  // Get the id from the href
327
327
  asset_id = $(this).siblings('a.show').attr('href').split('?')[0].split('/').pop();
328
328
  $(this).toggleClass('selected');
329
- Browser.toggle_added_asset(asset_id);
329
+ Browser.toggle_added_asset(asset_id, e);
330
330
  return false;
331
331
  },
332
332
  attach_asset: function() {
@@ -383,8 +383,8 @@ var Browser = {
383
383
  });
384
384
  }
385
385
  },
386
- do_action_and_close: function() {
387
- Browser.action();
386
+ do_action_and_close: function(e) {
387
+ Browser.action(e);
388
388
  Browser.close();
389
389
  },
390
390
  // Callback stubs to be overridden
@@ -398,6 +398,11 @@ function open_component_form(e) {
398
398
 
399
399
  form_detail = $(e.target).closest('div.component_form').find('.component_form_detail');
400
400
 
401
+ // unload tinymce on previous textareas
402
+ form_detail.find('.lite-editor, .editor').each(function(){
403
+ tinyMCE.get($(this).attr('id')).remove();
404
+ });
405
+
401
406
  // Set the slot to nil to clear on save
402
407
  form_detail.html('<input name="node[' + Component.last_slot_type + '_slot_' + Component.last_slot_index + ']" type="hidden" value=""/>');
403
408
 
@@ -423,7 +428,7 @@ function open_component_form(e) {
423
428
  Component.slot_form.find('li.multi-file').last().hide();
424
429
  Component.slot_form.find('textarea.lite-editor').tinymce(lite_tiny_mce_config);
425
430
  });
426
- }
431
+ };
427
432
 
428
433
  function clear_component_form(e) {
429
434
  slot_form = $(e.target).closest('div.component_form');
@@ -573,15 +578,11 @@ $('#tree-browser.link a').live('click', function(e) {
573
578
  // Asset Linker
574
579
  $('span.link-asset').live('click', {readonly:true}, function(event) {
575
580
  Component.link_input = $(this).siblings('input').first();
576
- Component.allowed_types = [];
577
- Browser.action = function() {
578
- asset_id = Browser.assets_to_add[0];
579
- Component.link_input.val($('#asset-' + asset_id).siblings('a.add').attr('href'));
581
+ Browser.set_opener($(this));
582
+ Browser.action = function(e) {
583
+ $(Component.link_input).val($(e.target).attr('href'));
580
584
  };
581
585
  Browser.after_close = Component.reopen_slot;
582
586
  Browser.open();
583
-
584
-
585
- event.stopImmediatePropagation();
586
- return false;
587
587
  });
588
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noodall-ui
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve England