active_scaffold_vho 3.2.11 → 3.2.12

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
- MDdiYjFiZTVjMjhhMjZhN2FkNDQxMjc4M2Q3ZDU0ZjkwZjE5YzczNQ==
4
+ YjliMmVhMmU0ZTExMGRjZjU2YWQ5NDc2MmQyMTgyMTgwZjM4MzZiYg==
5
5
  data.tar.gz: !binary |-
6
- M2FkZWIxMWZmYWYyOTA1MDJlNGVlNTIyODFhZDE3OGIyZmI4ODJhYw==
6
+ NDlmYWRmYTVmN2U3Yjg0NmNiZjg3ZTNiYTRlMmVlMGZlYjM5MjM4Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTlhMTRkOTZhNjlhYTRjNTM3N2QyZjJlZTViODZhOTAyMDVlOTJhMmNkYjMz
10
- MjViNTM3NzFiODdhMjJkNDc3N2EwNmVkZjgwMjFlZTRiODk4NGVhNjc3YWYw
11
- NDRjNDg5YjY2ZWNmNDRmYTFmZmY5NjBkN2QyZDA2MmEzYmJhNGY=
9
+ YTFkZTQ1NTgxOWU4NGI4YmM1YTIxZjAyNDI2ZTUxZDJhYmE2NGEzNTQ4MzM5
10
+ YWEwZDNmZjhkYmRjYjdlZGMxMjQyNmFkM2M5ODEwNTY2NTI5ODg1YTgwMDBi
11
+ NThhNTAwODQzNTIzYjMzZjBhNmY1ODU3ZjE2ZjM2NGZmNDZmOTY=
12
12
  data.tar.gz: !binary |-
13
- Mzg1MjZlMmVlMjk0MmVlMTM1NjU0YmI1NGU5MGRlYTM4YTdmMGExNGZkN2Fl
14
- YzhhNDVkNjM1YTNiNWY0YTkzNmIzMDhjOGQxYzIzYTBhNWFmNDEyYjU4ZDFi
15
- MjBlMzQ4NTkwZTgyMmUwNTc1ZDVlMTQyNjk3ZWMyNGQ4NTNiMDk=
13
+ NzUwMmVjMjU2NjM2NDk4YTAwZTNiMmRkMWMyM2VhZGYxZDU3OTg3N2Y2OWI3
14
+ OTNlNzNkZWMxODE0ZjkyN2ViY2NhM2I3NTVmNjgzNzA2Mzg2Yzk5ODhkOTkz
15
+ MGU0ZDc4MDY1MmZmZmU3OTE5YjkyYjE4NDJkYmExODFjNThjMTY=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_scaffold_vho (3.2.10)
4
+ active_scaffold_vho (3.2.11)
5
5
  kaminari
6
6
  rails (>= 3.1.0)
7
7
 
@@ -100,8 +100,8 @@ $(document).ready(function() {
100
100
  });
101
101
  $(document).on('ajax:before', 'a.as_cancel', function(event) {
102
102
  var as_cancel = $(this);
103
- var action_link = ActiveScaffold.find_action_link(as_cancel);
104
-
103
+ var action_link = ActiveScaffold.find_action_link(as_cancel);
104
+
105
105
  if (action_link) {
106
106
  var cancel_url = as_cancel.attr('href');
107
107
  var refresh_data = as_cancel.attr('data-refresh');
@@ -110,7 +110,7 @@ $(document).ready(function() {
110
110
  as_cancel.attr('href', action_link.refresh_url);
111
111
  if (action_link.position) event.data_type = 'rails';
112
112
  } else if (refresh_data === 'false' || typeof(cancel_url) == 'undefined' || cancel_url.length == 0) {
113
- action_link.close();
113
+ action_link.force_close(true);
114
114
  return false;
115
115
  }
116
116
  }
@@ -324,6 +324,7 @@ $(document).ready(function() {
324
324
  });
325
325
  ActiveScaffold.trigger_load_events($('[data-as_load]'));
326
326
  ActiveScaffold.load_embedded_conrollers();
327
+ ActiveScaffold.keep_open_action_links();
327
328
 
328
329
  });
329
330
 
@@ -958,6 +959,16 @@ var ActiveScaffold = {
958
959
  });
