active_scaffold_vho 3.0.12 → 3.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/active_scaffold_vho.gemspec +5 -2
- data/frontends/default/javascripts/jquery/active_scaffold.js +27 -1
- data/frontends/default/javascripts/prototype/active_scaffold.js +24 -0
- data/frontends/default/views/on_mark_all.js.rjs +4 -0
- data/lib/active_scaffold/actions/create.rb +10 -6
- data/lib/active_scaffold/actions/mark.rb +15 -2
- data/lib/active_scaffold/attribute_params.rb +9 -5
- data/lib/active_scaffold/bridges/cancan/bridge.rb +11 -0
- data/lib/active_scaffold/bridges/cancan/lib/cancan_bridge.rb +81 -0
- data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb +2 -8
- data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb +1 -15
- data/lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb +12 -7
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +26 -8
- data/lib/active_scaffold/data_structures/action_link.rb +4 -0
- data/lib/active_scaffold/extensions/action_view_rendering.rb +2 -2
- data/lib/active_scaffold/helpers/form_column_helpers.rb +4 -1
- data/lib/active_scaffold/helpers/view_helpers.rb +3 -0
- data/lib/active_scaffold/version.rb +1 -1
- data/lib/active_scaffold.rb +1 -2
- metadata +7 -4
data/active_scaffold_vho.gemspec
CHANGED
@@ -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.
|
8
|
+
s.version = "3.0.13"
|
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-02-
|
12
|
+
s.date = %q{2011-02-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 = [
|
@@ -95,6 +95,7 @@ Gem::Specification.new do |s|
|
|
95
95
|
"frontends/default/views/list.js.rjs",
|
96
96
|
"frontends/default/views/on_action_update.js.rjs",
|
97
97
|
"frontends/default/views/on_create.js.rjs",
|
98
|
+
"frontends/default/views/on_mark_all.js.rjs",
|
98
99
|
"frontends/default/views/on_update.js.rjs",
|
99
100
|
"frontends/default/views/search.html.erb",
|
100
101
|
"frontends/default/views/show.html.erb",
|
@@ -122,6 +123,8 @@ Gem::Specification.new do |s|
|
|
122
123
|
"lib/active_scaffold/bridges/bridge.rb",
|
123
124
|
"lib/active_scaffold/bridges/calendar_date_select/bridge.rb",
|
124
125
|
"lib/active_scaffold/bridges/calendar_date_select/lib/as_cds_bridge.rb",
|
126
|
+
"lib/active_scaffold/bridges/cancan/bridge.rb",
|
127
|
+
"lib/active_scaffold/bridges/cancan/lib/cancan_bridge.rb",
|
125
128
|
"lib/active_scaffold/bridges/carrierwave/bridge.rb",
|
126
129
|
"lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb",
|
127
130
|
"lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb",
|
@@ -563,7 +563,8 @@ var ActiveScaffold = {
|
|
563
563
|
|
564
564
|
delete_subform_record: function(record) {
|
565
565
|
if (typeof(record) == 'string') record = '#' + record;
|
566
|
-
|
566
|
+
record = $(record);
|
567
|
+
var errors = record.prev();
|
567
568
|
if (errors.hasClass('association-record-errors')) {
|
568
569
|
this.replace_html(errors, '');
|
569
570
|
}
|
@@ -701,6 +702,31 @@ var ActiveScaffold = {
|
|
701
702
|
ActiveScaffold.report_500_response(active_scaffold_id)
|
702
703
|
}
|
703
704
|
});
|
705
|
+
},
|
706
|
+
|
707
|
+
// element is tbody id
|
708
|
+
mark_records: function(element, options) {
|
709
|
+
if (typeof(element) == 'string') element = '#' + element;
|
710
|
+
var element = $(element);
|
711
|
+
var mark_checkboxes = $('#' + element.attr('id') + ' > tr.record td.marked-column input[type="checkbox"]');
|
712
|
+
mark_checkboxes.each(function (index) {
|
713
|
+
var item = $(this);
|
714
|
+
if(options.checked === true) {
|
715
|
+
item.attr('checked', 'checked');
|
716
|
+
} else {
|
717
|
+
item.removeAttr('checked');
|
718
|
+
}
|
719
|
+
item.attr('value', ('' + !options.checked));
|
720
|
+
});
|
721
|
+
if(options.include_mark_all === true) {
|
722
|
+
var mark_all_checkbox = element.prev('thead').find('th.marked-column_heading span input[type="checkbox"]');
|
723
|
+
if(options.checked === true) {
|
724
|
+
mark_all_checkbox.attr('checked', 'checked');
|
725
|
+
} else {
|
726
|
+
mark_all_checkbox.removeAttr('checked');
|
727
|
+
}
|
728
|
+
mark_all_checkbox.attr('value', ('' + !options.checked));
|
729
|
+
}
|
704
730
|
}
|
705
731
|
}
|
706
732
|
|
@@ -568,7 +568,31 @@ var ActiveScaffold = {
|
|
568
568
|
}
|
569
569
|
}
|
570
570
|
);
|
571
|
+
},
|
572
|
+
|
573
|
+
// element is tbody id
|
574
|
+
mark_records: function(element, options) {
|
575
|
+
var element = $(element);
|
576
|
+
var mark_checkboxes = $$('#' + element.readAttribute('id') + ' > tr.record td.marked-column input[type="checkbox"]');
|
577
|
+
mark_checkboxes.each(function(item) {
|
578
|
+
if(options.checked === true) {
|
579
|
+
item.writeAttribute({ checked: 'checked' });
|
580
|
+
} else {
|
581
|
+
item.removeAttribute('checked');
|
582
|
+
}
|
583
|
+
item.writeAttribute('value', ('' + !options.checked));
|
584
|
+
});
|
585
|
+
if(options.include_mark_all === true) {
|
586
|
+
var mark_all_checkbox = element.previous('thead').down('th.marked-column_heading span input[type="checkbox"]');
|
587
|
+
if(options.checked === true) {
|
588
|
+
mark_all_checkbox.writeAttribute({ checked: 'checked' });
|
589
|
+
} else {
|
590
|
+
mark_all_checkbox.removeAttribute('checked');
|
591
|
+
}
|
592
|
+
mark_all_checkbox.writeAttribute('value', ('' + !options.checked));
|
593
|
+
}
|
571
594
|
}
|
595
|
+
|
572
596
|
}
|
573
597
|
|
574
598
|
/*
|
@@ -103,17 +103,21 @@ module ActiveScaffold::Actions
|
|
103
103
|
create_association_with_parent(@record)
|
104
104
|
register_constraints_with_action_columns(nested.constrained_fields)
|
105
105
|
end
|
106
|
-
|
107
|
-
self.successful = [@record.valid?, @record.associated_valid?].all? {|v| v == true} # this syntax avoids a short-circuit
|
108
|
-
if successful?
|
109
|
-
@record.save! and @record.save_associated!
|
110
|
-
after_create_save(@record)
|
111
|
-
end
|
106
|
+
create_save
|
112
107
|
end
|
113
108
|
rescue ActiveRecord::RecordInvalid
|
114
109
|
end
|
115
110
|
end
|
116
111
|
|
112
|
+
def create_save
|
113
|
+
before_create_save(@record)
|
114
|
+
self.successful = [@record.valid?, @record.associated_valid?].all? {|v| v == true} # this syntax avoids a short-circuit
|
115
|
+
if successful?
|
116
|
+
@record.save! and @record.save_associated!
|
117
|
+
after_create_save(@record)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
117
121
|
# override this method if you want to inject data in the record (or its associated objects) before the save
|
118
122
|
def before_create_save(record); end
|
119
123
|
|
@@ -13,10 +13,19 @@ module ActiveScaffold::Actions
|
|
13
13
|
else
|
14
14
|
do_demark_all
|
15
15
|
end
|
16
|
-
|
17
|
-
respond_to_action(:list)
|
16
|
+
respond_to_action(:mark_all)
|
18
17
|
end
|
19
18
|
protected
|
19
|
+
|
20
|
+
def mark_all_respond_to_html
|
21
|
+
do_list
|
22
|
+
list_respond_to_html
|
23
|
+
end
|
24
|
+
|
25
|
+
def mark_all_respond_to_js
|
26
|
+
do_list
|
27
|
+
render :action => 'on_mark_all', :locals => {:mark_all => mark_all?}
|
28
|
+
end
|
20
29
|
|
21
30
|
# We need to give the ActiveRecord classes a handle to currently marked records. We don't want to just pass the object,
|
22
31
|
# because the object may change. So we give ActiveRecord a proc that ties to the
|
@@ -46,5 +55,9 @@ module ActiveScaffold::Actions
|
|
46
55
|
def mark_authorized?
|
47
56
|
authorized_for?(:action => :read)
|
48
57
|
end
|
58
|
+
|
59
|
+
def mark_all_formats
|
60
|
+
(default_formats + active_scaffold_config.formats).uniq
|
61
|
+
end
|
49
62
|
end
|
50
63
|
end
|
@@ -110,11 +110,7 @@ module ActiveScaffold
|
|
110
110
|
# it's a single id
|
111
111
|
column.association.klass.find(value) if value and not value.empty?
|
112
112
|
elsif column.plural_association?
|
113
|
-
|
114
|
-
if value and not value.empty?
|
115
|
-
ids = value.select {|id| id.respond_to?(:empty?) ? !id.empty? : true}
|
116
|
-
ids.empty? ? [] : column.association.klass.find(ids)
|
117
|
-
end
|
113
|
+
column_plural_assocation_value_from_value(column, value)
|
118
114
|
elsif column.column && column.column.number? && [:i18n_number, :currency].include?(column.options[:format])
|
119
115
|
self.class.i18n_number_to_native_format(value)
|
120
116
|
else
|
@@ -126,6 +122,14 @@ module ActiveScaffold
|
|
126
122
|
end
|
127
123
|
end
|
128
124
|
|
125
|
+
def column_plural_assocation_value_from_value(column, value)
|
126
|
+
# it's an array of ids
|
127
|
+
if value and not value.empty?
|
128
|
+
ids = value.select {|id| id.respond_to?(:empty?) ? !id.empty? : true}
|
129
|
+
ids.empty? ? [] : column.association.klass.find(ids)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
129
133
|
def column_value_from_param_hash_value(parent_record, column, value)
|
130
134
|
# this is just for backwards compatibility. we should clean this up in 2.0.
|
131
135
|
if column.form_ui == :select
|
@@ -0,0 +1,11 @@
|
|
1
|
+
ActiveScaffold::Bridges.bridge "CanCan" do
|
2
|
+
install do
|
3
|
+
require File.join(File.dirname(__FILE__), "lib", "cancan_bridge.rb")
|
4
|
+
|
5
|
+
ActiveScaffold::Actions::Core.send :include, ActiveScaffold::CancanBridge::Core
|
6
|
+
ActiveScaffold::Actions::Nested.send :include, ActiveScaffold::CancanBridge::Core
|
7
|
+
ActionController::Base.send :include, ActiveScaffold::CancanBridge::ModelUserAccess::Controller
|
8
|
+
ActiveRecord::Base.send :include, ActiveScaffold::CancanBridge::ModelUserAccess::Model
|
9
|
+
ActiveRecord::Base.send :include, ActiveScaffold::CancanBridge::ActiveRecord
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module ActiveScaffold
|
2
|
+
module CancanBridge
|
3
|
+
|
4
|
+
module Core
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
included do
|
7
|
+
alias_method_chain :beginning_of_chain, :cancan
|
8
|
+
end
|
9
|
+
# :TODO can this be expanded more ?
|
10
|
+
def beginning_of_chain_with_cancan
|
11
|
+
beginning_of_chain_without_cancan.accessible_by(current_ability)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# This is a module aimed at making the current_ability available to ActiveRecord models for permissions.
|
16
|
+
module ModelUserAccess
|
17
|
+
module Controller
|
18
|
+
extend ActiveSupport::Concern
|
19
|
+
included do
|
20
|
+
prepend_before_filter :assign_current_ability_to_models
|
21
|
+
end
|
22
|
+
|
23
|
+
# We need to give the ActiveRecord classes a handle to the current ability. We don't want to just pass the object,
|
24
|
+
# because the object may change (someone may log in or out). So we give ActiveRecord a proc that ties to the
|
25
|
+
# current_ability_method on this ApplicationController.
|
26
|
+
def assign_current_ability_to_models
|
27
|
+
::ActiveRecord::Base.current_ability_proc = proc {send(:current_ability)}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module Model
|
32
|
+
extend ActiveSupport::Concern
|
33
|
+
|
34
|
+
module ClassMethods
|
35
|
+
# The proc to call that retrieves the current_ability from the ApplicationController.
|
36
|
+
attr_accessor :current_ability_proc
|
37
|
+
|
38
|
+
# Class-level access to the current ability
|
39
|
+
def current_ability
|
40
|
+
::ActiveRecord::Base.current_ability_proc.call if ::ActiveRecord::Base.current_ability_proc
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Instance-level access to the current ability
|
45
|
+
def current_ability; self.class.current_ability end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
module ActiveRecord
|
51
|
+
extend ActiveSupport::Concern
|
52
|
+
included do
|
53
|
+
extend SecurityMethods
|
54
|
+
include SecurityMethods
|
55
|
+
alias_method_chain :authorized_for?, :cancan
|
56
|
+
class << self
|
57
|
+
alias_method_chain :authorized_for?, :cancan
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
module SecurityMethods
|
62
|
+
class InvalidArgument < StandardError; end
|
63
|
+
|
64
|
+
# is usually called with :crud_type and :column, or :action
|
65
|
+
# {:crud_type=>:update, :column=>"some_colum_name"}
|
66
|
+
# {:action=>"edit"}
|
67
|
+
# to allow access cancan must allow both :crud_type and :action
|
68
|
+
# if cancan says "no", it delegates to default AS behavior
|
69
|
+
def authorized_for_with_cancan?(options = {})
|
70
|
+
raise InvalidArgument if options[:crud_type].blank? and options[:action].blank?
|
71
|
+
crud_type_result = options[:crud_type].nil? ? true : current_ability.can?(options[:crud_type], self)
|
72
|
+
action_result = options[:action].nil? ? true : current_ability.can?(options[:action], self)
|
73
|
+
default_result = authorized_for_without_cancan?(options)
|
74
|
+
result = (crud_type_result and action_result) or default_result
|
75
|
+
return result
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -12,8 +12,6 @@ module ActiveScaffold
|
|
12
12
|
|
13
13
|
self.model.uploaders.keys.each do |field|
|
14
14
|
configure_carrierwave_field(field.to_sym)
|
15
|
-
# define the "delete" helper for use with active scaffold, unless it's already defined
|
16
|
-
ActiveScaffold::Bridges::Carrierwave::Lib::CarrierwaveBridgeHelpers.generate_delete_helper(self.model, field)
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
@@ -24,13 +22,9 @@ module ActiveScaffold
|
|
24
22
|
private
|
25
23
|
def configure_carrierwave_field(field)
|
26
24
|
self.columns << field
|
27
|
-
self.columns[field].form_ui ||= :carrierwave
|
25
|
+
self.columns[field].form_ui ||= :carrierwave # :TODO thumbnail
|
28
26
|
self.columns[field].params.add "#{field}_cache"
|
29
|
-
self.columns[field].params.add "
|
30
|
-
|
31
|
-
# [:file_name, :content_type, :file_size, :updated_at].each do |f|
|
32
|
-
# self.columns.exclude("#{field}_#{f}".to_sym)
|
33
|
-
# end
|
27
|
+
self.columns[field].params.add "remove_#{field}"
|
34
28
|
end
|
35
29
|
end
|
36
30
|
end
|
@@ -5,22 +5,8 @@ module ActiveScaffold
|
|
5
5
|
module CarrierwaveBridgeHelpers
|
6
6
|
mattr_accessor :thumbnail_style
|
7
7
|
self.thumbnail_style = :thumbnail
|
8
|
-
|
9
|
-
def self.generate_delete_helper(klass, field)
|
10
|
-
klass.class_eval <<-EOF, __FILE__, __LINE__ + 1 unless klass.methods.include?("delete_#{field}=")
|
11
|
-
attr_reader :delete_#{field}
|
12
|
-
|
13
|
-
def delete_#{field}=(value)
|
14
|
-
value = (value == "true") if String === value
|
15
|
-
return unless value
|
16
|
-
|
17
|
-
# passing nil to the file column causes the file to be deleted. Don't delete if we just uploaded a file!
|
18
|
-
self.remove_#{field}! unless new_record?
|
19
|
-
end
|
20
|
-
EOF
|
21
|
-
end
|
22
8
|
end
|
23
9
|
end
|
24
10
|
end
|
25
11
|
end
|
26
|
-
end
|
12
|
+
end
|
@@ -12,18 +12,23 @@ module ActiveScaffold
|
|
12
12
|
js_remove_file_code = "$(this).previous().value='true'; $(this).up().hide().next().show(); return false;";
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
:name => options[:name].gsub(/\[#{column.name}\]$/, "[
|
17
|
-
:id => options[:id]
|
18
|
-
:value =>
|
15
|
+
remove_field_options = {
|
16
|
+
:name => options[:name].gsub(/\[#{column.name}\]$/, "[remove_#{column.name}]"),
|
17
|
+
:id => 'remove_' + options[:id],
|
18
|
+
:value => false
|
19
|
+
}
|
20
|
+
|
21
|
+
cache_field_options = {
|
22
|
+
:name => options[:name].gsub(/\[#{column.name}\]$/, "[#{column.name}_cache]"),
|
23
|
+
:id => options[:id] + '_cache'
|
19
24
|
}
|
20
25
|
|
21
26
|
content_tag( :div,
|
22
27
|
content_tag(:div, (
|
23
28
|
get_column_value(@record, column) + " | " +
|
24
|
-
hidden_field(:record, "
|
25
|
-
|
26
|
-
|
29
|
+
hidden_field(:record, "#{column.name}_cache", cache_field_options) +
|
30
|
+
hidden_field(:record, "remove_#{column.name}", remove_field_options) +
|
31
|
+
content_tag(:a, as_(:remove_file), {:href => '#', :onclick => js_remove_file_code})
|
27
32
|
).html_safe
|
28
33
|
) + content_tag(:div, input, :style => "display: none")
|
29
34
|
)
|
@@ -70,14 +70,36 @@ module ActiveScaffold
|
|
70
70
|
def active_scaffold_human_condition_date_bridge(column, value)
|
71
71
|
case value[:opt]
|
72
72
|
when 'RANGE'
|
73
|
-
|
73
|
+
range_type, range = value[:range].downcase.split('_')
|
74
|
+
format = active_scaffold_human_condition_date_bridge_range_format(range_type, range)
|
75
|
+
from, to = controller.class.date_bridge_from_to(column, value)
|
76
|
+
"#{column.active_record_class.human_attribute_name(column.name)} = #{as_(value[:range].downcase).downcase} (#{I18n.l(from, :format => format)})"
|
74
77
|
when 'PAST', 'FUTURE'
|
75
|
-
|
78
|
+
from, to = controller.class.date_bridge_from_to(column, value)
|
79
|
+
"#{column.active_record_class.human_attribute_name(column.name)} #{as_('BETWEEN'.downcase).downcase} #{I18n.l(from)} - #{I18n.l(to)}"
|
76
80
|
else
|
77
81
|
from, to = controller.class.date_bridge_from_to(column, value)
|
78
82
|
"#{column.active_record_class.human_attribute_name(column.name)} #{as_(value[:opt].downcase).downcase} #{I18n.l(from)} #{value[:opt] == 'BETWEEN' ? '- ' + I18n.l(to) : ''}"
|
79
83
|
end
|
80
84
|
end
|
85
|
+
|
86
|
+
def active_scaffold_human_condition_date_bridge_range_format(range_type, range)
|
87
|
+
case range
|
88
|
+
when 'week'
|
89
|
+
first_day_of_week = I18n.translate 'active_scaffold.date_picker_options.firstDay'
|
90
|
+
if first_day_of_week == 1
|
91
|
+
'%W %Y'
|
92
|
+
else
|
93
|
+
'%U %Y'
|
94
|
+
end
|
95
|
+
when 'month'
|
96
|
+
'%b %Y'
|
97
|
+
when 'year'
|
98
|
+
'%Y'
|
99
|
+
else
|
100
|
+
I18n.translate 'date.formats.default'
|
101
|
+
end
|
102
|
+
end
|
81
103
|
end
|
82
104
|
|
83
105
|
module Finder
|
@@ -146,7 +168,7 @@ module ActiveScaffold
|
|
146
168
|
return date_bridge_now.beginning_of_day, date_bridge_now.end_of_day
|
147
169
|
when 'YESTERDAY'
|
148
170
|
return date_bridge_now.ago(1.day).beginning_of_day, date_bridge_now.ago(1.day).end_of_day
|
149
|
-
when '
|
171
|
+
when 'TOMORROW'
|
150
172
|
return date_bridge_now.in(1.day).beginning_of_day, date_bridge_now.in(1.day).end_of_day
|
151
173
|
else
|
152
174
|
range_type, range = value[:range].downcase.split('_')
|
@@ -184,8 +206,4 @@ ActiveScaffold::Finder.const_set('TimeUnits', ["SECONDS", "MINUTES", "HOURS"])
|
|
184
206
|
ActiveScaffold::Finder.const_set('DateRanges', ["TODAY", "YESTERDAY", "TOMORROW",
|
185
207
|
"THIS_WEEK", "PREV_WEEK", "NEXT_WEEK",
|
186
208
|
"THIS_MONTH", "PREV_MONTH", "NEXT_MONTH",
|
187
|
-
"THIS_YEAR", "PREV_YEAR", "NEXT_YEAR"])
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
209
|
+
"THIS_YEAR", "PREV_YEAR", "NEXT_YEAR"])
|
@@ -17,6 +17,7 @@ module ActiveScaffold::DataStructures
|
|
17
17
|
self.html_options = {}
|
18
18
|
self.column = nil
|
19
19
|
self.image = nil
|
20
|
+
self.dynamic_parameters = nil
|
20
21
|
|
21
22
|
# apply quick properties
|
22
23
|
options.each_pair do |k, v|
|
@@ -43,6 +44,9 @@ module ActiveScaffold::DataStructures
|
|
43
44
|
# a hash of request parameters
|
44
45
|
attr_accessor :parameters
|
45
46
|
|
47
|
+
# a block for dynamic_parameters
|
48
|
+
attr_accessor :dynamic_parameters
|
49
|
+
|
46
50
|
# the RESTful method
|
47
51
|
attr_accessor :method
|
48
52
|
|
@@ -66,8 +66,8 @@ module ActionView::Rendering #:nodoc:
|
|
66
66
|
id = "as_#{eid}-content"
|
67
67
|
url_options = {:controller => remote_controller.to_s, :action => 'index'}.merge(options[:params])
|
68
68
|
|
69
|
-
if respond_to?
|
70
|
-
|
69
|
+
if controller.respond_to?(:render_component_into_view)
|
70
|
+
controller.send(:render_component_into_view, url_options)
|
71
71
|
else
|
72
72
|
content_tag(:div, {:id => id}) do
|
73
73
|
url = url_for(url_options)
|
@@ -107,6 +107,7 @@ module ActiveScaffold
|
|
107
107
|
|
108
108
|
html_options.update(column.options[:html_options] || {})
|
109
109
|
options.update(column.options)
|
110
|
+
html_options[:name] = "#{html_options[:name]}[]" if (html_options[:multiple] == true && !html_options[:name].to_s.ends_with?("[]"))
|
110
111
|
select(:record, method, select_options.uniq, options, html_options)
|
111
112
|
end
|
112
113
|
|
@@ -171,7 +172,9 @@ module ActiveScaffold
|
|
171
172
|
# ... maybe this should be provided in a bridge?
|
172
173
|
def active_scaffold_input_record_select(column, options)
|
173
174
|
if column.singular_association?
|
174
|
-
|
175
|
+
multiple = false
|
176
|
+
multiple = column.options[:html_options][:multiple] if column.options[:html_options] && column.options[:html_options][:multiple]
|
177
|
+
active_scaffold_record_select(column, options, @record.send(column.name), multiple)
|
175
178
|
elsif column.plural_association?
|
176
179
|
active_scaffold_record_select(column, options, @record.send(column.name), true)
|
177
180
|
end
|
@@ -151,6 +151,9 @@ module ActiveScaffold
|
|
151
151
|
url_options[:controller] = link.controller if link.controller
|
152
152
|
url_options.delete(:search) if link.controller and link.controller.to_s != params[:controller]
|
153
153
|
url_options.merge! link.parameters if link.parameters
|
154
|
+
@link_record = record
|
155
|
+
url_options.merge! self.instance_eval(&(link.dynamic_parameters)) if link.dynamic_parameters.is_a?(Proc)
|
156
|
+
@link_record = nil
|
154
157
|
url_options_for_nested_link(link.column, record, link, url_options, options) if link.nested_link?
|
155
158
|
url_options_for_sti_link(link.column, record, link, url_options, options) unless record.nil? || active_scaffold_config.sti_children.nil?
|
156
159
|
url_options[:_method] = link.method if !link.confirm? && link.inline? && link.method != :get
|
data/lib/active_scaffold.rb
CHANGED
@@ -81,8 +81,7 @@ module ActiveScaffold
|
|
81
81
|
self.class.active_scaffold_config_for(klass)
|
82
82
|
end
|
83
83
|
|
84
|
-
def active_scaffold_session_storage
|
85
|
-
id = params[:eid] || params[:controller]
|
84
|
+
def active_scaffold_session_storage(id = (params[:eid] || params[:controller]))
|
86
85
|
session_index = "as:#{id}"
|
87
86
|
session[session_index] ||= {}
|
88
87
|
session[session_index]
|
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:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 13
|
10
|
+
version: 3.0.13
|
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-02-
|
18
|
+
date: 2011-02-18 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- frontends/default/views/list.js.rjs
|
211
211
|
- frontends/default/views/on_action_update.js.rjs
|
212
212
|
- frontends/default/views/on_create.js.rjs
|
213
|
+
- frontends/default/views/on_mark_all.js.rjs
|
213
214
|
- frontends/default/views/on_update.js.rjs
|
214
215
|
- frontends/default/views/search.html.erb
|
215
216
|
- frontends/default/views/show.html.erb
|
@@ -237,6 +238,8 @@ files:
|
|
237
238
|
- lib/active_scaffold/bridges/bridge.rb
|
238
239
|
- lib/active_scaffold/bridges/calendar_date_select/bridge.rb
|
239
240
|
- lib/active_scaffold/bridges/calendar_date_select/lib/as_cds_bridge.rb
|
241
|
+
- lib/active_scaffold/bridges/cancan/bridge.rb
|
242
|
+
- lib/active_scaffold/bridges/cancan/lib/cancan_bridge.rb
|
240
243
|
- lib/active_scaffold/bridges/carrierwave/bridge.rb
|
241
244
|
- lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb
|
242
245
|
- lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
|