forked from refinery/refinerycms
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds some improvements and removes some annoyances.
- Loading branch information
Showing
8 changed files
with
61 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.9.6.21 | ||
0.9.6.22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
vendor/plugins/refinery_settings/app/models/refinery_setting.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
vendor/plugins/themes/app/models/theme.rb → vendor/plugins/themes/lib/theme.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
class Theme | ||
|
||
def self.current_theme(request = nil) | ||
def self.current_theme(env) | ||
RefinerySetting[:theme] | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,31 @@ | ||
# Before the application gets setup this will fail badly if there's no database. | ||
if RefinerySetting.table_exists? | ||
# Set up middleware to serve theme files | ||
config.middleware.use "ThemeServer" | ||
|
||
::Refinery::ApplicationController.module_eval do | ||
|
||
# Add or remove theme paths to/from Refinery application | ||
before_filter do |controller| | ||
# remove any paths relating to any theme. | ||
controller.view_paths.reject! { |v| v.to_s =~ %r{^themes/} } | ||
|
||
# add back theme paths if there is a theme present. | ||
if (theme = Theme.current_theme(controller.request)).present? | ||
# Set up view path again for the current theme. | ||
controller.view_paths.unshift Rails.root.join("themes", theme, "views").to_s | ||
|
||
# Ensure that routes within the application are top priority. | ||
# Here we grab all the routes that are under the application's view folder | ||
# and promote them ahead of any other path. | ||
controller.view_paths.select{|p| p.to_s =~ /^app\/views/}.each do |app_path| | ||
controller.view_paths.unshift app_path | ||
end | ||
# Set up middleware to serve theme files | ||
config.middleware.use "ThemeServer" | ||
|
||
::Refinery::ApplicationController.module_eval do | ||
|
||
# Add or remove theme paths to/from Refinery application | ||
before_filter do |controller| | ||
# remove any paths relating to any theme. | ||
controller.view_paths.reject! { |v| v.to_s =~ %r{^themes/} } | ||
|
||
# add back theme paths if there is a theme present. | ||
if (theme = Theme.current_theme(controller.request.env)).present? | ||
# Set up view path again for the current theme. | ||
controller.view_paths.unshift Rails.root.join("themes", theme, "views").to_s | ||
|
||
# Ensure that routes within the application are top priority. | ||
# Here we grab all the routes that are under the application's view folder | ||
# and promote them ahead of any other path. | ||
controller.view_paths.select{|p| p.to_s =~ /^app\/views/}.each do |app_path| | ||
controller.view_paths.unshift app_path | ||
end | ||
|
||
# Set up menu caching for this theme or lack thereof | ||
RefinerySetting[:refinery_menu_cache_action_suffix] = "#{"#{theme}_" if theme.present?}site_menu" | ||
end | ||
|
||
# Set up menu caching for this theme or lack thereof | ||
RefinerySetting[:refinery_menu_cache_action_suffix] = "#{"#{theme}_" if theme.present?}site_menu" if RefinerySetting.table_exists? | ||
end | ||
|
||
# Include theme functions into application helper. | ||
Refinery::ApplicationHelper.send :include, ThemesHelper | ||
|
||
end | ||
|
||
# Include theme functions into application helper. | ||
Refinery::ApplicationHelper.send :include, ThemesHelper |