active_scaffold 3.3.0.rc3 → 3.3.0

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.
Files changed (60) hide show
  1. data/CHANGELOG +16 -4
  2. data/README.md +67 -0
  3. data/app/assets/javascripts/jquery/active_scaffold.js +9 -9
  4. data/app/views/active_scaffold_overrides/_form.html.erb +4 -4
  5. data/app/views/active_scaffold_overrides/_form_association.html.erb +3 -2
  6. data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +6 -4
  7. data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +1 -1
  8. data/app/views/active_scaffold_overrides/_list.html.erb +1 -1
  9. data/app/views/active_scaffold_overrides/_list_messages.html.erb +1 -1
  10. data/app/views/active_scaffold_overrides/_refresh_list.js.erb +4 -0
  11. data/app/views/active_scaffold_overrides/_render_field.js.erb +3 -2
  12. data/app/views/active_scaffold_overrides/_vertical_subform.html.erb +1 -1
  13. data/app/views/active_scaffold_overrides/edit_associated.js.erb +1 -1
  14. data/app/views/active_scaffold_overrides/on_create.js.erb +2 -1
  15. data/app/views/active_scaffold_overrides/render_field_inplace.html.erb +6 -1
  16. data/config/locales/ru.yml +6 -6
  17. data/lib/active_scaffold/actions/core.rb +2 -2
  18. data/lib/active_scaffold/actions/create.rb +1 -0
  19. data/lib/active_scaffold/actions/field_search.rb +4 -5
  20. data/lib/active_scaffold/actions/list.rb +13 -13
  21. data/lib/active_scaffold/actions/mark.rb +1 -1
  22. data/lib/active_scaffold/actions/search.rb +2 -2
  23. data/lib/active_scaffold/actions/show.rb +3 -3
  24. data/lib/active_scaffold/actions/subform.rb +2 -1
  25. data/lib/active_scaffold/actions/update.rb +1 -0
  26. data/lib/active_scaffold/attribute_params.rb +6 -2
  27. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +4 -1
  28. data/lib/active_scaffold/bridges/calendar_date_select.rb +1 -1
  29. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +2 -2
  30. data/lib/active_scaffold/bridges/date_picker/helper.rb +1 -1
  31. data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +2 -2
  32. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +1 -1
  33. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +2 -2
  34. data/lib/active_scaffold/bridges/file_column.rb +1 -1
  35. data/lib/active_scaffold/bridges/paperclip/form_ui.rb +2 -2
  36. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +1 -1
  37. data/lib/active_scaffold/bridges/paperclip.rb +1 -1
  38. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +1 -1
  39. data/lib/active_scaffold/config/list.rb +9 -1
  40. data/lib/active_scaffold/constraints.rb +2 -2
  41. data/lib/active_scaffold/data_structures/action_columns.rb +2 -2
  42. data/lib/active_scaffold/data_structures/action_links.rb +3 -3
  43. data/lib/active_scaffold/data_structures/column.rb +16 -1
  44. data/lib/active_scaffold/extensions/action_view_rendering.rb +17 -5
  45. data/lib/active_scaffold/extensions/left_outer_joins.rb +33 -0
  46. data/lib/active_scaffold/extensions/paginator_extensions.rb +8 -0
  47. data/lib/active_scaffold/extensions/unsaved_associated.rb +4 -4
  48. data/lib/active_scaffold/finder.rb +13 -7
  49. data/lib/active_scaffold/helpers/controller_helpers.rb +11 -1
  50. data/lib/active_scaffold/helpers/form_column_helpers.rb +50 -27
  51. data/lib/active_scaffold/helpers/list_column_helpers.rb +9 -3
  52. data/lib/active_scaffold/helpers/view_helpers.rb +8 -8
  53. data/lib/active_scaffold/tableless.rb +8 -0
  54. data/lib/active_scaffold/version.rb +1 -1
  55. data/lib/active_scaffold.rb +1 -0
  56. data/lib/generators/active_scaffold_controller/templates/controller.rb +7 -1
  57. metadata +7 -10
  58. data/README +0 -66
  59. data/app/views/active_scaffold_overrides/_form_attribute.html.erb +0 -27
  60. data/app/views/active_scaffold_overrides/_form_hidden_attribute.html.erb +0 -7
