active_scaffold 3.2.19 → 3.2.20

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,9 @@
1
- = 3.2.19 (not released yet)
1
+ = 3.2.20
2
+ - Some fixes for ruby 1.9
3
+ - Some fixes for rails 3.1
4
+ - Fix detection of empty for has_and_belongs_to_many on subforms
5
+
6
+ = 3.2.19
2
7
  - Avoid crashing when between is chosen and from or to is not filled
3
8
 
4
9
  = 3.2.18
@@ -0,0 +1,67 @@
1
+ Overview
2
+ ========
3
+ ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control.
4
+
5
+ Branch Details
6
+ --------------
7
+ This branch (rails-3.2) on Github supports Rails 3.1 & 3.2, and is the current source of the 3.2.x line of gems. The master branch has dropped support for Rails 3.1
8
+
9
+ Quick Start
10
+ -----------
11
+ To get started with a new Rails project
12
+
13
+ Added to Gemfile
14
+
15
+ gem 'active_scaffold'
16
+
17
+ Run the following commands
18
+
19
+ bundle install
20
+ bundle exec rake db:create
21
+ rails g active_scaffold User name:string
22
+ bundle exec rake db:migrate
23
+
24
+ Add the following line to app/assets/javascripts/application.js
25
+
26
+ //= require active_scaffold
27
+
28
+ Add the following line to /app/assets/stylesheets/application.css
29
+
30
+ *= require active_scaffold
31
+
32
+ Run the app and visit localhost:3000/teams
33
+
34
+ Configuration
35
+ -------------
36
+ See Wiki for instructions on customising ActiveScaffold and to find the full API details.
37
+
38
+ Compatability Issues
39
+ --------------------
40
+ jQuery 1.9 deprecates some methods that this branch still uses (NB: jQuery 1.9 is supported in the master branch). You'll therefore need to ensure you use jQuery 1.8. You can do this by fixing version in your Gemfile:
41
+
42
+ gem 'jquery-rails', '2.1.4'
43
+
44
+ active_scaffold_batch plugin gem (versions 3.2.x) require the master branch. Therefore if you wish to try using active_scaffold_batch with this branch, you'll need to fork the project and edit the runtime dependency in the gempsec file (use at your own discretion)
45
+
46
+ Credits
47
+ -------
48
+ ActiveScaffold grew out of a project named Ajaxscaffold dating back to 2006. It has had numerous contributors including:
49
+
50
+ 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)
51
+
52
+ Uses DhtmlHistory by Brad Neuberg (bkn3@columbia.edu)
53
+ http://codinginparadise.org
54
+
55
+ Uses Querystring by Adam Vandenberg
56
+ http://adamv.com/dev/javascript/querystring
57
+
58
+ Uses Paginator by Bruce Williams
59
+ http://paginator.rubyforge.org/
60
+
61
+ Supports RecordSelect by Lance Ivy
62
+ http://code.google.com/p/recordselect/
63
+
64
+
65
+ License
66
+ =======
67
+ Released under the MIT license (included)
@@ -1,3 +1,4 @@
1
+ <%# encoding: utf-8 %>
1
2
  <%= ActiveScaffold::Bridges[:date_picker].localization %>
2
3
 
