refinerycms 0.9.6.14 → 0.9.6.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.gitignore +4 -1
  2. data/Rakefile +3 -51
  3. data/VERSION +1 -1
  4. data/bin/refinery +20 -20
  5. data/bin/refinery-override +9 -9
  6. data/bin/refinery-update-core +41 -34
  7. data/config/application.rb +28 -87
  8. data/config/environment.rb +1 -4
  9. data/config/environments/development.rb +2 -0
  10. data/config/environments/production.rb +1 -1
  11. data/config/preinitializer.rb +2 -6
  12. data/db/schema.rb +1 -1
  13. data/db/seeds.rb +1 -1
  14. data/lib/refinery/tasks/refinery.rake +83 -0
  15. data/lib/refinery/tasks/refinery.rb +16 -0
  16. data/public/images/refinery/dialogLoadingAnimation.gif +0 -0
  17. data/public/javascripts/refinery/admin.js +9 -4
  18. data/public/javascripts/refinery/boot_wym.js +19 -5
  19. data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +72 -70
  20. data/public/stylesheets/refinery/refinery.css +19 -7
  21. data/readme.md +2 -2
  22. data/test/fixtures/user_plugins.yml +36 -0
  23. data/test/fixtures/users.yml +1 -2
  24. data/test/functional/dashboard_controller_test.rb +23 -3
  25. data/test/functional/images_controller_test.rb +93 -0
  26. data/test/test_helper.rb +9 -3
  27. data/test/unit/image_test.rb +2 -2
  28. data/test/unit/inquiry_test.rb +6 -6
  29. data/test/unit/news_items_test.rb +8 -8
  30. data/test/unit/refinery_setting_test.rb +12 -12
  31. data/test/unit/resource_test.rb +3 -3
  32. data/themes/demolicious/views/layouts/application.html.erb +1 -1
  33. data/themes/demolicious/views/pages/home.html.erb +1 -1
  34. data/themes/demolicious/views/pages/show.html.erb +1 -1
  35. data/themes/hemingway/views/layouts/application.html.erb +1 -1
  36. data/vendor/plugins/dashboard/app/controllers/admin/dashboard_controller.rb +1 -1
  37. data/vendor/plugins/dashboard/rails/init.rb +1 -1
  38. data/vendor/plugins/images/app/controllers/admin/images_controller.rb +2 -2
  39. data/vendor/plugins/images/app/helpers/admin/images_helper.rb +6 -2
  40. data/vendor/plugins/images/app/models/image.rb +3 -3
  41. data/vendor/plugins/images/app/views/admin/images/_form.html.erb +4 -4
  42. data/vendor/plugins/images/app/views/admin/images/index.html.erb +2 -2
  43. data/vendor/plugins/images/app/views/admin/images/insert.html.erb +1 -1
  44. data/vendor/plugins/inquiries/app/models/inquiry.rb +3 -3
  45. data/vendor/plugins/inquiries/app/views/admin/inquiries/show.html.erb +1 -1
  46. data/vendor/plugins/inquiries/rails/init.rb +1 -1
  47. data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +1 -1
  48. data/vendor/plugins/news/app/controllers/news_items_controller.rb +1 -1
  49. data/vendor/plugins/news/app/models/news_item.rb +2 -2
  50. data/vendor/plugins/news/app/views/admin/news_items/_news_item.html.erb +1 -1
  51. data/vendor/plugins/news/app/views/admin/news_items/edit.html.erb +1 -1
  52. data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +13 -0
  53. data/vendor/plugins/pages/app/models/page_part.rb +3 -1
  54. data/vendor/plugins/pages/app/views/admin/page_dialogs/_page_link.html.erb +2 -2
  55. data/vendor/plugins/pages/app/views/admin/pages/_form.html.erb +2 -2
  56. data/vendor/plugins/pages/app/views/admin/pages/_page_part_field.html.erb +1 -1
  57. data/vendor/plugins/refinery/app/views/admin/_head.html.erb +3 -3
  58. data/vendor/plugins/refinery/app/views/admin/_menu.html.erb +3 -7
  59. data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +1 -1
  60. data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +5 -3
  61. data/vendor/plugins/refinery/app/views/shared/admin/_image_picker.html.erb +1 -1
  62. data/vendor/plugins/refinery/app/views/shared/admin/_resource_picker.html.erb +0 -1
  63. data/vendor/plugins/refinery/lib/refinery.rb +9 -2
  64. data/vendor/plugins/refinery/lib/refinery/application_controller.rb +1 -1
  65. data/vendor/plugins/refinery/lib/refinery/deprecations.rb +46 -0
  66. data/vendor/plugins/refinery/lib/refinery/initializer.rb +20 -9
  67. data/vendor/plugins/refinery_dialogs/app/controllers/admin/dialogs_controller.rb +6 -5
  68. data/vendor/plugins/refinery_dialogs/app/views/admin/dialogs/show.html.erb +2 -2
  69. data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +41 -11
  70. data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_form.html.erb +1 -1
  71. data/vendor/plugins/resources/app/controllers/admin/resources_controller.rb +1 -1
  72. data/vendor/plugins/resources/app/models/resource.rb +3 -3
  73. data/vendor/plugins/resources/app/views/admin/resources/_form.html.erb +2 -2
  74. data/vendor/plugins/resources/app/views/admin/resources/insert.html.erb +2 -2
  75. data/vendor/plugins/themes/app/helpers/themes_helper.rb +1 -1
  76. data/vendor/plugins/themes/lib/theme_server.rb +1 -1
  77. data/vendor/plugins/themes/rails/init.rb +26 -18
  78. metadata +10 -20
  79. data/Gemfile +0 -12
  80. data/public/javascripts/thickbox.js +0 -350
  81. data/public/stylesheets/refinery/thickbox.css +0 -165
  82. data/vendor/cache/aasm-2.1.3.gem +0 -0
  83. data/vendor/cache/actionmailer-2.3.5.gem +0 -0
  84. data/vendor/cache/actionpack-2.3.5.gem +0 -0
  85. data/vendor/cache/activerecord-2.3.5.gem +0 -0
  86. data/vendor/cache/activeresource-2.3.5.gem +0 -0
  87. data/vendor/cache/activesupport-2.3.5.gem +0 -0
  88. data/vendor/cache/friendly_id-2.3.1.gem +0 -0
  89. data/vendor/cache/hpricot-0.8.2.gem +0 -0
  90. data/vendor/cache/rack-1.0.1.gem +0 -0
  91. data/vendor/cache/rails-2.3.5.gem +0 -0
  92. data/vendor/cache/rake-0.8.7.gem +0 -0
  93. data/vendor/cache/rubyzip-0.9.1.gem +0 -0
  94. data/vendor/cache/slim_scrooge-1.0.3.gem +0 -0
  95. data/vendor/cache/will_paginate-2.3.11.gem +0 -0
