active_scaffold_vho 3.0.18 → 3.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_scaffold_vho}
8
- s.version = "3.0.18"
8
+ s.version = "3.0.19"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Many, see README"]
12
- s.date = %q{2011-03-27}
12
+ s.date = %q{2011-04-18}
13
13
  s.description = %q{Save time and headaches, and create a more easily maintainable set of pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read, update, delete) user interface needs, leaving you more time to focus on more challenging (and interesting!) problems.}
14
14
  s.email = %q{activescaffold@googlegroups.com}
15
15
  s.extra_rdoc_files = [
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
  "frontends/default/images/arrow_down.gif",
30
30
  "frontends/default/images/arrow_up.gif",
31
31
  "frontends/default/images/close.gif",
32
+ "frontends/default/images/close_touch.png",
32
33
  "frontends/default/images/config.png",
33
34
  "frontends/default/images/cross.png",
34
35
  "frontends/default/images/gears.png",
@@ -128,69 +128,7 @@ $(document).ready(function() {
128
128
  return true;
129
129
  });
130
130
  $('span.in_place_editor_field').live('click', function(event) {
131
- var span = $(this);
132
- span.data(); // jquery 1.4.2 workaround
133
- if (typeof(span.data('editInPlace')) === 'undefined') {
134
- var options = {show_buttons: true,
135
- hover_class: 'hover',
136
- element_id: 'editor_id',
137
- ajax_data_type: "script",
138
- update_value: 'value'},
139
- csrf_param = $('meta[name=csrf-param]').first(),
140
- csrf_token = $('meta[name=csrf-token]').first(),
141
- my_parent = span.parent(),
142
- column_heading = null;
143
-
144
- if(!(my_parent.is('td') || my_parent.is('th'))){
145
- my_parent = span.parents('td').eq(0);
146
- }
147
-
148
- if (my_parent.is('td')) {
149
- var column_no = my_parent.prevAll('td').length;
150
- column_heading = my_parent.closest('.active-scaffold').find('th:eq(' + column_no + ')');
151
- } else if (my_parent.is('th')) {
152
- column_heading = my_parent;
153
- }
154
-
155
- var render_url = column_heading.attr('data-ie_render_url'),
156
- mode = column_heading.attr('data-ie_mode'),
157
- record_id = span.attr('data-ie_id');
158
-
159
- ActiveScaffold.read_inplace_edit_heading_attributes(column_heading, options);
160
-
161
- if (span.attr('data-ie_url')) {
162
- options.url = span.attr('data-ie_url').replace(/__id__/, record_id);
163
- } else {
164
- options.url = column_heading.attr('data-ie_url').replace(/__id__/, record_id);
165
- }
166
-
167
- if (csrf_param) options['params'] = csrf_param.attr('content') + '=' + csrf_token.attr('content');
168
-
169
- if (span.closest('div.active-scaffold').attr('data-eid')) {
170
- if (options['params'].length > 0) {
171
- options['params'] += "&";
172
- }
173
- options['params'] += ("eid=" + span.closest('div.active-scaffold').attr('data-eid'));
174
- }
175
-
176
- if (mode === 'clone') {
177
- options.clone_id_suffix = record_id;
178
- options.clone_selector = '#' + column_heading.attr('id') + ' .as_inplace_pattern';
179
- options.field_type = 'clone';
180
- }
181
-
182
- if (render_url) {
183
- var plural = false;
184
- if (column_heading.attr('data-ie_plural')) plural = true;
185
- options.field_type = 'remote';
186
- options.editor_url = render_url.replace(/__id__/, record_id)
187
- }
188
- if (mode === 'inline_checkbox') {
189
- ActiveScaffold.process_checkbox_inplace_edit(span.find('input:checkbox'), options);
190
- } else {
191
- ActiveScaffold.create_inplace_editor(span, options);
192
- }
193
- }
131
+ ActiveScaffold.in_place_editor_field_clicked($(this));
194
132
  });
195
133
  $('a.as_paginate').live('ajax:before',function(event) {
196
134
  var as_paginate = $(this);
@@ -216,10 +154,19 @@ $(document).ready(function() {
216
154
  $('input.update_form, select.update_form').live('change', function(event) {
217
155
  var element = $(this);
218
156
  var as_form = element.closest('form.as_form');
157
+ var params = null;
158
+
159
+ if (element.attr('data-update_send_form')) {
160
+ params = as_form.serialize();
161
+ params += '&' + $.param({source_id: element.attr('id')});
162
+ } else {
163
+ params = {value: element.val()};
164
+ params.source_id = element.attr('id');
165
+ }
166
+
219
167
  $.ajax({
220
168
  url: element.attr('data-update_url'),
221
- data: {value: element.val(),
222
- source_id: element.attr('id')},
169
+ data: params,
223
170
  beforeSend: function(event) {
224
171
  element.nextAll('img.loading-indicator').css('visibility','visible');
225
172
  ActiveScaffold.disable_form(as_form)
@@ -258,10 +205,27 @@ $(document).ready(function() {
258
205
  });
259
206
 
260
207
  $('a[data-popup]').live('click', function(e) {
261
- window.open($(this).attr('href'));
262
- e.preventDefault();
263
- });
264
-
208
+ window.open($(this).attr('href'));
209
+ e.preventDefault();
210
+ });
211
+
212
+ $('.hover_click').live("click", function(event) {
213
+ var element = $(this);
214
+ var ul_element = element.children('ul').first();
215
+ if (ul_element.is(':visible')) {
216
+ element.find('ul').hide();
217
+ } else {
218
+ ul_element.show();
219
+ }
220
+ return false;
221
+ });
222
+ $('.hover_click a.as_action').live('click', function(event) {
223
+ var element = $(this).closest('.hover_click');
224
+ if (element) {
225
+ element.find('ul').hide();
226
+ }
227
+ return true;
228
+ });
265
229
  });
266
230
 
267
231
  /* Simple Inheritance
@@ -731,6 +695,71 @@ var ActiveScaffold = {
731
695
  }
732
696
  mark_all_checkbox.attr('value', ('' + !options.checked));
733
697
  }
698
+ },
699
+
700
+ in_place_editor_field_clicked: function(span) {
701
+ span.data(); // jquery 1.4.2 workaround
702
+ if (typeof(span.data('editInPlace')) === 'undefined') {
703
+ var options = {show_buttons: true,
704
+ hover_class: 'hover',
705
+ element_id: 'editor_id',
706
+ ajax_data_type: "script",
707
+ update_value: 'value'},
708
+ csrf_param = $('meta[name=csrf-param]').first(),
709
+ csrf_token = $('meta[name=csrf-token]').first(),
710
+ my_parent = span.parent(),
711
+ column_heading = null;
712
+
713
+ if(!(my_parent.is('td') || my_parent.is('th'))){
714
+ my_parent = span.parents('td').eq(0);
715
+ }
716
+
717
+ if (my_parent.is('td')) {
718
+ var column_no = my_parent.prevAll('td').length;
719
+ column_heading = my_parent.closest('.active-scaffold').find('th:eq(' + column_no + ')');
720
+ } else if (my_parent.is('th')) {
721
+ column_heading = my_parent;
722
+ }
723
+
724
+ var render_url = column_heading.attr('data-ie_render_url'),
725
+ mode = column_heading.attr('data-ie_mode'),
726
+ record_id = span.attr('data-ie_id');
727
+
728
+ ActiveScaffold.read_inplace_edit_heading_attributes(column_heading, options);
729
+
730
+ if (span.attr('data-ie_url')) {
731
+ options.url = span.attr('data-ie_url').replace(/__id__/, record_id);
732
+ } else {
733
+ options.url = column_heading.attr('data-ie_url').replace(/__id__/, record_id);
734
+ }
735
+
736
+ if (csrf_param) options['params'] = csrf_param.attr('content') + '=' + csrf_token.attr('content');
737
+
738
+ if (span.closest('div.active-scaffold').attr('data-eid')) {
739
+ if (options['params'].length > 0) {
740
+ options['params'] += "&";
741
+ }
742
+ options['params'] += ("eid=" + span.closest('div.active-scaffold').attr('data-eid'));
743
+ }
744
+
745
+ if (mode === 'clone') {
746
+ options.clone_id_suffix = record_id;
747
+ options.clone_selector = '#' + column_heading.attr('id') + ' .as_inplace_pattern';
748
+ options.field_type = 'clone';
749
+ }
750
+
751
+ if (render_url) {
752
+ var plural = false;
753
+ if (column_heading.attr('data-ie_plural')) plural = true;
754
+ options.field_type = 'remote';
755
+ options.editor_url = render_url.replace(/__id__/, record_id)
756
+ }
757
+ if (mode === 'inline_checkbox') {
758
+ ActiveScaffold.process_checkbox_inplace_edit(span.find('input:checkbox'), options);
759
+ } else {
760
+ ActiveScaffold.create_inplace_editor(span, options);
761
+ }
762
+ }
734
763
  }
735
764
  }
736
765
 
@@ -239,10 +239,18 @@ document.observe("dom:loaded", function() {
239
239
  document.on('change', 'input.update_form, select.update_form', function(event) {
240
240
  var element = event.findElement();
241
241
  var as_form = element.up('form.as_form');
242
-
242
+ var params = null;
243
+
244
+ if (element.hasAttribute('data-update_send_form')) {
245
+ params = as_form.serialize(true);
246
+ } else {
247
+ params = {value: element.getValue()};
248
+ }
249
+ params.source_id = element.readAttribute('id');
250
+
243
251
  new Ajax.Request(element.readAttribute('data-update_url'), {
244
252
  method: 'get',
245
- parameters: {value: element.getValue(), source_id: element.readAttribute('id')},
253
+ parameters: params,
246
254
  onLoading: function(response) {
247
255
  element.next('img.loading-indicator').style.visibility = 'visible';
248
256
  as_form.disable();
@@ -280,10 +288,27 @@ document.observe("dom:loaded", function() {
280
288
  return true;
281
289
  });
282
290
  document.on("click", "a[data-popup]", function(event, element) {
283
- if (event.stopped) return;
284
- window.open($(element).href);
285
- event.stop();
286
- });
291
+ if (event.stopped) return;
292
+ window.open($(element).href);
293
+ event.stop();
294
+ });
295
+ document.on("click", ".hover_click", function(event, element) {
296
+ var ul_element = element.down('ul');
297
+ if (ul_element.getStyle('display') === 'none') {
298
+ ul_element.style.display = 'block';
299
+ } else {
300
+ ul_element.style.display = 'none';
301
+ }
302
+
303
+ return true;
304
+ });
305
+ document.on("click", ".hover_click a.as_action", function(event, element) {
306
+ var element = element.up('.hover_click').down('ul');
307
+ if (element) {
308
+ element.style.display = 'none';
309
+ }
310
+ return true;
311
+ });
287
312
  });
288
313
 
289
314
 
@@ -53,18 +53,6 @@ window.dhtmlHistory = {
53
53
 
54
54
  var that = this;
55
55
 
56
- /*Set up the historyStorage object; pass in options bundle*/
57
- window.historyStorage.setup(options);
58
-
59
- /*Set up our base title if one is passed in*/
60
- if (options && options.baseTitle) {
61
- if (options.baseTitle.indexOf("@@@") < 0 && historyStorage.debugMode) {
62
- throw new Error("Programmer error: options.baseTitle must contain the replacement parameter"
63
- + " '@@@' to be useful.");
64
- }
65
- this.baseTitle = options.baseTitle;
66
- }
67
-
68
56
  /*set user-agent flags*/
69
57
  var UA = navigator.userAgent.toLowerCase();
70
58
  var platform = navigator.platform.toLowerCase();
@@ -80,77 +68,92 @@ window.dhtmlHistory = {
80
68
  this.isSupported = true;
81
69
  } else if (vendor.indexOf("Apple Computer, Inc.") > -1) {
82
70
  this.isSafari = true;
83
- this.isSupported = (platform.indexOf("mac") > -1);
71
+ //this.isSupported = (platform.indexOf("mac") > -1);
72
+ this.isSupported = false;
84
73
  } else if (UA.indexOf("gecko") != -1) {
85
74
  this.isGecko = true;
86
75
  this.isSupported = true;
87
76
  }
88
77
 
89
- /*Create Safari/Opera-specific code*/
90
- if (this.isSafari) {
91
- this.createSafari();
92
- } else if (this.isOpera) {
93
- this.createOpera();
94
- }
95
-
96
- /*Get our initial location*/
97
- var initialHash = this.getCurrentLocation();
98
-
99
- /*Save it as our current location*/
100
- this.currentLocation = initialHash;
101
-
102
- /*Now that we have a hash, create IE-specific code*/
103
- if (this.isIE) {
104
- /*Optionally override the URL of IE's blank HTML file*/
105
- if (options && options.blankURL) {
106
- var u = options.blankURL;
107
- /*assign the value, adding the trailing ? if it's not passed in*/
108
- this.blankURL = (u.indexOf("?") != u.length - 1
109
- ? u + "?"
110
- : u
111
- );
112
- }
113
- this.createIE(initialHash);
114
- }
115
-
116
- /*Add an unload listener for the page; this is needed for FF 1.5+ because this browser caches all dynamic updates to the
117
- page, which can break some of our logic related to testing whether this is the first instance a page has loaded or whether
118
- it is being pulled from the cache*/
119
-
120
- var unloadHandler = function() {
121
- that.firstLoad = null;
122
- };
123
-
124
- this.addEventListener(window,'unload',unloadHandler);
125
-
126
- /*Determine if this is our first page load; for IE, we do this in this.iframeLoaded(), which is fired on pageload. We do it
127
- there because we have no historyStorage at this point, which only exists after the page is finished loading in IE*/
128
- if (this.isIE) {
129
- /*The iframe will get loaded on page load, and we want to ignore this fact*/
130
- this.ignoreLocationChange = true;
131
- } else {
132
- if (!historyStorage.hasKey(this.PAGELOADEDSTRING)) {
133
- /*This is our first page load, so ignore the location change and add our special history entry*/
134
- this.ignoreLocationChange = true;
135
- this.firstLoad = true;
136
- historyStorage.put(this.PAGELOADEDSTRING, true);
137
- } else {
138
- /*This isn't our first page load, so indicate that we want to pay attention to this location change*/
139
- this.ignoreLocationChange = false;
140
- this.firstLoad = false;
141
- /*For browsers other than IE, fire a history change event; on IE, the event will be thrown automatically when its
142
- hidden iframe reloads on page load. Unfortunately, we don't have any listeners yet; indicate that we want to fire
143
- an event when a listener is added.*/
144
- this.fireOnNewListener = true;
145
- }
78
+ if (this.isSupported) {
79
+ /*Set up the historyStorage object; pass in options bundle*/
80
+ window.historyStorage.setup(options);
81
+
82
+ /*Set up our base title if one is passed in*/
83
+ if (options && options.baseTitle) {
84
+ if (options.baseTitle.indexOf("@@@") < 0 && historyStorage.debugMode) {
85
+ throw new Error("Programmer error: options.baseTitle must contain the replacement parameter"
86
+ + " '@@@' to be useful.");
87
+ }
88
+ this.baseTitle = options.baseTitle;
89
+ }
90
+
91
+ /*Create Safari/Opera-specific code*/
92
+ if (this.isSafari && this.isSupported) {
93
+ this.createSafari();
94
+ } else if (this.isOpera) {
95
+ this.createOpera();
96
+ }
97
+
98
+ /*Get our initial location*/
99
+ var initialHash = this.getCurrentLocation();
100
+
101
+ /*Save it as our current location*/
102
+ this.currentLocation = initialHash;
103
+
104
+ /*Now that we have a hash, create IE-specific code*/
105
+ if (this.isIE) {
106
+ /*Optionally override the URL of IE's blank HTML file*/
107
+ if (options && options.blankURL) {
108
+ var u = options.blankURL;
109
+ /*assign the value, adding the trailing ? if it's not passed in*/
110
+ this.blankURL = (u.indexOf("?") != u.length - 1
111
+ ? u + "?"
112
+ : u
113
+ );
114
+ }
115
+ this.createIE(initialHash);
116
+ }
117
+
118
+ /*Add an unload listener for the page; this is needed for FF 1.5+ because this browser caches all dynamic updates to the
119
+ page, which can break some of our logic related to testing whether this is the first instance a page has loaded or whether
120
+ it is being pulled from the cache*/
121
+
122
+ var unloadHandler = function() {
123
+ that.firstLoad = null;
124
+ };
125
+
126
+ this.addEventListener(window,'unload',unloadHandler);
127
+
128
+ /*Determine if this is our first page load; for IE, we do this in this.iframeLoaded(), which is fired on pageload. We do it
129
+ there because we have no historyStorage at this point, which only exists after the page is finished loading in IE*/
130
+ if (this.isIE) {
131
+ /*The iframe will get loaded on page load, and we want to ignore this fact*/
132
+ this.ignoreLocationChange = true;
133
+ } else if (this.isSupported) {
134
+ if (!historyStorage.hasKey(this.PAGELOADEDSTRING)) {
135
+ /*This is our first page load, so ignore the location change and add our special history entry*/
136
+ this.ignoreLocationChange = true;
137
+ this.firstLoad = true;
138
+ historyStorage.put(this.PAGELOADEDSTRING, true);
139
+ } else {
140
+ /*This isn't our first page load, so indicate that we want to pay attention to this location change*/
141
+ this.ignoreLocationChange = false;
142
+ this.firstLoad = false;
143
+ /*For browsers other than IE, fire a history change event; on IE, the event will be thrown automatically when its
144
+ hidden iframe reloads on page load. Unfortunately, we don't have any listeners yet; indicate that we want to fire
145
+ an event when a listener is added.*/
146
+ this.fireOnNewListener = true;
147
+ }
148
+ }
149
+
150
+ /*Other browsers can use a location handler that checks at regular intervals as their primary mechanism; we use it for IE as
151
+ well to handle an important edge case; see checkLocation() for details*/
152
+ var locationHandler = function() {
153
+ that.checkLocation();
154
+ };
155
+ setInterval(locationHandler, 100);
146
156
  }
147
-
148
- /*Other browsers can use a location handler that checks at regular intervals as their primary mechanism; we use it for IE as
149
- well to handle an important edge case; see checkLocation() for details*/
150
- var locationHandler = function() {
151
- that.checkLocation();
152
- };
153
- setInterval(locationHandler, 100);
154
157
  },
155
158
 
156
159
  /*Public: Initialize our DHTML history. You must call this after the page is finished loading. Optionally, you can pass your listener in
@@ -99,6 +99,15 @@ background-position: 1px 50%;
99
99
  background-repeat: no-repeat;
100
100
  }
101
101
 
102
+ .active-scaffold-header div.actions a {
103
+ padding: 5px 5px;
104
+ margin-left: 0px;
105
+ }
106
+
107
+ .active-scaffold .active-scaffold .active-scaffold-header div.actions > a {
108
+ padding: 1px 5px;
109
+ }
110
+
102
111
  .active-scaffold-header div.actions div.action_group {
103
112
  display: inline;
104
113
  float: right;
@@ -112,6 +121,10 @@ margin: 0;
112
121
 
113
122
  .active-scaffold-header div.actions .action_group ul {
114
123
  line-height: 130%;
124
+ top: 19px;
125
+ }
126
+
127
+ .active-scaffold .active-scaffold .active-scaffold-header div.actions .action_group ul {
115
128
  top: 14px;
116
129
  }
117
130
 
@@ -141,6 +154,17 @@ opacity: 0.5;
141
154
  .active-scaffold-header div.actions a.show_config_list,
142
155
  .active-scaffold-header div.actions div.action_group div {
143
156
  margin:0;
157
+ padding: 5px 5px 5px 25px;
158
+ background-position: 5px 50%;
159
+ background-repeat: no-repeat;
160
+ }
161
+
162
+ .active-scaffold .active-scaffold .active-scaffold-header div.actions > a.new,
163
+ .active-scaffold .active-scaffold .active-scaffold-header div.actions > a.new_existing,
164
+ .active-scaffold .active-scaffold .active-scaffold-header div.actions > a.show_search,
165
+ .active-scaffold .active-scaffold .active-scaffold-header div.actions > a.show_config_list,
166
+ .active-scaffold .active-scaffold .active-scaffold-header div.actions div.action_group > div {
167
+ margin:0;
144
168
  padding: 1px 5px 1px 20px;
145
169
  background-position: 1px 50%;
146
170
  background-repeat: no-repeat;
@@ -971,3 +995,82 @@ font-size: 100%;
971
995
  .active-scaffold-found {
972
996
  float:left;
973
997
  }
998
+
999
+ .as_touch a.inline-adapter-close {
1000
+ width: 32px;
1001
+ height: 34px;
1002
+ background: url(../../../images/active_scaffold/default/close_touch.png) 0 0 no-repeat;
1003
+ }
1004
+
1005
+ .as_touch .as_paginate {
1006
+ font-size: 20px;
1007
+ padding: 3px 10px;
1008
+ }
1009
+
1010
+ .as_touch .active-scaffold-header div.actions a {
1011
+ padding: 7px 5px;
1012
+ }
1013
+
1014
+ .as_touch .active-scaffold .active-scaffold-header div.actions a {
1015
+ padding: 7px 5px;
1016
+ }
1017
+
1018
+ .as_touch .active-scaffold-header div.actions .action_group ul {
1019
+ line-height: 130%;
1020
+ top: 23px;
1021
+ }
1022
+
1023
+ .as_touch .active-scaffold .active-scaffold-header div.actions .action_group ul {
1024
+ top: 23px;
1025
+ }
1026
+
1027
+ .as_touch .active-scaffold-header div.actions a.new,
1028
+ .as_touch .active-scaffold-header div.actions a.new_existing,
1029
+ .as_touch .active-scaffold-header div.actions a.show_search,
1030
+ .as_touch .active-scaffold-header div.actions a.show_config_list,
1031
+ .as_touch .active-scaffold-header div.actions div.action_group div {
1032
+ padding: 7px 5px 7px 25px;
1033
+ }
1034
+
1035
+ .as_touch .active-scaffold .active-scaffold-header div.actions > a.new,
1036
+ .as_touch .active-scaffold .active-scaffold-header div.actions > a.new_existing,
1037
+ .as_touch .active-scaffold .active-scaffold-header div.actions > a.show_search,
1038
+ .as_touch .active-scaffold .active-scaffold-header div.actions > a.show_config_list,
1039
+ .as_touch .active-scaffold .active-scaffold-header div.actions div.action_group > div {
1040
+ padding: 7px 5px 7px 25px;
1041
+ background-position: 5px 50%;
1042
+ }
1043
+
1044
+ .as_touch .actions .action_group ul li div {
1045
+ padding: 7px 5px 7px 25px;
1046
+ }
1047
+
1048
+ .as_touch .actions .action_group ul li a {
1049
+ padding: 7px 5px 7px 25px;
1050
+ }
1051
+
1052
+ .as_touch .active-scaffold-header h2 {
1053
+ padding: 4px 0px;
1054
+ }
1055
+
1056
+ .as_touch .active-scaffold .active-scaffold-header div.actions a,
1057
+ .as_touch .active-scaffold .active-scaffold-header div.actions div {
1058
+ font: bold 14px arial;
1059
+ }
1060
+
1061
+ .as_touch .active-scaffold .active-scaffold-header div.actions {
1062
+ right: 15px;
1063
+ }
1064
+
1065
+ .as_touch tr.record {
1066
+ line-height: 130%;
1067
+ }
1068
+
1069
+ .as_touch th a, .as_touch th a:visited {
1070
+ color: #fff;
1071
+ padding: 5px 2px 5px 5px;
1072
+ }
1073
+
1074
+ .as_touch tr.record td {
1075
+ padding: 5px 10px;
1076
+ }
@@ -5,10 +5,14 @@
5
5
  <% if (options[:node] == :finished_traversing) -%>
6
6
  <%= "</ul>#{(options[:level] == 0 ? "</div>#{end_level_0_tag}": '</li>')}".html_safe %>
7
7
  <% elsif (options[:node] == :start_traversing) -%>
8
+ <% html_classes = []
9
+ html_classes << 'hover_click' if hover_via_click? %>
8
10
  <% if options[:level] == 0 %>
9
- <%= "#{start_level_0_tag}<div class=\"action_group\"> #{content_tag(:div, as_(parent.name), :class => (parent.name.to_s).downcase)}<ul>".html_safe %>
11
+ <% html_classes << 'action_group' %>
12
+ <%= "#{start_level_0_tag}<div class=\"#{html_classes.join(' ')}\" #{"onclick=\"\"" if hover_via_click?}> #{content_tag(:div, as_(parent.name), :class => (parent.name.to_s).downcase)}<ul>".html_safe %>
10
13
  <% else %>
11
- <%= "<li #{"class=\"top\"" if options[:first_action]}>#{content_tag(:div, as_(parent.name), :class => (parent.name.to_s).downcase)}<ul>".html_safe %>
14
+ <% html_classes << 'top' if options[:first_action] %>
15
+ <%= "<li #{"class=\"#{html_classes.join(' ')}\"" unless html_classes.empty?} #{"onclick=\"\"" if hover_via_click?}>#{content_tag(:div, as_(parent.name), :class => (parent.name.to_s).downcase)}<ul>".html_safe %>
12
16
  <% end %>
13
17
  <% else -%>
14
18
  <% if options[:level] == 0 %>
@@ -1,4 +1,4 @@
1
- <div id="<%= active_scaffold_id -%>" class="active-scaffold active-scaffold-<%= controller_id %> <%= "#{params[:controller]}-view" %> <%= active_scaffold_config.theme %>-theme" <%= "data-eid=#{id_from_controller(params[:eid])}" if params[:eid]%>>
1
+ <div id="<%= active_scaffold_id -%>" class="<%= as_main_div_class %>" <%= "data-eid=#{id_from_controller(params[:eid])}" if params[:eid]%>>
2
2
  <div class="active-scaffold-header">
3
3
  <%= render :partial => 'list_header' %>
4
4
  </div>
@@ -1,6 +1,6 @@
1
1
  column_span_id ||= element_cell_id(:id => @record.id.to_s, :action => 'update_column', :name => params[:column])
2
2
  unless controller.send :successful?
3
- page.call 'alert', @record.errors.full_messages(active_scaffold_config).join("\n")
3
+ page.call 'alert', @record.errors.full_messages.join("\n")
4
4
  @record.reload
5
5
  end
6
6
  column = active_scaffold_config.columns[params[:column]]
@@ -32,8 +32,12 @@ module ActiveScaffold::Actions
32
32
  @record = new_model
33
33
  column = active_scaffold_config.columns[params[:column]]
34
34
  unless column.nil?
35
- value = column_value_from_param_value(@record, column, params[:value])
36
- @record.send "#{column.name}=", value
35
+ if column.send_form_on_update_column
36
+ @record = update_record_from_params(@record, active_scaffold_config.update.columns, params[:record])
37
+ else
38
+ value = column_value_from_param_value(@record, column, params[:value])
39
+ @record.send "#{column.name}=", value
40
+ end
37
41
  after_render_field(@record, column)
38
42
  source_id = params.delete(:source_id)
39
43
  render :partial => "render_field", :collection => Array(params[:update_columns]), :content_type => 'text/javascript', :locals => {:source_id => source_id}
@@ -62,6 +62,10 @@ module ActiveScaffold::DataStructures
62
62
  @update_columns = Array(column_names)
63
63
  end
64
64
 
65
+ # send all the form instead of only new value when this column change
66
+ cattr_accessor :send_form_on_update_column
67
+ attr_accessor :send_form_on_update_column
68
+
65
69
  # sorting on a column can be configured four ways:
66
70
  # sort = true default, uses intelligent sorting sql default
67
71
  # sort = false sometimes sorting doesn't make sense
@@ -5,8 +5,9 @@ module ActionController #:nodoc:
5
5
  if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil?
6
6
  @rendering_adapter = true # recursion control
7
7
  # if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
8
+ opts = args.blank? ? Hash.new : args.first
8
9
  render :partial => params[:adapter][1..-1],
9
- :locals => {:payload => render_to_string(args.first.merge(:layout => false), &block)},
10
+ :locals => {:payload => render_to_string(opts.merge(:layout => false), &block)},
10
11
  :use_full_path => true, :layout => false
11
12
  @rendering_adapter = nil # recursion control
12
13
  else
@@ -18,3 +19,4 @@ module ActionController #:nodoc:
18
19
  # Rails 2.x implementation is post-initialization on :active_scaffold method
19
20
  end
20
21
  end
22
+
@@ -86,6 +86,7 @@ module ActiveScaffold
86
86
 
87
87
  options[:class] = "#{options[:class]} update_form".strip
88
88
  options['data-update_url'] = url_for(url_params)
89
+ options['data-update_send_form'] = true if column.send_form_on_update_column
89
90
  end
90
91
  options
91
92
  end
@@ -316,7 +316,7 @@ module ActiveScaffold
316
316
  all_marked = (marked_records.length >= @page.pager.count)
317
317
  tag_options = {:id => "#{controller_id}_mark_heading", :class => "mark_heading in_place_editor_field"}
318
318
  tag_options['data-ie_url'] = url_for({:controller => params_for[:controller], :action => 'mark_all', :eid => params[:eid]})
319
- content_tag(:span, check_box_tag(nil, !all_marked, all_marked), tag_options)
319
+ content_tag(:span, check_box_tag("#{controller_id}_mark_heading_span_input", !all_marked, all_marked), tag_options)
320
320
  end
321
321
 
322
322
  def render_column_heading(column, sorting, sort_direction)
@@ -132,10 +132,16 @@ module ActiveScaffold
132
132
 
133
133
  def active_scaffold_search_range(column, options)
134
134
  opt_value, from_value, to_value = field_search_params_range_values(column)
135
-
136
- select_options = active_scaffold_search_range_comparator_options(column)
137
- text_field_size = ((column.column && column.column.text?) ? 15 : 10)
138
135
 
136
+ select_options = active_scaffold_search_range_comparator_options(column)
137
+ if column.column && column.column.text?
138
+ text_field_size = 15
139
+ opt_value ||= '%?%'
140
+ else
141
+ text_field_size = 10
142
+ opt_value ||= '='
143
+ end
144
+
139
145
  from_value = controller.class.condition_value_for_numeric(column, from_value)
140
146
  to_value = controller.class.condition_value_for_numeric(column, to_value)
141
147
  from_value = format_number_value(from_value, column.options) if from_value.is_a?(Numeric)
@@ -190,10 +190,11 @@ module ActiveScaffold
190
190
  id = url_options[:id] || url_options[:parent_id]
191
191
  id = "#{column.association.name}-#{record.id}" if column && column.plural_association?
192
192
  if record.try(column.association.name.to_sym).present?
193
- id = "#{column.association.name}-#{record.send(column.association.name).id}"
193
+ id = "#{column.association.name}-#{record.send(column.association.name).id}-#{record.id}"
194
194
  else
195
195
  id = "#{column.association.name}-#{record.id}" unless record.nil?
196
196
  end if column && column.singular_association?
197
+ id = "#{id}-#{url_options[:batch_scope].downcase}" if url_options[:batch_scope]
197
198
  action_id = "#{id_from_controller(url_options[:controller]) + '-' if url_options[:parent_controller]}#{url_options[:action].to_s}"
198
199
  action_link_id(action_id, id)
199
200
  end
@@ -258,6 +259,12 @@ module ActiveScaffold
258
259
  classes.join(' ')
259
260
  end
260
261
 
262
+ def as_main_div_class
263
+ classes = ["active-scaffold", "active-scaffold-#{controller_id}", "#{params[:controller]}-view", "#{active_scaffold_config.theme}-theme"]
264
+ classes << "as_touch" if touch_device?
265
+ classes.join(' ')
266
+ end
267
+
261
268
  def column_empty?(column_value)
262
269
  empty = column_value.nil?
263
270
  empty ||= column_value.empty? if column_value.respond_to? :empty?
@@ -30,7 +30,7 @@
30
30
  :hide => 'Verstecken',
31
31
  :live_search => 'Live-Suche',
32
32
  :loading => 'Lade…',
33
- :next => 'Vorwärts',
33
+ :next => 'Vor',
34
34
  :no_entries => 'Keine Einträge',
35
35
  :no_options => 'Keine Optionen',
36
36
  :omit_header => 'Lasse Header weg',
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- PATCH = 18
5
+ PATCH = 19
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -66,7 +66,11 @@ module ActiveScaffold
66
66
  base.module_eval do
67
67
  # TODO: these should be in actions/core
68
68
  before_filter :handle_user_settings
69
+ before_filter :check_input_device
69
70
  end
71
+
72
+ base.helper_method :touch_device?
73
+ base.helper_method :hover_via_click?
70
74
  end
71
75
 
72
76
  def self.set_defaults(&block)
@@ -98,6 +102,24 @@ module ActiveScaffold
98
102
  end
99
103
  end
100
104
  end
105
+
106
+ def check_input_device
107
+ if request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPhone|iPod|iPad)/i]
108
+ session[:input_device_type] = 'TOUCH'
109
+ session[:hover_supported] = false
110
+ else
111
+ session[:input_device_type] = 'MOUSE'
112
+ session[:hover_supported] = true
113
+ end if session[:input_device_type].nil?
114
+ end
115
+
116
+ def touch_device?
117
+ session[:input_device_type] == 'TOUCH'
118
+ end
119
+
120
+ def hover_via_click?
121
+ session[:hover_supported] == false
122
+ end
101
123
 
102
124
  def self.js_framework=(framework)
103
125
  @@js_framework = framework
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold_vho
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 33
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 18
10
- version: 3.0.18
9
+ - 19
10
+ version: 3.0.19
11
11
  platform: ruby
12
12
  authors:
13
13
  - Many, see README
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-27 00:00:00 +01:00
18
+ date: 2011-04-18 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -144,6 +144,7 @@ files:
144
144
  - frontends/default/images/arrow_down.gif
145
145
  - frontends/default/images/arrow_up.gif
146
146
  - frontends/default/images/close.gif
147
+ - frontends/default/images/close_touch.png
147
148
  - frontends/default/images/config.png
148
149
  - frontends/default/images/cross.png
149
150
  - frontends/default/images/gears.png