refinerycms 0.9.5.29 → 0.9.5.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/.gitignore +7 -1
  2. data/.yardopts +21 -0
  3. data/CONTRIBUTORS +5 -2
  4. data/{README → README.rdoc} +6 -3
  5. data/Rakefile +8 -11
  6. data/VERSION +1 -1
  7. data/app/controllers/application.rb +1 -1
  8. data/app/controllers/application_controller.rb +1 -2
  9. data/bin/refinery +23 -23
  10. data/config/amazon_s3.yml.example +18 -0
  11. data/config/database.yml.example +0 -0
  12. data/config/environment.rb +4 -3
  13. data/config/environments/production.rb +6 -1
  14. data/config/preinitializer.rb +4 -0
  15. data/config/rackspace_cloudfiles.yml.example +14 -0
  16. data/db/migrate/20100114092849_add_themes_table.rb +19 -0
  17. data/db/schema.rb +12 -1
  18. data/db/seeds.rb +1 -0
  19. data/public/images/refinery/icons/star.png +0 -0
  20. data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +5 -4
  21. data/public/stylesheets/refinery/refinery.css +1 -9
  22. data/themes/demolicious/LICENSE +21 -0
  23. data/themes/demolicious/README +1 -0
  24. data/themes/demolicious/images/footer_background.png +0 -0
  25. data/themes/demolicious/images/header_background.png +0 -0
  26. data/themes/demolicious/preview.png +0 -0
  27. data/themes/demolicious/stylesheets/application.css +94 -0
  28. data/themes/demolicious/stylesheets/formatting.css +36 -0
  29. data/themes/demolicious/stylesheets/home.css +11 -0
  30. data/themes/demolicious/stylesheets/ie6.css +0 -0
  31. data/themes/demolicious/stylesheets/ie7.css +0 -0
  32. data/themes/demolicious/views/layouts/application.html.erb +33 -0
  33. data/themes/demolicious/views/pages/home.html.erb +1 -0
  34. data/themes/demolicious/views/pages/show.html.erb +1 -0
  35. data/themes/hemingway/LICENSE +7 -0
  36. data/themes/hemingway/README +3 -0
  37. data/themes/hemingway/images/archives.gif +0 -0
  38. data/themes/hemingway/images/footer_black.gif +0 -0
  39. data/themes/hemingway/images/kyle-header.jpg +0 -0
  40. data/themes/hemingway/images/readon_black.gif +0 -0
  41. data/themes/hemingway/images/search.gif +0 -0
  42. data/themes/hemingway/images/spinner.gif +0 -0
  43. data/themes/hemingway/images/trackback_pingback.gif +0 -0
  44. data/themes/hemingway/preview.png +0 -0
  45. data/themes/hemingway/stylesheets/application.css +713 -0
  46. data/themes/hemingway/views/layouts/application.html.erb +64 -0
  47. data/themes/hemingway/views/shared/content_page.html.erb +0 -0
  48. data/vendor/plugins/dashboard/app/controllers/admin/dashboard_controller.rb +17 -6
  49. data/vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb +3 -3
  50. data/vendor/plugins/dashboard/app/views/admin/dashboard/_recent_activity.html.erb +1 -1
  51. data/vendor/plugins/images/app/models/image.rb +4 -3
  52. data/vendor/plugins/inquiries/app/models/inquiry.rb +2 -1
  53. data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +1 -1
  54. data/vendor/plugins/news/app/models/news_item.rb +5 -7
  55. data/vendor/plugins/news/app/views/admin/news_items/index.html.erb +10 -14
  56. data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +7 -9
  57. data/vendor/plugins/pages/app/models/page.rb +4 -9
  58. data/vendor/plugins/pages/app/models/page_part.rb +1 -8
  59. data/vendor/plugins/pages/app/views/admin/pages/index.html.erb +2 -2
  60. data/vendor/plugins/refinery/app/views/admin/_head.html.erb +7 -1
  61. data/vendor/plugins/refinery/app/views/shared/_content_page.html.erb +1 -1
  62. data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +16 -14
  63. data/vendor/plugins/refinery/app/views/shared/_message.html.erb +4 -4
  64. data/vendor/plugins/refinery/app/views/shared/admin/_search.html.erb +2 -2
  65. data/vendor/plugins/refinery/lib/crud.rb +78 -26
  66. data/vendor/plugins/refinery/lib/generators/refinery/templates/migration.rb +2 -1
  67. data/vendor/plugins/refinery/lib/generators/refinery/templates/model.rb +2 -1
  68. data/vendor/plugins/refinery/lib/refinery/application_controller.rb +5 -1
  69. data/vendor/plugins/refinery/lib/refinery/html_truncation_helper.rb +2 -2
  70. data/vendor/plugins/refinery/lib/refinery/initializer.rb +1 -1
  71. data/vendor/plugins/refinery/lib/refinery/plugin.rb +1 -1
  72. data/vendor/plugins/refinery/lib/tasks/doc.rake +29 -0
  73. data/vendor/plugins/refinery/lib/tasks/refinery.rake +1 -2
  74. data/vendor/plugins/refinery/lib/tasks/yard.rake +32 -0
  75. data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +4 -0
  76. data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_refinery_setting.html.erb +1 -1
  77. data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/index.html.erb +12 -18
  78. data/vendor/plugins/resources/app/models/resource.rb +5 -4
  79. data/vendor/plugins/resources/config/routes.rb +3 -1
  80. data/vendor/plugins/themes/app/controllers/admin/themes_controller.rb +25 -0
  81. data/vendor/plugins/themes/app/controllers/themes_controller.rb +49 -0
  82. data/vendor/plugins/themes/app/models/theme.rb +62 -0
  83. data/vendor/plugins/themes/app/views/admin/themes/_form.html.erb +11 -0
  84. data/vendor/plugins/themes/app/views/admin/themes/_theme.html.erb +24 -0
  85. data/vendor/plugins/themes/app/views/admin/themes/edit.html.erb +1 -0
  86. data/vendor/plugins/themes/app/views/admin/themes/index.html.erb +35 -0
  87. data/vendor/plugins/themes/app/views/admin/themes/new.html.erb +1 -0
  88. data/vendor/plugins/themes/config/routes.rb +12 -0
  89. data/vendor/plugins/themes/rails/init.rb +9 -0
  90. data/vendor/plugins/themes/themes.rdoc +131 -0
  91. metadata +52 -39
  92. data/config/amazon_s3.yml +0 -17
  93. data/config/rackspace_cloudfiles.yml +0 -14
  94. data/public/images/lightbox/bullet.gif +0 -0
  95. data/public/images/lightbox/close.gif +0 -0
  96. data/public/images/lightbox/closelabel.gif +0 -0
  97. data/public/images/lightbox/donate-button.gif +0 -0
  98. data/public/images/lightbox/download-icon.gif +0 -0
  99. data/public/images/lightbox/loading.gif +0 -0
  100. data/public/images/lightbox/nextlabel.gif +0 -0
  101. data/public/images/lightbox/prevlabel.gif +0 -0
  102. data/public/images/refinery/add.gif +0 -0
  103. data/public/images/refinery/cross.gif +0 -0
  104. data/public/images/refinery/deactive-gradient.gif +0 -0
  105. data/public/images/refinery/delete.gif +0 -0
  106. data/public/images/refinery/drag.gif +0 -0
  107. data/public/images/refinery/edit.gif +0 -0
  108. data/public/images/refinery/header-background.gif +0 -0
  109. data/public/images/refinery/icons/bin_closed.png +0 -0
  110. data/public/images/refinery/icons/help.png +0 -0
  111. data/public/images/refinery/icons/page_link.png +0 -0
  112. data/public/images/refinery/icons/reorder.png +0 -0
  113. data/public/images/refinery/icons/user.png +0 -0
  114. data/public/images/refinery/info.gif +0 -0
  115. data/public/images/refinery/m-tools.gif +0 -0
  116. data/public/images/refinery/magnifier.png +0 -0
  117. data/public/images/refinery/resolve-digital.gif +0 -0
  118. data/public/images/refinery/search.gif +0 -0
  119. data/public/images/refinery/shad_blcorner.png +0 -0
  120. data/public/images/refinery/shad_bottom.png +0 -0
  121. data/public/images/refinery/shad_brcorner.png +0 -0
  122. data/public/images/refinery/shad_tlcorner.png +0 -0
  123. data/public/images/refinery/shad_trcorner.png +0 -0
  124. data/public/images/refinery/tableft.gif +0 -0
  125. data/public/images/refinery/tabright.gif +0 -0
  126. data/public/images/refinery/tick.gif +0 -0
@@ -32,7 +32,8 @@ class <%= migration_name %> < ActiveRecord::Migration
32
32
  UserPlugin.destroy_all({:title => "<%= class_name.pluralize.underscore.titleize %>"})
33
33
 
34
34
  Page.find_all_by_link_url("/<%= plural_name %>").each do |page|
35
- page.link_url, page.menu_match, page.deletable = nil
35
+ page.link_url, page.menu_match = nil
36
+ page.deletable = true
36
37
  page.destroy
37
38
  end
38
39
  Page.destroy_all({:link_url => "/<%= plural_name %>"})
@@ -1,6 +1,7 @@
1
1
  class <%= class_name %> < ActiveRecord::Base
2
2
 
3
- acts_as_indexed :fields => [:<%= attributes.collect{ |attribute| attribute.name if attribute.type.to_s =~ /string|text/ }.compact.uniq.join(", :") %>]
3
+ acts_as_indexed :fields => [:<%= attributes.collect{ |attribute| attribute.name if attribute.type.to_s =~ /string|text/ }.compact.uniq.join(", :") %>],
4
+ :index_file => [RAILS_ROOT,"tmp","index"]
4
5
 
5
6
  validates_presence_of :<%= attributes.first.name %>
6
7
  validates_uniqueness_of :<%= attributes.first.name %>