3
4
  jQuery(document).ready(function() {
@@ -17,7 +17,7 @@ action_link.update_flash_messages('<%=escape_javascript(render(:partial => 'mess
17
17
  <% elsif params[:parent_controller].nil? %>
18
18
  <% new_row = render :partial => 'list_record', :locals => {:record => @record} %>
19
19
  ActiveScaffold.create_record_row(action_link.scaffold(),'<%= escape_javascript(new_row) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
20
- <%= render :partial => 'update_calculations', :formats => [:js] %>
20
+ <%= render :partial => 'update_calculations.js' %>
21
21
  <% end %>
22
22
 
23
23
  <% unless render_parent? %>
@@ -6,7 +6,7 @@ action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'mes
6
6
  <% if params[:dont_close] %>
7
7
  <% row_selector = element_row_id(:action => :list, :id => @record.id) %>
8
8
  ActiveScaffold.update_row('<%= row_selector %>', '<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
9
- <%= render :partial => 'update_calculations', :formats => [:js] %>
9
+ <%= render :partial => 'update_calculations.js' %>
10
10
  ActiveScaffold.scroll_to('<%= row_selector %>', true);
11
11
  <% else %>
12
12
  <% if render_parent? %>
@@ -19,7 +19,7 @@ action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'mes
19
19
  <%= render :partial => 'refresh_list' %>
20
20
  <% else %>
21
21
  action_link.close('<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
22
- <%= render :partial => 'update_calculations', :formats => [:js] %>
22
+ <%= render :partial => 'update_calculations.js' %>
23
23
  <% end %>
24
24
  <% end %>
25
25
  <% else %>
@@ -16,6 +16,7 @@ require 'active_scaffold/engine' unless defined? ACTIVE_SCAFFOLD_PLUGIN
16
16
  require 'json' # for js_config
17
17
 
18
18
  module ActiveScaffold
19
+ METHOD_CONVERSION = RUBY_VERSION < '1.9' ? :to_s : :to_sym
19
20
  autoload :AttributeParams, 'active_scaffold/attribute_params'
20
21
  autoload :Configurable, 'active_scaffold/configurable'
21
22
  autoload :Constraints, 'active_scaffold/constraints'
@@ -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', :formats => [:js], :layout => false
37
+ render :action => 'on_create.js', :layout => false
38
38
  end
39
39
  else
40
40
  if successful?
@@ -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', :formats => [:js], :layout => false
38
+ render :action => 'on_update.js', :layout => false
39
39
  end
40
40
  else # just a regular post
41
41
  if successful?
@@ -190,7 +190,7 @@ module ActiveScaffold
190
190
  if value.is_a?(Hash)
191
191
  attributes_hash_is_empty?(value, klass)
192
192
  elsif value.is_a?(Array)
193
- value.any? {|id| id.respond_to?(:empty?) ? !id.empty? : true}
193
+ value.all?(&:blank?)
194
194
  else
195
195
  value.respond_to?(:empty?) ? value.empty? : false
196
196
  end
@@ -3,7 +3,7 @@ class ActiveScaffold::Bridges::CalendarDateSelect < ActiveScaffold::DataStructur
3
3
  # check to see if the old bridge was installed. If so, warn them
4
4
  # we can detect this by checking to see if the bridge was installed before calling this code
5
5
 
6
- if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_calendar_date_select")
6
+ if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_calendar_date_select".send(::ActiveScaffold::METHOD_CONVERSION))
7
7
  raise RuntimeError, "We've detected that you have active_scaffold_calendar_date_select_bridge installed. This plugin has been moved to core. Please remove active_scaffold_calendar_date_select_bridge to prevent any conflicts"
8
8
  end
9
9
 
@@ -1,6 +1,6 @@
1
1
  class ActiveScaffold::Bridges::FileColumn < ActiveScaffold::DataStructures::Bridge
2
2
  def self.install
3
- if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_file_column")
3
+ if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_file_column".send(::ActiveScaffold::METHOD_CONVERSION))
4
4
  raise RuntimeError, "We've detected that you have active_scaffold_file_column_bridge installed. This plugin has been moved to core. Please remove active_scaffold_file_column_bridge to prevent any conflicts"
5
5
  end
6
6
  require File.join(File.dirname(__FILE__), "file_column/as_file_column_bridge")
@@ -24,7 +24,7 @@ module ActiveScaffold::Config
24
24
  }
25
25
  end
26
26
 
27
- alias_method_chain :initialize, :file_column unless self.instance_methods.include?("initialize_without_file_column")
27
+ alias_method_chain :initialize, :file_column unless self.instance_methods.include?("initialize_without_file_column".send(::ActiveScaffold::METHOD_CONVERSION))
28
28
 
29
29
  def configure_file_column_field(field)
30
30
  # set list_ui first because it gets its default value from form_ui
@@ -4,12 +4,12 @@ module ActiveScaffold
4
4
  module FileColumnHelpers
5
5
  class << self
6
6
  def file_column_fields(klass)
7
- klass.instance_methods.grep(/_just_uploaded\?$/).collect{|m| m[0..-16].to_sym }
7
+ klass.instance_methods.select{|m| m.to_s =~ /_just_uploaded\?$/}.collect{|m| m[0..-16].to_sym }
8
8
  end
9
9
 
10
10
  def generate_delete_helpers(klass)
11
11
  file_column_fields(klass).each { |field|
12
- klass.send :class_eval, <<-EOF, __FILE__, __LINE__ + 1 unless klass.methods.include?("#{field}_with_delete=")
12
+ klass.send :class_eval, <<-EOF, __FILE__, __LINE__ + 1 unless klass.methods.include?("#{field}_with_delete=".send(::ActiveScaffold::METHOD_CONVERSION))
13
13
  attr_reader :delete_#{field}
14
14
 
15
15
  def delete_#{field}=(value)
@@ -1,6 +1,6 @@
1
1
  class ActiveScaffold::Bridges::Paperclip < ActiveScaffold::DataStructures::Bridge
2
2
  def self.install
3
- if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_paperclip")
3
+ if ActiveScaffold::Config::Core.instance_methods.include?("initialize_with_paperclip".send(::ActiveScaffold::METHOD_CONVERSION))
4
4
  raise RuntimeError, "We've detected that you have active_scaffold_paperclip_bridge installed. This plugin has been moved to core. Please remove active_scaffold_paperclip_bridge to prevent any conflicts"
5
5
  end
6
6
  require File.join(File.dirname(__FILE__), "paperclip/form_ui")
@@ -6,7 +6,7 @@ module ActiveScaffold
6
6
  self.thumbnail_style = :thumbnail
7
7
 
8
8
  def self.generate_delete_helper(klass, field)
9
- klass.class_eval <<-EOF, __FILE__, __LINE__ + 1 unless klass.instance_methods.include?("delete_#{field}=")
9
+ klass.class_eval <<-EOF, __FILE__, __LINE__ + 1 unless klass.instance_methods.include?("delete_#{field}=".send(::ActiveScaffold::METHOD_CONVERSION))
10
10
  attr_reader :delete_#{field}
11
11
 
12
12
  def delete_#{field}=(value)
@@ -16,7 +16,7 @@ class ActiveScaffold::Bridges::TinyMce
16
16
  options[:class] = "#{options[:class]} mceEditor #{column.options[:class]}".strip
17
17
 
18
18
  settings = { :theme => 'simple' }.merge(column.options[:tinymce] || {})
19
- settings = settings.to_s.gsub(/:(.+?)\=\>/, '\1:')
19
+ settings = settings.to_json
20
20
  settings = "tinyMCE.settings = #{settings};"
21
21
 
22
22
  html = []
@@ -174,7 +174,11 @@ module ActiveScaffold::DataStructures
174
174
  end
175
175
 
176
176
  # a collection of columns to load when eager loading is disabled, if it's nil all columns will be loaded
177
- attr_accessor :select_columns
177
+ attr_accessor :select_associated_columns
178
+ def select_columns=(value)
179
+ ActiveSupport::Deprecation.warn "Use select_associated_columns= instead of select_columns="
180
+ self.select_associated_columns = value
181
+ end
178
182
 
179
183
  # describes how to search on a column
180
184
  # search = true default, uses intelligent search sql
@@ -357,8 +357,8 @@ module ActiveScaffold
357
357
 
358
358
  def append_to_query(query, options)
359
359
  options.assert_valid_keys :where, :select, :group, :reorder, :limit, :offset, :joins, :includes, :lock, :readonly, :from, :conditions
360
- query = apply_conditions(query, *options.delete(:conditions)) if options[:conditions]
361
- options.reject{|k, v| v.blank?}.inject(query) do |query, (k, v)|
360
+ query = apply_conditions(query, *options[:conditions]) if options[:conditions]
361
+ options.reject{|k, v| k == :conditions || v.blank?}.inject(query) do |query, (k, v)|
362
362
  query.send((k.to_sym), v)
363
363
  end
364
364
  end
@@ -237,7 +237,7 @@ module ActiveScaffold
237
237
  if column.associated_limit.nil?
238
238
  Rails.logger.warn "ActiveScaffold: Enable eager loading for #{column.name} association to reduce SQL queries"
239
239
  elsif column.associated_limit > 0
240
- value.target = value.find(:all, :limit => column.associated_limit + 1, :select => column.select_columns)
240
+ value.target = value.find(:all, :limit => column.associated_limit + 1, :select => column.select_associated_columns)
241
241
  elsif @cache_associations
242
242
  value.target = size.to_i.zero? ? [] : [nil]
243
243
  end
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- PATCH = 19
5
+ PATCH = 20
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: 41
4
+ hash: 39
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 19
10
- version: 3.2.19
9
+ - 20
10
+ version: 3.2.20
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: 2013-02-04 00:00:00 Z
18
+ date: 2013-04-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  type: :development
@@ -84,7 +84,7 @@ executables: []
84
84
  extensions: []
85
85
 
86
86
  extra_rdoc_files:
87
- - README
87
+ - README.md
88
88
  files:
89
89
  - app/assets/images/active_scaffold/add.png
90
90
  - app/assets/images/active_scaffold/arrow_down.png
@@ -332,7 +332,7 @@ files:
332
332
  - vendor/assets/stylesheets/jquery-ui.css
333
333
  - MIT-LICENSE
334
334
  - CHANGELOG
335
- - README
335
+ - README.md
336
336
  - test/bridges/active_scaffold_dependent_protect_test.rb
337
337
  - test/bridges/bridge_test.rb
338
338
  - test/bridges/company.rb
@@ -442,7 +442,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
442
442
  requirements: []
443
443
 
444
444
  rubyforge_project:
445
- rubygems_version: 1.8.24
445
+ rubygems_version: 1.8.23
446
446
  signing_key:
447
447
  specification_version: 3
448
448
  summary: Rails 3.1 Version of activescaffold supporting prototype and jquery
data/README DELETED
@@ -1,66 +0,0 @@
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)
2
-
3
- Uses DhtmlHistory by Brad Neuberg (bkn3@columbia.edu)
4
- http://codinginparadise.org
5
-
6
- Uses Querystring by Adam Vandenberg
7
- http://adamv.com/dev/javascript/querystring
8
-
9
- Uses Paginator by Bruce Williams
10
- http://paginator.rubyforge.org/
11
-
12
- Supports RecordSelect by Lance Ivy
13
- http://code.google.com/p/recordselect/
14
-
15
- == Version Information
16
-
17
- If you want to use the gem, add to your Gemfile:
18
- gem "active_scaffold"
19
-
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:
27
- Rails 3.0.*: Active Scaffold rails-3.0
28
- Rails 2.3.*: Active Scaffold rails-2.3 and v2.4
29
- Rails 2.2.*: Active Scaffold rails-2.2
30
- Rails 2.1.*: Active Scaffold rails-2.1
31
- Rails < 2.1: Active Scaffold 1-1-stable (no guarantees)
32
-
33
- Since Rails 2.3, render_component plugin is needed for nested and embedded scaffolds. It works with rails-2.3 branch from ewildgoose repository:
34
- script/plugin install git://github.com/ewildgoose/render_component.git -r rails-2.3
35
-
36
- Since Rails 3.0 render_component is not used for nesting, but is optional for embedded scaffolds.
37
- For Rails 3.0, https://github.com/rails/verification.git is also needed, not in rails 3.1 or higher.
38
-
39
- If you want to install as plugins under vendor/plugins, install these versions:
40
- rails plugin install git://github.com/vhochstein/render_component.git
41
- rails plugin install git://github.com/rails/verification.git
42
- rails plugin install git://github.com/activescaffold/active_scaffold.git -r 'rails-3.0'
43
-
44
- == Pick your own javascript framework
45
-
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 for rails 3.1 and later. For rails 3.0 pick a JS file:
48
-
49
- Prototype 1.7 (default js framework)
50
- rails.js in git://github.com/vhochstein/prototype-ujs.git
51
-
52
- JQuery 1.4.1, 1.4.2
53
- https://github.com/vhochstein/jquery-ujs/raw/jquery1_4_2/src/rails.js
54
-
55
- JQuery > 1.4.2
56
- https://github.com/vhochstein/jquery-ujs/raw/master/src/rails.js
57
-
58
- To configure the javascript framework when installed under vendor/plugins/
59
- uncomment last line in config/initializers/active_scaffold.rb in order to use jquery instead of prototype.
60
- That file is created when you install ActiveScaffold as a plugin.
61
-
62
- To configure the javascript framework when installed as a gem:
63
- Add a config/initializers/active_scaffold.rb containing:
64
- ActiveScaffold.js_framework = :jquery # :prototype is the default
65
-
66
- Released under the MIT license (included)