active_scaffold 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/CHANGELOG +5 -0
  2. data/active_scaffold.gemspec +1 -1
  3. data/frontends/default/stylesheets/stylesheet.css +40 -2
  4. data/lib/active_scaffold.rb +111 -21
  5. data/lib/active_scaffold/actions/nested.rb +5 -1
  6. data/lib/active_scaffold/actions/subform.rb +4 -1
  7. data/lib/active_scaffold/attribute_params.rb +4 -4
  8. data/lib/active_scaffold/bridges/bridge.rb +2 -5
  9. data/lib/active_scaffold/config/list.rb +9 -9
  10. data/lib/active_scaffold/config/update.rb +1 -1
  11. data/lib/active_scaffold/data_structures/action_links.rb +4 -3
  12. data/lib/active_scaffold/finder.rb +13 -13
  13. data/lib/active_scaffold/helpers/controller_helpers.rb +5 -3
  14. data/lib/active_scaffold/helpers/country_helpers.rb +263 -257
  15. data/lib/active_scaffold/helpers/form_column_helpers.rb +5 -5
  16. data/lib/active_scaffold/helpers/id_helpers.rb +2 -2
  17. data/lib/active_scaffold/helpers/search_column_helpers.rb +11 -11
  18. data/lib/active_scaffold/helpers/view_helpers.rb +15 -15
  19. data/lib/active_scaffold/marked_model.rb +6 -6
  20. data/lib/extensions/action_view_rendering.rb +5 -5
  21. data/lib/extensions/active_record_offset.rb +7 -7
  22. data/lib/extensions/localize.rb +1 -1
  23. data/lib/extensions/name_option_for_datetime.rb +1 -1
  24. data/lib/extensions/paginator_extensions.rb +2 -2
  25. data/lib/extensions/reverse_associations.rb +1 -1
  26. data/lib/extensions/routing_mapper.rb +2 -2
  27. data/lib/extensions/usa_state.rb +15 -11
  28. data/lib/generators/active_scaffold/active_scaffold_generator.rb +5 -5
  29. data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +2 -2
  30. data/lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb +10 -10
  31. metadata +4 -6
  32. data/environment.rb +0 -24
  33. data/install_assets.rb +0 -44
@@ -6,14 +6,14 @@ module Rails
6
6
  class ActiveScaffoldGenerator < ResourceGenerator #metagenerator
7
7
  remove_hook_for :resource_controller
8
8
  remove_class_option :actions
9
-
9
+
10
10
  def add_resource_route
11
- route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
11
+ route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
12
12
  route_config << "resources :#{file_name.pluralize} do as_routes end"
13
- route_config << " end" * class_path.size
13
+ route_config << " end" * class_path.size
14
14
  route route_config
15
- end
16
-
15
+ end
16
+
17
17
  invoke "active_scaffold_controller"
18
18
  end
19
19
  end
@@ -22,7 +22,7 @@ module Rails
22
22
 
23
23
  def create_view_root_folder
24
24
  empty_directory File.join("app/views", controller_file_path)
25
- end
25
+ end
26
26
  end
27
27
  end
28
- end
28
+ end
@@ -1,8 +1,8 @@
1
1
  module Rails
2
2
  module Generators
3
3
  class ActiveScaffoldSetupGenerator < Rails::Generators::Base #metagenerator
4
- argument :js_lib, :type => :string, :default => 'prototype', :desc => 'js_lib for activescaffold (prototype|jquery)'
5
-
4
+ argument :js_lib, :type => :string, :default => 'prototype', :desc => 'js_lib for activescaffold (prototype|jquery)'
5
+
6
6
  def self.source_root
7
7
  @source_root ||= File.join(File.dirname(__FILE__), 'templates')
8
8
  end
@@ -17,20 +17,20 @@ module Rails
17
17
  get "https://github.com/vhochstein/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js", "public/javascripts/jquery-ui-timepicker-addon.js"
18
18
  end
19
19
  end
20
-
20
+
21
21
  def configure_active_scaffold
22
22
  if js_lib == 'jquery'
23
23
  gsub_file 'vendor/plugins/active_scaffold/environment.rb', /#ActiveScaffold.js_framework = :jquery/, 'ActiveScaffold.js_framework = :jquery'
24
24
  end
25
25
  end
26
-
26
+
27
27
  def configure_application_layout
28
28
  if js_lib == 'prototype'
29
- inject_into_file "app/views/layouts/application.html.erb",
29
+ inject_into_file "app/views/layouts/application.html.erb",
30
30
  " <%= active_scaffold_includes %>\n",
31
31
  :after => "<%= javascript_include_tag :defaults %>\n"
32
32
  elsif js_lib == 'jquery'
33
- inject_into_file "app/views/layouts/application.html.erb",
33
+ inject_into_file "app/views/layouts/application.html.erb",
34
34
  " <%= stylesheet_link_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css' %>
35
35
  <%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js' %>
36
36
  <%= javascript_include_tag 'rails_jquery.js' %>
@@ -39,15 +39,15 @@ module Rails
39
39
  <%= javascript_include_tag 'application.js' %>
40
40
  <%= active_scaffold_includes %>\n",
41
41
  :after => "<%= javascript_include_tag :defaults %>\n"
42
-
42
+
43
43
  inject_into_file "config/locales/en.yml",
44
44
  " time:
45
45
  formats:
