refinerycms 0.9.6.5 → 0.9.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/application.rb +1 -1
- data/app/controllers/application_controller.rb +1 -1
- data/config/environment.rb +2 -2
- data/config/environments/development.rb +1 -1
- data/config/environments/production.rb +1 -1
- data/config/preinitializer.rb +1 -1
- data/db/migrate/20100114092849_add_themes_table.rb +12 -12
- data/db/migrate/20100202034802_remove_custom_title_image_id_and_image_id_from_pages.rb +6 -6
- data/db/schema.rb +1 -1
- data/db/seeds.rb +2 -2
- data/lib/refinery_initializer.rb +1 -1
- data/public/javascripts/refinery/admin.js +61 -61
- data/readme.md +3 -3
- data/test/files/The world!.gif +0 -0
- data/test/files/car-wallpapers19.jpg +0 -0
- data/test/fixtures/images.yml +14 -0
- data/test/test_helper.rb +1 -1
- data/test/unit/image_test.rb +19 -8
- data/test/unit/page_part_test.rb +11 -11
- data/test/unit/page_test.rb +125 -125
- data/vendor/plugins/authentication/app/controllers/users_controller.rb +20 -20
- data/vendor/plugins/authentication/app/models/user.rb +5 -5
- data/vendor/plugins/authentication/app/views/user_mailer/reset_notification.html.erb +2 -2
- data/vendor/plugins/authentication/app/views/users/forgot.html.erb +1 -1
- data/vendor/plugins/authentication/app/views/users/reset.html.erb +2 -2
- data/vendor/plugins/authentication/config/routes.rb +4 -4
- data/vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb +1 -1
- data/vendor/plugins/dashboard/app/views/admin/dashboard/_recent_activity.html.erb +1 -1
- data/vendor/plugins/dashboard/rails/init.rb +1 -1
- data/vendor/plugins/images/app/models/image.rb +14 -14
- data/vendor/plugins/images/app/views/admin/images/_form.html.erb +1 -8
- data/vendor/plugins/images/app/views/admin/images/insert.html.erb +1 -1
- data/vendor/plugins/inquiries/app/views/admin/inquiries/_inquiry.html.erb +3 -3
- data/vendor/plugins/inquiries/app/views/inquiries/new.html.erb +1 -1
- data/vendor/plugins/inquiries/app/views/inquiries/thank_you.html.erb +1 -1
- data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +1 -1
- data/vendor/plugins/news/app/controllers/news_items_controller.rb +1 -1
- data/vendor/plugins/news/app/views/news_items/index.html.erb +1 -1
- data/vendor/plugins/news/app/views/news_items/show.html.erb +1 -1
- data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +1 -1
- data/vendor/plugins/pages/app/models/page.rb +42 -42
- data/vendor/plugins/pages/app/models/page_part.rb +1 -1
- data/vendor/plugins/pages/app/presenters/page_presenter.rb +1 -1
- data/vendor/plugins/pages/app/views/admin/page_dialogs/_page_link.html.erb +1 -1
- data/vendor/plugins/pages/app/views/admin/pages/_form.html.erb +1 -1
- data/vendor/plugins/pages/app/views/admin/pages/_list.html.erb +1 -1
- data/vendor/plugins/pages/app/views/admin/pages/_page_part_field.html.erb +1 -1
- data/vendor/plugins/pages/app/views/pages/home.html.erb +1 -1
- data/vendor/plugins/pages/app/views/pages/show.html.erb +1 -1
- data/vendor/plugins/pages/rails/init.rb +5 -5
- data/vendor/plugins/rails_indexes/lib/indexer.rb +49 -47
- data/vendor/plugins/rails_indexes/tasks/indexer.rake +5 -3
- data/vendor/plugins/rails_indexes/test/fixtures/app/controllers/users_controller.rb +3 -3
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/address.rb +2 -2
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/company.rb +4 -4
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/country.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/freelancer.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/gift.rb +4 -4
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/god.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/user.rb +7 -6
- data/vendor/plugins/rails_indexes/test/fixtures/app/sweepers/user_sweeper.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/schema.rb +9 -9
- data/vendor/plugins/rails_indexes/test/rails_indexes_test.rb +18 -18
- data/vendor/plugins/refinery/app/views/admin/_head.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/layouts/application.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_content_page.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_head.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_header.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_menu_branch.html.erb +5 -5
- data/vendor/plugins/refinery/app/views/shared/_submenu.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_continue_editing.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_error_messages_for.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_image_picker.html.erb +27 -13
- data/vendor/plugins/refinery/app/views/shared/admin/_resource_picker.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_search.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_sortable_list.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/model.rb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/public_controller.rb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_sortable_list.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/index.html.erb +2 -2
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/index.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/show.html.erb +1 -1
- data/vendor/plugins/refinery/lib/refinery/activity.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/application_controller.rb +4 -4
- data/vendor/plugins/refinery/lib/refinery/application_helper.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/base_presenter.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/initializer.rb +1 -1
- data/vendor/plugins/refinery_dialogs/app/controllers/admin/dialogs_controller.rb +1 -1
- data/vendor/plugins/resources/app/models/resource.rb +8 -8
- data/vendor/plugins/resources/app/views/admin/resources/_form.html.erb +1 -1
- data/vendor/plugins/resources/app/views/admin/resources/index.html.erb +1 -1
- data/vendor/plugins/resources/app/views/admin/resources/insert.html.erb +1 -1
- data/vendor/plugins/resources/config/routes.rb +2 -2
- data/vendor/plugins/resources/rails/init.rb +1 -1
- data/vendor/plugins/themes/app/controllers/admin/themes_controller.rb +17 -17
- data/vendor/plugins/themes/app/models/theme.rb +40 -40
- data/vendor/plugins/themes/app/views/admin/themes/_form.html.erb +1 -1
- data/vendor/plugins/themes/config/routes.rb +2 -2
- data/vendor/plugins/themes/lib/theme_server.rb +26 -0
- data/vendor/plugins/themes/rails/init.rb +3 -1
- metadata +6 -3
- data/vendor/plugins/themes/app/controllers/themes_controller.rb +0 -45
@@ -17,13 +17,13 @@
|
|
17
17
|
<div id='records'>
|
18
18
|
<%% if searching? %>
|
19
19
|
<h2>Search Results for "<%%= params[:search] %>"</h2>
|
20
|
-
<%%
|
20
|
+
<%% unless @<%= plural_name %>.empty? %>
|
21
21
|
<%%= render :partial => "<%= singular_name %>", :collection => @<%= plural_name %> %>
|
22
22
|
<%% else %>
|
23
23
|
<p>Sorry, no results found.</p>
|
24
24
|
<%% end %>
|
25
25
|
<%% else %>
|
26
|
-
<%%
|
26
|
+
<%% unless @<%= plural_name %>.empty? %>
|
27
27
|
<%%= will_paginate @<%= plural_name %>, :previous_label => '«', :next_label => '»' %>
|
28
28
|
<ul id='sortable_list'>
|
29
29
|
<%%= render :partial => "sortable_list" %>
|
@@ -43,9 +43,9 @@ class Refinery::ApplicationController < ActionController::Base
|
|
43
43
|
|
44
44
|
protected
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
def setup_theme
|
47
|
+
self.view_paths = ::ActionController::Base.view_paths.dup.unshift(Rails.root.join("themes", RefinerySetting[:theme], "views").to_s)
|
48
|
+
end
|
49
49
|
|
50
50
|
def take_down_for_maintenance?
|
51
51
|
if RefinerySetting.find_or_set(:down_for_maintenance, false)
|
@@ -78,4 +78,4 @@ protected
|
|
78
78
|
super
|
79
79
|
end
|
80
80
|
|
81
|
-
end
|
81
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Resource < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
3
|
+
# Docs for attachment_fu http://github.com/technoweenie/attachment_fu
|
4
4
|
has_attachment :storage => (USE_S3_BACKEND ? :s3 : :file_system),
|
5
5
|
:size => 0.kilobytes..50.megabytes,
|
6
6
|
:path_prefix => (USE_S3_BACKEND ? nil : 'public/system/resources')
|
@@ -11,13 +11,13 @@ class Resource < ActiveRecord::Base
|
|
11
11
|
acts_as_indexed :fields => [:title, :type_of_content],
|
12
12
|
:index_file => [Rails.root.to_s, "tmp", "index"]
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
# when a dialog pops up with images, how many images per page should there be
|
15
|
+
PAGES_PER_DIALOG = 12
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
# when listing images out in the admin area, how many images should show per page
|
18
|
+
PAGES_PER_ADMIN_INDEX = 20
|
19
19
|
|
20
|
-
|
20
|
+
# How many images per page should be displayed?
|
21
21
|
def self.per_page(dialog = false)
|
22
22
|
dialog ? PAGES_PER_DIALOG : PAGES_PER_ADMIN_INDEX
|
23
23
|
end
|
@@ -28,9 +28,9 @@ class Resource < ActiveRecord::Base
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# Returns a titleized version of the filename
|
31
|
-
|
31
|
+
# my_file.pdf returns My File
|
32
32
|
def title
|
33
|
-
self.filename.gsub(/\.\w+$/, '').titleize
|
33
|
+
CGI::unescape(self.filename).gsub(/\.\w+$/, '').titleize
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
@@ -2,24 +2,24 @@ class Admin::ThemesController < Admin::BaseController
|
|
2
2
|
|
3
3
|
crudify :theme, :order => "updated_at DESC"
|
4
4
|
|
5
|
-
|
5
|
+
before_filter :find_theme, :only => [:update, :destroy, :edit, :preview_image, :activate]
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
17
|
|
18
|
-
|
19
|
-
|
18
|
+
def activate
|
19
|
+
RefinerySetting[:theme] = @theme.folder_title
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
flash[:notice] = "'#{@theme.title}' applied to live site."
|
22
|
+
redirect_to admin_themes_url
|
23
|
+
end
|
24
24
|
|
25
|
-
end
|
25
|
+
end
|
@@ -11,46 +11,46 @@ class Theme < ActiveRecord::Base
|
|
11
11
|
before_save :read_theme
|
12
12
|
|
13
13
|
has_attachment :storage => (USE_S3_BACKEND ? :s3 : :file_system),
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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.license = File.open(File.join(theme_path, "LICENSE")).read if File.exists? File.join(theme_path, "LICENSE")
|
49
49
|
self.description = File.open(File.join(theme_path, "README")).read if File.exists? File.join(theme_path, "README")
|
50
|
-
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
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
55
|
|
56
|
-
end
|
56
|
+
end
|
@@ -4,9 +4,9 @@ ActionController::Routing::Routes.draw do |map|
|
|
4
4
|
admin.resources :themes, :member => {:preview_image => :get, :activate => :get}
|
5
5
|
end
|
6
6
|
|
7
|
-
|
7
|
+
# allows theme files that are not in the Rails public directory to be served back to the client
|
8
8
|
map.connect 'theme/stylesheets/*filepath', :controller => 'themes', :action => 'stylesheets'
|
9
9
|
map.connect 'theme/javascripts/*filepath', :controller => 'themes', :action => 'javascripts'
|
10
10
|
map.connect 'theme/images/*filepath', :controller => 'themes', :action => 'images'
|
11
11
|
|
12
|
-
end
|
12
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Allow the metal piece to run in isolation
|
2
|
+
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
|
3
|
+
|
4
|
+
# Servers theme files from the them directory without touching Rails too much
|
5
|
+
class ThemeServer
|
6
|
+
|
7
|
+
def initialize(app)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
if env["PATH_INFO"] =~ /^\/theme/
|
13
|
+
relative_path = env["PATH_INFO"].gsub(/^\/theme\//, '')
|
14
|
+
|
15
|
+
if (file_path = Rails.root.join "themes", RefinerySetting[:theme], relative_path).exist?
|
16
|
+
[200, {"Content-Type" => Rack::Mime.mime_type(File.extname file_path)}, file_path.open]
|
17
|
+
else
|
18
|
+
[404, {"Content-Type" => "text/html"}, ["404 file not found."]]
|
19
|
+
end
|
20
|
+
else
|
21
|
+
status, headers, response = @app.call(env)
|
22
|
+
[status, headers, response]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
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.6.
|
4
|
+
version: 0.9.6.6
|
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: 2010-02-
|
14
|
+
date: 2010-02-11 00:00:00 +13:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|
@@ -212,6 +212,9 @@ files:
|
|
212
212
|
- script/process/spawner
|
213
213
|
- script/runner
|
214
214
|
- script/server
|
215
|
+
- test/files/The world!.gif
|
216
|
+
- test/files/car-wallpapers19.jpg
|
217
|
+
- test/fixtures/images.yml
|
215
218
|
- test/fixtures/page_parts.yml
|
216
219
|
- test/fixtures/pages.yml
|
217
220
|
- test/performance/browsing_test.rb
|
@@ -516,7 +519,6 @@ files:
|
|
516
519
|
- vendor/plugins/resources/rails/init.rb
|
517
520
|
- vendor/plugins/resources/resources.md
|
518
521
|
- vendor/plugins/themes/app/controllers/admin/themes_controller.rb
|
519
|
-
- vendor/plugins/themes/app/controllers/themes_controller.rb
|
520
522
|
- vendor/plugins/themes/app/models/theme.rb
|
521
523
|
- vendor/plugins/themes/app/views/admin/themes/_form.html.erb
|
522
524
|
- vendor/plugins/themes/app/views/admin/themes/_theme.html.erb
|
@@ -524,6 +526,7 @@ files:
|
|
524
526
|
- vendor/plugins/themes/app/views/admin/themes/index.html.erb
|
525
527
|
- vendor/plugins/themes/app/views/admin/themes/new.html.erb
|
526
528
|
- vendor/plugins/themes/config/routes.rb
|
529
|
+
- vendor/plugins/themes/lib/theme_server.rb
|
527
530
|
- vendor/plugins/themes/rails/init.rb
|
528
531
|
- vendor/plugins/themes/themes.md
|
529
532
|
has_rdoc: true
|
@@ -1,45 +0,0 @@
|
|
1
|
-
class ThemesController < ApplicationController
|
2
|
-
|
3
|
-
def stylesheets
|
4
|
-
render_theme_item(:stylesheets, params[:filepath])
|
5
|
-
end
|
6
|
-
|
7
|
-
def javascripts
|
8
|
-
render_theme_item(:javascripts, params[:filepath])
|
9
|
-
end
|
10
|
-
|
11
|
-
def images
|
12
|
-
render_theme_item(:images, params[:filepath])
|
13
|
-
end
|
14
|
-
|
15
|
-
protected
|
16
|
-
|
17
|
-
def render_theme_item(type, relative_path)
|
18
|
-
if File.exist?(file_path = File.join(Rails.root, "themes", RefinerySetting[:theme], type.to_s, relative_path))
|
19
|
-
send_file(file_path, :type => mime_for(relative_path), :disposition => 'inline', :stream => true)
|
20
|
-
else
|
21
|
-
return error_404
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def mime_for(filename)
|
26
|
-
# could we use the built in Rails mime types to work this out?
|
27
|
-
case filename.last.downcase
|
28
|
-
when /\.js$/
|
29
|
-
'text/javascript; charset=utf-8'
|
30
|
-
when /\.css$/
|
31
|
-
'text/css; charset=utf-8'
|
32
|
-
when /\.gif$/
|
33
|
-
'image/gif'
|
34
|
-
when /(\.jpg|\.jpeg)$/
|
35
|
-
'image/jpeg'
|
36
|
-
when /\.png$/
|
37
|
-
'image/png'
|
38
|
-
when /\.swf$/
|
39
|
-
'application/x-shockwave-flash'
|
40
|
-
else
|
41
|
-
'application/binary'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|