active_scaffold 3.2.14 → 3.2.15
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +12 -1
- data/app/assets/javascripts/jquery/active_scaffold.js +6 -2
- data/app/assets/javascripts/prototype/active_scaffold.js +1 -1
- data/config/locales/de.yml +1 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/config/locales/fr.yml +1 -0
- data/config/locales/hu.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/config/locales/ru.yml +1 -0
- data/frontends/default/views/_base_form.html.erb +4 -1
- data/frontends/default/views/on_update.js.erb +7 -3
- data/lib/active_scaffold/actions/delete.rb +1 -1
- data/lib/active_scaffold/actions/list.rb +1 -0
- data/lib/active_scaffold/actions/show.rb +1 -1
- data/lib/active_scaffold/actions/update.rb +1 -1
- data/lib/active_scaffold/bridges/date_picker/ext.rb +4 -2
- data/lib/active_scaffold/data_structures/action_links.rb +1 -1
- data/lib/active_scaffold/finder.rb +2 -2
- data/lib/active_scaffold/helpers/list_column_helpers.rb +7 -2
- data/lib/active_scaffold/helpers/show_column_helpers.rb +6 -1
- data/lib/active_scaffold/version.rb +1 -1
- metadata +9 -9
data/CHANGELOG
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
= 3.2.
|
1
|
+
= 3.2.15 (not released yet)
|
2
|
+
- Prepare to unify field overrides and list_ui method signatures
|
3
|
+
- Add :optional to update.persistent
|
4
|
+
- Add missing triggering of as:element_updated in new subform rows
|
5
|
+
- Fix conditions for :select in field_search
|
6
|
+
- Fix datetime field search
|
7
|
+
- Fix authorization checking in member action links
|
8
|
+
|
9
|
+
= 3.2.14
|
10
|
+
- Fix default sorting, it was broken in 3.2.13
|
11
|
+
|
12
|
+
= 3.2.13
|
2
13
|
- Fix destroy action, was broken in 3.2.12
|
3
14
|
- Remove default :method sorting for associations, it wasn't useful and can be slow
|
4
15
|
- Rescue from ActiveScaffold::ActionNotAllowed and ActiveScaffold::RecordNotAllowed with 401 response, it can be overrided with deny_access method in ApplicationController.
|
@@ -72,7 +72,7 @@ jQuery(document).ready(function() {
|
|
72
72
|
|
73
73
|
if (action_link) {
|
74
74
|
var cancel_url = as_cancel.attr('href');
|
75
|
-
var refresh_data = action_link.tag.data('cancel-refresh');
|
75
|
+
var refresh_data = action_link.tag.data('cancel-refresh') || as_cancel.data('refresh');
|
76
76
|
if (!refresh_data || !cancel_url) {
|
77
77
|
action_link.close();
|
78
78
|
return false;
|
@@ -547,6 +547,7 @@ var ActiveScaffold = {
|
|
547
547
|
} else {
|
548
548
|
server_error.show();
|
549
549
|
}
|
550
|
+
ActiveScaffold.scroll_to(server_error, ActiveScaffold.config.scroll_on_close == 'checkInViewport');
|
550
551
|
},
|
551
552
|
|
552
553
|
find_action_link: function(element) {
|
@@ -626,9 +627,11 @@ var ActiveScaffold = {
|
|
626
627
|
create_associated_record_form: function(element, content, options) {
|
627
628
|
if (typeof(element) == 'string') element = '#' + element;
|
628
629
|
var element = jQuery(element);
|
630
|
+
content = jQuery(content);
|
629
631
|
if (options.singular == false) {
|
630
632
|
if (!(options.id && jQuery('#' + options.id).size() > 0)) {
|
631
|
-
element.append(content);
|
633
|
+
var new_element = element.append(content);
|
634
|
+
content.trigger('as:element_updated');
|
632
635
|
}
|
633
636
|
} else {
|
634
637
|
var current = jQuery('#' + element.attr('id') + ' .association-record')
|
@@ -636,6 +639,7 @@ var ActiveScaffold = {
|
|
636
639
|
this.replace(current[0], content);
|
637
640
|
} else {
|
638
641
|
element.prepend(content);
|
642
|
+
content.trigger('as:element_updated');
|
639
643
|
}
|
640
644
|
}
|
641
645
|
},
|
@@ -95,7 +95,7 @@ document.observe("dom:loaded", function() {
|
|
95
95
|
var action_link = ActiveScaffold.find_action_link(as_cancel);
|
96
96
|
|
97
97
|
if (action_link) {
|
98
|
-
var refresh_data = action_link.readAttribute('data-cancel-refresh');
|
98
|
+
var refresh_data = action_link.readAttribute('data-cancel-refresh') || as_cancel.readAttribute('data-refresh');
|
99
99
|
if (refresh_data && action_link.refresh_url) {
|
100
100
|
event.memo.url = action_link.refresh_url;
|
101
101
|
} else if (!refresh_data || as_cancel.readAttribute('href').blank()) {
|
data/config/locales/de.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/fr.yml
CHANGED
data/config/locales/hu.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/config/locales/ru.yml
CHANGED
@@ -6,6 +6,7 @@ ru:
|
|
6
6
|
add: 'Добавить запись'
|
7
7
|
add_existing: 'Добавить существующую запись'
|
8
8
|
add_existing_model: '%{model}: добавить существующую запись'
|
9
|
+
apply: 'Apply'
|
9
10
|
are_you_sure_to_delete: 'Удалить %{label}?'
|
10
11
|
cancel: 'Отмена'
|
11
12
|
click_to_edit: 'Нажмите для редактирования'
|
@@ -5,9 +5,11 @@
|
|
5
5
|
if active_scaffold_config.actions.include? form_action
|
6
6
|
multipart ||= active_scaffold_config.send(form_action).multipart?
|
7
7
|
columns ||= active_scaffold_config.send(form_action).columns
|
8
|
+
persistent ||= active_scaffold_config.send(form_action).persistent
|
8
9
|
else
|
9
10
|
multipart ||= false
|
10
11
|
columns ||= nil
|
12
|
+
persistent ||= false
|
11
13
|
end
|
12
14
|
method ||= :post
|
13
15
|
cancel_link = true if cancel_link.nil?
|
@@ -40,7 +42,8 @@ end
|
|
40
42
|
<%= render :partial => body_partial, :locals => { :columns => columns, :form_action => form_action, :scope => scope } %>
|
41
43
|
|
42
44
|
<p class="form-footer">
|
43
|
-
<%= submit_tag as_(submit_text), :class => "submit" %>
|
45
|
+
<%= submit_tag as_(submit_text), :class => "submit" if !persistent || persistent == :optional %>
|
46
|
+
<%= submit_tag as_(:apply), :class => "submit", :name => 'dont_close' if persistent %>
|
44
47
|
<%= link_to(as_(:cancel), main_path_to_return, cancel_options) if cancel_link %>
|
45
48
|
<%= loading_indicator_tag(:action => form_action, :id => params[:id]) %>
|
46
49
|
<%= render :partial => footer_extension, :locals => { :form_action => form_action } if footer_extension %>
|
@@ -3,7 +3,12 @@ try {
|
|
3
3
|
var action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
|
4
4
|
action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
|
5
5
|
<% if controller.send :successful? %>
|
6
|
-
<% if
|
6
|
+
<% if params[:dont_close] %>
|
7
|
+
<% row_selector = element_row_id(:action => :list, :id => @record.id) %>
|
8
|
+
ActiveScaffold.update_row('<%= row_selector %>', '<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
|
9
|
+
<%= render :partial => 'update_calculations', :formats => [:js] %>
|
10
|
+
ActiveScaffold.scroll_to('<%= row_selector %>', true);
|
11
|
+
<% else %>
|
7
12
|
<% if render_parent? %>
|
8
13
|
<% if nested_singular_association? || render_parent_action == :row %>
|
9
14
|
action_link.close(true);
|
@@ -13,8 +18,7 @@ action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'mes
|
|
13
18
|
<% elsif update_refresh_list? %>
|
14
19
|
<%= render :partial => 'refresh_list' %>
|
15
20
|
<% else %>
|
16
|
-
|
17
|
-
action_link.close('<%= escape_javascript(updated_row) %>');
|
21
|
+
action_link.close('<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
|
18
22
|
<%= render :partial => 'update_calculations', :formats => [:js] %>
|
19
23
|
<% end %>
|
20
24
|
<% end %>
|
@@ -60,7 +60,7 @@ module ActiveScaffold::Actions
|
|
60
60
|
# The default security delegates to ActiveRecordPermissions.
|
61
61
|
# You may override the method to customize.
|
62
62
|
def delete_authorized?(record = nil)
|
63
|
-
(!nested? || !nested.readonly?) &&
|
63
|
+
(!nested? || !nested.readonly?) && (record || self).send(:authorized_for?, :crud_type => :delete)
|
64
64
|
end
|
65
65
|
private
|
66
66
|
def delete_authorized_filter
|
@@ -56,6 +56,7 @@ module ActiveScaffold::Actions
|
|
56
56
|
|
57
57
|
# The actual algorithm to prepare for the list view
|
58
58
|
def set_includes_for_list_columns
|
59
|
+
@cache_associations = true
|
59
60
|
includes_for_list_columns = active_scaffold_config.list.columns.collect{ |c| c.includes }.flatten.uniq.compact
|
60
61
|
self.active_scaffold_includes.concat includes_for_list_columns
|
61
62
|
end
|
@@ -47,7 +47,7 @@ module ActiveScaffold::Actions
|
|
47
47
|
# The default security delegates to ActiveRecordPermissions.
|
48
48
|
# You may override the method to customize.
|
49
49
|
def show_authorized?(record = nil)
|
50
|
-
|
50
|
+
(record || self).send(:authorized_for?, :crud_type => :read)
|
51
51
|
end
|
52
52
|
private
|
53
53
|
def show_authorized_filter
|
@@ -139,7 +139,7 @@ module ActiveScaffold::Actions
|
|
139
139
|
# The default security delegates to ActiveRecordPermissions.
|
140
140
|
# You may override the method to customize.
|
141
141
|
def update_authorized?(record = nil)
|
142
|
-
(!nested? || !nested.readonly?) &&
|
142
|
+
(!nested? || !nested.readonly?) && (record || self).send(:authorized_for?, :crud_type => :update)
|
143
143
|
end
|
144
144
|
private
|
145
145
|
def update_authorized_filter
|
@@ -49,13 +49,15 @@ ActionView::Base.class_eval do
|
|
49
49
|
end
|
50
50
|
ActiveScaffold::Finder::ClassMethods.module_eval do
|
51
51
|
include ActiveScaffold::Bridges::Shared::DateBridge::Finder::ClassMethods
|
52
|
-
def
|
52
|
+
def datetime_conversion_for_condition_with_datepicker(column)
|
53
53
|
if column.search_ui == :date_picker
|
54
54
|
:to_date
|
55
55
|
else
|
56
|
-
|
56
|
+
datetime_conversion_for_condition_without_datepicker
|
57
57
|
end
|
58
58
|
end
|
59
|
+
alias_method_chain :datetime_conversion_for_condition, :datepicker
|
60
|
+
|
59
61
|
alias_method :condition_for_date_picker_type, :condition_for_date_bridge_type
|
60
62
|
alias_method :condition_for_datetime_picker_type, :condition_for_date_picker_type
|
61
63
|
end
|
@@ -123,7 +123,7 @@ module ActiveScaffold::DataStructures
|
|
123
123
|
elsif controller.nil? || !skip_action_link(controller, link, *(Array(options[:for])))
|
124
124
|
security_method = link.security_method_set? || controller.respond_to?(link.security_method)
|
125
125
|
authorized = if security_method
|
126
|
-
controller.send(link.security_method, *
|
126
|
+
controller.send(link.security_method, *(Array(options[:for])))
|
127
127
|
else
|
128
128
|
options[:for].nil? ? true : options[:for].authorized_for?(:crud_type => link.crud_type, :action => link.action)
|
129
129
|
end
|
@@ -59,8 +59,8 @@ module ActiveScaffold
|
|
59
59
|
condition_for_range(column, value, like_pattern)
|
60
60
|
when :date, :time, :datetime, :timestamp
|
61
61
|
condition_for_datetime(column, value)
|
62
|
-
when :select, :multi_select, :country, :usa_state
|
63
|
-
["%{search_sql} in (?)",
|
62
|
+
when :select, :multi_select, :country, :usa_state, :chosen, :multi_chosen
|
63
|
+
["%{search_sql} in (?)", Array(value)]
|
64
64
|
else
|
65
65
|
if column.column.nil? || column.column.text?
|
66
66
|
["%{search_sql} #{ActiveScaffold::Finder.like_operator} ?", like_pattern.sub('?', value)]
|
@@ -10,7 +10,12 @@ module ActiveScaffold
|
|
10
10
|
# we only pass the record as the argument. we previously also passed the formatted_value,
|
11
11
|
# but mike perham pointed out that prohibited the usage of overrides to improve on the
|
12
12
|
# performance of our default formatting. see issue #138.
|
13
|
-
|
13
|
+
if method(method).arity == 1
|
14
|
+
ActiveSupport::Deprecation.warn("Add column argument to field override, signature is unified with list_ui")
|
15
|
+
send(method, record)
|
16
|
+
else
|
17
|
+
send(method, record, column)
|
18
|
+
end
|
14
19
|
# second, check if the dev has specified a valid list_ui for this column
|
15
20
|
elsif column.list_ui and (method = override_column_ui(column.list_ui))
|
16
21
|
send(method, column, record)
|
@@ -236,7 +241,7 @@ module ActiveScaffold
|
|
236
241
|
Rails.logger.warn "ActiveScaffold: Enable eager loading for #{column.name} association to reduce SQL queries"
|
237
242
|
elsif column.associated_limit > 0
|
238
243
|
value.target = value.find(:all, :limit => column.associated_limit + 1, :select => column.select_columns)
|
239
|
-
|
244
|
+
elsif @cache_associations
|
240
245
|
value.target = size.to_i.zero? ? [] : [nil]
|
241
246
|
end
|
242
247
|
end
|
@@ -8,7 +8,12 @@ module ActiveScaffold
|
|
8
8
|
# we only pass the record as the argument. we previously also passed the formatted_value,
|
9
9
|
# but mike perham pointed out that prohibited the usage of overrides to improve on the
|
10
10
|
# performance of our default formatting. see issue #138.
|
11
|
-
|
11
|
+
if method(method).arity == 1
|
12
|
+
ActiveSupport::Deprecation.warn("Add column argument to field override, signature is unified with list_ui")
|
13
|
+
send(method, record)
|
14
|
+
else
|
15
|
+
send(method, record, column)
|
16
|
+
end
|
12
17
|
# second, check if the dev has specified a valid list_ui for this column
|
13
18
|
elsif column.list_ui and (method = override_show_column_ui(column.list_ui))
|
14
19
|
send(method, column, record)
|
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: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 15
|
10
|
+
version: 3.2.15
|
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: 2012-07
|
18
|
+
date: 2012-08-07 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :development
|
@@ -29,8 +29,8 @@ dependencies:
|
|
29
29
|
- 0
|
30
30
|
version: "0"
|
31
31
|
version_requirements: *id001
|
32
|
-
name: shoulda
|
33
32
|
prerelease: false
|
33
|
+
name: shoulda
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
type: :development
|
36
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
@@ -45,8 +45,8 @@ dependencies:
|
|
45
45
|
- 0
|
46
46
|
version: 1.0.0
|
47
47
|
version_requirements: *id002
|
48
|
-
name: bundler
|
49
48
|
prerelease: false
|
49
|
+
name: bundler
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
type: :development
|
52
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
@@ -59,8 +59,8 @@ dependencies:
|
|
59
59
|
- 0
|
60
60
|
version: "0"
|
61
61
|
version_requirements: *id003
|
62
|
-
name: rcov
|
63
62
|
prerelease: false
|
63
|
+
name: rcov
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
type: :runtime
|
66
66
|
requirement: &id004 !ruby/object:Gem::Requirement
|
@@ -75,8 +75,8 @@ dependencies:
|
|
75
75
|
- 3
|
76
76
|
version: 3.1.3
|
77
77
|
version_requirements: *id004
|
78
|
-
name: rails
|
79
78
|
prerelease: false
|
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: []
|
@@ -443,7 +443,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
443
443
|
requirements: []
|
444
444
|
|
445
445
|
rubyforge_project:
|
446
|
-
rubygems_version: 1.8.
|
446
|
+
rubygems_version: 1.8.23
|
447
447
|
signing_key:
|
448
448
|
specification_version: 3
|
449
449
|
summary: Rails 3.1 Version of activescaffold supporting prototype and jquery
|