caboose-cms 0.6.33 → 0.6.34

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
- YjgzNGU1YzAzMmJhOWNjNjg2MTc1N2M2ZTk1MTA4NjczMzExZWFkMQ==
4
+ ZDc5ZjY1NTljMGNjZTM5NGU2ODNlYmIyNmNkODM1OGRkNTEwZGVkYw==
5
5
  data.tar.gz: !binary |-
6
- MjkyMmY2NDA0ZTYwOTUxNTEyYjljMWIyY2VhYTcwN2Y2NWZiNmNlNg==
6
+ Yzk1YmZmOTdhYzQyMGUyYWI3ODcwYzdiMmU2OTMzNzUxNjE2OTA4NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzRmNzQwZmI3YTMxNDU3OTgzMzQ5NzBmYTA2N2VjYTQ0YWEyNTMwNTU4ZDM5
10
- ZTg2OTY4OGVjMWQ3ZWQ1NzM2MTdjOGE5NmM0ZWU5OTEzNDhkZTZiOGUyOGQ4
11
- NTE1NDM5MjRiNTFhM2NkMGM4M2E1Yjk1MjkyOGNkNmY0YjUyOWQ=
9
+ YmQzMjRiY2ExZmNjNzkyMmU0YjFkZjhhZGFiMjcwNzU3ODcyNGIyOTA3MjI5
10
+ ODEwZmEwNTI5MGYyMmYzZTNkYTViY2Y3ZWU1Mzg0YWVmMGFmZGZkNzhiOGRk
11
+ NDZiZTM1MWU3MDBhZDUyNzAxMTFlMmMyNmVhOWRlMWJlYTM0MDU=
12
12
  data.tar.gz: !binary |-
13
- NzdmMzRiMDRjYzlmZjQ3ZDEyN2UwZGI2ZGQ4MjZlMmMwMGExYjJlMzQ3MGUz
14
- ZWRhZTk5ZGQ2MjA1YWM3NzIwODJkOThhNzhhZjhkN2E1NmZmNjA1N2I5Y2Rm
15
- ZjljMDI2N2Q0Mjg3MGM4NGZkOGFkNmVkNzJkZWMwYTM4NDYxNjA=
13
+ Njg5YmI2MGQyOGE2ODk1ZmQ3NTUxZTUxYmFiMTg5ZTY1NTQyYTFhMTE4NzYx
14
+ NDk1YjA4ZjZhMzI3MDUzYmMzOTYyNTFkZDNjNDJhZTRmOWM3YzQ2YTBjOWY4
15
+ YmNlYTNhNTI3MDNkMWE0NGYwYzNjNmNjNWZjMjAyOWRlMTJhOWI=
@@ -83,6 +83,8 @@ function caboose_modal_url(url)
83
83
  });
84
84
  }
85
85
 
86
+ var caboose_modal_close_handler = function(var1){};
87
+
86
88
  function caboose_fix_colorbox() {
87
89
  var color = '#111';
88
90
  if (typeof COLORBOX_COLOR !== 'undefined')
@@ -28,7 +28,9 @@ Attribute.prototype = {
28
28
  minute_increment: 15,
29
29
  hour_increment: 1,
30
30
  show_check_all: true,
31
- show_empty_option: false,
31
+ show_empty_option: false,
32
+ quick_add_url: false,
33
+ quick_add_text: 'Add New',
32
34
 
33
35
  update_url: false,
34
36
  options_url: false,
@@ -59,10 +61,10 @@ Attribute.prototype = {
59
61
  });
60
62
  },
61
63
 
62
- populate_options: function(after) {
64
+ populate_options: function(after, refresh) {
63
65
  if (!this.options_url)
64
66
  return;
65
- if (this.options)
67
+ if (this.options && !refresh)
66
68
  {
67
69
  if (after) after();
68
70
  return;
@@ -65,10 +65,37 @@ BoundSelect = BoundControl.extend({
65
65
  .attr('id', this2.el + '_select')
66
66
  .addClass('mb_fake')
67
67
  .css('width', $('#'+this2.el).outerWidth())
68
- .on('change', function() {
68
+ .on('change', function() {
69
69
  var v = $('#'+this2.el+'_select').val();
70
- $('#'+this2.el).val(v);
71
- this2.save();
70
+ if (this2.attribute.quick_add_url && v == 'quickadd')
71
+ {
72
+ caboose_modal_close_handler = function(new_id) {
73
+ this2.attribute.populate_options(function() {
74
+ var select2 = $('#' + this2.el + '_select');
75
+ select2.empty();
76
+ if (this2.attribute.show_empty_option) select.append($('<option/>').val('').html('-- Empty --'));
77
+ if (this2.attribute.quick_add_url) select.append($('<option/>').val('quickadd').html('-- ' + this2.attribute.quick_add_text + ' --'));
78
+ $.each(this2.attribute.options, function(i, option) {
79
+ var opt = $('<option/>').val(option.value).html(option.text);
80
+ if (option.value == new_id)
81
+ {
82
+ this2.attribute.text = option.text;
83
+ $('#'+this2.el).val(this2.attribute.text);
84
+ opt.attr('selected', 'true');
85
+ }
86
+ select.append(opt);
87
+ });
88
+ $('#'+this2.el).val(new_id);
89
+ this2.save();
90
+ }, true);
91
+ }
92
+ caboose_modal_url(this2.attribute.quick_add_url);
93
+ }
94
+ else
95
+ {
96
+ $('#'+this2.el).val(v);
97
+ this2.save();
98
+ }
72
99
  });
73
100
  // Make sure the existing value is in the list of options
74
101
  var exists = false;
@@ -87,7 +114,9 @@ BoundSelect = BoundControl.extend({
87
114
  });
88
115
  }
89
116
  if (this2.attribute.show_empty_option)
90
- select.append($('<option/>').val('').html('-- Empty --'));
117
+ select.append($('<option/>').val('').html('-- Empty --'));
118
+ if (this2.attribute.quick_add_url)
119
+ select.append($('<option/>').val('quickadd').html('-- ' + this2.attribute.quick_add_text + ' --'));
91
120
  $.each(this2.attribute.options, function(i, option) {
92
121
  var opt = $('<option/>')
93
122
  .val(option.value)
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.6.33'
2
+ VERSION = '0.6.34'
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.6.33
4
+ version: 0.6.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2015-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg