refinerycms 0.9.5.15 → 0.9.5.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ REFINERY_ROOT = File.expand_path(File.dirname(__FILE__) << "/..")
4
+ unless (override_path = ARGV.shift).nil? or (override_path.length == 0)
5
+ # if "" or "." or "./" is specified then get the current directory otherwise accept the specified app_path.
6
+ if ((app_path = ARGV.shift).nil? or app_path.length <= 2) and ((is_current_dir = app_path =~ /(\.(\/)?)/).nil? or !is_current_dir or is_current_dir < 2)
7
+ RAILS_ROOT = Dir.getwd
8
+ else
9
+ RAILS_ROOT = app_path
10
+ end
11
+
12
+ if File.exists? RAILS_ROOT
13
+ # figure out what to override
14
+ override_parts = override_path.downcase.split('/').compact.collect {|part| part if part.length > 0 }.compact
15
+ admin = ""
16
+ if override_parts.first == "admin"
17
+ # we're inside the admin namespace
18
+ admin = override_parts.shift
19
+ end
20
+
21
+ if override_parts.length > 1
22
+ # controller plus action is specified
23
+ action = override_parts.pop
24
+ end
25
+
26
+ # controller is what's left.
27
+ controller = override_parts.first
28
+ controller_with_admin = [admin,override_parts].flatten.compact.join('/')
29
+
30
+ # copy the controller
31
+ unless controller_with_admin =~ /\*(\*)?/ and !action.nil?
32
+ refinery_controllers = Dir[File.join(REFINERY_ROOT, %w(vendor plugins ** app controllers), "#{controller_with_admin}_controller.rb")]
33
+ unless refinery_controllers.compact.empty? # the controllers may not exist.
34
+ refinery_controllers.each do |refinery_controller|
35
+ # make the directories
36
+ FileUtils.mkdir_p(copy_to = File.join(RAILS_ROOT, %w(app controllers), admin))
37
+ FileUtils.cp(refinery_controller, copy_to)
38
+ end
39
+ else
40
+ puts "Note: Couldn't find a matching controller to override."
41
+ end
42
+ end
43
+
44
+ # copy the action, if it exists
45
+ unless action.nil? or action.length == 0
46
+ # get all the matching files
47
+ looking_for = File.join(REFINERY_ROOT, %w(vendor plugins ** app views), controller_with_admin.split('/'), "#{action}*.erb")
48
+ action_files = Dir[looking_for]
49
+
50
+ # copy in the action template
51
+ action_files.each do |action_file|
52
+ action_file_path = action_file.split("/app/views/").last
53
+ action_file_dir = action_file_path.split('/')
54
+ action_file_dir.pop # get rid of the file.
55
+
56
+ FileUtils.mkdir_p(File.join(RAILS_ROOT, %w(app views), action_file_dir))
57
+ FileUtils.cp action_file, File.join(RAILS_ROOT, %w(app views), action_file_path)
58
+ end
59
+ else
60
+ puts "Note: No action was specified."
61
+ end
62
+
63
+ else
64
+ puts "Couldn't understand your project's directory?"
65
+ end
66
+ else
67
+ puts "You didn't specify anything to override. Here's some examples:"
68
+ puts "refinery-override /pages/* /path/to/my/project"
69
+ puts "refinery-override /pages/show /path/to/my/project"
70
+ puts "refinery-override /admin/pages/index"
71
+ puts "refinery-override /shared/_menu /path/to/my/project"
72
+ puts "refinery-override **/*menu /path/to/my/project"
73
+ puts "refinery-override /shared/_menu_branch"
74
+ end
data/config/boot.rb CHANGED
@@ -82,8 +82,8 @@ module Rails
82
82
  end
83
83
 
84
84
  def load_rubygems
85
+ min_version = '1.3.2'
85
86
  require 'rubygems'
86
- min_version = '1.3.1'
87
87
  unless rubygems_version >= min_version
88
88
  $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
89
  exit 1
@@ -7,7 +7,7 @@
7
7
  # Specifies gem version of Rails to use when vendor/rails is not present
8
8
  RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
9
9
  # Freeze to a specific version of refinerycms when running as a gem
10
- # REFINERY_GEM_VERSION = 0.9.5.10 unless defined? REFINERY_GEM_VERSION
10
+ # REFINERY_GEM_VERSION = '0.9.5.15' unless defined? REFINERY_GEM_VERSION
11
11
 
12
12
  # Bootstrap the Rails environment, frameworks, and default configuration
13
13
  require File.join(File.dirname(__FILE__), 'boot')
@@ -69,7 +69,7 @@ eval("#{(defined? Refinery::Initializer) ? Refinery : Rails}::Initializer").run
69
69
  config.gem "rails", :version => ">= 2.3.4", :lib => "rails"
70
70
  config.gem "aasm", :version => ">= 2.1.3", :lib => "aasm", :source => "http://gemcutter.org"
71
71
  config.gem "unicode", :version => ">= 0.1", :lib => "unicode"
72
- config.gem "slim_scrooge", :version => ">= 1.0.1", :lib => "slim_scrooge", :source => "http://gemcutter.org"
72
+ config.gem "slim_scrooge", :version => ">= 1.0.1", :lib => "slim_scrooge", :source => "http://gemcutter.org" unless RUBY_PLATFORM =~ /mswin|mingw/ # kill gem when windows is running.
73
73
  config.gem "hpricot", :version => "= 0.8.1", :lib => "hpricot", :source => "http://gemcutter.org"
74
74
  #===REFINERY END OF REQUIRED GEMS===
75
75
  end
@@ -10,9 +10,9 @@ FastInit.addOnLoad(function()
10
10
  {
11
11
  init_tooltips();
12
12
  // focus first field in an admin form.
13
- try{$(document.forms[0]).getInputs('text').first().focus();}catch(err){}
13
+ jQuery('form input[type=text]:first').focus();
14
14
 
15
- $$('a([href*="dialog=true"])').each(function(anchor)
15
+ jQuery('a[href*="dialog=true"]').each(function(i, anchor)
16
16
  {
17
17
  ['modal=true', 'width=928', 'height=473', 'titlebar=true', 'draggable=true'].each(function(feature)
18
18
  {
@@ -21,7 +21,52 @@ FastInit.addOnLoad(function()
21
21
  anchor.href += "&" + feature;
22
22
  }
23
23
  });
24
-
24
+
25
25
  tb_init(anchor);
26
26
  });
27
+
28
+ jQuery('#submit_continue_button').bind('click', function(e) {
29
+ // ensure wymeditors are up to date.
30
+ if (jQuery(this).hasClass('wymupdate')) {
31
+ WYMeditor.INSTANCES.each(function(wym)
32
+ {
33
+ wym.update();
34
+ });
35
+ }
36
+
37
+ jQuery('#continue_editing').val(true);
38
+
39
+ if ((flash=$('flash')) != null) {
40
+ flash.hide();
41
+ }
42
+
43
+ jQuery.post(this.form.action, this.form.serialize(), function(data) {
44
+ if ((flash_container = $('flash_container')) != null) {
45
+ flash_container.update(data);
46
+
47
+ if ((flash = $('flash')) != null) {
48
+ flash.style.width = 'auto';
49
+ flash.appear();
50
+ }
51
+
52
+ jQuery('.errorExplanation').each(function(i, node) {
53
+ if (node.parentNode.id != 'flash_container') {
54
+ node.remove();
55
+ }
56
+ });
57
+
58
+ jQuery('.fieldWithErrors').each(function(i, field) {
59
+ field.removeClassName('fieldWithErrors').addClassName('field');
60
+ });
61
+
62
+ $('flash_container').scrollTo();
63
+
64
+ jQuery('#continue_editing').val(false);
65
+
66
+ jQuery('.fieldWithErrors:first :input:first').focus();
67
+ }
68
+ });
69
+
70
+ e.preventDefault();
71
+ });
27
72
  });
@@ -1,7 +1,6 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "Dashboard"
4
3
  plugin.description = "Gives an overview of activity in Refinery"
5
4
  plugin.version = 1.0
6
5
  plugin.always_allow_access = true
7
- end
6
+ end
@@ -1,5 +1,4 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "Images"
4
3
  plugin.description = "Manage images"
5
4
  plugin.version = 1.0
@@ -1,5 +1,4 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "Inquiries"
4
3
  plugin.description = "Provides a contact form and stores inquiries"
5
4
  plugin.version = 1.0
@@ -1,5 +1,4 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "News"
4
3
  plugin.description = "Provides a blog-like news section"
5
4
  plugin.version = 1.0
@@ -1,5 +1,4 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "Pages"
4
3
  plugin.description = "Manage content pages"
5
4
  plugin.version = 1.0
@@ -1,51 +1,4 @@
1
1
  <% unless f.object.new_record? -%>
2
2
  <%= hidden_field_tag :continue_editing, false %>
3
3
  <%= f.submit 'Save &amp; Continue Editing', :id => "submit_continue_button", :class => "wymupdate" %>
4
- <% content_for :head do -%>
5
- <script type='text/javascript'>
6
- FastInit.addOnLoad(function() {
7
- if ($('submit_continue_button') != null) {
8
- $('submit_continue_button').observe("click", function(e) {
9
- $('continue_editing').value = true;
10
-
11
- if ((flash=$('flash')) != null) {
12
- flash.hide();
13
- }
14
-
15
- new Ajax.Request(this.form.action, {
16
- method: this.form.method
17
- , parameters: this.form.serialize()
18
- , onComplete: function(e) {
19
- if ((flash_container = $('flash_container')) != null) {
20
-
21
- flash_container.update(e.transport.responseText);
22
-
23
- if ((flash = $('flash')) != null) {
24
- flash.style.width = 'auto';
25
- flash.appear();
26
- }
27
-
28
- $$('#errorExplanation').each(function(errorExplanation) {
29
- if (errorExplanation.parentNode.id != 'flash_container') {
30
- errorExplanation.remove();
31
- }
32
- });
33
-
34
- $$('.fieldWithErrors').each(function(field) {
35
- field.removeClassName('fieldWithErrors').addClassName('field');
36
- });
37
-
38
- flash_container.scrollTo();
39
- $('continue_editing').value = false;
40
- }
41
- }
42
- , evalScripts: true
43
- });
44
-
45
- e.preventDefault();
46
- });
47
- }
48
- });
49
- </script>
50
- <% end -%>
51
- <% end -%>
4
+ <% end -%>
@@ -15,7 +15,7 @@ class RefineryGenerator < Rails::Generator::NamedBase
15
15
  directories = ["vendor/plugins/#{plural_name}", "vendor/plugins/#{plural_name}/app", "vendor/plugins/#{plural_name}/app/controllers",
16
16
  "vendor/plugins/#{plural_name}/app/controllers/admin", "vendor/plugins/#{plural_name}/app/models", "vendor/plugins/#{plural_name}/app/views",
17
17
  "vendor/plugins/#{plural_name}/app/helpers", "vendor/plugins/#{plural_name}/app/views", "vendor/plugins/#{plural_name}/app/views/admin",
18
- "vendor/plugins/#{plural_name}/config"]
18
+ "vendor/plugins/#{plural_name}/config", "vendor/plugins/#{plural_name}/rails"]
19
19
 
