active_scaffold 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/README +10 -17
  2. data/app/assets/images/active_scaffold/add.png +0 -0
  3. data/app/assets/images/active_scaffold/arrow_down.png +0 -0
  4. data/app/assets/images/active_scaffold/arrow_up.png +0 -0
  5. data/app/assets/images/active_scaffold/close.png +0 -0
  6. data/app/assets/stylesheets/active_scaffold-ie.css.scss +54 -0
  7. data/app/assets/stylesheets/active_scaffold_images.css.scss +7 -10
  8. data/app/assets/stylesheets/active_scaffold_layout.css +1 -4
  9. data/frontends/default/views/_field_search.html.erb +1 -1
  10. data/frontends/default/views/_form_attribute.html.erb +1 -1
  11. data/frontends/default/views/_list_inline_adapter.html.erb +8 -1
  12. data/frontends/default/views/_list_record.html.erb +1 -2
  13. data/frontends/default/views/_search.html.erb +1 -1
  14. data/lib/active_scaffold/actions/core.rb +7 -6
  15. data/lib/active_scaffold/actions/create.rb +1 -1
  16. data/lib/active_scaffold/actions/list.rb +1 -1
  17. data/lib/active_scaffold/actions/subform.rb +1 -1
  18. data/lib/active_scaffold/actions/update.rb +1 -1
  19. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +37 -0
  20. data/lib/active_scaffold/bridges/bitfields.rb +6 -0
  21. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +1 -1
  22. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +20 -0
  23. data/lib/active_scaffold/bridges/date_picker/helper.rb +1 -1
  24. data/lib/active_scaffold/bridges/record_select/helpers.rb +1 -1
  25. data/lib/active_scaffold/bridges/shared/date_bridge.rb +4 -4
  26. data/lib/active_scaffold/config/list.rb +18 -10
  27. data/lib/active_scaffold/data_structures/sorting.rb +1 -1
  28. data/lib/active_scaffold/finder.rb +3 -9
  29. data/lib/active_scaffold/helpers/search_column_helpers.rb +3 -3
  30. data/lib/active_scaffold/helpers/view_helpers.rb +5 -0
  31. data/lib/active_scaffold/version.rb +1 -1
  32. data/lib/active_scaffold.rb +1 -1
  33. metadata +27 -25
  34. data/app/assets/images/active_scaffold/add.gif +0 -0
  35. data/app/assets/images/active_scaffold/arrow_down.gif +0 -0
  36. data/app/assets/images/active_scaffold/arrow_up.gif +0 -0
  37. data/app/assets/images/active_scaffold/close.gif +0 -0
  38. data/app/assets/stylesheets/active_scaffold-ie.css +0 -35
data/README CHANGED
@@ -1,7 +1,3 @@
1
- ******************************************************************************************************
2
- ** For all documentation see the project website: http://github.com/vhochstein/active_scaffold/wiki **
3
- ******************************************************************************************************
4
-
5
1
  ActiveScaffold Gem/Plugin by Scott Rutherford (scott@caronsoftware.com), Richard White (rrwhite@gmail.com), Lance Ivy (lance@cainlevy.net), Ed Moss, Tim Harper and Sergio Cambra (sergio@entrecables.com)
6
2
 
7
3
  Uses DhtmlHistory by Brad Neuberg (bkn3@columbia.edu)
@@ -18,9 +14,16 @@ http://code.google.com/p/recordselect/
18
14
 
19
15
  == Version Information
20
16
 
21
- Please note the following list of Active Scaffold branches and Rails versions. Master will not work with Rails < 3.1
17
+ If you want to use the gem, add to your Gemfile:
18
+ gem "active_scaffold"
22
19
 
23
- Active Scaffold master currently supports rails-3.1, but incompatible changes can be introduced, if you want an stable version, use rails-3.0
20
+ In case you would like to use most recent commit:
21
+ gem 'active_scaffold', :git => 'git://github.com/activescaffold/active_scaffold.git'
22
+
23
+ 3.1.* and 3.2.* versions works with rails 3.1 and 3.2, 3.0.* versions with rails 3.0.
24
+ To use previous rails versions you will have to install the right branch as a plugin.
25
+
26
+ Active Scaffold master currently supports rails 3.1 and rails 3.2, you can use following branches for previous rails versions:
24
27
  Rails 3.0.*: Active Scaffold rails-3.0
25
28
  Rails 2.3.*: Active Scaffold rails-2.3 and v2.4
26
29
  Rails 2.2.*: Active Scaffold rails-2.2