959
960
  },
960
961
 
962
+ keep_open_action_links: function() {
963
+ $.each($('a.as_action[data-keep_open="true"]'), function(index) {
964
+ var action_link = ActiveScaffold.ActionLink.get($(this));
965
+
966
+ if (action_link) {
967
+ action_link.open();
968
+ }
969
+ });
970
+ },
971
+
961
972
  form_elements_changed: function(form_elements){
962
973
  var form_elements_count = form_elements.length;
963
974
  var i = 0;
@@ -1076,17 +1087,28 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
1076
1087
  },
1077
1088
 
1078
1089
  open: function(event) {
1090
+ this.tag.click();
1079
1091
  },
1080
1092
 
1081
1093
  insert: function(content) {
1082
1094
  throw 'unimplemented'
1083
1095
  },
1084
1096
 
1097
+ force_close: function(force_closing) {
1098
+ if(!this.keep_open() || force_closing === true) {
1099
+ this.enable();
1100
+ ActiveScaffold.trigger_unload_events(this.adapter.find('[data-as_load]'));
1101
+ this.adapter.remove();
1102
+ if (this.hide_target) this.target.show();
1103
+ } else {
1104
+ var as_form = $(this.adapter).find("form").first();
1105
+ if (as_form) {
1106
+ ActiveScaffold.reset_form(as_form);
1107
+ }
1108
+ }
1109
+ },
1085
1110
  close: function() {
1086
- this.enable();
1087
- ActiveScaffold.trigger_unload_events(this.adapter.find('[data-as_load]'));
1088
- this.adapter.remove();
1089
- if (this.hide_target) this.target.show();
1111
+ this.force_close(false)
1090
1112
  },
1091
1113
 
1092
1114
  reload: function() {
@@ -1147,6 +1169,9 @@ ActiveScaffold.ActionLink.Abstract = Class.extend({
1147
1169
  }
1148
1170
 
1149
1171
  return '<tr class="inline-adapter" id="' + id_string + '"><td colspan="99" class="inline-adapter-cell"><div class="' + this.action + '-view ' + controller + '-view view"><a class="inline-adapter-close as_cancel" title="' + close_label + '" data-remote="true" data-refresh="' + should_refresh_data + '" href="">' + close_label +'</a>' + content + '</div></td></tr>'
1172
+ },
1173
+ keep_open: function() {
1174
+ return (this.tag.data('keep_open') === true);
1150
1175
  }
1151
1176
  });
1152
1177
 
@@ -152,6 +152,13 @@ module ActiveScaffold::DataStructures
152
152
 
153
153
  # nested action_links are referencing a column
154
154
  attr_accessor :column
155
+
156
+
157
+ # action link is open always, execept another actionlink is open
158
+ attr_writer :keep_open
159
+ def keep_open?
160
+ @keep_open
161
+ end
155
162
 
156
163
  # indicates that this a nested_link
157
164
  def nested_link?
@@ -177,10 +177,15 @@ module ActiveScaffold
177
177
  html_options[:method] = link.method if link.method != :get
178
178
 
179
179
  html_options['data-confirm'] = link.confirm(record.try(:to_label)) if link.confirm?
180
- html_options['data-position'] = link.position if link.position and link.inline?
181
180
  html_options['data-controller'] = link.controller.to_s if link.controller
182
- html_options[:class] += ' as_action' if link.inline?
183
- html_options['data-action'] = link.action if link.inline?
181
+
182
+ if link.inline?
183
+ html_options['data-position'] = link.position if link.position
184
+ html_options[:class] += ' as_action'
185
+ html_options['data-action'] = link.action
186
+ html_options['data-keep_open'] = true if link.keep_open?
187
+ end
188
+
184
189
  if link.popup?
185
190
  html_options['data-popup'] = true
186
191
  html_options[:target] = '_blank'
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- PATCH = 11
5
+ PATCH = 12
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold_vho
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.11
4
+ version: 3.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-01 00:00:00.000000000 Z
11
+ date: 2014-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda