camaleon_cms 2.0.2 → 2.0.3
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/README.md +5 -3
- data/app/controllers/camaleon_cms/admin/media_controller.rb +2 -0
- data/app/controllers/camaleon_cms/frontend_controller.rb +0 -6
- data/app/decorators/camaleon_cms/application_decorator.rb +0 -5
- data/app/decorators/camaleon_cms/user_decorator.rb +0 -5
- data/app/helpers/camaleon_cms/camaleon_helper.rb +7 -1
- data/app/helpers/camaleon_cms/frontend/seo_helper.rb +29 -9
- data/app/helpers/camaleon_cms/frontend/site_helper.rb +12 -7
- data/app/helpers/camaleon_cms/uploader_helper.rb +3 -0
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/generators/camaleon_cms/install_generator.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1ba5c936124f4f5012e985ffa2380addcb3b741
|
4
|
+
data.tar.gz: e9aced89daa293cfaca1717564102bfd4c19b7b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32c21dbff1283ac8e05ef6d59cc6f3f03c495684b57f302d99147bf2dd7de4339dfe3aa8164d4b3d501b453f50c4807501d7fead43c533f00ef228ca2eafa792
|
7
|
+
data.tar.gz: bbe6bc4fc4ea279ec53846f18d91b67ff59930ec64ac03f41b0216f29037a1f7325cee18e2bf37ffbd2373b67e73b365503ee8f26090d36c3144de936def94ae
|
data/README.md
CHANGED
@@ -28,8 +28,8 @@
|
|
28
28
|
* Add the gem in your Gemfile
|
29
29
|
|
30
30
|
```
|
31
|
-
gem "camaleon_cms"
|
32
|
-
# If you are using Camaleon CMS 1x, you
|
31
|
+
gem "camaleon_cms"
|
32
|
+
# If you are using Camaleon CMS 1x, you need to use this patch
|
33
33
|
gem "migration1x", github: 'owen2345/camaleoncms_1xmigration'
|
34
34
|
```
|
35
35
|
* Install required Gem and dependencies
|
@@ -37,7 +37,7 @@
|
|
37
37
|
```
|
38
38
|
bundle install
|
39
39
|
```
|
40
|
-
* Install the CMS (
|
40
|
+
* Install the CMS (before this, you can change defaut configuration in config/system.json)
|
41
41
|
|
42
42
|
```
|
43
43
|
rails generate camaleon_cms:install
|
@@ -52,6 +52,7 @@
|
|
52
52
|
```
|
53
53
|
rails server # and then go to your browser http://localhost:3000/
|
54
54
|
```
|
55
|
+
Previous stable version (1x): https://github.com/owen2345/camaleon-cms/tree/version_1x
|
55
56
|
|
56
57
|
# Camaleon CMS (It adapts to your needs)
|
57
58
|
|
@@ -85,6 +86,7 @@ It was released on July, 2015 and tested previously with more than 20 projects b
|
|
85
86
|
- Easy migration from wordpress
|
86
87
|
|
87
88
|
## Some features are:
|
89
|
+
* Integrate into existent Ruby on Rails Projects
|
88
90
|
* Easy administration
|
89
91
|
Camaleon CMS permit you to adapt the CMS to all your needs and not you adapt to the CMS.
|
90
92
|
I.E. you can create your custom architecture with all attributes that you need for each kind of content.
|
@@ -17,6 +17,8 @@ class CamaleonCms::Admin::MediaController < CamaleonCms::AdminController
|
|
17
17
|
authorize! :manager, :media
|
18
18
|
@show_file_actions = true
|
19
19
|
add_breadcrumb I18n.t("camaleon_cms.admin.sidebar.media")
|
20
|
+
render "index"
|
21
|
+
cama_draw_timer
|
20
22
|
end
|
21
23
|
|
22
24
|
# crop a image to save as a new file
|
@@ -20,7 +20,6 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
20
20
|
# home page for frontend
|
21
21
|
def index
|
22
22
|
@cama_visited_home = true
|
23
|
-
cama_init_seo(current_site)
|
24
23
|
if @_site_options[:home_page].present?
|
25
24
|
render_post(@_site_options[:home_page].to_i)
|
26
25
|
else
|
@@ -39,7 +38,6 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
39
38
|
return page_not_found
|
40
39
|
end
|
41
40
|
@cama_visited_category = @category
|
42
|
-
cama_init_seo(@category)
|
43
41
|
@children = @category.children.no_empty.decorate
|
44
42
|
@posts = @category.the_posts.paginate(:page => params[:page], :per_page => current_site.front_per_page).eager_load(:metas)
|
45
43
|
r_file = lookup_context.template_exists?("categories/#{@category.the_slug}") ? "categories/#{@category.the_slug}" : "category"
|
@@ -56,7 +54,6 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
56
54
|
return page_not_found
|
57
55
|
end
|
58
56
|
@cama_visited_post_type = @post_type
|
59
|
-
cama_init_seo(@post_type)
|
60
57
|
@posts = @post_type.the_posts.paginate(:page => params[:page], :per_page => current_site.front_per_page).eager_load(:metas)
|
61
58
|
@categories = @post_type.categories.no_empty.eager_load(:metas).decorate
|
62
59
|
@post_tags = @post_type.post_tags.eager_load(:metas)
|
@@ -75,7 +72,6 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
75
72
|
return page_not_found
|
76
73
|
end
|
77
74
|
@cama_visited_tag = @post_tag
|
78
|
-
cama_init_seo(@post_tag)
|
79
75
|
@posts = @post_tag.the_posts.paginate(:page => params[:page], :per_page => current_site.front_per_page).eager_load(:metas)
|
80
76
|
r_file = lookup_context.template_exists?("post_tags/#{@post_tag.the_slug}") ? "post_tags/#{@post_tag.the_slug}" : "post_tag"
|
81
77
|
layout_ = lookup_context.template_exists?("layouts/post_tags/#{@post_tag.the_slug}") ? "post_tags/#{@post_tag.the_slug}" : (self.send :_layout)
|
@@ -124,7 +120,6 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
124
120
|
return page_not_found
|
125
121
|
end
|
126
122
|
@cama_visited_profile = true
|
127
|
-
cama_init_seo(@user)
|
128
123
|
layout_ = lookup_context.template_exists?("layouts/profile") ? "profile" : (self.send :_layout)
|
129
124
|
r = {user: @user, layout: layout_, render: "profile"}; hooks_run("on_render_profile", r)
|
130
125
|
render r[:render], layout: r[:layout]
|
@@ -158,7 +153,6 @@ class CamaleonCms::FrontendController < CamaleonCms::CamaleonController
|
|
158
153
|
else
|
159
154
|
@post = @post.decorate
|
160
155
|
@cama_visited_post = @post
|
161
|
-
cama_init_seo(@post)
|
162
156
|
@post_type = @post.the_post_type
|
163
157
|
@comments = @post.the_comments
|
164
158
|
@categories = @post.the_categories
|
@@ -44,11 +44,6 @@ class CamaleonCms::ApplicationDecorator < Draper::Decorator
|
|
44
44
|
h.breadcrumb_draw
|
45
45
|
end
|
46
46
|
|
47
|
-
# build the attributes for this model
|
48
|
-
def the_seo
|
49
|
-
h.cama_build_seo({ image: (the_thumb_url() rescue nil), title: the_title, description: the_excerpt, keywords: the_keywords, object: self })
|
50
|
-
end
|
51
|
-
|
52
47
|
# ---------------------
|
53
48
|
def set_decoration_locale(locale)
|
54
49
|
@_deco_locale = locale.to_sym
|
@@ -35,11 +35,6 @@ class CamaleonCms::UserDecorator < CamaleonCms::ApplicationDecorator
|
|
35
35
|
object.get_meta("slogan", "Hello World")
|
36
36
|
end
|
37
37
|
|
38
|
-
# generate all seo attributes for profile page
|
39
|
-
def the_seo
|
40
|
-
h.cama_build_seo({ image: (the_avatar rescue nil), title: the_name, object: self })
|
41
|
-
end
|
42
|
-
|
43
38
|
# return front url for this user
|
44
39
|
def the_url(*args)
|
45
40
|
args = args.extract_options!
|
@@ -16,7 +16,7 @@ module CamaleonCms::CamaleonHelper
|
|
16
16
|
# layout_name: path of the template to render
|
17
17
|
# template_name: template name to render in template_path
|
18
18
|
def sendmail(email,subject='Tiene una notificacion',content='',from=nil,attachs=[],template_name = 'mailer', layout_name = 'camaleon_cms/mailer')
|
19
|
-
Thread.abort_on_exception=true
|
19
|
+
# Thread.abort_on_exception=true
|
20
20
|
Thread.new do
|
21
21
|
HtmlMailer.sender(email, subject, content, from, attachs, cama_root_url, current_site, template_name, layout_name).deliver_now
|
22
22
|
ActiveRecord::Base.connection.close
|
@@ -92,4 +92,10 @@ module CamaleonCms::CamaleonHelper
|
|
92
92
|
cache
|
93
93
|
end
|
94
94
|
|
95
|
+
def cama_draw_timer
|
96
|
+
@_cama_timer ||= Time.current
|
97
|
+
puts "***************************************** timer: #{((Time.current - @_cama_timer) * 24 * 60 * 60).to_i} (#{caller.first})"
|
98
|
+
@_cama_timer = Time.current
|
99
|
+
end
|
100
|
+
|
95
101
|
end
|
@@ -7,22 +7,42 @@
|
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
9
|
module CamaleonCms::Frontend::SeoHelper
|
10
|
-
def cama_init_seo(model)
|
11
|
-
@_seo_info = model.the_seo
|
12
|
-
end
|
13
|
-
|
14
10
|
# add seo attributes to your page
|
15
11
|
# you can pass custom data to overwrite default data generated by the system
|
16
12
|
def cama_the_seo(data = {})
|
17
|
-
|
13
|
+
if is_home?
|
14
|
+
data2 = {}
|
15
|
+
elsif is_page?
|
16
|
+
data2 = {image: @cama_visited_post.the_thumb_url, title: @cama_visited_post.the_title, description: @cama_visited_post.the_excerpt, keywords: @cama_visited_post.the_keywords, object: @cama_visited_post }
|
17
|
+
elsif is_ajax?
|
18
|
+
data2 = {}
|
19
|
+
elsif is_search?
|
20
|
+
data2 = {title: "#{current_site.the_title} | #{ct("search_title", default: "Search")}"}
|
21
|
+
elsif is_post_type?
|
22
|
+
data2 = {image: @cama_visited_post_type.the_thumb_url, title: @cama_visited_post_type.the_title, description: @cama_visited_post_type.the_excerpt, keywords: @cama_visited_post_type.the_keywords, object: @cama_visited_post_type }
|
23
|
+
elsif is_post_tag?
|
24
|
+
data2 = {image: @cama_visited_tag.the_thumb_url, title: @cama_visited_tag.the_title, description: @cama_visited_tag.the_excerpt, keywords: @cama_visited_tag.the_keywords, object: @cama_visited_tag }
|
25
|
+
elsif is_category?
|
26
|
+
data2 = {image: @cama_visited_category.the_thumb_url, title: @cama_visited_category.the_title, description: @cama_visited_category.the_excerpt, keywords: @cama_visited_category.the_keywords, object: @cama_visited_category }
|
27
|
+
else
|
28
|
+
data2 = {}
|
29
|
+
end
|
30
|
+
cama_build_seo((@_cama_seo_default_values || {}).merge(data2).merge(data))
|
31
|
+
end
|
32
|
+
|
33
|
+
# permit to define define default seo attributes by code without hooks
|
34
|
+
# @Sample: cama_seo_default({title: "my custom title", description: "my descr", keywords: "my keywords", image: 'my img url'})
|
35
|
+
def cama_seo_default(options)
|
36
|
+
@_cama_seo_default_values ||= {}
|
37
|
+
@_cama_seo_default_values = @_cama_seo_default_values.merge(options)
|
18
38
|
end
|
19
39
|
|
20
40
|
# create seo attributes with options + default attributes
|
21
|
-
def cama_build_seo(options)
|
41
|
+
def cama_build_seo(options = {})
|
22
42
|
options[:image] = options[:image] || current_site.get_option("screenshot", current_site.the_logo)
|
23
|
-
options[:title] = I18n.transliterate(
|
24
|
-
options[:description] = I18n.transliterate(
|
25
|
-
options[:keywords] = I18n.transliterate(
|
43
|
+
options[:title] = I18n.transliterate(options[:title].present? ? "#{current_site.the_title} | #{options[:title]}" : current_site.the_title)
|
44
|
+
options[:description] = I18n.transliterate(options[:description].present? ? options[:description].to_s : current_site.the_option("seo_description"))
|
45
|
+
options[:keywords] = I18n.transliterate(options[:keywords].present? ? options[:keywords] : current_site.the_option("keywords"))
|
26
46
|
options[:url] = request.original_url
|
27
47
|
s = {
|
28
48
|
title: options[:title],
|
@@ -26,32 +26,37 @@ module CamaleonCms::Frontend::SiteHelper
|
|
26
26
|
|
27
27
|
# check if current section visited is for post
|
28
28
|
def is_page?
|
29
|
-
|
29
|
+
@cama_visited_post.present?
|
30
|
+
end
|
31
|
+
|
32
|
+
# check if current section visited is for post
|
33
|
+
def is_profile?
|
34
|
+
@cama_visited_profile.present?
|
30
35
|
end
|
31
36
|
|
32
37
|
# check if current section visited is for ajax
|
33
38
|
def is_ajax?
|
34
|
-
|
39
|
+
@cama_visited_ajax.present?
|
35
40
|
end
|
36
41
|
|
37
42
|
# check if current section visited is for search
|
38
43
|
def is_search?
|
39
|
-
["camaleon_cms/frontend", "frontend"].include?(params[:controller]) && params[:action] == "search"
|
44
|
+
@cama_visited_search.present? || ["camaleon_cms/frontend", "frontend"].include?(params[:controller]) && params[:action] == "search"
|
40
45
|
end
|
41
46
|
|
42
47
|
# check if current section visited is for post type
|
43
48
|
def is_post_type?
|
44
|
-
|
49
|
+
@cama_visited_post_type.present?
|
45
50
|
end
|
46
51
|
|
47
52
|
# check if current section visited is for post tag
|
48
53
|
def is_post_tag?
|
49
|
-
|
54
|
+
@cama_visited_tag.present?
|
50
55
|
end
|
51
56
|
|
52
57
|
# check if current section visited is for category
|
53
58
|
def is_category?
|
54
|
-
|
59
|
+
@cama_visited_category.present?
|
55
60
|
end
|
56
61
|
#**************** end section is a? ****************#
|
57
62
|
|
@@ -62,6 +67,6 @@ module CamaleonCms::Frontend::SiteHelper
|
|
62
67
|
def the_head(seo_attrs = {}, show_seo = true)
|
63
68
|
icon = "<link rel='shortcut icon' href='#{current_site.the_icon}'>"
|
64
69
|
js = "<script>var ROOT_URL = '#{cama_root_url}'; var LANGUAGE = '#{I18n.locale}'; </script>"
|
65
|
-
icon + "\n" + (csrf_meta_tag || "") + "\n" + (show_seo ? display_meta_tags(cama_the_seo
|
70
|
+
icon + "\n" + (csrf_meta_tag || "") + "\n" + (show_seo ? display_meta_tags(cama_the_seo(seo_attrs)) : "") + "\n" + js + "\n" + cama_draw_custom_assets
|
66
71
|
end
|
67
72
|
end
|
@@ -197,7 +197,9 @@ module CamaleonCms::UploaderHelper
|
|
197
197
|
# sample: cama_media_find_folder("test/exit")
|
198
198
|
def cama_media_find_folder(path = "")
|
199
199
|
res = nil
|
200
|
+
cama_draw_timer
|
200
201
|
folder = cama_uploader_browser_files[:folders]
|
202
|
+
cama_draw_timer
|
201
203
|
"#{current_site.id}/#{path}".gsub(/(\/){2,}/, "/").split("/").each do |k|
|
202
204
|
if k.present?
|
203
205
|
begin
|
@@ -208,6 +210,7 @@ module CamaleonCms::UploaderHelper
|
|
208
210
|
end
|
209
211
|
end
|
210
212
|
end
|
213
|
+
cama_draw_timer
|
211
214
|
res || {folders: {}, files: []}
|
212
215
|
end
|
213
216
|
|
data/lib/camaleon_cms/version.rb
CHANGED
@@ -9,6 +9,7 @@ module CamaleonCms
|
|
9
9
|
def create_initializer_file
|
10
10
|
copy_file "system.json", "config/system.json"
|
11
11
|
copy_file "plugin_routes.rb", "lib/plugin_routes.rb"
|
12
|
+
Dir.mkdir Rails.root.join("app", "apps").to_s unless Dir.exist?(Rails.root.join("app", "apps").to_s)
|
12
13
|
directory("apps", "app/apps")
|
13
14
|
append_to_file 'Gemfile' do
|
14
15
|
"\n\n#################### Camaleon CMS include all gems for plugins and themes #################### \nrequire './lib/plugin_routes' \ninstance_eval(PluginRoutes.draw_gems)"
|
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: 2.0.
|
4
|
+
version: 2.0.3
|
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-12-
|
11
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt
|
@@ -878,8 +878,9 @@ requirements:
|
|
878
878
|
- ruby >= 1.9.3
|
879
879
|
- imagemagick
|
880
880
|
rubyforge_project:
|
881
|
-
rubygems_version: 2.4.
|
881
|
+
rubygems_version: 2.4.5.1
|
882
882
|
signing_key:
|
883
883
|
specification_version: 4
|
884
884
|
summary: Camaleon is a cms for Ruby on Rails 4 as an alternative to wordpress.
|
885
885
|
test_files: []
|
886
|
+
has_rdoc:
|