active_scaffold 3.2.2 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
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
- 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
- %>
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<%= ' class="hidden"'.html_safe if column_renders_as(column) == :hidden %>>
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 => crud_type, :flatten => true do |column| %>
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="form-element <%= 'required' if column.required? %> <%= column.css_class unless column.css_class.nil? %>">
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 certain variables and the absence of errors (when applicable).
112
- # Success can also be defined.
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
- @records or (@record and @record.errors.count == 0 and @record.no_errors_in_associated?)
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 params.delete(:embedded)
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 params[:embedded]
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
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 2
10
- version: 3.2.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-15 00:00:00 Z
18
+ date: 2012-03-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  type: :development