camaleon_cms 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of camaleon_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/apps/plugins/front_cache/front_cache_helper.rb +2 -1
- data/app/apps/plugins/visibility_post/visibility_post_helper.rb +3 -3
- data/app/apps/themes/camaleon_first/views/layouts/index.html.erb +1 -1
- data/app/apps/themes/default/views/layouts/index.html.erb +1 -1
- data/app/apps/themes/new/views/layouts/index.html.erb +1 -1
- data/app/decorators/site_decorator.rb +2 -1
- data/app/helpers/admin/menus_helper.rb +1 -1
- data/app/helpers/plugins_helper.rb +14 -5
- data/app/helpers/site_helper.rb +3 -1
- data/app/helpers/theme_helper.rb +11 -3
- data/app/models/site.rb +1 -1
- data/app/views/admin/appearances/themes/index.html.erb +2 -2
- data/app/views/admin/settings/site.html.erb +1 -1
- data/lib/camaleon_cms/engine.rb +0 -1
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/generators/camaleon_cms/install_template/plugin_routes.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86c5a7115b4f87254af8ba53628179b7b6304a87
|
4
|
+
data.tar.gz: 008600c9651dd60a96ce27fafba73ff9382ed0ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0720ca7d3b7530b926b2ee3065b14893a766470890fdc297be2cc7903c6c68dca42d13a2edf2dcd58e552cf4b3ea0a44e91be645c86f20c88c924883cbb5402
|
7
|
+
data.tar.gz: 67eff63900f35a31c009994939e87d82349e830f6b29ad94f455e1e852f072a64bc68544a2f9bce9c1d3c25b3067ca7f656b8af1749ea7981b16f6bf77e7455c
|
@@ -12,6 +12,7 @@ module Plugins::FrontCache::FrontCacheHelper
|
|
12
12
|
def front_cache_front_before_load
|
13
13
|
return if signin?
|
14
14
|
cache_key = front_cache_get_key
|
15
|
+
ActionController::Base.page_cache_directory = Rails.root.join("tmp", "cache", "pages")
|
15
16
|
if page_cache_exist?(cache_key) # recover cache file
|
16
17
|
Rails.logger.info "============================================== readed cache: #{cache_key}"
|
17
18
|
render text: File.read(page_cache_get(cache_key)).gsub("{{form_authenticity_token}}", form_authenticity_token)
|
@@ -133,7 +134,7 @@ module Plugins::FrontCache::FrontCacheHelper
|
|
133
134
|
# clear all frontend cache files
|
134
135
|
def front_cache_clean
|
135
136
|
FileUtils.rm_f(cache_store.cache_path) # clear fragment caches
|
136
|
-
FileUtils.rm_rf(File.join(
|
137
|
+
FileUtils.rm_rf(File.join(ActionController::Base.page_cache_directory, current_site.id.to_s)) # clear site pages cache
|
137
138
|
end
|
138
139
|
|
139
140
|
private
|
@@ -57,10 +57,10 @@ module Plugins::VisibilityPost::VisibilityPostHelper
|
|
57
57
|
def plugin_visibility_filter_post(args)
|
58
58
|
args[:active_record] = args[:active_record].where("(posts.published_at is null or posts.published_at <= ?)", Time.now)
|
59
59
|
if signin?
|
60
|
-
if ActiveRecord::Base.connection.adapter_name.downcase.include?("
|
61
|
-
args[:active_record] = args[:active_record].where("visibility != 'private' or (visibility = 'private' and (',' || posts.visibility_value || ',') LIKE '%,#{current_site.visitor_role},%')")
|
62
|
-
else
|
60
|
+
if ActiveRecord::Base.connection.adapter_name.downcase.include?("mysql")
|
63
61
|
args[:active_record] = args[:active_record].where("visibility != 'private' or (visibility = 'private' and FIND_IN_SET(?, posts.visibility_value))", current_site.visitor_role)
|
62
|
+
else
|
63
|
+
args[:active_record] = args[:active_record].where("visibility != 'private' or (visibility = 'private' and (',' || posts.visibility_value || ',') LIKE '%,#{current_site.visitor_role},%')")
|
64
64
|
end
|
65
65
|
else
|
66
66
|
args[:active_record] = args[:active_record].where("visibility != 'private'")
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
8
8
|
<!-- END META SECTION -->
|
9
9
|
|
10
|
-
<%= stylesheet_link_tag theme_asset_path("css/main") %>
|
10
|
+
<%= stylesheet_link_tag theme_asset_path("css/main.css") %>
|
11
11
|
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
12
12
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Montserrat%3A400%2C700&ver=4.2.2">
|
13
13
|
<%= javascript_include_tag theme_asset_path("js/main.js") %>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
8
8
|
<!-- END META SECTION -->
|
9
9
|
<%#= javascript_include_tag theme_asset_path("js/main.js") %>
|
10
|
-
<%= stylesheet_link_tag theme_asset_path("css/main") %>
|
10
|
+
<%= stylesheet_link_tag theme_asset_path("css/main.css") %>
|
11
11
|
<%= stylesheet_link_tag theme_asset_path("genericons/genericons.css") %>
|
12
12
|
<%= raw the_head %>
|
13
13
|
</head>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
9
9
|
<!-- END META SECTION -->
|
10
10
|
|
11
|
-
<%= stylesheet_link_tag theme_asset_path("css/main") %>
|
11
|
+
<%= stylesheet_link_tag theme_asset_path("css/main.css") %>
|
12
12
|
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
|
13
13
|
<%= javascript_include_tag theme_asset_path("js/main.js") %>
|
14
14
|
<%= raw the_head %>
|
@@ -24,10 +24,11 @@ class SiteDecorator < TermTaxonomyDecorator
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# return all contents from this site registered for post_type = slug (filter visibility, hidden, expired, ...)
|
27
|
-
# slug_or_id: slug or id of the post_type, default 'post'
|
27
|
+
# slug_or_id: slug or id of the post_type or array of slugs, default 'post'
|
28
28
|
def the_contents(slug_or_id = "post")
|
29
29
|
return h.verify_front_visibility(object.posts.where("term_taxonomy.id = ?", slug_or_id)) if slug_or_id.is_a?(Integer)
|
30
30
|
return h.verify_front_visibility(object.posts.where("term_taxonomy.slug = ?", slug_or_id)) if slug_or_id.is_a?(String)
|
31
|
+
return h.verify_front_visibility(object.posts.where("term_taxonomy.slug in (?)", slug_or_id)) if slug_or_id.is_a?(Array)
|
31
32
|
end
|
32
33
|
|
33
34
|
# return all contents for this site registered for post_type = slug (filter visibility, hidden, expired, ...)
|
@@ -152,7 +152,7 @@ module Admin::MenusHelper
|
|
152
152
|
bool = false
|
153
153
|
menus.each_with_index do |menu, index_menu|
|
154
154
|
menu[:key] = "#{parent_index}__#{rand(999...99999)}" if menu[:key].nil?
|
155
|
-
uri = URI(menu[:url])
|
155
|
+
uri = URI(menu[:url].to_s)
|
156
156
|
url_path = uri.path
|
157
157
|
url_query = uri.query
|
158
158
|
bool = url_path.to_s == _url.to_s && url_path.present?
|
@@ -78,13 +78,22 @@ module PluginsHelper
|
|
78
78
|
|
79
79
|
# return plugin full asset path
|
80
80
|
# plugin_key: plugin name
|
81
|
-
#
|
82
|
-
# sample: <script src="<%= plugin_asset_path("my_plugin", "js/admin.js") %>"></script>
|
83
|
-
def plugin_asset_path(plugin_key, asset
|
84
|
-
|
85
|
-
"plugins/#{plugin_key}/assets/#{asset}"
|
81
|
+
# asset: (String) asset name
|
82
|
+
# sample: <script src="<%= plugin_asset_path("my_plugin", "js/admin.js") %>"></script> => /assets/plugins/my_plugin/assets/css/main-54505620f.css
|
83
|
+
def plugin_asset_path(plugin_key, asset)
|
84
|
+
asset_url("plugins/#{plugin_key}/assets/#{asset}")
|
86
85
|
end
|
87
86
|
|
87
|
+
# return the full url for asset of current plugin:
|
88
|
+
# asset: (String) asset name
|
89
|
+
# plugin_key: (optional) plugin name, default (current plugin caller to this function)
|
90
|
+
# sample:
|
91
|
+
# plugin_asset_url("css/main.css") => return: http://myhost.com/assets/plugins/my_plugin/assets/css/main-54505620f.css
|
92
|
+
def plugin_asset_url(asset, plugin_key = nil)
|
93
|
+
asset_url("plugins/#{plugin_key || self_plugin_key}/assets/#{asset}")
|
94
|
+
end
|
95
|
+
|
96
|
+
|
88
97
|
# auto load all helpers of this plugin
|
89
98
|
def plugin_load_helpers(plugin)
|
90
99
|
return if !plugin.present? || !plugin["helpers"].present?
|
data/app/helpers/site_helper.rb
CHANGED
@@ -89,7 +89,9 @@ module SiteHelper
|
|
89
89
|
# new theme
|
90
90
|
current_site.set_option('_theme', key)
|
91
91
|
theme = PluginRoutes.theme_info(key)
|
92
|
+
current_site.themes.update_all(status: "inactive")
|
92
93
|
theme_model = current_site.themes.where(slug: key).first_or_create!{|t| t.name = theme[:name]; }
|
94
|
+
theme_model.update(status: nil)
|
93
95
|
hook_run(theme, "on_active", theme_model)
|
94
96
|
PluginRoutes.reload
|
95
97
|
end
|
@@ -100,7 +102,7 @@ module SiteHelper
|
|
100
102
|
theme = PluginRoutes.theme_info(key)
|
101
103
|
theme_model = current_site.get_theme(key)
|
102
104
|
hook_run(theme, "on_inactive", theme_model) if theme_model.present?
|
103
|
-
theme_model.destroy
|
105
|
+
# theme_model.destroy
|
104
106
|
end
|
105
107
|
|
106
108
|
|
data/app/helpers/theme_helper.rb
CHANGED
@@ -24,10 +24,18 @@ module ThemeHelper
|
|
24
24
|
# return theme full asset path
|
25
25
|
# theme_name: theme name, if nil, then will use current theme
|
26
26
|
# asset: asset file name, if asset is present return full path to this asset
|
27
|
-
# sample: <script src="<%= theme_asset_path("js/admin.js") %>"></script>
|
27
|
+
# sample: <script src="<%= theme_asset_path("js/admin.js") %>"></script> => return: /assets/themes/my_theme/assets/css/main-54505620f.css
|
28
28
|
def theme_asset_path(asset = nil, theme_name = nil)
|
29
|
-
|
30
|
-
|
29
|
+
asset_url("themes/#{theme_name || current_theme.slug }/assets/#{asset}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# return the full url for asset of current theme:
|
33
|
+
# asset: (String) asset name
|
34
|
+
# theme_name: (optional) theme name, default (current theme caller to this function)
|
35
|
+
# sample:
|
36
|
+
# theme_asset_url("css/main.css") => return: http://myhost.com/assets/themes/my_theme/assets/css/main-54505620f.css
|
37
|
+
def theme_asset_url(asset, theme_name = nil)
|
38
|
+
asset_url("themes/#{theme_name || current_theme.slug }/assets/#{asset}")
|
31
39
|
end
|
32
40
|
|
33
41
|
# return theme full view path
|
data/app/models/site.rb
CHANGED
@@ -94,7 +94,7 @@ class Site < TermTaxonomy
|
|
94
94
|
# return theme model with slug theme_slug for this site
|
95
95
|
# theme_slug: (optional) if it is null, this will return current theme for this site
|
96
96
|
def get_theme(theme_slug = nil)
|
97
|
-
self.themes.where(slug: (theme_slug || get_theme_slug)).first_or_create!
|
97
|
+
self.themes.where(slug: (theme_slug || get_theme_slug), status: nil).first_or_create!
|
98
98
|
end
|
99
99
|
|
100
100
|
# return plugin model with slug plugin_slug
|
@@ -37,8 +37,8 @@
|
|
37
37
|
<div class="panel-footer text-muted text-right">
|
38
38
|
<% if current_theme.slug == theme[:key] && params[:set].nil? %>
|
39
39
|
<% r = {links: []}; hook_run(theme, "theme_options", r) %>
|
40
|
-
<% r[:links] << link_to(raw(' Import Data (data.json) '), admin_plugins_export_content_settings_path(file: ["app", "apps", 'themes', theme[:key], 'data.json'].join("/"))) if current_site.plugin_installed?('export_content') && File.exist?(
|
41
|
-
<% r[:links] << link_to(raw(' Import Data (data.json) '), "#", {'onclick' => "alert('You need to install import/export plugin to import sample data.'); return false;"}) if !current_site.plugin_installed?('export_content') && File.exist?(
|
40
|
+
<% r[:links] << link_to(raw(' Import Data (data.json) '), admin_plugins_export_content_settings_path(file: ["app", "apps", 'themes', theme[:key], 'data.json'].join("/"))) if current_site.plugin_installed?('export_content') && File.exist?(File.join(theme["path"], "data.json")) %>
|
41
|
+
<% r[:links] << link_to(raw(' Import Data (data.json) '), "#", {'onclick' => "alert('You need to install import/export plugin to import sample data.'); return false;"}) if !current_site.plugin_installed?('export_content') && File.exist?(File.join(theme["path"], "data.json")) %>
|
42
42
|
<%= raw r[:links].join(" | ") %>
|
43
43
|
<span class="btn btn-success"><%= t('admin.button.actived').upcase %></span>
|
44
44
|
<% else %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%
|
2
|
-
theme_settings_file =
|
2
|
+
theme_settings_file = File.join(current_theme.settings["path"], "views/admin/settings.html.erb").to_s
|
3
3
|
@site.slug = PluginRoutes.system_info["base_domain"] if current_site.main_site?
|
4
4
|
groups = @site.get_field_groups()
|
5
5
|
%>
|
data/lib/camaleon_cms/engine.rb
CHANGED
@@ -45,7 +45,6 @@ module CamaleonCms
|
|
45
45
|
|
46
46
|
# cache control
|
47
47
|
app.config.cache_store = :file_store, Rails.root.join("tmp","cache","vars")
|
48
|
-
app.config.action_controller.page_cache_directory = Rails.root.join("tmp","cache","pages")# (pending for error)
|
49
48
|
|
50
49
|
# extra configuration for plugins
|
51
50
|
app.config.autoload_paths += %W{#{app.config.root}/app/apps/**/}
|
data/lib/camaleon_cms/version.rb
CHANGED
@@ -80,7 +80,6 @@ class PluginRoutes
|
|
80
80
|
camaleon_gem = get_gem('camaleon_cms')
|
81
81
|
return {} if !camaleon_gem
|
82
82
|
r = cache_variable("system_info"); return r unless r.nil?
|
83
|
-
res = {}
|
84
83
|
res = JSON.parse(File.read(File.join(camaleon_gem.gem_dir, "config", "system.json")))
|
85
84
|
res = res.with_indifferent_access rescue res
|
86
85
|
return cache_variable("system_info", res) unless File.exist?(system_file = File.join(apps_dir, "..", '..', "config", "system.json"))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camaleon_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen Peredo Diaz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Camaleon CMS is a dynamic and advanced content management system based
|
14
14
|
on Ruby on Rails 4 as an alternative to Wordpress.
|