@@ -31,19 +34,13 @@ Since Rails 2.3, render_component plugin is needed for nested and embedded scaff
31
34
  script/plugin install git://github.com/ewildgoose/render_component.git -r rails-2.3
32
35
 
33
36
  Since Rails 3.0 render_component is not used for nesting, but is optional for embedded scaffolds.
34
- Since Rails 3.0, https://github.com/rails/verification.git is also needed.
37
+ For Rails 3.0, https://github.com/rails/verification.git is also needed, not in rails 3.1 or higher.
35
38
 
36
39
  If you want to install as plugins under vendor/plugins, install these versions:
37
40
  rails plugin install git://github.com/vhochstein/render_component.git
38
41
  rails plugin install git://github.com/rails/verification.git
39
42
  rails plugin install git://github.com/activescaffold/active_scaffold.git -r 'rails-3.0'
40
43
 
41
- If you want to use the gem, add to your Gemfile:
42
- gem "active_scaffold"
43
-
44
- In case you would like to use most recent commit:
45
- gem 'active_scaffold', :git => 'git://github.com/activescaffold/active_scaffold.git', :branch => 'rails-3.0'
46
-
47
44
  == Pick your own javascript framework
48
45
 
49
46
  The Rails 3.0 version uses unobtrusive Javascript, so you are free to pick your javascript framework.
@@ -66,8 +63,4 @@ To configure the javascript framework when installed as a gem:
66
63
  Add a config/initializers/active_scaffold.rb containing:
67
64
  ActiveScaffold.js_framework = :jquery # :prototype is the default
68
65
 
69
- == Rails 3.1 compatible branch:
70
- under construction
71
-
72
-
73
66
  Released under the MIT license (included)
@@ -0,0 +1,54 @@
1
+ /* IE hacks
2
+ ==================================== */
3
+
4
+ * html .active-scaffold-header,
5
+ .active-scaffold li.form-element,
6
+ .active-scaffold li.sub-section {
7
+ zoom: 1;
8
+ }
9
+
10
+ * html .active-scaffold td .messages-container {
11
+ border-top: solid 1px #DAFFCD;
12
+ }
13
+
14
+ * html .active-scaffold-header div.actions a.show_search {
15
+ background-image: none;
16
+ filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='#{image_path('active_scaffold/magnifier.png')}', sizingMethod='crop');
17
+ }
18
+
19
+ * html .active-scaffold .sub-form .association-record a.destroy {
20
+ background-image: none;
21
+ filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='#{image_path('active_scaffold/cross.png')}', sizingMethod='crop');
22
+ }
23
+ * html .active-scaffold-header div.actions a.new,
24
+ * html .active-scaffold-header div.actions a.new_existing {
25
+ background-image: none;
26
+ filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='#{image_path('active_scaffold/add.png')}', sizingMethod='crop');
27
+ }
28
+ * html .active-scaffold-header th.asc a,
29
+ * html .active-scaffold-header th.asc a:hover {
30
+ background-image: none;
31
+ filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='#{image_path('active_scaffold/arrow_up.png')}', sizingMethod='crop');
32
+ }
33
+ * html .active-scaffold-header th.desc a,
34
+ * html .active-scaffold-header th.desc a:hover {
35
+ background-image: none;
36
+ filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='#{image_path('active_scaffold/arrow_down.png')}', sizingMethod='crop');
37
+ }
38
+ * html .active-scaffold-header a.inline-adapter-close {
39
+ background-image: none;
40
+ filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='#{image_path('active_scaffold/close.png')}', sizingMethod='crop');
41
+ }
42
+
43
+ .active-scaffold-header div.actions a.disabled {
44
+ filter: alpha(opacity=50);
45
+ }
46
+
47
+ .active-scaffold .show-view dd,
48
+ .active-scaffold li.form-element dd {
49
+ float: none;
50
+ }
51
+
52
+ .active-scaffold li.form-element dt {
53
+ padding: 4px 0;
54
+ }
@@ -8,30 +8,27 @@
8
8
 
9
9
  .active-scaffold-header div.actions a.new,
10
10
  .active-scaffold-header div.actions a.new_existing {
11
- background-image: image-url('active_scaffold/add.gif');
11
+ background-image: image-url('active_scaffold/add.png');
12
12
  }
13
13
 
14
14
  .active-scaffold-header div.actions a.show_search {
15
15
  background-image: image-url('active_scaffold/magnifier.png');
16
16
  }
17
17
 