@@ -49,10 +49,6 @@ module ActiveScaffold
49
49
  lookup_context.exists? template_name, '', partial
50
50
  end
51
51
 
52
- def generate_temporary_id
53
- (Time.now.to_f*1000).to_i.to_s
54
- end
55
-
56
52
  # Turns [[label, value]] into <option> tags
57
53
  # Takes optional parameter of :include_blank
58
54
  def option_tags_for(select_options, options = {})
@@ -169,7 +165,7 @@ module ActiveScaffold
169
165
  options.delete :link if link.crud_type == :create
170
166
  end
171
167
  if link.action.nil? || (link.type == :member && options.has_key?(:authorized) && !options[:authorized])
172
- action_link_html(link, nil, {:link => options[:link], :class => "disabled #{link.action}#{" #{link.html_options[:class]}" unless link.html_options[:class].blank?}"}, record)
168
+ action_link_html(link, nil, {:link => action_link_text(link, options), :class => "disabled #{link.action}#{" #{link.html_options[:class]}" unless link.html_options[:class].blank?}"}, record)
173
169
  else
174
170
  url = action_link_url(link, record)
175
171
  html_options = action_link_html_options(link, record, options)
@@ -321,10 +317,15 @@ module ActiveScaffold
321
317
  url_options
322
318
  end
323
319
 
320
+ def action_link_text(link, options)
321
+ text = image_tag(link.image[:name], :size => link.image[:size], :alt => options[:link] || link.label, :title => options[:link] || link.label) if link.image
322
+ text || options[:link]
323
+ end
324
+
324
325
  def action_link_html_options(link, record, options)
325
326
  link_id = get_action_link_id(link, record)
326
327
  html_options = link.html_options.merge(:class => [link.html_options[:class], link.action.to_s].compact.join(' '))
327
- html_options[:link] = options[:link] if options[:link]
328
+ html_options[:link] = action_link_text(link, options)
328
329
 
329
330
  # Needs to be in html_options to as the adding _method to the url is no longer supported by Rails
330
331
  html_options[:method] = link.method if link.method != :get
@@ -374,7 +375,6 @@ module ActiveScaffold
374
375
  def action_link_html(link, url, html_options, record)
375
376
  label = html_options.delete(:link)
376
377
  label ||= link.label
377
- label = image_tag(link.image[:name], :size => link.image[:size], :alt => label, :title => label) if link.image
378
378
  if url.nil?
379
379
  content_tag(:a, label, html_options)
380
380
  else
@@ -469,7 +469,7 @@ module ActiveScaffold
469
469
 
470
470
  def column_calculation(column)
471
471
  unless column.calculate.instance_of? Proc
472
- calculate(column)
472
+ calculate_query.calculate(column.calculate, column.name)
473
473
  else
474
474
  column.calculate.call(@records)
475
475
  end
@@ -79,4 +79,12 @@ class ActiveScaffold::Tableless < ActiveRecord::Base
79
79
  def destroy
80
80
  raise 'destroy must be implemented in a Tableless model'
81
81
  end
82
+
83
+ def create #:nodoc:
84
+ run_callbacks(:create) {}
85
+ end
86
+
87
+ def update(*) #:nodoc:
88
+ run_callbacks(:update) {}
89
+ end
82
90
  end
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 3
5
- PATCH = "0.rc3"
5
+ PATCH = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -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'
@@ -1,4 +1,10 @@
1
+ <% if namespaced? -%>
2
+ require_dependency "<%= namespaced_file_path %>/application_controller"
3
+
4
+ <% end -%>
5
+ <% module_namespacing do -%>
1
6
  class <%= controller_class_name %>Controller < ApplicationController
2
- active_scaffold :<%= class_name.demodulize.underscore %> do |conf|
7
+ active_scaffold :"<%= class_name.underscore %>" do |conf|
3
8
  end
4
9
  end
10
+ <% end -%>
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- hash: 2488911141
5
- prerelease: 6
4
+ hash: 11
5
+ prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
9
  - 0
10
- - rc
11
- - 3
12
- version: 3.3.0.rc3
10
+ version: 3.3.0
13
11
  platform: ruby
14
12
  authors:
15
13
  - Many, see README
@@ -17,7 +15,7 @@ autorequire:
17
15
  bindir: bin
18
16
  cert_chain: []
19
17
 
20
- date: 2013-03-06 00:00:00 Z
18
+ date: 2013-05-08 00:00:00 Z
21
19
  dependencies:
22
20
  - !ruby/object:Gem::Dependency
23
21
  type: :development
@@ -86,7 +84,7 @@ executables: []
86
84
  extensions: []
87
85
 
88
86
  extra_rdoc_files:
89
- - README
87
+ - README.md
90
88
  files:
91
89
  - app/assets/images/active_scaffold/add.png
92
90
  - app/assets/images/active_scaffold/arrow_down.png
@@ -128,8 +126,6 @@ files:
128
126
  - app/views/active_scaffold_overrides/_form_association.html.erb
129
127
  - app/views/active_scaffold_overrides/_form_association_footer.html.erb
130
128
  - app/views/active_scaffold_overrides/_form_association_record.html.erb
131
- - app/views/active_scaffold_overrides/_form_attribute.html.erb
132
- - app/views/active_scaffold_overrides/_form_hidden_attribute.html.erb
133
129
  - app/views/active_scaffold_overrides/_form_messages.html.erb
134
130
  - app/views/active_scaffold_overrides/_horizontal_subform.html.erb
135
131
  - app/views/active_scaffold_overrides/_horizontal_subform_footer.html.erb
@@ -281,6 +277,7 @@ files:
281
277
  - lib/active_scaffold/extensions/action_view_rendering.rb
282
278
  - lib/active_scaffold/extensions/array.rb
283
279
  - lib/active_scaffold/extensions/cache_association.rb
280
+ - lib/active_scaffold/extensions/left_outer_joins.rb
284
281
  - lib/active_scaffold/extensions/localize.rb
285
282
  - lib/active_scaffold/extensions/name_option_for_datetime.rb
286
283
  - lib/active_scaffold/extensions/paginator_extensions.rb
@@ -333,7 +330,7 @@ files:
333
330
  - vendor/assets/stylesheets/jquery-ui.css
334
331
  - MIT-LICENSE
335
332
  - CHANGELOG
336
- - README
333
+ - README.md
337
334
  - test/bridges/active_scaffold_dependent_protect_test.rb
338
335
  - test/bridges/bridge_test.rb
339
336
  - test/bridges/company.rb
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)
@@ -1,27 +0,0 @@
1
- <%
2
- scope ||= nil
3
- column_options = active_scaffold_input_options(column, scope)
4
- attributes = field_attributes(column, @record)
5
- if local_assigns[:col_class].present?
6
- attributes[:class] = "#{attributes[:class]} #{col_class}"
7
- end
8
- %>
9
- <%= tag :dl, attributes, true %>
10
- <dt>
11
- <label for="<%= column_options[:id] %>"><%= column.label %></label>
12
- </dt>
13
- <dd>
14
- <% unless local_assigns[:only_value] %>
15
- <%=raw active_scaffold_input_for column, scope %>
16
- <% else %>
17
- <%= content_tag :span, get_column_value(@record, column), column_options.except(:name) %>
18
- <%= hidden_field :record, column.association ? column.association.foreign_key : column.name, column_options -%>
19
- <% end %>
20
- <% if column.update_columns -%>
21
- <%= loading_indicator_tag(:action => :render_field, :id => params[:id]) %>
22
- <% end -%>
23
- <% if column.description.present? -%>
24
- <span class="description"><%= column.description %></span>
25
- <% end -%>
26
- </dd>
27
- </dl>
@@ -1,7 +0,0 @@
1
- <% scope ||= nil %>
2
- <dl style="display: none;">
3
- <dt></dt>
4
- <dd>
5
- <%= hidden_field :record, column.name, active_scaffold_input_options(column, scope) %>
6
- </dd>
7
- </dl>