@@ -17,7 +17,7 @@ class ResourceTest < ActiveSupport::TestCase
17
17
  def test_attachment_fu_options
18
18
  assert_equal 50.megabytes, Resource.attachment_options[:max_size]
19
19
 
20
- if USE_S3_BACKEND
20
+ if Refinery.s3_backend
21
21
  assert_equal :s3, Resource.attachment_options[:storage]
22
22
  assert_nil Resource.attachment_options[:path_prefix]
23
23
  else
@@ -25,9 +25,9 @@ class ResourceTest < ActiveSupport::TestCase
25
25
  assert_equal 'public/system/resources', Resource.attachment_options[:path_prefix]
26
26
  end
27
27
  end
28
-
28
+
29
29
  def test_type_of_content
30
30
  assert_equal "application pdf", resources(:pdf_document).type_of_content
31
31
  end
32
32
 
33
- end
33
+ end
@@ -17,4 +17,4 @@
17
17
  </div>
18
18
  </div>
19
19
  </body>
20
- </html>
20
+ </html>
@@ -1 +1 @@
1
- <%= render :partial => "/shared/content_page", :locals => {:show_submenu => false} %>
1
+ <%= render :partial => "/shared/content_page", :locals => {:show_submenu => false} %>
@@ -1 +1 @@
1
- <%= render :partial => "/shared/content_page" %>
1
+ <%= render :partial => "/shared/content_page" %>
@@ -52,4 +52,4 @@
52
52
  </div>
53
53
  </div>
54
54
  </body>
55
- </html>
55
+ </html>
@@ -2,7 +2,7 @@ class Admin::DashboardController < Admin::BaseController
2
2
 
3
3
  def index
4
4
  @recent_activity = []
5
-
5
+
6
6
  Refinery::Plugins.active.each do |plugin|
7
7
  begin
8
8
  plugin.activity.each do |activity|
@@ -3,4 +3,4 @@ Refinery::Plugin.register do |plugin|
3
3
  plugin.description = "Gives an overview of activity in Refinery"
4
4
  plugin.version = 1.0
5
5
  plugin.always_allow_access = true
6
- end
6
+ end
@@ -79,7 +79,7 @@ class Admin::ImagesController < Admin::BaseController
79
79
  protected
80
80
 
81
81
  def init_dialog
82
- @thickbox = params[:thickbox].present?
82
+ @app_dialog = params[:app_dialog].present?
83
83
  @field = params[:field]
84
84
  @update_image = params[:update_image]
85
85
  @thumbnail = params[:thumbnail]
@@ -92,7 +92,7 @@ protected
92
92
  :conditions => {:parent_id => nil}.merge!(conditions),
93
93
  :order => 'created_at DESC',
94
94
  :per_page => Image.per_page(from_dialog?),
95
- :include => :thumbnails
95
+ :include => :thumbnails
96
96
  end
97
97
 
98
98
  end
@@ -8,6 +8,10 @@ module Admin::ImagesHelper
8
8
  RefinerySetting.find_or_set(:preferred_image_view, :list)
9
9
  end
10
10
 
11
+ def other_image_views
12
+ image_views.reject {|image_view| image_view.to_s == current_image_view.to_s }
13
+ end
14
+
11
15
  def change_list_mode_if_specified
12
16
  unless params[:action] != "index" or params[:view].blank? or !image_views.include? params[:view].to_sym
13
17
  RefinerySetting[:preferred_image_view] = params[:view]
@@ -18,6 +22,6 @@ module Admin::ImagesHelper
18
22
  will_paginate collection, :previous_label => '&laquo; Previous',
19
23
  :next_label => 'Next &raquo;',
20
24
  :renderer => Refinery::LinkRenderer
21
- #:params => {:controller => "admin/images", :action => "insert", :dialog => dialog }
22
25
  end
23
- end
26
+
27
+ end
@@ -5,8 +5,8 @@ class Image < ActiveRecord::Base
5
5
 
6
6
  # Docs for attachment_fu http://github.com/technoweenie/attachment_fu
7
7
  has_attachment :content_type => :image,
8
- :storage => (USE_S3_BACKEND ? :s3 : :file_system),
9
- :path_prefix => (USE_S3_BACKEND ? nil : 'public/system/images'),
8
+ :storage => (Refinery.s3_backend ? :s3 : :file_system),
9
+ :path_prefix => (Refinery.s3_backend ? nil : 'public/system/images'),
10
10
  :processor => 'Rmagick',
11
11
  :thumbnails => ((((thumbnails = RefinerySetting.find_or_set(:image_thumbnails, {})).is_a?(Hash) ? thumbnails : (RefinerySetting[:image_thumbnails] = {}))) rescue {}),
12
12
  :max_size => MAX_SIZE_IN_MB.megabytes
@@ -21,7 +21,7 @@ class Image < ActiveRecord::Base
21
21
  else
22
22
  [:size, :content_type].each do |attr_name|
23
23
  enum = attachment_options[attr_name]
24
-
24
+
25
25
  unless enum.nil? || enum.include?(send(attr_name))
26
26
  errors.add_to_base("Images should be smaller than #{MAX_SIZE_IN_MB} MB in size") if attr_name == :size
27
27
  errors.add_to_base("Your image must be either a JPG, PNG or GIF") if attr_name == :content_type
@@ -11,10 +11,10 @@
11
11
  <%= f.file_field :uploaded_data %>
12
12
  </div>
13
13
 
14
- <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false, :hide_cancel => (@thickbox or params[:action] == "insert")} %>
14
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false, :hide_cancel => (@app_dialog or params[:action] == "insert")} %>
15
15
 
16
- <% if @thickbox %>
17
- <input type='hidden' name='thickbox' value='<%= @thickbox %>' />
16
+ <% if @app_dialog %>
17
+ <input type='hidden' name='app_dialog' value='<%= @app_dialog %>' />
18
18
  <input type='hidden' name='field' value='<%= @field %>' />
19
19
  <input type='hidden' name='update_image' value='<%= @update_image %>' />
20
20
  <input type='hidden' name='thumbnail' value='<%= @thumbnail %>' />
@@ -28,4 +28,4 @@
28
28
  <label>Current Image</label>
29
29
  <%= image_fu @image, :medium, { :class => "brown_border" } %>
30
30
  </div>
31
- <% end %>
31
+ <% end %>
@@ -8,7 +8,7 @@
8
8
  </li>
9
9
  </ul>
10
10
  <ul>
11
- <% image_views.delete_if {|image_view| image_view.to_s == current_image_view.to_s }.each do |image_view| %>
11
+ <% other_image_views.each do |image_view| %>
12
12
  <li>
13
13
  <%= link_to "Switch to #{image_view.to_s.titleize} View",
14
14
  admin_images_url(:view => image_view, :page => params[:page]),
@@ -39,4 +39,4 @@
39
39
  </p>
40
40
  <% end %>
41
41
  <% end %>
42
- </div>
42
+ </div>
@@ -33,7 +33,7 @@
33
33
  </div>
34
34
  </div>
35
35
  </div>
36
- <% if @thickbox %>
36
+ <% if @app_dialog %>
37
37
  <div id='dialog-form-actions' class='form-actions'>
38
38
  <%= submit_tag 'Insert', :id => "submit_button" %>
39
39
  or
@@ -7,10 +7,10 @@ class Inquiry < ActiveRecord::Base
7
7
 
8
8
  acts_as_indexed :fields => [:name, :email, :message, :phone],
9
9
  :index_file => [Rails.root.to_s, "tmp", "index"]
10
-
10
+
11
11
  default_scope :order => 'created_at DESC'
12
-
12
+
13
13
  named_scope :closed, :conditions => {:open => false}
14
14
  named_scope :open, :conditions => {:open => true}
15
15
 
16
- end
16
+ end
@@ -54,7 +54,7 @@
54
54
  </td>
55
55
  <td>
56
56
  <p style='margin-top: 0px'>
57
- <%=h @inquiry.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "</p><p>") %>
57
+ <%= h(@inquiry.message).gsub("\r\n\r\n", "\r\n").gsub("\r\n", "</p><p>") %>
58
58
  </p>
59
59
  </td>
60
60
  </tr>
@@ -10,4 +10,4 @@ Refinery::Plugin.register do |plugin|
10
10
  end
11
11
 
12
12
  # Set the actionmailer root so that it'll work for delivering emails from this plugin.
13
- ActionMailer::Base.template_root = Refinery.root.join("vendor", "plugins", "inquiries", "app", "views").to_s
13
+ ActionMailer::Base.template_root = Refinery.root.join("vendor", "plugins", "inquiries", "app", "views").to_s
@@ -2,4 +2,4 @@ class Admin::NewsItemsController < Admin::BaseController
2
2
 
3
3
  crudify :news_item, :order => "created_at DESC"
4
4
 
5
- end
5
+ end
@@ -17,4 +17,4 @@ protected
17
17
  @page = Page.find_by_link_url("/news", :include => [:parts, :slugs])
18
18
  end
19
19
 
20
- end
20
+ end
@@ -6,7 +6,7 @@ class NewsItem < ActiveRecord::Base
6
6
 
7
7
  acts_as_indexed :fields => [:title, :body],
8
8
  :index_file => [Rails.root.to_s, "tmp", "index"]
9
-
9
+
10
10
  default_scope :order => "publish_date DESC"
11
11
  named_scope :latest, :conditions => ["publish_date < ?", Time.now], :limit => 10
12
12
  named_scope :published, :conditions => ["publish_date < ?", Time.now]
@@ -19,4 +19,4 @@ class NewsItem < ActiveRecord::Base
19
19
  20
20
20
  end
21
21
 
22
- end
22
+ end
@@ -12,4 +12,4 @@
12
12
  </span>
13
13
  <%=h news_item.title %> <span class="preview">&nbsp;</span>
14
14
  </span>
15
- </li>
15
+ </li>
@@ -1 +1 @@
1
- <%= render :partial => "form" %>
1
+ <%= render :partial => "form" %>
@@ -1,6 +1,7 @@
1
1
  class Admin::PagesController < Admin::BaseController
2
2
 
3
3
  crudify :page, :conditions => "parent_id IS NULL", :order => "position ASC", :include => [:parts, :slugs, :children], :paging => false
4
+ before_filter :find_pages_for_parents_list, :only => [:new, :create, :edit, :update]
4
5
  after_filter :expire_menu_fragment_caching, :only => [:create, :update, :destroy]
5
6
 
6
7
  def new
@@ -15,4 +16,16 @@ protected
15
16
  expire_fragment(%r{site_menu})
16
17
  end
17
18
 
19
+ # This finds all of the pages that could possibly be assigned as the current page's parent.
20
+ def find_pages_for_parents_list
21
+ @pages_for_parents_list = Page.find(:all, :order => "parent_id, position ASC")
22
+
23
+ # We need to remove all references to the current page or any of its decendants or we get a nightmare.
24
+ unless @page.nil? or @page.new_record?
25
+ @pages_for_parents_list.reject! do |page|
26
+ page.id == @page.id or @page.descendants.include?(page)
27
+ end
28
+ end
29
+ end
30
+
18
31
  end
@@ -5,6 +5,8 @@ class PagePart < ActiveRecord::Base
5
5
  validates_presence_of :title
6
6
  alias_attribute :content, :body
7
7
 
8
- has_friendly_id :title, :use_slug => true
8
+ def to_param
9
+ "page_part_#{self.title.downcase.gsub(" ", "_")}"
10
+ end
9
11
 
10
12
  end
@@ -1,5 +1,5 @@
1
- <% linked = (page_link.url == params[:current_link]) if params[:current_link].present? %>
1
+ <% linked = (url_for(page_link.url) == params[:current_link]) if params[:current_link].present? %>
2
2
  <li class='clearfix<%= " child#{child}" if child %><%= " linked" if linked%>' id="<%= dom_id(page_link) -%>">
3
3
  <%= link_to page_link.title_with_meta, page_link.url, :title => 'Link to this Page', :rel => page_link.title, :class => 'page_link' %>
4
4
  </li>
5
- <%= render :partial => 'page_link', :collection => page_link.children, :locals => {:child => child ? (child+1) : 1} if page_link.children.any? %>
5
+ <%= render :partial => 'page_link', :collection => page_link.children, :locals => {:child => child ? (child+1) : 1} if page_link.children.any? %>
@@ -9,7 +9,7 @@
9
9
  <ul id="page_parts">
10
10
  <% @page.parts.each_with_index do |part, part_index| %>
11
11
  <li>
12
- <%= link_to part.title, "##{@page.new_record? ? "page_part_new_#{part_index}" : dom_id(part)}" %>
12
+ <%= link_to part.title, "##{@page.new_record? ? "page_part_new_#{part_index}" : part.to_param}" %>
13
13
  </li>
14
14
  <% end %>
15
15
  </ul>
@@ -41,7 +41,7 @@
41
41
  <div id='more_options' style="display:none;">
42
42
  <div class='field'>
43
43
  <%= f.label :parent_id %>
44
- <%= f.collection_select :parent_id, Page.find(:all, :order => "parent_id, position ASC"), :id, :indented_title, :include_blank => true %>
44
+ <%= f.collection_select :parent_id, @pages_for_parents_list, :id, :indented_title, :include_blank => true %>
45
45
  </div>
46
46
  <div class='field'>
47
47
  <%= label_tag :custom_title %>
@@ -1,4 +1,4 @@
1
- <div class='page_part field' id='<%= new_part ? "page_part_new_#{part_index}" : dom_id(part) %>'>
1
+ <div class='page_part field' id='<%= new_part ? "page_part_new_#{part_index}" : part.to_param %>'>
2
2
  <%= hidden_field_tag "page[parts_attributes][#{part_index}][title]", part.title if new_part %>
3
3
  <%= text_area_tag "page[parts_attributes][#{part_index}][body]", part.body, :rows => 20, :cols => 140, :class => 'wymeditor' %>
4
4
  </div>
@@ -2,10 +2,10 @@
2
2
  <head>
3
3
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
4
4
  <title><%= RefinerySetting.find_or_set(:site_name, 'Company Name').titleize %> - Refinery</title>
5
- <%= stylesheet_link_tag 'refinery/thickbox', 'refinery/refinery', 'refinery/tooltips', :cache => (use_caching ? "cache/refinery" : false) %>
5
+ <%= stylesheet_link_tag 'refinery/refinery', 'refinery/tooltips', :cache => (use_caching ? "cache/refinery" : false) %>
6
6
  <%= render :partial => "/shared/admin/head_before_javascript_libraries" -%>
7
7
  <%= jquery_include_tags(use_caching) %>
8
- <%= javascript_include_tag 'admin', 'thickbox', 'wymeditor/jquery.refinery.wymeditor.js', 'refinery/boot_wym', 'refinery/admin', :cache => (use_caching ? "cache/admin" : false) %>
8
+ <%= javascript_include_tag 'admin', 'wymeditor/jquery.refinery.wymeditor.js', 'refinery/boot_wym', 'refinery/admin', :cache => (use_caching ? "cache/admin" : false) %>
9
9
  <%= javascript_include_tag "http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js" if RefinerySetting.find_or_set(:show_firebug_lite, false) -%>
10
10
  <%= yield :head %>
11
- </head>
11
+ </head>
@@ -1,14 +1,10 @@
1
1
  <ul id="menu">
2
- <%
3
- Refinery::Plugins.active.each do |plugin|
4
- unless plugin.hide_from_menu
5
- -%>
2
+ <% Refinery::Plugins.active.in_menu.each do |plugin| -%>
6
3
  <li class='tab' id='plugin_<%= plugin.title %>'>
7
4
  <%= link_to plugin.title, plugin.url, :class => (plugin.highlighted?(params) ? "active" : "") %>
8
5
  </li>
9
- <% end
10
- end -%>
11
- <% if Refinery::Plugins.active.in_menu.size > 1 -%>
6
+ <% end -%>
7
+ <% if Refinery::Plugins.active.in_menu.many? -%>
12
8
  <li>
13
9
  <%= link_to "&nbsp;", "", :id => "menu_reorder", :title => "Reorder menu" %>
14
10
  <%= link_to "&nbsp;", "", :id => "menu_reorder_done", :title => "I'm done reordering the menu", :style => "display: none;" %>
@@ -1,4 +1,4 @@
1
- <% cache(:action_suffix => "site_menu") do %>
1
+ <% cache(:action_suffix => RefinerySetting.find_or_set(:refinery_menu_cache_action_suffix, "site_menu")) do %>
2
2
  <ul id='<%= dom_id ||= "menu" %>' class='menu clearfix'>