18
- .active-scaffold th.asc a,
19
- .active-scaffold th.asc a:hover {
20
- background-image: image-url('active_scaffold/arrow_up.gif');
18
+ .active-scaffold th.asc a {
19
+ background-image: image-url('active_scaffold/arrow_up.png');
21
20
  }
22
21
 
23
- .active-scaffold th.desc a,
24
- .active-scaffold th.desc a:hover {
25
- background-image: image-url('active_scaffold/arrow_down.gif');
22
+ .active-scaffold th.desc a {
23
+ background-image: image-url('active_scaffold/arrow_down.png');
26
24
  }
27
25
 
28
- .active-scaffold th.loading a,
29
- .active-scaffold th.loading a:hover {
26
+ .active-scaffold th.loading a {
30
27
  background-image: image-url('active_scaffold/indicator-small.gif');
31
28
  }
32
29
 
33
30
  .active-scaffold a.inline-adapter-close {
34
- background-image: image-url('active_scaffold/close.gif');
31
+ background-image: image-url('active_scaffold/close.png');
35
32
  }
36
33
 
37
34
  .active-scaffold .sub-form .association-record a.destroy {
@@ -172,11 +172,8 @@ padding-right: 18px;
172
172
  }
173
173
 
174
174
  .active-scaffold th.asc a,
175
- .active-scaffold th.asc a:hover,
176
175
  .active-scaffold th.desc a,
177
- .active-scaffold th.desc a:hover,
178
- .active-scaffold th.loading a,
179
- .active-scaffold th.loading a:hover {
176
+ .active-scaffold th.loading a {
180
177
  background: right 50% no-repeat;
181
178
  }
182
179
 
@@ -25,7 +25,7 @@ form_tag url_options, options %>
25
25
  </ol>
26
26
  <p class="form-footer">
27
27
  <%= submit_tag as_(:search), :class => "submit" %>
28
- <%= link_to as_(:reset), url_for(url_options.merge(:search => '')), :class => 'as_cancel', :remote => true %>
28
+ <%= link_to as_(:reset), url_for(url_options.merge(:search => '')), :class => 'as_cancel', :remote => true, :data => {:refresh => true} %>
29
29
  <%= loading_indicator_tag(:action => :search) %>
30
30
  </p>
31
31
  </form>
@@ -8,7 +8,7 @@
8
8
  <%=raw active_scaffold_input_for column, scope %>
9
9
  <% else %>
10
10
  <%= get_column_value(@record, column) %>
11
- <%= hidden_field :record, column.association ? column.association.primary_key_name : column.name, active_scaffold_input_options(column, scope) -%>
11
+ <%= hidden_field :record, column.association ? column.association.foreign_key : column.name, active_scaffold_input_options(column, scope) -%>
12
12
  <% end %>
13
13
  <% if column.update_columns -%>
14
14
  <%= loading_indicator_tag(:action => :render_field, :id => params[:id]) %>
@@ -1,6 +1,13 @@
1
+ <%
2
+ column_count = if nested?
3
+ active_scaffold_config_for(nested.parent_model).list.columns.count + 1
4
+ else
5
+ active_scaffold_config.list.columns.count + 1
6
+ end
7
+ %>
1
8
  <%# nested_id, allows us to remove a nested scaffold programmatically %>
2
9
  <tr class="inline-adapter" id="<%= element_row_id :action => :nested %>">
3
- <td colspan="99" class="inline-adapter-cell">
10
+ <td colspan="<%= column_count %>" class="inline-adapter-cell">
4
11
  <div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{nested? ? nested.name : id_from_controller(params[:controller])}-view" %> view">
5
12
  <%= link_to(as_(:close), '', :class => 'inline-adapter-close as_cancel', :remote => true, :title => as_(:close), 'data-refresh' => (action_name == 'index' ? true : false)) -%>
6
13
  <%= payload -%>
@@ -1,8 +1,7 @@
1
1
  <%
2
2
  record = list_record if list_record # compat with render :partial :collection
3
3
  columns ||= list_columns
4
- tr_class = cycle("", "even-record")
5
- tr_class += " #{list_row_class(record)}" if respond_to? :list_row_class
4
+ tr_class = cycle("", "even-record") + ' ' + list_row_class(record)
6
5
  url_options = params_for(:action => :list, :id => record.id)
7
6
  action_links ||= active_scaffold_config.action_links.member
8
7
  -%>
@@ -9,7 +9,7 @@ options['data-loading'] = true unless live_search
9
9
  form_tag url_options, options %>
10
10
  <%= text_field_tag :search, search_params, :class => 'text-input', :id => search_input_id, :size => 50, :autocomplete => :off %>
11
11
  <%= submit_tag as_(:search), :class => "submit" %>
12
- <%= link_to as_(:reset), url_for(url_options.merge(:search => '')), :class => 'as_cancel', :remote => true %>
12
+ <%= link_to as_(:reset), url_for(url_options.merge(:search => '')), :class => 'as_cancel', :remote => true, :data => {:refresh => true} %>
13
13
  <%= loading_indicator_tag(:action => :search) %>
14
14
  </form>
15
15
 
@@ -2,7 +2,6 @@ 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
6
5
  after_filter :clear_flashes
7
6
  end
8
7
  base.helper_method :nested?
@@ -37,15 +36,17 @@ module ActiveScaffold::Actions
37
36
  @scope = params[:scope]
38
37
 
39
38
  if column.send_form_on_update_column
40
- hash = if @scope
41
- @scope.gsub('[','').split(']').inject(params[:record]) do |hash, index|
39
+ if @scope
40
+ hash = @scope.gsub('[','').split(']').inject(params[:record]) do |hash, index|
42
41
  hash[index]
43
42
  end
43
+ id = hash[:id]
44
44
  else
45
- params[:record]
45
+ hash = params[:record]
46
+ id = params[:id]
46
47
  end
47
- @record = hash[:id] ? find_if_allowed(hash[:id], :update) : new_model
48
- @record = update_record_from_params(@record, active_scaffold_config.send(@scope ? :subform : (params[:id] ? :update : :create)).columns, hash)
48
+ @record = id ? find_if_allowed(id, :update) : new_model
49
+ @record = update_record_from_params(@record, active_scaffold_config.send(@scope ? :subform : (id ? :update : :create)).columns, hash)
49
50
  else
50
51
  @record = new_model
51
52
  value = column_value_from_param_value(@record, column, params[:value])
@@ -34,7 +34,7 @@ module ActiveScaffold::Actions
34
34
  def create_respond_to_html
35
35
  if params[:iframe]=='true' # was this an iframe post ?
36
36
  responds_to_parent do
37
- render :action => 'on_create.js', :layout => false
37
+ render :action => 'on_create', :format => [:js], :layout => false
38
38
  end
39
39
  else
40
40
  if successful?
@@ -36,7 +36,7 @@ module ActiveScaffold::Actions
36
36
  params.delete(:embedded)
37
37
  render(:partial => 'list_with_header')
38
38
  else
39
- render :action => 'refresh_list.js'
39
+ render :action => 'refresh_list', :format => [:js]
40
40
  end
41
41
  end
42
42
  def list_respond_to_xml
@@ -2,7 +2,7 @@ module ActiveScaffold::Actions
2
2
  module Subform
3
3
  def edit_associated
4
4
  do_edit_associated
5
- render :action => 'edit_associated.js'
5
+ render :action => 'edit_associated', :format => [:js]
6
6
  end
7
7
 
8
8
  protected
@@ -35,7 +35,7 @@ module ActiveScaffold::Actions
35
35
  def update_respond_to_html
36
36
  if params[:iframe]=='true' # was this an iframe post ?
37
37
  responds_to_parent do
38
- render :action => 'on_update.js', :layout => false
38
+ render :action => 'on_update', :format => [:js], :layout => false
39
39
  end
40
40
  else # just a regular post
41
41
  if successful?
@@ -0,0 +1,37 @@
1
+ module ActiveScaffold
2
+ module Bridges
3
+ class Bitfields
4
+ module BitfieldsBridge
5
+ def initialize_with_bitfields(model_id)
6
+ initialize_without_bitfields(model_id)
7
+ return unless self.model.respond_to?(:bitfields) and self.model.bitfields.present?
8
+
9
+ self.model.bitfields.each do |column_name, options|
10
+ self.columns << options.keys
11
+ options.each do |column, value|
12
+ self.columns[column].form_ui = :checkbox
13
+ self.columns[column].weight = 1000 + value.to_s(2).size
14
+ end
15
+ end
16
+ end
17
+
18
+ def _load_action_columns_with_bitfields
19
+ self.model.bitfields.each do |column_name, options|
20
+ columns = options.keys.sort_by { |column| self.columns[column].weight }
21
+ [:create, :update, :show, :subform].each do |action|
22
+ self.send(action).columns.add_subgroup(column_name) { |group| group.add *columns }
23
+ end
24
+ end if self.model.respond_to?(:bitfields) and self.model.bitfields.present?
25
+
26
+ _load_action_columns_without_bitfields
27
+ end
28
+
29
+
30
+ def self.included(base)
31
+ base.alias_method_chain :initialize, :bitfields
32
+ base.alias_method_chain :_load_action_columns, :bitfields
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,6 @@
1
+ class ActiveScaffold::Bridges::Bitfields < ActiveScaffold::DataStructures::Bridge
2
+ def self.install
3
+ require File.join(File.dirname(__FILE__), "bitfields/bitfields_bridge")
4
+ ActiveScaffold::Config::Core.send :include, ActiveScaffold::Bridges::Bitfields::BitfieldsBridge
5
+ end
6
+ end
@@ -44,7 +44,7 @@ module ActiveScaffold
44
44
  :class => 'text-input',
45
45
  :id => "#{options[:id]}_#{name}",
46
46
  :time => column_datetime?(column) ? true : false,
47
- :style => "display:#{(options[:show].nil? || options[:show]) ? '' : 'none'}"})
47
+ :style => (options[:show].nil? || options[:show]) ? nil : "display: none"})
48
48
  end
49
49
  end
50
50
  end
@@ -1,3 +1,23 @@
1
+ # Allow users to easily define aliases for AS actions.
2
+ # Ability#as_action_aliases should be called by the user in his ability class
3
+ #
4
+ # class Ability < CanCan::Ability
5
+ # def initialize(user)
6
+ # as_action_aliases
7
+ # end
8
+ # end
9
+ #
10
+ module CanCan
11
+ module Ability
12
+ def as_action_aliases
13
+ alias_action :list, :row, :show_search, :render_field, :to => :read
14
+ alias_action :update_column, :add_association, :edit_associated,
15
+ :edit_associated, :new_existing, :add_existing, :to => :update
16
+ alias_action :delete, :destroy_existing, :to => :destroy
17
+ end
18
+ end
19
+ end
20
+
1
21
  module ActiveScaffold::Bridges
2
22
  class Cancan
3
23
 
@@ -157,7 +157,7 @@ module ActiveScaffold::Bridges
157
157
  options = column.options.merge(options).except!(:include_blank, :discard_time, :discard_date, :value)
158
158
  options = active_scaffold_input_text_options(options.merge(column.options))
159
159
  options[:class] << " #{column.search_ui.to_s}"
160
- options[:style] = "display:#{(options[:show].nil? || options[:show]) ? '' : 'none'}"
160
+ options[:style] = (options[:show].nil? || options[:show]) ? nil : "display: none"
161
161
  format = options.delete(:format) || :default
162
162
  datepicker_format_options(column, format, options)
163
163
  text_field_tag("#{options[:name]}[#{name}]", value ? l(value, :format => format) : nil, options.merge(:id => "#{options[:id]}_#{name}", :name => "#{options[:name]}[#{name}]"))
@@ -30,7 +30,7 @@ class ActiveScaffold::Bridges::RecordSelect
30
30
  # if the opposite association is a :belongs_to (in that case association in this class must be has_one or has_many)
31
31
  # then only show records that have not been associated yet
32
32
  if [:has_one, :has_many].include?(column.association.macro)
33
- params.merge!({column.association.primary_key_name => ''})
33
+ params.merge!({column.association.foreign_key => ''})
34
34
  end
35
35
 
36
36
  record_select_options = active_scaffold_input_text_options(options).merge(
@@ -28,8 +28,8 @@ module ActiveScaffold
28
28
  numeric_controls = "" <<
29
29
  active_scaffold_search_date_bridge_calendar_control(column, options, current_search, 'from') <<
30
30
  content_tag(:span, (" - " + active_scaffold_search_date_bridge_calendar_control(column, options, current_search, 'to')).html_safe,
31
- :id => "#{options[:id]}_between", :class => "as_search_range_between", :style => "display:#{current_search['opt'] == 'BETWEEN' ? '' : 'none'}")
32
- content_tag("span", numeric_controls.html_safe, :id => "#{options[:id]}_numeric", :style => "display:#{ActiveScaffold::Finder::NumericComparators.include?(current_search['opt']) ? '' : 'none'}")
31
+ :id => "#{options[:id]}_between", :class => "as_search_range_between", :style => current_search['opt'] == 'BETWEEN' ? nil : "display: none")
32
+ content_tag("span", numeric_controls.html_safe, :id => "#{options[:id]}_numeric", :style => ActiveScaffold::Finder::NumericComparators.include?(current_search['opt']) ? nil : "display: none")
33
33
  end
34
34
 
35
35
  def active_scaffold_search_date_bridge_trend_tag(column, options, current_search)
@@ -45,7 +45,7 @@ module ActiveScaffold
45
45
  select_tag("#{trend_options[:name_prefix]}[#{column.name}][unit]",
46
46
  options_for_select(active_scaffold_search_date_bridge_trend_units(column), trend_options[:unit_value]),
47
47
  :class => 'text-input')