@@ -7,7 +7,7 @@ class Refinery::ApplicationController < ActionController::Base
7
7
  include Crud # basic create, read, update and delete methods
8
8
  include AuthenticatedSystem
9
9
 
10
- before_filter :find_pages_for_menu, :show_welcome_page, :take_down_for_maintenance?
10
+ before_filter :find_pages_for_menu, :setup_theme, :show_welcome_page, :take_down_for_maintenance?
11
11
  rescue_from ActiveRecord::RecordNotFound, :with => :error_404
12
12
  rescue_from ActionController::UnknownAction, :with => :error_404
13
13
 
@@ -42,6 +42,10 @@ class Refinery::ApplicationController < ActionController::Base
42
42
 
43
43
  protected
44
44
 
45
+ def setup_theme
46
+ self.view_paths = ::ActionController::Base.view_paths.dup.unshift("#{RAILS_ROOT}/themes/#{RefinerySetting[:theme]}/views")
47
+ end
48
+
45
49
  def take_down_for_maintenance?
46
50
  if RefinerySetting.find_or_set(:down_for_maintenance, false)
47
51
  @page = Page.find_by_menu_match("^/maintenance$", :include => [:parts, :slugs])
@@ -45,7 +45,6 @@ module Refinery::HtmlTruncationHelper
45
45
  word_length = actual_length - (truncated_doc.inner_html.mb_chars.length - truncated_doc.inner_html.rindex(' '))
46
46
  truncated_doc = doc.truncate(word_length)
47
47
  end
48
-
49
48
  if (last_child = truncated_doc.children.last).inner_html.nil?
50
49
  "#{truncated_doc.inner_html}#{omission}#{options[:link]}" if options[:link]
51
50
  else
@@ -77,7 +76,8 @@ module HpricotTruncator
77
76
  truncated_node = if self.is_a?(Hpricot::Doc)
78
77
  self.dup
79
78
  else
80
- self.class.send(:new, self.name, self.attributes)
79
+ # only pass self.attributes if it's able to use map, otherwise nil works. (Fix for Hpricot 0.8.2)
80
+ self.class.send(:new, self.name, self.attributes.respond_to?("map") ? self.attributes : nil)
81
81
  end
82
82
  truncated_node.children = []
83
83
  each_child do |node|
@@ -31,7 +31,7 @@ module Refinery
31
31
  class Initializer < Rails::Initializer
32
32
  def self.run(command = :process, configuration = Configuration.new)
33
33
  Rails.configuration = configuration
34
- configuration.reload_plugins = true if RAILS_ENV =~ /development/ and REFINERY_ROOT == RAILS_ROOT # seems to work, don't in gem.
34
+ #configuration.reload_plugins = true if RAILS_ENV =~ /development/ and REFINERY_ROOT == RAILS_ROOT # seems to work, don't in gem.
35
35
  configuration.plugin_loader = Refinery::PluginLoader
36
36
  super
37
37
  end
@@ -28,7 +28,7 @@ module Refinery
28
28
  end
29
29
 
30
30
  def url
31
- @url ||= "/admin/#{self.directory.blank? ? self.title.downcase : self.directory.split('/').pop}"
31
+ @url ||= "/admin/#{self.directory.blank? ? self.title.gsub(" ", "_").downcase : self.directory.split('/').pop}"
32
32
  end
33
33
 
34
34
  def menu_match
@@ -0,0 +1,29 @@
1
+ namespace :doc do
2
+
3
+ task :app => [:refinery]
4
+
5
+ desc "Generate documentation for the application"
6
+ Rake::RDocTask.new(:refinery) { |rdoc|
7
+ rdoc.title = "Refinery CMS Documentation"
8
+ rdoc.main = "README.rdoc"
9
+ rdoc.options = ['--inline-source']
10
+ rdoc.rdoc_files.include('lib/**/*.rb',
11
+ 'lib/*',
12
+ 'app/**/*.rb',
13
+ 'db/seeds.rb',
14
+ 'config/preinitializer.rb',
15
+ 'vendor/plugins/images/**/*.rb',
16
+ 'vendor/plugins/authentication/**/*.rb',
17
+ 'vendor/plugins/dashboard/**/*.rb',
18
+ 'vendor/plugins/inquiries/**/*.rb',
19
+ 'vendor/plugins/news/**/*.rb',
20
+ 'vendor/plugins/pages/**/*.rb',
21
+ 'vendor/plugins/refinery/**/*.rb',
22
+ 'vendor/plugins/refinery_dialogs/**/*.rb',
23
+ 'vendor/plugins/refinery_settings/**/*.rb',
24
+ 'vendor/plugins/resources/**/*.rb',
25
+ 'vendor/plugins/themes/**/*.rb',
26
+ 'README.rdoc', 'LICENSE', 'CONTRIBUTORS', 'vendor/plugins/themes/themes.rdoc')
27
+ }
28
+
29
+ end
@@ -31,5 +31,4 @@ namespace :refinery do
31
31
  end
32
32
  end
33
33
 
34
- end
35
-
34
+ end
@@ -0,0 +1,32 @@
1
+ begin
2
+
3
+ require 'yard'
4
+
5
+ YARD::Rake::YardocTask.new do |t|
6
+ t.files = ['lib/**/*.rb',
7
+ 'lib/*',
8
+ 'app/**/*.rb',
9
+ 'db/seeds.rb',
10
+ 'config/preinitializer.rb',
11
+ 'vendor/plugins/images/**/*.rb',
12
+ 'vendor/plugins/authentication/**/*.rb',
13
+ 'vendor/plugins/dashboard/**/*.rb',
14
+ 'vendor/plugins/inquiries/**/*.rb',
15
+ 'vendor/plugins/news/**/*.rb',
16
+ 'vendor/plugins/pages/**/*.rb',
17
+ 'vendor/plugins/refinery/**/*.rb',
18
+ 'vendor/plugins/refinery_dialogs/**/*.rb',
19
+ 'vendor/plugins/refinery_settings/**/*.rb',
20
+ 'vendor/plugins/resources/**/*.rb',
21
+ 'vendor/plugins/themes/**/*.rb',
22
+ '-', 'License', 'Contributors',
23
+ 'vendor/plugins/themes/Themes.rdoc']
24
+ end
25
+
26
+ rescue LoadError
27
+
28
+ task :yard do
29
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
30
+ end
31
+
32
+ end
@@ -59,4 +59,8 @@ class RefinerySetting < ActiveRecord::Base
59
59
  self[:value] = new_value