46
- default: \"%a, %d %b %Y %H:%M:%S\"",
46
+ default: \"%a, %d %b %Y %H:%M:%S\"",
47
47
  :after => "hello: \"Hello world\"\n"
48
48
  gsub_file 'app/views/layouts/application.html.erb', /<%= javascript_include_tag :defaults/, '<%# javascript_include_tag :defaults'
49
49
  end
50
- end
50
+ end
51
51
  end
52
52
  end
53
- end
53
+ 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: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 4
10
- version: 3.0.4
9
+ - 5
10
+ version: 3.0.5
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: 2010-11-20 00:00:00 -05:00
18
+ date: 2010-11-22 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -109,7 +109,6 @@ files:
109
109
  - README
110
110
  - Rakefile
111
111
  - active_scaffold.gemspec
112
- - environment.rb
113
112
  - frontends/default/images/add.gif
114
113
  - frontends/default/images/arrow_down.gif
115
114
  - frontends/default/images/arrow_up.gif
@@ -183,7 +182,6 @@ files:
183
182
  - frontends/default/views/update_column.js.rjs
184
183
  - frontends/default/views/update_row.js.rjs
185
184
  - init.rb
186
- - install_assets.rb
187
185
  - lib/active_record_permissions.rb
188
186
  - lib/active_scaffold.rb
189
187
  - lib/active_scaffold/actions/common_search.rb
data/environment.rb DELETED
@@ -1,24 +0,0 @@
1
- require 'active_scaffold'
2
-
3
- # TODO: clean up extensions. some could be organized for autoloading, and others could be removed entirely.
4
- Dir["#{File.dirname __FILE__}/lib/extensions/*.rb"].each { |file| require file }
5
- #Dir["#{File.dirname __FILE__}/lib/generators/*/*.rb"].each { |file| require file }
6
- require "#{File.dirname __FILE__}/lib/active_scaffold/data_structures/set.rb"
7
- Dir["#{File.dirname __FILE__}/lib/active_scaffold/data_structures/*.rb"].each { |file| require file }
8
- Dir["#{File.dirname __FILE__}/lib/active_scaffold/actions/*.rb"].each { |file| require file }
9
- Dir["#{File.dirname __FILE__}/lib/active_scaffold/config/*.rb"].each { |file| require file }
10
- require "#{File.dirname __FILE__}/lib/active_scaffold/helpers/id_helpers.rb"
11
- Dir["#{File.dirname __FILE__}/lib/active_scaffold/helpers/*.rb"].each { |file| require file }
12
-
13
- ActionController::Base.send(:include, ActiveScaffold)
14
- ActionController::Base.send(:include, RespondsToParent)
15
- ActionController::Base.send(:include, ActiveScaffold::Helpers::ControllerHelpers)
16
- ActionView::Base.send(:include, ActiveScaffold::Helpers::ViewHelpers)
17
-
18
- ActionController::Base.class_eval {include ActiveRecordPermissions::ModelUserAccess::Controller}
19
- ActiveRecord::Base.class_eval {include ActiveRecordPermissions::ModelUserAccess::Model}
20
- ActiveRecord::Base.class_eval {include ActiveRecordPermissions::Permissions}
21
-
22
- require "#{File.dirname __FILE__}/lib/active_scaffold/bridges/bridge.rb"
23
- I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'lib', 'active_scaffold', 'locale', '*.{rb,yml}')]
24
- #ActiveScaffold.js_framework = :jquery
data/install_assets.rb DELETED
@@ -1,44 +0,0 @@
1
- # Workaround a problem with script/plugin and http-based repos.
2
- # See http://dev.rubyonrails.org/ticket/8189
3
- Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do
4
-
5
- ##
6
- ## Copy over asset files (javascript/css/images) from the plugin directory to public/
7
- ##
8
-
9
- def copy_files(source_path, destination_path, directory, file_mask = '*.*', clean_up_destination = false)
10
- source, destination = File.join(directory, source_path), File.join(Rails.root, destination_path)
11
- FileUtils.mkdir_p(destination) unless File.exist?(destination)
12
-
13
- FileUtils.rm Dir.glob("#{destination}/*") if clean_up_destination
14
- FileUtils.cp_r(Dir.glob("#{source}/#{file_mask}"), destination)
15
- end
16
-
17
- directory = File.dirname(__FILE__)
18
-
19
- copy_files("/public", "/public", directory)
20
-
21
- available_frontends = Dir[File.join(directory, 'frontends', '*')].collect { |d| File.basename d }
22
- [ :stylesheets, :javascripts, :images].each do |asset_type|
23
- path = "/public/#{asset_type}/active_scaffold"
24
- copy_files(path, path, directory)
25
-
26
- File.open(File.join(Rails.root, path, 'DO_NOT_EDIT'), 'w') do |f|
27
- f.puts "Any changes made to files in sub-folders will be lost."
28
- f.puts "See http://activescaffold.com/tutorials/faq#custom-css."
29
- end
30
-
31
- available_frontends.each do |frontend|
32
- if asset_type == :javascripts
33
- file_mask = '*.js'
34
- source = "/frontends/#{frontend}/#{asset_type}/#{ActiveScaffold.js_framework}"
35
- else
36
- file_mask = '*.*'
37
- source = "/frontends/#{frontend}/#{asset_type}"
38
- end
39
- destination = "/public/#{asset_type}/active_scaffold/#{frontend}"
40
- copy_files(source, destination, directory, file_mask, true)
41
- end
42
- end
43
-
44
- end