active_scaffold 3.2.3 → 3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +11 -0
- data/app/assets/javascripts/jquery/jquery.editinplace.js +30 -30
- data/frontends/default/views/_form.html.erb +1 -1
- data/lib/active_scaffold/actions/update.rb +7 -1
- data/lib/active_scaffold/data_structures/sorting.rb +1 -2
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +1 -1
- data/lib/active_scaffold/helpers/controller_helpers.rb +2 -2
- data/lib/active_scaffold/helpers/view_helpers.rb +3 -0
- data/lib/active_scaffold/version.rb +1 -1
- metadata +21 -21
data/CHANGELOG
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
= 3.2.4
|
2
|
+
- don't break on custom SQL sorting (e.g. sorting with functions)
|
3
|
+
- fix cancel inplace edit with jquery
|
4
|
+
- fix nested scaffolds inside nested and embedded scaffolds
|
5
|
+
- fix collapsed subgroups
|
6
|
+
- fix inplace edit for checkboxes columns with true as default value
|
7
|
+
- fix calendar date select bridge
|
8
|
+
|
9
|
+
= 3.0.6 .. 3.2.3
|
10
|
+
- many changes
|
11
|
+
|
1
12
|
= 3.0.5
|
2
13
|
|
3
14
|
- switch from explicit requires to autoloading
|
@@ -11,7 +11,7 @@ Authors:
|
|
11
11
|
Project home:
|
12
12
|
http://code.google.com/p/jquery-in-place-editor/
|
13
13
|
|
14
|
-
Patches with tests welcomed! For guidance see the tests
|
14
|
+
Patches with tests welcomed! For guidance see the tests </spec/unit/>. To submit, attach them to the bug tracker.
|
15
15
|
|
16
16
|
License:
|
17
17
|
This source file is subject to the BSD license bundled with this package.
|
@@ -19,6 +19,7 @@ Available online: {@link http://www.opensource.org/licenses/bsd-license.php}
|
|
19
19
|
If you did not receive a copy of the license, and are unable to obtain it,
|
20
20
|
learn to use a search engine.
|
21
21
|
|
22
|
+
Rev: 161
|
22
23
|
*/
|
23
24
|
|
24
25
|
(function($){
|
@@ -26,9 +27,7 @@ learn to use a search engine.
|
|
26
27
|
$.fn.editInPlace = function(options) {
|
27
28
|
|
28
29
|
var settings = $.extend({}, $.fn.editInPlace.defaults, options);
|
29
|
-
|
30
30
|
assertMandatorySettingsArePresent(settings);
|
31
|
-
|
32
31
|
preloadImage(settings.saving_image);
|
33
32
|
|
34
33
|
return this.each(function() {
|
@@ -57,7 +56,7 @@ $.fn.editInPlace.defaults = {
|
|
57
56
|
params: "", // string: example: first_name=dave&last_name=hauenstein extra paramters sent via the post request to the server
|
58
57
|
field_type: "text", // string: "text", "textarea", or "select", or "remote", or "clone"; The type of form field that will appear on instantiation
|
59
58
|
default_text: "(Click here to add text)", // string: text to show up if the element that has this functionality is empty
|
60
|
-
use_html: false, // boolean, set to true if the editor should use jQuery.fn.html() to extract the value to show from the dom node
|
59
|
+
use_html: false, // boolean, set to true if the editor should use jQuery.fn.html() to extract the value to show from the dom node (keep in mind that IE will uppercase all tags, so use with caution)
|
61
60
|
textarea_rows: 10, // integer: set rows attribute of textarea, if field_type is set to textarea. Use CSS if possible though
|
62
61
|
textarea_cols: 25, // integer: set cols attribute of textarea, if field_type is set to textarea. Use CSS if possible though
|
63
62
|
select_text: "Choose new value", // string: default text to show up in select box
|
@@ -179,14 +178,15 @@ $.extend(InlineEditor.prototype, {
|
|
179
178
|
if ( ! this.shouldOpenEditor(anEvent))
|
180
179
|
return;
|
181
180
|
|
182
|
-
this.workAroundFirefoxBlurBug();
|
183
181
|
this.disconnectOpeningEvents();
|
184
182
|
this.removeHoverEffect();
|
185
183
|
this.removeInsertedDefaultTextIfNeccessary();
|
186
184
|
this.saveOriginalValue();
|
187
185
|
this.markEditorAsActive();
|
188
186
|
this.replaceContentWithEditor();
|
189
|
-
|
187
|
+
this.setInitialValue();
|
188
|
+
this.workAroundMissingBlurBug();
|
189
|
+
this.connectClosingEventsToEditor();
|
190
190
|
this.triggerDelegateCall('didOpenEditInPlace');
|
191
191
|
},
|
192
192
|
|
@@ -239,20 +239,16 @@ $.extend(InlineEditor.prototype, {
|
|
239
239
|
this.dom.text(aValue);
|
240
240
|
},
|
241
241
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
// Firefox will forget to send a blur event to an input element when another one is
|
249
|
-
// created and selected programmatically. This means that if another inline editor is
|
250
|
-
// opened, existing inline editors will _not_ close if they are configured to submit when blurred.
|
251
|
-
// This is actually the first time I've written browser specific code for a browser different than IE! Wohoo!
|
242
|
+
workAroundMissingBlurBug: function() {
|
243
|
+
// Strangely, all browser will forget to send a blur event to an input element
|
244
|
+
// when another one is created and selected programmatically. (at least under some circumstances).
|
245
|
+
// This means that if another inline editor is opened, existing inline editors will _not_ close
|
246
|
+
// if they are configured to submit when blurred.
|
252
247
|
|
253
248
|
// Using parents() instead document as base to workaround the fact that in the unittests
|
254
249
|
// the editor is not a child of window.document but of a document fragment
|
255
|
-
|
250
|
+
var ourInput = this.dom.find(':input');
|
251
|
+
this.dom.parents(':last').find('.editInPlace-active :input').not(ourInput).blur();
|
256
252
|
},
|
257
253
|
|
258
254
|
replaceContentWithEditor: function() {
|
@@ -285,10 +281,20 @@ $.extend(InlineEditor.prototype, {
|
|
285
281
|
editor = this.cloneEditor();
|
286
282
|
return editor;
|
287
283
|
}
|
288
|
-
editor.val(this.triggerDelegateCall('willOpenEditInPlace', this.originalValue));
|
289
284
|
return editor;
|
290
285
|
},
|
291
286
|
|
287
|
+
setInitialValue: function() {
|
288
|
+
var initialValue = this.triggerDelegateCall('willOpenEditInPlace', this.originalValue);
|
289
|
+
var editor = this.dom.find(':input');
|
290
|
+
editor.val(initialValue);
|
291
|
+
|
292
|
+
// Workaround for select fields which don't contain the original value.
|
293
|
+
// Somehow the browsers don't like to select the instructional choice (disabled) in that case
|
294
|
+
if (editor.val() !== initialValue)
|
295
|
+
editor.val(''); // selects instructional choice
|
296
|
+
},
|
297
|
+
|
292
298
|
createRemoteGeneratedEditor: function () {
|
293
299
|
this.dom.html(this.settings.loading_text);
|
294
300
|
return $($.ajax({
|
@@ -373,7 +379,6 @@ $.extend(InlineEditor.prototype, {
|
|
373
379
|
optionsArray = optionsArray.split(',');
|
374
380
|
|
375
381
|
for (var i=0; i<optionsArray.length; i++) {
|
376
|
-
|
377
382
|
var currentTextAndValue = optionsArray[i];
|
378
383
|
if ( ! $.isArray(currentTextAndValue))
|
379
384
|
currentTextAndValue = currentTextAndValue.split(':');
|
@@ -381,16 +386,14 @@ $.extend(InlineEditor.prototype, {
|
|
381
386
|
var value = trim(currentTextAndValue[1] || currentTextAndValue[0]);
|
382
387
|
var text = trim(currentTextAndValue[0]);
|
383
388
|
|
384
|
-
|
385
|
-
var option = $('<option ' + selected + ' ></option>').val(value).text(text);
|
389
|
+
var option = $('<option>').val(value).text(text);
|
386
390
|
editor.append(option);
|
387
391
|
}
|
392
|
+
|
388
393
|
return editor;
|
389
|
-
|
390
394
|
},
|
391
395
|
|
392
|
-
|
393
|
-
connectOpeningEventsToEditor: function() {
|
396
|
+
connectClosingEventsToEditor: function() {
|
394
397
|
var that = this;
|
395
398
|
function cancelEditorAction(anEvent) {
|
396
399
|
that.handleCancelEditor(anEvent);
|
@@ -415,8 +418,8 @@ $.extend(InlineEditor.prototype, {
|
|
415
418
|
else
|
416
419
|
form.find(".inplace_field").blur(cancelEditorAction);
|
417
420
|
|
418
|
-
// workaround for firefox bug where it won't submit on enter if no button is shown
|
419
|
-
if ($.browser.mozilla)
|
421
|
+
// workaround for msie & firefox bug where it won't submit on enter if no button is shown
|
422
|
+
if ($.browser.mozilla || $.browser.msie)
|
420
423
|
this.bindSubmitOnEnterInInput();
|
421
424
|
}
|
422
425
|
|
@@ -460,9 +463,6 @@ $.extend(InlineEditor.prototype, {
|
|
460
463
|
enteredText = this.triggerDelegateCall('willCloseEditInPlace', enteredText);
|
461
464
|
|
462
465
|
this.restoreOriginalValue();
|
463
|
-
if (hasContent(enteredText)
|
464
|
-
&& ! this.isDisabledDefaultSelectChoice() && !editor.is('select'))
|
465
|
-
this.setClosedEditorContent(enteredText);
|
466
466
|
this.reinit();
|
467
467
|
},
|
468
468
|
|
@@ -609,7 +609,7 @@ $.extend(InlineEditor.prototype, {
|
|
609
609
|
if ( ! aCallback)
|
610
610
|
return; // callback wasn't specified after all
|
611
611
|
|
612
|
-
var callbackArguments = Array.prototype.
|
612
|
+
var callbackArguments = Array.prototype.slice.call(arguments, 1);
|
613
613
|
return aCallback.apply(this.dom[0], callbackArguments);
|
614
614
|
},
|
615
615
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% subsection_id ||= nil %>
|
2
2
|
<% show_unauthorized_columns = active_scaffold_config.send(form_action).show_unauthorized_columns %>
|
3
|
-
<ol class="form" <%= "id=#{subsection_id}" unless subsection_id.nil? %> <%= "style=\"display: none;\"" if columns.collapsed %>>
|
3
|
+
<ol class="form" <%= "id=#{subsection_id}" unless subsection_id.nil? %> <%= "style=\"display: none;\"".html_safe if columns.collapsed %>>
|
4
4
|
<% columns.each :for => @record, :crud_type => (:read if show_unauthorized_columns) do |column| %>
|
5
5
|
<% authorized = show_unauthorized_columns ? @record.authorized_for?(:crud_type => form_action, :column => column.name) : true %>
|
6
6
|
<% renders_as = column_renders_as(column) %>
|
@@ -107,7 +107,13 @@ module ActiveScaffold::Actions
|
|
107
107
|
@record = active_scaffold_config.model.find(params[:id])
|
108
108
|
if @record.authorized_for?(:crud_type => :update, :column => params[:column])
|
109
109
|
column = active_scaffold_config.columns[params[:column].to_sym]
|
110
|
-
|
110
|
+
unless @record.column_for_attribute(params[:column]).nil? || @record.column_for_attribute(params[:column]).null
|
111
|
+
if @record.column_for_attribute(params[:column]).default == true
|
112
|
+
params[:value] ||= false
|
113
|
+
else
|
114
|
+
params[:value] ||= @record.column_for_attribute(params[:column]).default
|
115
|
+
end
|
116
|
+
end
|
111
117
|
unless column.nil?
|
112
118
|
params[:value] = column_value_from_param_value(@record, column, params[:value])
|
113
119
|
params[:value] = [] if params[:value].nil? && column.form_ui && column.plural_association?
|
@@ -32,9 +32,8 @@ module ActiveScaffold::DataStructures
|
|
32
32
|
direction ||= 'ASC'
|
33
33
|
direction = direction.to_s.upcase
|
34
34
|
column = get_column(column_name)
|
35
|
-
raise ArgumentError, "Could not find column #{column_name}" if column.nil?
|
36
35
|
raise ArgumentError, "Sorting direction unknown" unless [:ASC, :DESC].include? direction.to_sym
|
37
|
-
@clauses << [column, direction.untaint] if column.sortable?
|
36
|
+
@clauses << [column, direction.untaint] if column and column.sortable?
|
38
37
|
raise ArgumentError, "Can't mix :method- and :sql-based sorting" if mixed_sorting?
|
39
38
|
end
|
40
39
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module ActionController #:nodoc:
|
3
3
|
class Base
|
4
4
|
def render_with_active_scaffold(*args, &block)
|
5
|
-
if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil?
|
5
|
+
if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil? and request.xhr?
|
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
8
|
opts = args.blank? ? Hash.new : args.first
|
@@ -30,12 +30,12 @@ module ActiveScaffold
|
|
30
30
|
parameters = {}
|
31
31
|
if params[:parent_controller]
|
32
32
|
parameters[:controller] = params[:parent_controller]
|
33
|
-
#parameters[:eid] = params[:parent_controller]
|
33
|
+
#parameters[:eid] = params[:parent_controller] # not neeeded anymore?
|
34
34
|
end
|
35
35
|
parameters.merge! nested.to_params if nested?
|
36
36
|
if params[:parent_sti]
|
37
37
|
parameters[:controller] = params[:parent_sti]
|
38
|
-
#parameters[:eid] = nil
|
38
|
+
#parameters[:eid] = nil # not neeeded anymore?
|
39
39
|
end
|
40
40
|
parameters[:parent_column] = nil
|
41
41
|
parameters[:parent_id] = nil
|
@@ -190,9 +190,12 @@ module ActiveScaffold
|
|
190
190
|
if column && column.association
|
191
191
|
url_options[column.association.active_record.name.foreign_key.to_sym] = url_options.delete(:id)
|
192
192
|
url_options[:id] = record.send(column.association.name).id if column.singular_association? && record.send(column.association.name).present?
|
193
|
+
url_options[:eid] = nil # needed for nested scaffolds open from an embedded scaffold
|
193
194
|
elsif link.parameters && link.parameters[:named_scope]
|
194
195
|
url_options[active_scaffold_config.model.name.foreign_key.to_sym] = url_options.delete(:id)
|
196
|
+
url_options[:eid] = nil # needed for nested scaffolds open from an embedded scaffold
|
195
197
|
end
|
198
|
+
nested.constrained_fields.each { |field| url_options.delete field } if nested?
|
196
199
|
end
|
197
200
|
|
198
201
|
def url_options_for_sti_link(column, record, link, url_options, options = {})
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 4
|
10
|
+
version: 3.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Many, see README
|
@@ -15,11 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-04-16 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
22
|
none: false
|
24
23
|
requirements:
|
25
24
|
- - ">="
|
@@ -28,12 +27,12 @@ dependencies:
|
|
28
27
|
segments:
|
29
28
|
- 0
|
30
29
|
version: "0"
|
31
|
-
|
32
|
-
name: shoulda
|
30
|
+
type: :development
|
33
31
|
prerelease: false
|
32
|
+
requirement: *id001
|
33
|
+
name: shoulda
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
|
36
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
35
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
36
|
none: false
|
38
37
|
requirements:
|
39
38
|
- - ~>
|
@@ -44,12 +43,12 @@ dependencies:
|
|
44
43
|
- 0
|
45
44
|
- 0
|
46
45
|
version: 1.0.0
|
47
|
-
|
48
|
-
name: bundler
|
46
|
+
type: :development
|
49
47
|
prerelease: false
|
48
|
+
requirement: *id002
|
49
|
+
name: bundler
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
53
52
|
none: false
|
54
53
|
requirements:
|
55
54
|
- - ">="
|
@@ -58,12 +57,12 @@ dependencies:
|
|
58
57
|
segments:
|
59
58
|
- 0
|
60
59
|
version: "0"
|
61
|
-
|
62
|
-
name: rcov
|
60
|
+
type: :development
|
63
61
|
prerelease: false
|
62
|
+
requirement: *id003
|
63
|
+
name: rcov
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
|
-
|
66
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
67
66
|
none: false
|
68
67
|
requirements:
|
69
68
|
- - ">="
|
@@ -74,9 +73,10 @@ dependencies:
|
|
74
73
|
- 1
|
75
74
|
- 3
|
76
75
|
version: 3.1.3
|
77
|
-
|
78
|
-
name: rails
|
76
|
+
type: :runtime
|
79
77
|
prerelease: false
|
78
|
+
requirement: *id004
|
79
|
+
name: rails
|
80
80
|
description: 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.
|
81
81
|
email: activescaffold@googlegroups.com
|
82
82
|
executables: []
|
@@ -437,7 +437,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
437
437
|
requirements: []
|
438
438
|
|
439
439
|
rubyforge_project:
|
440
|
-
rubygems_version: 1.8.
|
440
|
+
rubygems_version: 1.8.21
|
441
441
|
signing_key:
|
442
442
|
specification_version: 3
|
443
443
|
summary: Rails 3.1 Version of activescaffold supporting prototype and jquery
|