60
60
  end
61
61
 
62
+ def self.per_page
63
+ 10
64
+ end
65
+
62
66
  end
@@ -8,6 +8,6 @@
8
8
  :class => "cancel", :method => :delete,
9
9
  :title => 'Remove this setting forever' if refinery_setting.destroyable %>
10
10
  </span>
11
- <%=h refinery_setting.name.titleize %> <span class="preview">- <%=h truncate(refinery_setting.value.to_s, :length => 40) %></span>
11
+ <%=h refinery_setting.name.titleize %> <span class="preview">- <%=h truncate(refinery_setting.value.to_s, :length => 40) %></span>
12
12
  </span>
13
13
  </li>
@@ -6,28 +6,22 @@
6
6
  </ul>
7
7
  </div>
8
8
  <div id='records'>
9
- <% if searching? %>
10
- <% if @refinery_settings.size > 0 %>
11
- <ul>
12
- <%= render :partial => 'refinery_setting', :collection => @refinery_settings %>
13
- </ul>
14
- <% else %>
15
- <p>Sorry, no results found</p>
16
- <% end %>
9
+ <% unless @refinery_settings.empty? %>
10
+ <%= will_paginate @refinery_settings, :previous_label => '&laquo;', :next_label => '&raquo;' unless searching? %>
11
+ <ul>
12
+ <%= render :partial => 'refinery_setting', :collection => @refinery_settings %>
13
+ </ul>
14
+ <%= will_paginate @refinery_settings, :previous_label => '&laquo;', :next_label => '&raquo;' unless searching? %>
17
15
  <% else %>
18
- <% if @refinery_settings.size > 0 %>
19
- <%= will_paginate @refinery_settings, :previous_label => '&laquo;', :next_label => '&raquo;' %>
20
- <ul>
21
- <%= render :partial => 'refinery_setting', :collection => @refinery_settings %>
22
- </ul>
23
- <%= will_paginate @refinery_settings, :previous_label => '&laquo;', :next_label => '&raquo;' %>
24
- <% else %>
25
- <p>
16
+ <p>
17
+ <% if searching? %>
18
+ Sorry, no results found
19
+ <% else %>
26
20
  <strong>
27
21
  There are no settings yet.
28
22
  Click "Create New Setting" to add your first setting.
29
23
  </strong>
30
- </p>
31
- <% end %>
24
+ <% end %>
25
+ </p>
32
26
  <% end %>
33
27
  </div>
@@ -1,10 +1,11 @@
1
1
  class Resource < ActiveRecord::Base
2
2
 
3
- has_attachment :storage => :file_system,
4
- :size => 0.kilobytes..50.megabytes,
5
- :path_prefix => 'public/system/resources'
3
+ has_attachment :storage => (USE_S3_BACKEND ? :s3 : :file_system),
4
+ :size => 0.kilobytes..50.megabytes,
5
+ :path_prefix => (USE_S3_BACKEND ? nil : 'public/system/resources')
6
6
 
7
- acts_as_indexed :fields => [:title, :type_of_content]
7
+ acts_as_indexed :fields => [:title, :type_of_content],
8
+ :index_file => [RAILS_ROOT,"tmp","index"]
8
9
 
9
10
  def validate
10
11
  errors.add_to_base("You must choose a file to upload") unless self.filename
@@ -1,7 +1,9 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
+
2
3
  map.resources :resources
3
4
 
4
5
  map.namespace(:admin) do |admin|
5
6
  admin.resources :resources, :collection => {:insert => :get}
6
7
  end