3
3
  <%= render :partial => "/shared/menu_branch", :collection => @menu_pages, :locals => {
4
4
  :hide_children => RefinerySetting.find_or_set(:menu_hide_children, false),
@@ -6,8 +6,10 @@
6
6
  <% end -%>
7
7
  <% unless (hide_cancel ||= from_dialog?) -%>
8
8
  or
9
- <%= link_to "Cancel", (cancel_url ||= send("admin_#{f.object.class.name.pluralize.underscore}_url")),
10
- :title => (title ||= "Cancelling will lose all changes you've made to this #{f.object.class.name.underscore.gsub("_", " ")}"),
11
- :id => "#{cancel_button_id ||= "cancel_button"}", :class => "close_dialog" %>
9
+ <%= link_to "Cancel",
10
+ (cancel_url ||= ((back=url_for(:back)).include?('javascript') ? send("admin_#{f.object.class.name.pluralize.underscore}_url") : back)),
11
+ :title => (title ||= "Cancelling will lose all changes you've made to this #{f.object.class.name.underscore.gsub("_", " ")}"),
12
+ :id => "#{cancel_button_id ||= "cancel_button"}",
13
+ :class => "close_dialog" %>
12
14
  <% end -%>
13
15
  </div>
@@ -8,7 +8,7 @@
8
8
  <%= f.hidden_field field, :id => "current_image_id_#{randomiser}" -%>
9
9
 
10
10
  <div id='current_image_container_<%= randomiser %>'<%= " style='display: none'" if toggle_image_display %> style="margin-top: 10px;">
11
- <a id='current_image_link_<%= randomiser %>' href="<%= insert_admin_images_url %>?thickbox=true&amp;modal=true&amp;titlebar=true&amp;callback=image_picker_<%= randomiser %>_changed&amp;KeepThis=true&amp;TB_iframe=true&amp;width=958&amp;height=510" style='border: 0px' title='Change <%= description.titleize %>' name='Change <%= description.titleize %>' class='thickbox'>
11
+ <a id='current_image_link_<%= randomiser %>' href="<%= insert_admin_images_url %>?dialog=true&amp;modal=true&amp;titlebar=true&amp;callback=image_picker_<%= randomiser %>_changed&amp;KeepThis=true&amp;TB_iframe=true&amp;width=958&amp;height=510" style='border: 0px' title='Change <%= description.titleize %>' name='Change <%= description.titleize %>' class='dialog'>
12
12
  <% unless image.nil? -%>
13
13
  <%= image_fu image, nil, {:class => "brown_border", :id => "current_picked_image_#{randomiser}"} %>
14
14
  <% else -%>
@@ -3,7 +3,6 @@
3
3
  <%= link_to "<span id='no_resource_selected' #{"style='display: none;'" if resource.present?}>
4
4
  There is currently no #{description ||= resource} selected, click here to add one.
5
5
  </span>", insert_admin_resources_url(:dialog => true,
6
- :thickbox => true,
7
6
  :update_resource => 'current_resource',
8
7
  :update_text => 'current_resource_text',
9
8
  :callback => 'resource_changed',
@@ -1,11 +1,18 @@
1
1
  module Refinery
2
2
 
3
3
  class << self
4
- attr_accessor :root
4
+ attr_accessor :is_a_gem, :root, :s3_backend
5
+ def is_a_gem
6
+ @is_a_gem ||= false
7
+ end
8
+
5
9
  def root
6
10
  @root ||= Pathname.new(File.dirname(__FILE__).split("vendor").first.to_s)
7
11
  end
8
- attr_accessor :is_a_gem
12
+
13
+ def s3_backend
14
+ @s3_backend ||= false
15
+ end
9
16
  end
10
17
 
11
18
  end
@@ -77,4 +77,4 @@ protected
77
77
  super
78
78
  end
79
79
 
80
- end
80
+ end
@@ -0,0 +1,46 @@
1
+ require 'active_support/string_inquirer'
2
+ require 'active_support/deprecation'
3
+
4
+ # Set up deprecation warnings:
5
+ Refinery.s3_backend = USE_S3_BACKEND if defined?(USE_S3_BACKEND) # map it before we deprecate it incase it's already in use
6
+ USE_S3_BACKEND = (Class.new(ActiveSupport::Deprecation::DeprecationProxy) do
7
+ cattr_accessor :warned
8
+ self.warned = false
9
+
10
+ def target(*args)
11
+ Refinery.s3_backend
12
+ end
13
+
14
+ def replace(*args)
15
+ warn(caller, :replace, *args)
16
+ end
17
+
18
+ def warn(callstack, called, args)
19
+ unless self.warned
20
+ puts (msg = "USE_S3_BACKEND is deprecated! Use Refinery.s3_backend instead")
21
+ ActiveSupport::Deprecation.warn(msg, callstack)
22
+ self.warned = true
23
+ end
24
+ end
25
+ end).new
26
+
27
+ REFINERY_ROOT = (Class.new(ActiveSupport::Deprecation::DeprecationProxy) do
28
+ cattr_accessor :warned
29
+ self.warned = false
30
+
31
+ def target
32
+ Refinery.root
33
+ end
34
+
35
+ def replace(*args)
36
+ warn(caller, :replace, *args)
37
+ end
38
+
39
+ def warn(callstack, called, args)
40
+ unless warned
41
+ puts (msg = "REFINERY_ROOT is deprecated! Use Refinery.root instead")
42
+ ActiveSupport::Deprecation.warn(msg, callstack)
43
+ self.warned = true
44
+ end
45
+ end
46
+ end).new