active_scaffold 3.2.11 → 3.2.12
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +23 -2
- data/app/assets/javascripts/jquery/active_scaffold.js +55 -46
- data/app/assets/javascripts/prototype/active_scaffold.js +54 -35
- data/app/assets/stylesheets/active_scaffold_layout.css +4 -0
- data/config/locales/de.yml +5 -0
- data/config/locales/en.yml +5 -0
- data/config/locales/es.yml +5 -0
- data/config/locales/fr.yml +5 -0
- data/config/locales/hu.yml +5 -0
- data/config/locales/ja.yml +5 -0
- data/config/locales/ru.yml +5 -0
- data/frontends/default/views/_form_association.html.erb +2 -2
- data/frontends/default/views/_form_association_footer.html.erb +2 -2
- data/frontends/default/views/_horizontal_subform.html.erb +3 -3
- data/frontends/default/views/_list_inline_adapter.html.erb +7 -4
- data/frontends/default/views/_list_messages.html.erb +2 -1
- data/frontends/default/views/_messages.html.erb +1 -1
- data/frontends/default/views/_row.html.erb +1 -6
- data/frontends/default/views/_vertical_subform.html.erb +2 -2
- data/frontends/default/views/add_existing.js.erb +1 -1
- data/frontends/default/views/destroy.js.erb +2 -2
- data/frontends/default/views/on_action_update.js.erb +1 -1
- data/frontends/default/views/on_create.js.erb +3 -17
- data/frontends/default/views/on_mark.js.erb +6 -0
- data/frontends/default/views/on_update.js.erb +4 -13
- data/frontends/default/views/row.js.erb +1 -0
- data/lib/active_scaffold.rb +1 -0
- data/lib/active_scaffold/actions/core.rb +9 -7
- data/lib/active_scaffold/actions/create.rb +1 -1
- data/lib/active_scaffold/actions/delete.rb +1 -1
- data/lib/active_scaffold/actions/list.rb +11 -4
- data/lib/active_scaffold/actions/mark.rb +35 -24
- data/lib/active_scaffold/actions/nested.rb +3 -1
- data/lib/active_scaffold/actions/subform.rb +2 -2
- data/lib/active_scaffold/config/core.rb +17 -1
- data/lib/active_scaffold/config/form.rb +1 -1
- data/lib/active_scaffold/config/list.rb +0 -8
- data/lib/active_scaffold/config/mark.rb +7 -12
- data/lib/active_scaffold/data_structures/action_columns.rb +19 -15
- data/lib/active_scaffold/data_structures/nested_info.rb +27 -7
- data/lib/active_scaffold/extensions/routing_mapper.rb +2 -2
- data/lib/active_scaffold/finder.rb +12 -11
- data/lib/active_scaffold/helpers/controller_helpers.rb +5 -9
- data/lib/active_scaffold/helpers/form_column_helpers.rb +3 -3
- data/lib/active_scaffold/helpers/id_helpers.rb +5 -1
- data/lib/active_scaffold/helpers/list_column_helpers.rb +55 -40
- data/lib/active_scaffold/helpers/view_helpers.rb +22 -6
- data/lib/active_scaffold/marked_model.rb +4 -4
- data/lib/active_scaffold/tableless.rb +18 -0
- data/lib/active_scaffold/version.rb +1 -1
- data/test/config/list_test.rb +0 -6
- metadata +18 -18
- data/frontends/default/views/on_mark_all.js.erb +0 -12
@@ -123,9 +123,11 @@ module ActiveScaffold
|
|
123
123
|
url_options[:controller] = link.controller.to_s if link.controller
|
124
124
|
url_options.delete(:search) if link.controller and link.controller.to_s != params[:controller]
|
125
125
|
url_options.merge! link.parameters if link.parameters
|
126
|
-
|
127
|
-
|
128
|
-
|
126
|
+
if link.dynamic_parameters.is_a?(Proc)
|
127
|
+
@link_record = record
|
128
|
+
url_options.merge! self.instance_eval(&(link.dynamic_parameters))
|
129
|
+
@link_record = nil
|
130
|
+
end
|
129
131
|
url_options_for_nested_link(link.column, record, link, url_options, options) if link.nested_link?
|
130
132
|
url_options_for_sti_link(link.column, record, link, url_options, options) unless record.nil? || active_scaffold_config.sti_children.nil?
|
131
133
|
url_options[:_method] = link.method if !link.confirm? && link.inline? && link.method != :get
|
@@ -180,7 +182,7 @@ module ActiveScaffold
|
|
180
182
|
if link.image.nil?
|
181
183
|
html = link_to(label, url, html_options)
|
182
184
|
else
|
183
|
-
html = link_to(image_tag(link.image[:name]
|
185
|
+
html = link_to(image_tag(link.image[:name], :size => link.image[:size], :alt => label, :title => label), url, html_options)
|
184
186
|
end
|
185
187
|
# if url is nil we would like to generate an anchor without href attribute
|
186
188
|
url.nil? ? html.sub(/href=".*?"/, '').html_safe : html.html_safe
|
@@ -195,7 +197,8 @@ module ActiveScaffold
|
|
195
197
|
url_options[active_scaffold_config.model.name.foreign_key.to_sym] = url_options.delete(:id)
|
196
198
|
url_options[:eid] = nil # needed for nested scaffolds open from an embedded scaffold
|
197
199
|
end
|
198
|
-
|
200
|
+
url_options.except! *params_conditions
|
201
|
+
url_options.except! *nested.constrained_fields if nested?
|
199
202
|
end
|
200
203
|
|
201
204
|
def url_options_for_sti_link(column, record, link, url_options, options = {})
|
@@ -237,7 +240,7 @@ module ActiveScaffold
|
|
237
240
|
classes << 'empty' if column_empty? column_value
|
238
241
|
classes << 'sorted' if active_scaffold_config.list.user.sorting.sorts_on?(column)
|
239
242
|
classes << 'numeric' if column.column and [:decimal, :float, :integer].include?(column.column.type)
|
240
|
-
classes << 'in_place_editor_field' if inplace_edit?(record, column)
|
243
|
+
classes << 'in_place_editor_field' if inplace_edit?(record, column) or column.list_ui == :marked
|
241
244
|
classes.join(' ').rstrip
|
242
245
|
end
|
243
246
|
|
@@ -308,6 +311,19 @@ module ActiveScaffold
|
|
308
311
|
method if respond_to?(method)
|
309
312
|
end
|
310
313
|
|
314
|
+
def display_message(message)
|
315
|
+
if (highlights = active_scaffold_config.highlight_messages)
|
316
|
+
message = highlights.inject(message) do |msg, (phrases, highlighter)|
|
317
|
+
highlight(msg, phrases, highlighter)
|
318
|
+
end
|
319
|
+
end
|
320
|
+
if (format = active_scaffold_config.timestamped_messages)
|
321
|
+
format = :short if format == true
|
322
|
+
message = "#{content_tag :div, l(Time.current, :format => format), :class => 'timestamp'} #{content_tag :div, message, :class => 'message-content'}".html_safe
|
323
|
+
end
|
324
|
+
message
|
325
|
+
end
|
326
|
+
|
311
327
|
def active_scaffold_error_messages_for(*params)
|
312
328
|
options = params.extract_options!.symbolize_keys
|
313
329
|
options.reverse_merge!(:container_tag => :div, :list_type => :ul)
|
@@ -4,17 +4,17 @@ module ActiveScaffold
|
|
4
4
|
|
5
5
|
def self.included(base)
|
6
6
|
base.extend ClassMethods
|
7
|
-
base.scope :
|
7
|
+
base.scope :as_marked, lambda { where(:id => base.marked_records.to_a) }
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def as_marked
|
11
11
|
marked_records.include?(self.id)
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def as_marked=(value)
|
15
15
|
value = [true, 'true', 1, '1', 'T', 't'].include?(value.class == String ? value.downcase : value)
|
16
16
|
if value == true
|
17
|
-
marked_records << self.id if !
|
17
|
+
marked_records << self.id if !as_marked
|
18
18
|
else
|
19
19
|
marked_records.delete(self.id)
|
20
20
|
end
|
@@ -25,6 +25,12 @@ class ActiveScaffold::Tableless < ActiveRecord::Base
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def except(*skips)
|
29
|
+
super.tap do |new_relation|
|
30
|
+
new_relation.conditions = conditions unless skips.include? :where
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
28
34
|
def to_a
|
29
35
|
@klass.find_all(self)
|
30
36
|
end
|
@@ -32,6 +38,10 @@ class ActiveScaffold::Tableless < ActiveRecord::Base
|
|
32
38
|
def find_one(id)
|
33
39
|
@klass.find_one(id, self)
|
34
40
|
end
|
41
|
+
|
42
|
+
def execute_simple_calculation(operation, column_name, distinct)
|
43
|
+
@klass.execute_simple_calculation(self, operation, column_name, distinct)
|
44
|
+
end
|
35
45
|
end
|
36
46
|
|
37
47
|
def self.columns; @columns ||= []; end
|
@@ -60,6 +70,14 @@ class ActiveScaffold::Tableless < ActiveRecord::Base
|
|
60
70
|
raise 'self.find_one must be implemented in a Tableless model'
|
61
71
|
end
|
62
72
|
|
73
|
+
def self.execute_simple_calculation(relation, operation, column_name, distinct)
|
74
|
+
if operation == 'count' && column_name == :all && !distinct
|
75
|
+
find_all(relation).size
|
76
|
+
else
|
77
|
+
raise "self.execute_simple_calculation must be implemented in a Tableless model to support #{operation} #{column_name} #{' distinct' if distinct} columns"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
63
81
|
def destroy
|
64
82
|
raise 'destroy must be implemented in a Tableless model'
|
65
83
|
end
|
data/test/config/list_test.rb
CHANGED
@@ -25,7 +25,6 @@ class Config::ListTest < Test::Unit::TestCase
|
|
25
25
|
assert_equal :filtered, @config.list.filtered_message
|
26
26
|
assert !@config.list.always_show_create
|
27
27
|
assert !@config.list.always_show_search
|
28
|
-
assert !@config.list.mark_records
|
29
28
|
assert @config.list.count_includes.nil?
|
30
29
|
assert_equal 'ModelStubs', @config.list.label
|
31
30
|
assert @config.list.sorting.sorts_on?(:id)
|
@@ -73,11 +72,6 @@ class Config::ListTest < Test::Unit::TestCase
|
|
73
72
|
assert !@config.list.sorting.sorts_on?(:id)
|
74
73
|
end
|
75
74
|
|
76
|
-
def test_mark_records
|
77
|
-
@config.list.mark_records = true
|
78
|
-
assert @config.list.mark_records
|
79
|
-
end
|
80
|
-
|
81
75
|
def test_per_page
|
82
76
|
per_page = 35
|
83
77
|
@config.list.per_page = per_page
|
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: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 12
|
10
|
+
version: 3.2.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Many, see README
|
@@ -15,11 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-06-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
prerelease: false
|
21
|
+
type: :development
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
@@ -29,11 +28,11 @@ dependencies:
|
|
29
28
|
segments:
|
30
29
|
- 0
|
31
30
|
version: "0"
|
32
|
-
type: :development
|
33
31
|
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: bundler
|
36
32
|
prerelease: false
|
33
|
+
name: shoulda
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
type: :development
|
37
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
37
|
none: false
|
39
38
|
requirements:
|
@@ -45,11 +44,11 @@ dependencies:
|
|
45
44
|
- 0
|
46
45
|
- 0
|
47
46
|
version: 1.0.0
|
48
|
-
type: :development
|
49
47
|
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rcov
|
52
48
|
prerelease: false
|
49
|
+
name: bundler
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
type: :development
|
53
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
53
|
none: false
|
55
54
|
requirements:
|
@@ -59,11 +58,11 @@ dependencies:
|
|
59
58
|
segments:
|
60
59
|
- 0
|
61
60
|
version: "0"
|
62
|
-
type: :development
|
63
61
|
version_requirements: *id003
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: rails
|
66
62
|
prerelease: false
|
63
|
+
name: rcov
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
type: :runtime
|
67
66
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
67
|
none: false
|
69
68
|
requirements:
|
@@ -75,8 +74,9 @@ dependencies:
|
|
75
74
|
- 1
|
76
75
|
- 3
|
77
76
|
version: 3.1.3
|
78
|
-
type: :runtime
|
79
77
|
version_requirements: *id004
|
78
|
+
prerelease: false
|
79
|
+
name: rails
|
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: []
|
@@ -177,7 +177,7 @@ files:
|
|
177
177
|
- frontends/default/views/list.html.erb
|
178
178
|
- frontends/default/views/on_action_update.js.erb
|
179
179
|
- frontends/default/views/on_create.js.erb
|
180
|
-
- frontends/default/views/
|
180
|
+
- frontends/default/views/on_mark.js.erb
|
181
181
|
- frontends/default/views/on_update.js.erb
|
182
182
|
- frontends/default/views/refresh_list.js.erb
|
183
183
|
- frontends/default/views/render_field.js.erb
|
@@ -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.
|
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
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<%options = {:checked => mark_all,
|
2
|
-
:include_mark_all => true}%>
|
3
|
-
ActiveScaffold.mark_records('<%=active_scaffold_tbody_id%>',<%=options.to_json.html_safe%>);
|
4
|
-
<%if active_scaffold_config.model.marked.length>0 then %>
|
5
|
-
<%if active_scaffold_config.model.marked.length < @page.pager.count then%>
|
6
|
-
ActiveScaffold.replace_html('<%=active_scaffold_messages_id%>','<%="#{active_scaffold_config.model.marked.length.to_s} records marked. Press <a href=\"#{url_for(:action=>"mark_all",:mark_target=>"scope")}\">here</a> to select all #{@page.pager.count} records.".html_safe%>');
|
7
|
-
<%else%>
|
8
|
-
ActiveScaffold.replace_html('<%=active_scaffold_messages_id%>','<%="All #{@page.pager.count} records marked".html_safe%>');
|
9
|
-
<%end%>
|
10
|
-
<%else%>
|
11
|
-
ActiveScaffold.replace_html('<%=active_scaffold_messages_id%>','');
|
12
|
-
<%end%>
|