scrivito_advanced_editors 1.0.0.rc1 → 1.2.0

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: 8d67ccd96d0f92203bc801001fbe9abda97740fd
4
- data.tar.gz: 819ac1a7bcc835d3fb81f3668ce64c7cdc7d32e7
3
+ metadata.gz: aa7284e9cfcaf9ed385cfa8ed52ed8e64ce85e51
4
+ data.tar.gz: faae731d850059b8a61056a6124accd33ccbd681
5
5
  SHA512:
6
- metadata.gz: e930f550a7d91f161a60e0766a80b6310736698568f00ab6f8e0dc5348dc75c86670edf5c9448e9ee73090dadd01fa197ec99a4da0c6adfa4ee5322c256c2905
7
- data.tar.gz: 2dc9bffc5a11adfdf58aa1b2ee8696289c649a90cb1394d01df740022ef7421632a2fd706e74a80d447c7c76a65b0a23c2af8fe3d79e4ff32308d207a22edf18
6
+ metadata.gz: 8b79e44f86ba6cdaa7f608257742fed730d7953c84d5db2db846eecd7e8f03eb00bde3582c0654fba34ce8de9f947024e61bda8d16ae76318dec33eccf0f1191
7
+ data.tar.gz: 08747c35827c08143ffd0dde72aa5a22906114aa93603d1c78e84e8fe4376efb28049fb82ff72692376a22e05e579d4d9524bf058584a87c244d28e36f594d4d
@@ -0,0 +1,48 @@
1
+ (function($, App) {
2
+ 'use strict';
3
+
4
+ var activate;
5
+
6
+ scrivito.on('content', function() {
7
+ var l, b, id;
8
+
9
+ $(document).on('click', '[data-tab-to-toggle] li', function(event) {
10
+ activate(event.currentTarget);
11
+ });
12
+
13
+ // initial activate listelems
14
+ $.each($('.tab-list'), function(index, elem) {
15
+ id = '#'+$(elem).attr('id')
16
+ b = $('[data-tab-to-toggle="'+id+'"]');
17
+ activate(b);
18
+ });
19
+ });
20
+
21
+ activate = function(button) {
22
+ var value = $(button).data('scrivito-toggle-value') || button.text();
23
+ var list = $(button).parents('[data-tab-to-toggle]')[0] || button;
24
+ var selector = $(list).data('tab-to-toggle');
25
+ var tab = $(selector);
26
+ var panel, allowedValues;
27
+
28
+ $(tab).find('.active').removeClass('active');
29
+
30
+ $.each(tab.find('li'), function(index, elem) {
31
+ panel = $(elem).data('panel-target');
32
+ $(panel).removeClass('active');
33
+ allowedValues = $(elem).data('allowed-values');
34
+
35
+ if(allowedValues == undefined || $.inArray(value, allowedValues) > -1) {
36
+ if($(button).hasClass('scrivito_enum_active')) {
37
+ $(elem).removeClass('inactive');
38
+ }
39
+ } else {
40
+ $(elem).addClass('inactive');
41
+ }
42
+ });
43
+
44
+ $($(tab).find('li').not('.inactive')[0]).addClass('active');
45
+ $($($(tab).find('li').not('.inactive')[0]).data('panel-target')).addClass('active');
46
+ }
47
+
48
+ })(jQuery, this);
@@ -35,7 +35,7 @@
35
35
  validValue = validValues[i];
36
36
  caption = (captions && captions[validValue]) ? captions[validValue] : validValue;
37
37
  li = $('<li></li>');
38
- li.text(caption);
38
+ li.html(caption);
39
39
  li.data('scrivito-select-value', validValue);
40
40
  if (indexOf.call(values, validValue) >= 0) {
41
41
  li.addClass('scrivito_enum_active');
@@ -15,7 +15,7 @@
15
15
  };
16
16
 
17
17
  scrivito.on('load', function() {
18
- return scrivito.define_editor('enum', scrivito.editors.enum_editor);
18
+ return scrivito.define_editor('toggle_button_editor', scrivito.editors.enum_editor);
19
19
  });
20
20
 
21
21
  activate = function(cmsField) {
@@ -23,7 +23,7 @@
23
23
  var captions = cmsField.data('toggle-button-caption');
24
24
  cmsField.html(renderTemplate(cmsField.scrivito('content'), validValues, captions));
25
25
  return cmsField.find('.scrivito_enum_editor li').on('click', function() {
26
- return handleClick(cmsField, $(this));
26
+ handleClick(cmsField, $(this));
27
27
  });
28
28
  };
29
29
 
@@ -35,7 +35,7 @@
35
35
  validValue = validValues[i];
36
36
  caption = (captions && captions[validValue]) ? captions[validValue] : validValue;
37
37
  li = $('<li></li>');
38
- li.text(caption);
38
+ li.html(caption);
39
39
  li.data('scrivito-toggle-value', validValue);
40
40
  if (validValue === value) {
41
41
  li.addClass('scrivito_enum_active');
@@ -47,14 +47,15 @@
47
47
 
48
48
  handleClick = function(cmsField, clickedItem) {
49
49
  if (clickedItem.hasClass('scrivito_enum_active')) {
50
- clickedItem.removeClass('scrivito_enum_active');
51
- save(cmsField, null);
50
+ if(!cmsField.is('[data-scrivito-toggle-button-enable=false]')) {
51
+ clickedItem.removeClass('scrivito_enum_active');
52
+ save(cmsField, null);
53
+ }
52
54
  } else {
53
55
  cmsField.find('li').removeClass('scrivito_enum_active');
54
56
  clickedItem.addClass('scrivito_enum_active');
55
57
  save(cmsField, clickedItem.data('scrivito-toggle-value'));
56
58
  }
57
- return false;
58
59
  };
59
60
 
60
61
  save = function(cmsField, value) {
@@ -19,6 +19,12 @@
19
19
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
20
20
  }
21
21
 
22
+ .tab-list li[data-panel-target].inactive:hover {
23
+ box-shadow: none;
24
+ background: transparent;
25
+ cursor: auto;
26
+ }
27
+
22
28
  .tab-list li[data-panel-target].active {
23
29
  background-color: #fff;
24
30
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
@@ -1,3 +1,3 @@
1
1
  module ScrivitoAdvancedEditors
2
- VERSION = "1.0.0.rc1"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_advanced_editors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - LICENSE
77
77
  - Rakefile
78
+ - app/assets/javascripts/scripts/button_activate.js
78
79
  - app/assets/javascripts/scripts/color_picker.js
79
80
  - app/assets/javascripts/scripts/create_obj.js
80
81
  - app/assets/javascripts/scripts/details_accordion.js
@@ -111,9 +112,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
112
  version: '0'
112
113
  required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  requirements:
114
- - - ">"
115
+ - - ">="
115
116
  - !ruby/object:Gem::Version
116
- version: 1.3.1
117
+ version: '0'
117
118
  requirements: []
118
119
  rubyforge_project:
119
120
  rubygems_version: 2.4.5