48
- content_tag("span", trend_controls.html_safe, :id => "#{options[:id]}_trend", :style => "display:#{trend_options[:show] ? '' : 'none'}")
48
+ content_tag("span", trend_controls.html_safe, :id => "#{options[:id]}_trend", :style => trend_options[:show] ? nil : "display: none")
49
49
  end
50
50
 
51
51
  def active_scaffold_search_date_bridge_trend_units(column)
@@ -58,7 +58,7 @@ module ActiveScaffold
58
58
  range_controls = select_tag("search[#{column.name}][range]",
59
59
  options_for_select( ActiveScaffold::Finder::DateRanges.collect{|range| [as_(range.downcase.to_sym), range]}, current_search["range"]),
60
60
  :class => 'text-input')
61
- content_tag("span", range_controls.html_safe, :id => "#{options[:id]}_range", :style => "display:#{(current_search['opt'] == 'RANGE') ? '' : 'none'}")
61
+ content_tag("span", range_controls.html_safe, :id => "#{options[:id]}_range", :style => (current_search['opt'] == 'RANGE') ? nil : "display: none")
62
62
  end
63
63
 
64
64
  def column_datetime?(column)
@@ -142,6 +142,11 @@ module ActiveScaffold::Config
142
142
  attr_accessor :nested_auto_open
143
143
 
144
144
  class UserSettings < UserSettings
145
+ def initialize(conf, storage, params)
146
+ super(conf,storage,params)
147
+ @sorting = nil
148
+ end
149
+
145
150
  # This label has alread been localized.
146
151
  def label
147
152
  @session[:label] ? @session[:label] : @conf.label
@@ -173,17 +178,20 @@ module ActiveScaffold::Config
173
178
  end
174
179
 
175
180
  def sorting
176
- # we want to store as little as possible in the session, but we want to return a Sorting data structure. so we recreate it each page load based on session data.
177
- @session['sort'] = [@params['sort'], @params['sort_direction']] if @params['sort'] and @params['sort_direction']
178
- @session['sort'] = nil if @params['sort_direction'] == 'reset'
179
-
180
- if @session['sort']
181
- sorting = @conf.sorting.clone
182
- sorting.set(*@session['sort'])
183
- return sorting
184
- else
185
- return default_sorting
181
+ if @sorting.nil?
182
+ # we want to store as little as possible in the session, but we want to return a Sorting data structure. so we recreate it each page load based on session data.
183
+ @session['sort'] = [@params['sort'], @params['sort_direction']] if @params['sort'] and @params['sort_direction']
184
+ @session['sort'] = nil if @params['sort_direction'] == 'reset'
185
+
186
+ if @session['sort']
187
+ sorting = @conf.sorting.clone
188
+ sorting.set(*@session['sort'])
189
+ @sorting = sorting
190
+ else
191
+ @sorting = default_sorting
192
+ end
186
193
  end
194
+ @sorting
187
195
  end
188
196
 
189
197
  def count_includes
@@ -95,7 +95,7 @@ module ActiveScaffold::DataStructures
95
95
  sql = sort_column.sort[:sql]
96
96
  next if sql.nil? or sql.empty?
97
97
 
98
- order << "#{sql} #{sort_direction}"
98
+ order << Array(sql).map {|column| "#{column} #{sort_direction}"}.join(', ')
99
99
  end
100
100
 
101
101
  order.join(', ') unless order.empty?
@@ -265,7 +265,7 @@ module ActiveScaffold
265
265
  full_includes = (active_scaffold_includes.blank? ? nil : active_scaffold_includes)
266
266
 
267
267
  # create a general-use options array that's compatible with Rails finders