7
- end
8
+
9
+ end
@@ -0,0 +1,25 @@
1
+ class Admin::ThemesController < Admin::BaseController
2
+
3
+ crudify :theme, :order => "updated_at DESC"
4
+
5
+ before_filter :find_theme, :only => [:update, :destroy, :edit, :preview_image, :activate]
6
+
7
+ # accessor method for theme preview image
8
+ def preview_image
9
+ if File.exists? @theme.preview_image
10
+ send_file(@theme.preview_image, :type => 'image/png',
11
+ :disposition => 'inline',
12
+ :stream => true)
13
+ else
14
+ return error_404
15
+ end
16
+ end
17
+
18
+ def activate
19
+ RefinerySetting[:theme] = @theme.title
20
+
21
+ flash[:notice] = "'#{@theme.title}' applied to live site."
22
+ redirect_to admin_themes_url
23
+ end
24
+
25
+ end
@@ -0,0 +1,49 @@
1
+ class ThemesController < ApplicationController
2
+
3
+ def stylesheets
4
+ render_theme_item(:stylesheets, params[:filename], 'text/css; charset=utf-8')
5
+ end
6
+
7
+ def javascripts
8
+ render_theme_item(:javascript, params[:filename], 'text/javascript; charset=utf-8')
9
+ end
10
+
11
+ def images
12
+ render_theme_item(:images, params[:filename])
13
+ end
14
+
15
+ protected
16
+
17
+ def render_theme_item(type, file, mime = nil)
18
+ mime ||= mime_for(file)
19
+
20
+ file_path = File.join(RAILS_ROOT, "themes", RefinerySetting[:theme], "#{type}/#{file}#{params[:extension]}")
21
+
22
+ if File.exists? file_path
23
+ send_file(file_path, :type => mime, :disposition => 'inline', :stream => true)
24
+ else
25
+ return error_404
26
+ end
27
+ end
28
+
29
+ def mime_for(filename)
30
+ # could we use the built in Rails mime types to work this out?
31
+ case filename.downcase
32
+ when /\.js$/
33
+ 'text/javascript'
34
+ when /\.css$/
35
+ 'text/css'
36
+ when /\.gif$/
37
+ 'image/gif'
38
+ when /(\.jpg|\.jpeg)$/
39
+ 'image/jpeg'
40
+ when /\.png$/
41
+ 'image/png'
42
+ when /\.swf$/
43
+ 'application/x-shockwave-flash'
44
+ else
45
+ 'application/binary'
46
+ end
47
+ end
48
+
49
+ end
@@ -0,0 +1,62 @@
1
+ begin
2
+ require 'zip/zip'
3
+ require 'zip/zipfilesystem'
4
+ rescue LoadError => load_error
5
+ # Otherwise, this will stop rake tasks running
6
+ "*** rubyzip gem needs to be installed to use themes. ***"
7
+ end
8
+
9
+ class Theme < ActiveRecord::Base
10
+
11
+ before_save :read_theme
12
+
13
+ has_attachment :storage => (USE_S3_BACKEND ? :s3 : :file_system),
14
+ :size => 0.kilobytes..15.megabytes,
15
+ :path_prefix => (USE_S3_BACKEND ? nil : 'public/system/themes'),
16
+ :content_type => 'application/zip'
17
+
18
+ # Once a zip is uploaded it unzips it into the themes directory if writable
19
+ def after_attachment_saved
20
+ if Theme::directory_is_writable?
21
+ # make the folder for the them
22
+ FileUtils.mkdir(self.theme_path) unless File.exists? self.theme_path
23
+
24
+ # extracts the contents of the zip file into the theme directory
25
+ Zip::ZipFile.foreach(self.filename) do |entry|
26
+ FileUtils.mkdir_p(File.dirname("#{theme_path}/#{entry}"))
27
+ entry.extract("#{theme_path}/#{entry}") { true }
28
+ end
29
+ else
30
+ raise "Theme directory not writable"
31
+ end
32
+ end
33
+
34
+ def theme_folder_title
35
+ File.basename(self.filename).split(".").first
36
+ end
37
+
38
+ def theme_path
39
+ File.join(RAILS_ROOT, "themes", theme_folder_title)
40
+ end
41
+
42
+ def preview_image
43
+ File.join(theme_path, "preview.png")
44
+ end
45
+
46
+ def read_theme
47
+ self.title = File.basename(self.filename).split(".").first.titleize
48
+
49
+ if File.exists? File.join(theme_path, "LICENSE")
50
+ self.license = File.open(File.join(theme_path, "LICENSE")).read
51
+ end
52
+
53
+ if File.exists? File.join(theme_path, "README")
54
+ self.description = File.open(File.join(theme_path, "README")).read
55
+ end
56
+ end
57
+
58
+ def self.directory_is_writable?
59
+ File.writable? File.join(RAILS_ROOT, "themes") # Heroku users will receive false here
60
+ end
61
+
62
+ end
@@ -0,0 +1,11 @@
1
+ <%= error_messages_for :theme -%>
2
+
3
+ <% form_for [:admin, @theme], :url => @url_override || @url,
4
+ :html => {:multipart => true} do |f| -%>
5
+ <div class='field'>
6
+ <%= f.label :uploaded_data, 'Theme' -%>
7
+ <%= f.file_field :uploaded_data -%>
8
+ </div>
9
+
10
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
11
+ <% end -%>
@@ -0,0 +1,24 @@
1
+ <li class=''>
2
+
3
+ <p>
4
+ <%=h theme.title %>
5
+ </p>
6
+ <%= image_tag(preview_image_admin_theme_url(theme), :width => 135, :height => 135) %>
7
+ <p>
8
+
9
+ <span class='actions'>
10
+ <%= link_to refinery_icon_tag('star.png'), activate_admin_theme_url(theme) %>
11
+ <%= link_to refinery_icon_tag('page_white_put.png'), theme.public_filename,
12
+ :title => "Download this theme (#{number_to_human_size(theme.size)})" %>
13
+ <% if Theme::directory_is_writable? %>
14
+ <%= link_to refinery_icon_tag('application_edit.png'), edit_admin_theme_url(theme),
15
+ :title => "Edit this theme" %>
16
+ <% end %>
17
+ <%= link_to refinery_icon_tag('delete.png'), admin_theme_path(theme),
18
+ :confirm => "Are you sure you want to delete '#{theme.title}'?",
19
+ :class => "cancel", :method => :delete,
20
+ :title => "Remove this theme forever" %>
21
+ </span>
22
+ </p>
23
+
24
+ </li>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" -%>
@@ -0,0 +1,35 @@
1
+ <div id='actions'>
2
+ <ul>
3
+ <li>
4
+ <%= render :partial => "/shared/admin/search", :locals => {:url => admin_themes_url} %>
5
+ </li>
6
+ <% if Theme::directory_is_writable? %>
7
+ <li>
8
+ <%= link_to "Upload New Theme", new_admin_theme_url, :class => "add_icon" %>
9
+ </li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <div id='records'>
14
+ <% if searching? %>
15
+ <h2>Search Results for "<%= params[:search] %>"</h2>
16
+ <% if @themes.size > 0 %>
17
+ <%= render :partial => "theme", :collection => @themes %>
18
+ <% else %>
19
+ <p>Sorry, no results found.</p>
20
+ <% end %>
21
+ <% else %>
22
+ <% if @themes.size > 0 -%>
23
+ <%= will_paginate @themes, :previous_label => '&laquo;', :next_label => '&raquo;' %>
24
+ <ul id='image_grid'>
25
+ <%= render :partial => "theme", :collection => @themes %>
26
+ </ul>
27
+
28
+ <%= will_paginate @themes, :previous_label => '&laquo;', :next_label => '&raquo;' %>
29
+ <% else -%>
30
+ <p>
31
+ <strong>There are no themes yet. Click "Upload New Theme" to add your first theme.</strong>
32
+ </p>
33
+ <% end -%>
34
+ <% end %>
35
+ </div>