active_scaffold 3.2.2 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
- data/frontends/default/views/_horizontal_subform.html.erb +1 -11
- data/frontends/default/views/_horizontal_subform_record.html.erb +14 -9
- data/frontends/default/views/_vertical_subform_record.html.erb +8 -3
- data/lib/active_scaffold/actions/core.rb +8 -4
- data/lib/active_scaffold/actions/list.rb +2 -3
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +0 -1
- data/lib/active_scaffold/version.rb +1 -1
- metadata +4 -4
data/README
CHANGED
@@ -44,7 +44,7 @@ If you want to install as plugins under vendor/plugins, install these versions:
|
|
44
44
|
== Pick your own javascript framework
|
45
45
|
|
46
46
|
The Rails 3.0 version uses unobtrusive Javascript, so you are free to pick your javascript framework.
|
47
|
-
Out of the box Prototype or JQuery are supported:
|
47
|
+
Out of the box Prototype or JQuery are supported for rails 3.1 and later. For rails 3.0 pick a JS file:
|
48
48
|
|
49
49
|
Prototype 1.7 (default js framework)
|
50
50
|
rails.js in git://github.com/vhochstein/prototype-ujs.git
|
@@ -1,15 +1,5 @@
|
|
1
1
|
<table cellpadding="0" cellspacing="0">
|
2
|
-
<%
|
3
|
-
@record = if associated.empty?
|
4
|
-
if column.singular_association?
|
5
|
-
parent_record.send("build_#{column.name}".to_sym)
|
6
|
-
else
|
7
|
-
parent_record.send(column.name).build
|
8
|
-
end
|
9
|
-
else
|
10
|
-
associated.last
|
11
|
-
end
|
12
|
-
-%>
|
2
|
+
<% @record = associated.empty? ? build_associated(column, parent_record) : associated.last -%>
|
13
3
|
<%= render :partial => 'horizontal_subform_header', :locals => {:parent_record => parent_record, :record => @record} %>
|
14
4
|
|
15
5
|
<tbody id="<%= sub_form_list_id(:association => column.name) %>">
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
record_column = column
|
3
|
+
readonly = (@record.readonly? or not @record.authorized_for?(:crud_type => :update))
|
4
|
+
crud_type = @record.new_record? ? :create : (readonly ? :read : :update)
|
5
|
+
show_actions = false
|
6
|
+
config = active_scaffold_config_for(@record.class)
|
7
|
+
options = active_scaffold_input_options(config.columns[@record.class.primary_key], scope)
|
8
|
+
tr_id = "association-#{options[:id]}"
|
9
|
+
-%>
|
10
10
|
<tr id="<%= tr_id %>" class="association-record <%= 'association-record-new' if @record.new_record? -%> <%= 'locked' if locked -%>">
|
11
11
|
<% config.subform.columns.each :for => @record.class, :crud_type => :read, :flatten => true do |column| %>
|
12
12
|
<%
|
@@ -14,8 +14,13 @@
|
|
14
14
|
show_actions = true
|
15
15
|
column = column.clone
|
16
16
|
column.form_ui ||= :select if column.association
|
17
|
+
|
18
|
+
col_class = []
|
19
|
+
col_class << 'required' if column.required?
|
20
|
+
col_class << column.css_class unless column.css_class.nil?
|
21
|
+
col_class << 'hidden' if column_renders_as(column) == :hidden
|
17
22
|
-%>
|
18
|
-
<td
|
23
|
+
<td class="<%= col_class.join(' ') %>">
|
19
24
|
<% unless readonly and not @record.new_record? or not @record.authorized_for?(:crud_type => crud_type, :column => column.name) -%>
|
20
25
|
<%= render :partial => form_partial_for_column(column), :locals => { :column => column, :scope => scope } -%>
|
21
26
|
<% else -%>
|
@@ -8,15 +8,20 @@
|
|
8
8
|
tr_id = "association-#{options[:id]}"
|
9
9
|
-%>
|
10
10
|
<ol id="<%= tr_id %>" class="association-record <%= 'association-record-new' if @record.new_record? -%> <%= 'locked' if locked -%>">
|
11
|
-
<% config.subform.columns.each :for => @record, :crud_type =>
|
11
|
+
<% config.subform.columns.each :for => @record.class, :crud_type => :read, :flatten => true do |column| %>
|
12
12
|
<%
|
13
13
|
next unless in_subform?(column, parent_record)
|
14
14
|
show_actions = true
|
15
15
|
column = column.clone
|
16
16
|
column.form_ui ||= :select if column.association
|
17
|
+
|
18
|
+
col_class = ['form-element']
|
19
|
+
col_class << 'required' if column.required?
|
20
|
+
col_class << column.css_class unless column.css_class.nil?
|
21
|
+
col_class << 'hidden' if column_renders_as(column) == :hidden
|
17
22
|
-%>
|
18
|
-
<li class="
|
19
|
-
<% unless readonly -%>
|
23
|
+
<li class="<%= col_class.join(' ') %>">
|
24
|
+
<% unless readonly and not @record.new_record? or not @record.authorized_for?(:crud_type => crud_type, :column => column.name) -%>
|
20
25
|
<%= render :partial => form_partial_for_column(column), :locals => { :column => column, :scope => scope } -%>
|
21
26
|
<% else -%>
|
22
27
|
<p><%= get_column_value(@record, column) -%></p>
|
@@ -2,6 +2,7 @@ module ActiveScaffold::Actions
|
|
2
2
|
module Core
|
3
3
|
def self.included(base)
|
4
4
|
base.class_eval do
|
5
|
+
before_filter :register_constraints_with_action_columns, :if => :embedded?
|
5
6
|
after_filter :clear_flashes
|
6
7
|
end
|
7
8
|
base.helper_method :nested?
|
@@ -17,6 +18,9 @@ module ActiveScaffold::Actions
|
|
17
18
|
end
|
18
19
|
|
19
20
|
protected
|
21
|
+
def embedded?
|
22
|
+
@embedded ||= params.delete(:embedded)
|
23
|
+
end
|
20
24
|
|
21
25
|
def nested?
|
22
26
|
false
|
@@ -108,16 +112,16 @@ module ActiveScaffold::Actions
|
|
108
112
|
@response_object = successful? ? (@record || @records) : @record.errors
|
109
113
|
end
|
110
114
|
|
111
|
-
# Success is the existence of
|
112
|
-
#
|
115
|
+
# Success is the existence of one or more model objects. Most actions
|
116
|
+
# circumvent this method by setting @success directly.
|
113
117
|
def successful?
|
114
118
|
if @successful.nil?
|
115
|
-
@
|
119
|
+
@record || @records
|
116
120
|
else
|
117
121
|
@successful
|
118
122
|
end
|
119
123
|
end
|
120
|
-
|
124
|
+
|
121
125
|
def successful=(val)
|
122
126
|
@successful = (val) ? true : false
|
123
127
|
end
|
@@ -23,7 +23,7 @@ module ActiveScaffold::Actions
|
|
23
23
|
|
24
24
|
protected
|
25
25
|
def list_respond_to_html
|
26
|
-
if
|
26
|
+
if embedded?
|
27
27
|
render :action => 'list', :layout => false
|
28
28
|
else
|
29
29
|
render :action => 'list'
|
@@ -32,8 +32,7 @@ module ActiveScaffold::Actions
|
|
32
32
|
def list_respond_to_js
|
33
33
|
if params[:adapter]
|
34
34
|
render(:partial => 'list_with_header')
|
35
|
-
elsif
|
36
|
-
params.delete(:embedded)
|
35
|
+
elsif embedded?
|
37
36
|
render(:partial => 'list_with_header')
|
38
37
|
else
|
39
38
|
render :action => 'refresh_list', :formats => [:js]
|
@@ -58,7 +58,6 @@ ActionView::Base.class_eval do
|
|
58
58
|
include ActiveScaffold::Bridges::Shared::DateBridge::HumanConditionHelpers
|
59
59
|
alias_method :active_scaffold_human_condition_calendar_date_select, :active_scaffold_human_condition_date_bridge
|
60
60
|
include ActiveScaffold::Bridges::CalendarDateSelect::SearchColumnHelpers
|
61
|
-
include ActiveScaffold::Bridges::CalendarDateSelect::ViewHelpers
|
62
61
|
end
|
63
62
|
|
64
63
|
ActiveScaffold::Finder::ClassMethods.module_eval do
|
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: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 3
|
10
|
+
version: 3.2.3
|
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-03-
|
18
|
+
date: 2012-03-30 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :development
|