268
- finder_options = { :order => options[:sorting].try(:clause),
268
+ finder_options = { :reorder => options[:sorting].try(:clause),
269
269
  :where => search_conditions,
270
270
  :joins => joins_for_finder,
271
271
  :includes => full_includes}
@@ -278,7 +278,7 @@ module ActiveScaffold
278
278
  # See finder_options for valid options
279
279
  def count_options(find_options = {}, count_includes = nil)
280
280
  count_includes ||= find_options[:includes] unless find_options[:where].nil?
281
- options = find_options.reject{|k,v| [:select, :order].include? k}
281
+ options = find_options.reject{|k,v| [:select, :reorder].include? k}
282
282
  options[:includes] = count_includes
283
283
  options
284
284
  end
@@ -320,14 +320,8 @@ module ActiveScaffold
320
320
  end
321
321
 
322
322
  def append_to_query(query, options)
323
- options.assert_valid_keys :where, :select, :group, :order, :limit, :offset, :joins, :includes, :lock, :readonly, :from
323
+ options.assert_valid_keys :where, :select, :group, :reorder, :limit, :offset, :joins, :includes, :lock, :readonly, :from
324
324
  options.reject{|k, v| v.blank?}.inject(query) do |query, (k, v)|
325
- # default ordering of model has a higher priority than current queries ordering
326
- # fix this by removing existing ordering from arel
327
- if k.to_sym == :order
328
- query = query.where('1=1') unless query.is_a?(ActiveRecord::Relation)
329
- query = query.except(:order)
330
- end
331
325
  query.send((k.to_sym), v)
332
326
  end
333
327
  end
@@ -133,7 +133,7 @@ module ActiveScaffold
133
133
  def include_null_comparators?(column)
134
134
  return column.options[:null_comparators] if column.options.has_key? :null_comparators
135
135
  if column.association
136
- column.association.macro != :belongs_to || active_scaffold_config.columns[column.association.primary_key_name].column.try(:null)
136
+ column.association.macro != :belongs_to || active_scaffold_config.columns[column.association.foreign_key].column.try(:null)
137
137
  else
138
138
  column.column.try(:null)
139
139
  end
@@ -153,7 +153,7 @@ module ActiveScaffold
153
153
  def include_null_comparators?(column)
154
154
  return column.options[:null_comparators] if column.options.has_key? :null_comparators
155
155
  if column.association
156
- column.association.macro != :belongs_to || active_scaffold_config.columns[column.association.primary_key_name].column.try(:null)
156
+ column.association.macro != :belongs_to || active_scaffold_config.columns[column.association.foreign_key].column.try(:null)
157
157
  else
158
158
  column.column.try(:null)
159
159
  end
@@ -182,7 +182,7 @@ module ActiveScaffold
182
182
  html << ' ' << text_field_tag("#{options[:name]}[from]", from_value, active_scaffold_input_text_options(:id => options[:id], :size => text_field_size))
183
183
  html << ' ' << content_tag(:span, (' - ' + text_field_tag("#{options[:name]}[to]", to_value,
184
184
  active_scaffold_input_text_options(:id => "#{options[:id]}_to", :size => text_field_size))).html_safe,
185
- :id => "#{options[:id]}_between", :class => "as_search_range_between", :style => "display:#{(opt_value == 'BETWEEN') ? '' : 'none'}")
185
+ :id => "#{options[:id]}_between", :class => "as_search_range_between", :style => (opt_value == 'BETWEEN') ? nil : "display: none")
186
186
  content_tag :span, html, :class => 'search_range'
187
187
  end
188
188
  alias_method :active_scaffold_search_integer, :active_scaffold_search_range
@@ -210,6 +210,11 @@ module ActiveScaffold
210
210
  end
211
211
  end
212
212
 
213
+ def list_row_class(record)
214
+ class_override_helper = :"#{clean_class_name(record.class.name)}_list_row_class"
215
+ respond_to?(class_override_helper) ? send(class_override_helper, record) : ''
216
+ end
217
+
213
218
  def column_class(column, column_value, record)
214
219
  classes = []
215
220
  classes << "#{column.name}-column"
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -271,8 +271,8 @@ module ActiveScaffold
271
271
 
272
272
  ActiveScaffold::DataStructures::ActionLink.new('index', options) #unless column.through_association?
273
273
  else
274
- actions = [:create, :update, :show]
275
274
  actions = controller.active_scaffold_config.actions unless controller == :polymorph
275
+ actions ||= [:create, :update, :show]
276
276
  column.actions_for_association_links.delete :new unless actions.include? :create
277
277
  column.actions_for_association_links.delete :edit unless actions.include? :update
278
278
  column.actions_for_association_links.delete :show unless actions.include? :show
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: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 0
10
- version: 3.2.0
9
+ - 1
10
+ version: 3.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Many, see README
@@ -15,10 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-14 00:00:00 Z
18
+ date: 2012-03-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ type: :development
22
+ requirement: &id001 !ruby/object:Gem::Requirement
22
23
  none: false
23
24
  requirements:
24
25
  - - ">="
@@ -27,12 +28,12 @@ dependencies:
27
28
  segments:
28
29
  - 0
29
30
  version: "0"
30
- requirement: *id001
31
- prerelease: false
32
- type: :development
31
+ version_requirements: *id001
33
32
  name: shoulda
33
+ prerelease: false
34
34
  - !ruby/object:Gem::Dependency
35
- version_requirements: &id002 !ruby/object:Gem::Requirement
35
+ type: :development
36
+ requirement: &id002 !ruby/object:Gem::Requirement
36
37
  none: false
37
38
  requirements:
38
39
  - - ~>