20
20
  directories.each do |dir|
21
21
  m.directory dir
@@ -50,7 +50,7 @@ class RefineryGenerator < Rails::Generator::NamedBase
50
50
  m.template "public_controller.rb", "vendor/plugins/#{plural_name}/app/controllers/#{plural_name}_controller.rb"
51
51
 
52
52
  # Add in the init file that ties the plugin to the app.
53
- m.template "init.rb", "vendor/plugins/#{plural_name}/init.rb"
53
+ m.template "rails/init.rb", "vendor/plugins/#{plural_name}/rails/init.rb"
54
54
 
55
55
  m.directory 'db/migrate/'
56
56
  m.migration_template 'migration.rb', 'db/migrate', :assigns => {:migration_name => "Create#{class_name.pluralize}"}, :migration_file_name => "create_#{singular_name.pluralize}"
@@ -1,5 +1,4 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "<%= class_name.pluralize.underscore.titleize %>"
4
3
  plugin.description = "Manage <%= class_name.pluralize.underscore.titleize %>"
5
4
  plugin.version = 1.0
@@ -28,7 +28,7 @@ protected
28
28
 
29
29
  def restrict_controller
30
30
  if Refinery::Plugins.active.reject {|plugin| params[:controller] !~ Regexp.new(plugin.menu_match) }.empty?
31
- flash[:error] = "You do not have permission to access the #{params[:controller]} controller on this plugin."
31
+ flash.now[:error] = "You do not have permission to access the #{params[:controller]} controller on this plugin."
32
32
  logger.warn "'#{current_user.login}' tried to access '#{params[:controller]}'"
33
33
  end
34
34
  end
@@ -16,6 +16,7 @@ module Refinery
16
16
  class Initializer < Rails::Initializer
17
17
  def self.run(command = :process, configuration = Configuration.new)
18
18
  Rails.configuration = configuration
19
+ configuration.reload_plugins = true if RAILS_ENV =~ /development/ and REFINERY_ROOT == RAILS_ROOT # seems to work, don't in gem.
19
20
  super
20
21
  end
21
22
 
@@ -1,5 +1,4 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "Refinery"
4
3
  plugin.description = "Core refinery plugin"
5
4
  plugin.version = 1.0
@@ -1,5 +1,4 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "Dialogs"
4
3
  plugin.description = "Refinery Dialogs plugin"
5
4
  plugin.version = 1.0
@@ -1,5 +1,4 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "Settings"
4
3
  plugin.description = "Manage Refinery settings"
5
4
  plugin.version = 1.0
@@ -1,5 +1,4 @@
1
1
  Refinery::Plugin.register do |plugin|
2
- plugin.directory = directory
3
2
  plugin.title = "Resources"
4
3
  plugin.description = "Upload and link to files"
5
4
  plugin.version = 1.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5.15
4
+ version: 0.9.5.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Resolve Digital
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-11-23 00:00:00 +13:00
14
+ date: 2009-11-26 00:00:00 +13:00
15
15
  default_executable: refinery
16
16
  dependencies: []
17
17
 
@@ -19,6 +19,7 @@ description: A beautiful open source Ruby on Rails content manager for small bus
19
19
  email: info@refinerycms.com
20
20
  executables:
21
21
  - refinery
22
+ - refinery-override
22
23
  - refinery-update-core
23
24
  extensions: []
24
25
 
@@ -36,6 +37,7 @@ files:
36
37
  - app/controllers/application_controller.rb
37
38
  - app/helpers/application_helper.rb
38
39
  - bin/refinery
40
+ - bin/refinery-override
39
41
  - bin/refinery-update-core
40
42
  - config/amazon_s3.yml
41
43
  - config/boot.rb
@@ -332,7 +334,7 @@ files:
332
334
  - vendor/plugins/authentication/app/views/user_mailer/signup_notification.html.erb
333
335
  - vendor/plugins/authentication/app/views/users/new.html.erb
334
336
  - vendor/plugins/authentication/config/routes.rb
335
- - vendor/plugins/authentication/init.rb
337
+ - vendor/plugins/authentication/rails/init.rb
336
338
  - vendor/plugins/authentication/lib/authenticated_system.rb
337
339
  - vendor/plugins/authentication/lib/authenticated_test_helper.rb
338
340
  - vendor/plugins/authentication/Rakefile
@@ -351,7 +353,7 @@ files:
351
353
  - vendor/plugins/dashboard/app/views/admin/dashboard/_recent_activity.html.erb
352
354
  - vendor/plugins/dashboard/app/views/admin/dashboard/index.html.erb
353
355
  - vendor/plugins/dashboard/config/routes.rb
354
- - vendor/plugins/dashboard/init.rb
356
+ - vendor/plugins/dashboard/rails/init.rb
355
357
  - vendor/plugins/images/app/controllers/admin/images_controller.rb
356
358
  - vendor/plugins/images/app/helpers/admin/images_helper.rb
357
359
  - vendor/plugins/images/app/models/image.rb
@@ -364,7 +366,7 @@ files:
364
366
  - vendor/plugins/images/app/views/admin/images/insert.html.erb
365
367
  - vendor/plugins/images/app/views/admin/images/new.html.erb
366
368
  - vendor/plugins/images/config/routes.rb
367
- - vendor/plugins/images/init.rb
369
+ - vendor/plugins/images/rails/init.rb
368
370
  - vendor/plugins/images/lib/tasks/images.rake
369
371
  - vendor/plugins/inquiries/app/controllers/admin/inquiries_controller.rb
370
372
  - vendor/plugins/inquiries/app/controllers/admin/inquiry_settings_controller.rb
@@ -385,7 +387,7 @@ files:
385
387
  - vendor/plugins/inquiries/app/views/inquiry_mailer/confirmation.html.erb
386
388
  - vendor/plugins/inquiries/app/views/inquiry_mailer/notification.html.erb
387
389
  - vendor/plugins/inquiries/config/routes.rb
388
- - vendor/plugins/inquiries/init.rb
390
+ - vendor/plugins/inquiries/rails/init.rb
389
391
  - vendor/plugins/news/app/controllers/admin/news_items_controller.rb
390
392
  - vendor/plugins/news/app/controllers/news_items_controller.rb
391
393
  - vendor/plugins/news/app/models/news_item.rb
@@ -398,7 +400,7 @@ files:
398
400
  - vendor/plugins/news/app/views/news_items/index.html.erb
399
401
  - vendor/plugins/news/app/views/news_items/show.html.erb
400
402
  - vendor/plugins/news/config/routes.rb
401
- - vendor/plugins/news/init.rb
403
+ - vendor/plugins/news/rails/init.rb
402
404
  - vendor/plugins/pages/app/controllers/admin/page_dialogs_controller.rb
403
405
  - vendor/plugins/pages/app/controllers/admin/page_parts_controller.rb
404
406
  - vendor/plugins/pages/app/controllers/admin/pages_controller.rb
@@ -418,7 +420,7 @@ files:
418
420
  - vendor/plugins/pages/app/views/pages/home.html.erb
419
421
  - vendor/plugins/pages/app/views/pages/show.html.erb
420
422
  - vendor/plugins/pages/config/routes.rb
421
- - vendor/plugins/pages/init.rb
423
+ - vendor/plugins/pages/rails/init.rb
422
424
  - vendor/plugins/refinery/app/controllers/admin/refinery_core_controller.rb
423
425
  - vendor/plugins/refinery/app/views/admin/_head.html.erb
424
426
  - vendor/plugins/refinery/app/views/admin/_menu.html.erb
@@ -444,7 +446,7 @@ files:
444
446
  - vendor/plugins/refinery/app/views/welcome.html.erb
445
447
  - vendor/plugins/refinery/app/views/wymiframe.html.erb
446
448
  - vendor/plugins/refinery/config/routes.rb
447
- - vendor/plugins/refinery/init.rb
449
+ - vendor/plugins/refinery/rails/init.rb
448
450
  - vendor/plugins/refinery/lib/crud.rb
449
451
  - vendor/plugins/refinery/lib/generators/refinery/install.rb
450
452
  - vendor/plugins/refinery/lib/generators/refinery/Rakefile
@@ -452,7 +454,7 @@ files:
452
454
  - vendor/plugins/refinery/lib/generators/refinery/refinery_generator.rb
453
455
  - vendor/plugins/refinery/lib/generators/refinery/templates/config/routes.rb
454
456
  - vendor/plugins/refinery/lib/generators/refinery/templates/controller.rb
455
- - vendor/plugins/refinery/lib/generators/refinery/templates/init.rb
457
+ - vendor/plugins/refinery/lib/generators/refinery/templates/rails/init.rb
456
458
  - vendor/plugins/refinery/lib/generators/refinery/templates/migration.rb
457
459
  - vendor/plugins/refinery/lib/generators/refinery/templates/model.rb
458
460
  - vendor/plugins/refinery/lib/generators/refinery/templates/public_controller.rb
@@ -483,7 +485,7 @@ files:
483
485
  - vendor/plugins/refinery_dialogs/app/views/admin/dialogs/show.html.erb
484
486
  - vendor/plugins/refinery_dialogs/app/views/layouts/admin_dialog.html.erb
485
487
  - vendor/plugins/refinery_dialogs/config/routes.rb
486
- - vendor/plugins/refinery_dialogs/init.rb
488
+ - vendor/plugins/refinery_dialogs/rails/init.rb
487
489
  - vendor/plugins/refinery_settings/app/controllers/admin/refinery_settings_controller.rb
488
490
  - vendor/plugins/refinery_settings/app/models/refinery_setting.rb
489
491
  - vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_form.html.erb
@@ -493,7 +495,7 @@ files:
493
495
  - vendor/plugins/refinery_settings/app/views/admin/refinery_settings/index.html.erb
494
496
  - vendor/plugins/refinery_settings/app/views/admin/refinery_settings/new.html.erb
495
497
  - vendor/plugins/refinery_settings/config/routes.rb
496
- - vendor/plugins/refinery_settings/init.rb
498
+ - vendor/plugins/refinery_settings/rails/init.rb
497
499
  - vendor/plugins/resources/app/controllers/admin/resources_controller.rb
498
500
  - vendor/plugins/resources/app/models/resource.rb
499
501
  - vendor/plugins/resources/app/views/admin/resources/_form.html.erb
@@ -503,7 +505,7 @@ files:
503
505
  - vendor/plugins/resources/app/views/admin/resources/insert.html.erb
504
506
  - vendor/plugins/resources/app/views/admin/resources/new.html.erb
505
507
  - vendor/plugins/resources/config/routes.rb
506
- - vendor/plugins/resources/init.rb
508
+ - vendor/plugins/resources/rails/init.rb
507
509
  has_rdoc: true
508
510
  homepage: http://refinerycms.com
509
511
  licenses: []