refinerycms 0.9.6.12 → 0.9.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +0 -1
- data/Gemfile +2 -3
- data/Rakefile +22 -8
- data/VERSION +1 -1
- data/bin/refinery +2 -2
- data/config/application.rb +5 -6
- data/config/preinitializer.rb +3 -5
- data/db/migrate/20100223211536_remove_themes_table.rb +17 -0
- data/db/schema.rb +1 -12
- data/db/seeds.rb +2 -10
- data/lib/refinery_initializer.rb +14 -10
- data/public/javascripts/refinery/admin.js +20 -13
- data/readme.md +15 -9
- data/test/fixtures/users.yml +16 -0
- data/test/functional/dashboard_controller_test.rb +24 -0
- data/test/test_helper.rb +5 -0
- data/themes/demolicious/LICENSE +21 -0
- data/themes/demolicious/README +1 -0
- data/themes/demolicious/images/footer_background.png +0 -0
- data/themes/demolicious/images/header_background.png +0 -0
- data/themes/demolicious/stylesheets/application.css +94 -0
- data/themes/demolicious/stylesheets/formatting.css +36 -0
- data/themes/demolicious/stylesheets/home.css +8 -0
- data/themes/demolicious/stylesheets/ie6.css +0 -0
- data/themes/demolicious/stylesheets/ie7.css +0 -0
- data/themes/demolicious/views/layouts/application.html.erb +20 -0
- data/themes/demolicious/views/pages/home.html.erb +1 -0
- data/themes/demolicious/views/pages/show.html.erb +1 -0
- data/themes/hemingway/LICENSE +7 -0
- data/themes/hemingway/README +3 -0
- data/themes/hemingway/images/archives.gif +0 -0
- data/themes/hemingway/images/footer_black.gif +0 -0
- data/themes/hemingway/images/kyle-header.jpg +0 -0
- data/themes/hemingway/images/readon_black.gif +0 -0
- data/themes/hemingway/images/search.gif +0 -0
- data/themes/hemingway/images/spinner.gif +0 -0
- data/themes/hemingway/images/trackback_pingback.gif +0 -0
- data/themes/hemingway/stylesheets/application.css +713 -0
- data/themes/hemingway/stylesheets/formatting.css +1 -0
- data/themes/hemingway/stylesheets/home.css +1 -0
- data/themes/hemingway/views/layouts/application.html.erb +55 -0
- data/todo.md +3 -1
- data/vendor/plugins/authentication/app/controllers/users_controller.rb +3 -5
- data/vendor/plugins/dashboard/app/controllers/admin/dashboard_controller.rb +1 -0
- data/vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb +1 -1
- data/vendor/plugins/images/app/models/image.rb +2 -2
- data/vendor/plugins/pages/rails/init.rb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_menu_branch.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_singular_name.html.erb +0 -1
- data/vendor/plugins/refinery/lib/refinery.rb +1 -0
- data/vendor/plugins/refinery/lib/refinery/admin_base_controller.rb +4 -3
- data/vendor/plugins/refinery/lib/refinery/application_controller.rb +0 -1
- data/vendor/plugins/refinery/lib/refinery/application_helper.rb +0 -27
- data/vendor/plugins/refinery/lib/refinery/initializer.rb +10 -5
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_refinery_setting.html.erb +0 -1
- data/vendor/plugins/resources/app/models/resource.rb +2 -2
- data/vendor/plugins/themes/app/helpers/themes_helper.rb +25 -0
- data/vendor/plugins/themes/lib/theme_server.rb +11 -7
- data/vendor/plugins/themes/rails/init.rb +18 -19
- data/vendor/plugins/themes/themes.md +1 -23
- metadata +43 -18
- data/test/fixtures/themes.yml +0 -5
- data/test/unit/theme_test.rb +0 -19
- data/vendor/plugins/themes/app/controllers/admin/themes_controller.rb +0 -25
- data/vendor/plugins/themes/app/models/theme.rb +0 -56
- data/vendor/plugins/themes/app/views/admin/themes/_form.html.erb +0 -11
- data/vendor/plugins/themes/app/views/admin/themes/_theme.html.erb +0 -18
- data/vendor/plugins/themes/app/views/admin/themes/edit.html.erb +0 -1
- data/vendor/plugins/themes/app/views/admin/themes/index.html.erb +0 -34
- data/vendor/plugins/themes/app/views/admin/themes/new.html.erb +0 -1
- data/vendor/plugins/themes/config/routes.rb +0 -12
data/test/fixtures/themes.yml
DELETED
data/test/unit/theme_test.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ThemeTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
fixtures :themes
|
6
|
-
|
7
|
-
def test_folder_title
|
8
|
-
assert_equal 'my_theme', themes(:my_theme).folder_title
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_theme_path
|
12
|
-
assert_equal "#{Rails.root}/themes/my_theme", themes(:my_theme).theme_path
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_preview_image
|
16
|
-
assert_equal "#{Rails.root}/themes/my_theme/preview.png", themes(:my_theme).preview_image
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
@@ -1,25 +0,0 @@
|
|
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.folder_title
|
20
|
-
|
21
|
-
flash[:notice] = "'#{@theme.title}' applied to live site."
|
22
|
-
redirect_to admin_themes_url
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,56 +0,0 @@
|
|
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..25.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.directory? self.theme_path
|
23
|
-
|
24
|
-
# extracts the contents of the zip file into the theme directory
|
25
|
-
Zip::ZipFile.foreach(self.full_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 folder_title
|
35
|
-
File.basename(self.full_filename).split(".").first
|
36
|
-
end
|
37
|
-
|
38
|
-
def theme_path
|
39
|
-
Rails.root.join("themes", folder_title).to_s
|
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.full_filename).split(".").first.titleize
|
48
|
-
self.licence = File.open(File.join(theme_path, "LICENCE")).read if File.exists? File.join(theme_path, "LICENCE")
|
49
|
-
self.description = File.open(File.join(theme_path, "README")).read if File.exists? File.join(theme_path, "README")
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.directory_is_writable?
|
53
|
-
Rails.root.join("themes").writable? # Heroku users (or users with read-only filesystem) will receive false here
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
@@ -1,11 +0,0 @@
|
|
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 -%>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<li>
|
2
|
-
<p>
|
3
|
-
<%=h theme.title %>
|
4
|
-
</p>
|
5
|
-
<%= image_tag(preview_image_admin_theme_url(theme), :width => 135, :height => 135) %>
|
6
|
-
<p>
|
7
|
-
<span class='actions'>
|
8
|
-
<%= link_to refinery_icon_tag('star.png'), activate_admin_theme_url(theme),
|
9
|
-
:title => "Activate this theme" %>
|
10
|
-
<%= link_to refinery_icon_tag('page_white_put.png'), theme.public_filename,
|
11
|
-
:title => "Download this theme (#{number_to_human_size(theme.size)})" %>
|
12
|
-
<%= link_to refinery_icon_tag('application_edit.png'), edit_admin_theme_url(theme),
|
13
|
-
:title => "Edit this theme" if Theme::directory_is_writable? %>
|
14
|
-
<%= link_to refinery_icon_tag('delete.png'), admin_theme_path(theme), :class => "cancel confirm-delete",
|
15
|
-
:title => "Remove this theme forever" %>
|
16
|
-
</span>
|
17
|
-
</p>
|
18
|
-
</li>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render :partial => "form" -%>
|
@@ -1,34 +0,0 @@
|
|
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.any? %>
|
17
|
-
<%= render :partial => "theme", :collection => @themes %>
|
18
|
-
<% else %>
|
19
|
-
<p>Sorry, no results found.</p>
|
20
|
-
<% end %>
|
21
|
-
<% else %>
|
22
|
-
<% if @themes.any? -%>
|
23
|
-
<%= will_paginate @themes, :previous_label => '«', :next_label => '»' %>
|
24
|
-
<ul id='image_grid'>
|
25
|
-
<%= render :partial => "theme", :collection => @themes %>
|
26
|
-
</ul>
|
27
|
-
<%= will_paginate @themes, :previous_label => '«', :next_label => '»' %>
|
28
|
-
<% else -%>
|
29
|
-
<p>
|
30
|
-
<strong>There are no themes yet. Click "Upload New Theme" to add your first theme.</strong>
|
31
|
-
</p>
|
32
|
-
<% end -%>
|
33
|
-
<% end %>
|
34
|
-
</div>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render :partial => "form" -%>
|
@@ -1,12 +0,0 @@
|
|
1
|
-
ActionController::Routing::Routes.draw do |map|
|
2
|
-
|
3
|
-
map.namespace(:admin) do |admin|
|
4
|
-
admin.resources :themes, :member => {:preview_image => :get, :activate => :get}
|
5
|
-
end
|
6
|
-
|
7
|
-
# allows theme files that are not in the Rails public directory to be served back to the client
|
8
|
-
map.connect 'theme/stylesheets/*filepath', :controller => 'themes', :action => 'stylesheets'
|
9
|
-
map.connect 'theme/javascripts/*filepath', :controller => 'themes', :action => 'javascripts'
|
10
|
-
map.connect 'theme/images/*filepath', :controller => 'themes', :action => 'images'
|
11
|
-
|
12
|
-
end
|