@@ -43,12 +44,12 @@ dependencies:
43
44
  - 0
44
45
  - 0
45
46
  version: 1.0.0
46
- requirement: *id002
47
- prerelease: false
48
- type: :development
47
+ version_requirements: *id002
49
48
  name: bundler
49
+ prerelease: false
50
50
  - !ruby/object:Gem::Dependency
51
- version_requirements: &id003 !ruby/object:Gem::Requirement
51
+ type: :development
52
+ requirement: &id003 !ruby/object:Gem::Requirement
52
53
  none: false
53
54
  requirements:
54
55
  - - ">="
@@ -57,12 +58,12 @@ dependencies:
57
58
  segments:
58
59
  - 0
59
60
  version: "0"
60
- requirement: *id003
61
- prerelease: false
62
- type: :development
61
+ version_requirements: *id003
63
62
  name: rcov
63
+ prerelease: false
64
64
  - !ruby/object:Gem::Dependency
65
- version_requirements: &id004 !ruby/object:Gem::Requirement
65
+ type: :runtime
66
+ requirement: &id004 !ruby/object:Gem::Requirement
66
67
  none: false
67
68
  requirements:
68
69
  - - ">="
@@ -73,10 +74,9 @@ dependencies:
73
74
  - 1
74
75
  - 3
75
76
  version: 3.1.3
76
- requirement: *id004
77
- prerelease: false
78
- type: :runtime
77
+ version_requirements: *id004
79
78
  name: rails
79
+ prerelease: false
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: []
@@ -86,10 +86,10 @@ extensions: []
86
86
  extra_rdoc_files:
87
87
  - README
88
88
  files:
89
- - app/assets/images/active_scaffold/add.gif
90
- - app/assets/images/active_scaffold/arrow_down.gif
91
- - app/assets/images/active_scaffold/arrow_up.gif
92
- - app/assets/images/active_scaffold/close.gif
89
+ - app/assets/images/active_scaffold/add.png
90
+ - app/assets/images/active_scaffold/arrow_down.png
91
+ - app/assets/images/active_scaffold/arrow_up.png
92
+ - app/assets/images/active_scaffold/close.png
93
93
  - app/assets/images/active_scaffold/close_touch.png
94
94
  - app/assets/images/active_scaffold/config.png
95
95
  - app/assets/images/active_scaffold/cross.png
@@ -108,7 +108,7 @@ files:
108
108
  - app/assets/javascripts/prototype/form_enhancements.js
109
109
  - app/assets/javascripts/prototype/rico_corner.js
110
110
  - app/assets/javascripts/prototype/tiny_mce_bridge.js
111
- - app/assets/stylesheets/active_scaffold-ie.css
111
+ - app/assets/stylesheets/active_scaffold-ie.css.scss
112
112
  - app/assets/stylesheets/active_scaffold.css.scss
113
113
  - app/assets/stylesheets/active_scaffold_colors.css.scss
114
114
  - app/assets/stylesheets/active_scaffold_extensions.css.erb
@@ -201,6 +201,8 @@ files:
201
201
  - lib/active_scaffold/bridges.rb
202
202
  - lib/active_scaffold/bridges/ancestry.rb
203
203
  - lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb
204
+ - lib/active_scaffold/bridges/bitfields.rb
205
+ - lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb
204
206
  - lib/active_scaffold/bridges/calendar_date_select.rb
205
207
  - lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb
206
208
  - lib/active_scaffold/bridges/cancan.rb
@@ -1,35 +0,0 @@
1
- /* IE hacks
2
- ==================================== */
3
-
4
- * html .active-scaffold-header,
5
- .active-scaffold li.form-element,
6
- .active-scaffold li.sub-section {
7
- zoom: 1;
8
- }
9
-
10
- * html .active-scaffold td .messages-container {
11
- border-top: solid 1px #DAFFCD;
12
- }
13
-
14
- * html .active-scaffold-header div.actions a.show_search {
15
- background-image: none;
16
- filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/active_scaffold/default/magnifier.png', sizingMethod='crop');
17
- }
18
-
19
- * html .active-scaffold .sub-form .association-record a.destroy {
20
- background-image: none;
21
- filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../../images/active_scaffold/default/cross.png', sizingMethod='crop');
22
- }
23
-
24
- .active-scaffold-header div.actions a.disabled {
25
- filter: alpha(opacity=50);
26
- }
27
-
28
- .active-scaffold .show-view dd,
29
- .active-scaffold li.form-element dd {
30
- float: none;
31
- }
32
-
33
- .active-scaffold li.form-element dt {
34
- padding: 4px 0;
35
- }