camaleon_cms 0.1.4 → 0.1.5

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.

Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/apps/plugins/contact_form/config/custom_models.rb +3 -0
  3. data/app/apps/plugins/contact_form/contact_form_helper.rb +1 -4
  4. data/app/apps/plugins/visibility_post/assets/js/form.js +2 -2
  5. data/app/apps/plugins/visibility_post/visibility_post_helper.rb +2 -2
  6. data/app/assets/javascripts/admin/data.js +1 -0
  7. data/app/controllers/apps/plugins_admin_controller.rb +0 -2
  8. data/app/controllers/apps/plugins_front_controller.rb +0 -2
  9. data/app/controllers/apps/themes_admin_controller.rb +0 -2
  10. data/app/controllers/apps/themes_front_controller.rb +0 -2
  11. data/app/controllers/camaleon_controller.rb +22 -1
  12. data/app/controllers/frontend_controller.rb +0 -14
  13. data/app/helpers/hooks_helper.rb +6 -6
  14. data/app/helpers/plugins_helper.rb +4 -2
  15. data/app/helpers/short_code_helper.rb +27 -13
  16. data/app/helpers/site_helper.rb +2 -1
  17. data/app/helpers/theme_helper.rb +4 -2
  18. data/app/helpers/uploader_helper.rb +16 -9
  19. data/app/mailers/html_mailer.rb +1 -1
  20. data/app/views/admin/installers/form.html.erb +2 -2
  21. data/app/views/admin/plugins/info.html.erb +47 -0
  22. data/app/views/admin/settings/site.html.erb +1 -0
  23. data/app/views/layouts/admin/_flash_messages.html.erb +3 -4
  24. data/app/views/layouts/admin/installer.html.erb +1 -1
  25. data/app/views/shortcode_templates/widget.html.erb +1 -1
  26. data/config/initializers/active_record_extension.rb +8 -0
  27. data/config/initializers/assets.rb +8 -0
  28. data/config/initializers/cache_helper.rb +8 -0
  29. data/config/initializers/custom_initializers.rb +15 -0
  30. data/config/initializers/fix_ssl.rb +8 -3
  31. data/config/initializers/page_caching.rb +8 -0
  32. data/config/initializers/rufus_cron.rb +14 -4
  33. data/config/locales/admin/en.yml +2 -0
  34. data/config/locales/admin/es.yml +2 -0
  35. data/config/system.json +2 -5
  36. data/lib/camaleon_cms/engine.rb +5 -17
  37. data/lib/camaleon_cms/version.rb +1 -1
  38. data/lib/generators/camaleon_cms/install_template/system.json +0 -3
  39. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86c5a7115b4f87254af8ba53628179b7b6304a87
4
- data.tar.gz: 008600c9651dd60a96ce27fafba73ff9382ed0ed
3
+ metadata.gz: 322873a45ef38a4a4f83887f1963bfe55e2b7ab4
4
+ data.tar.gz: 87a4662b7f099b0f8e1ef8606a56f0794935409b
5
5
  SHA512:
6
- metadata.gz: f0720ca7d3b7530b926b2ee3065b14893a766470890fdc297be2cc7903c6c68dca42d13a2edf2dcd58e552cf4b3ea0a44e91be645c86f20c88c924883cbb5402
7
- data.tar.gz: 67eff63900f35a31c009994939e87d82349e830f6b29ad94f455e1e852f072a64bc68544a2f9bce9c1d3c25b3067ca7f656b8af1749ea7981b16f6bf77e7455c
6
+ metadata.gz: d3c6e1be0f889d9e35821c42415c005caaa1796c6ea98cecfe26ffafa6e88744c27b58d9bd3a3bd383e8edf26170041cef4825de500918cc396eb44d22340e21
7
+ data.tar.gz: 6701d5ff639c44fbe9fbec821b605e2d02789127d56c7568206070067963aa7814283f612521d60dc7d35ecf1e984c2a14a2d5f1fc4192e1dba32d0b49fb241d
@@ -0,0 +1,3 @@
1
+ Site.class_eval do
2
+ has_many :contact_forms, :class_name => "Plugins::ContactForm::Models::ContactForm", foreign_key: :site_id, dependent: :destroy
3
+ end
@@ -25,7 +25,7 @@ module Plugins::ContactForm::ContactFormHelper
25
25
  plugins[self_plugin_key.to_sym].each do |contact|
26
26
  unless current_site.contact_forms.where(slug: contact[:slug]).first.present?
27
27
  sba_data = ActionController::Parameters.new(contact)
28
- contact_new = current_site.slider_basics.new(sba_data.permit(:name, :slug, :count, :description, :value, :settings))
28
+ contact_new = current_site.contact_forms.new(sba_data.permit(:name, :slug, :count, :description, :value, :settings))
29
29
  if contact_new.save!
30
30
  if contact[:get_field_groups] # save group fields
31
31
  save_field_group(contact_new, contact[:get_field_groups])
@@ -78,9 +78,6 @@ module Plugins::ContactForm::ContactFormHelper
78
78
  end
79
79
 
80
80
  def contact_form_app_before_load
81
- Site.class_eval do
82
- has_many :contact_forms, :class_name => "Plugins::ContactForm::Models::ContactForm", foreign_key: :site_id, dependent: :destroy
83
- end
84
81
 
85
82
  end
86
83
 
@@ -22,8 +22,8 @@ jQuery(function($){
22
22
  //label.next().show();
23
23
  }).filter(":checked").trigger("change");
24
24
 
25
- var cal_input = $('#datetimepicker');
26
- cal_input.datepicker({
25
+ var cal_input = $("#form-post").find('#published_from');
26
+ cal_input.datetimepicker({
27
27
  language: CURRENT_LOCALE
28
28
  });
29
29
  });
@@ -88,12 +88,12 @@ module Plugins::VisibilityPost::VisibilityPostHelper
88
88
 
89
89
  def form_html(post)
90
90
  append_asset_libraries({"plugin_visibility"=> { js: [plugin_asset_path("visibility_post", "js/form.js")] }})
91
- add_asset_library('datepicker')
91
+ add_asset_library('datetimepicker')
92
92
 
93
93
  "
94
94
  <div class='form-group'>
95
95
  <label class='control-label'>#{t('admin.post_type.published_date')}</label>
96
- <div id='datetimepicker' data-locale='#{current_locale}' class='input-append date'>
96
+ <div id='published_from' data-locale='#{current_locale}' class='input-append date'>
97
97
  <input type='text' name='post[published_at]' data-format='yyyy-MM-dd hh:mm:ss' value='#{@post[:published_at]}' />
98
98
  <span class='add-on input-group-addon'><span class='glyphicon glyphicon-calendar'></span></span>
99
99
  </div>
@@ -23,6 +23,7 @@ var DATA = {
23
23
  $.fn.upload_elfinder({
24
24
  selected: function(res){
25
25
  var file = _.first(res)
26
+ if(type == 'media') type = 'video';
26
27
  if(file.mime && (file.mime.indexOf(type) > -1 || type == "file")){
27
28
  $('#'+field_name).val(file.url.to_url());
28
29
  }else{
@@ -15,8 +15,6 @@ class Apps::PluginsAdminController < AdminController
15
15
  @plugin = current_site.plugins.where(slug: plugin_name).first
16
16
  return render_error(404) unless @plugin.active?
17
17
  lookup_context.prefixes.prepend(params[:controller].sub("plugins/#{plugin_name}", "#{plugin_name}/views"))
18
- self.prepend_view_path(File.join($camaleon_engine_dir, "app", 'apps', "plugins"))
19
- self.prepend_view_path(Rails.root.join("app", 'apps', "plugins"))
20
18
  end
21
19
 
22
20
  end
@@ -15,8 +15,6 @@ class Apps::PluginsFrontController < FrontendController
15
15
  @plugin = current_site.plugins.where(slug: plugin_name).first
16
16
  return render_error(404) unless @plugin.active?
17
17
  lookup_context.prefixes.prepend(params[:controller].sub("plugins/#{plugin_name}", "#{plugin_name}/views"))
18
- self.prepend_view_path(File.join($camaleon_engine_dir, "app", 'apps', "plugins"))
19
- self.prepend_view_path(Rails.root.join("app", 'apps', "plugins"))
20
18
  end
21
19
 
22
20
  end
@@ -15,8 +15,6 @@ class Apps::ThemesAdminController < AdminController
15
15
  @theme = current_theme
16
16
  return render_error(404) unless current_theme.slug == theme_name
17
17
  lookup_context.prefixes.prepend(params[:controller].sub("themes/#{theme_name}", "#{theme_name}/views"))
18
- self.append_view_path(Rails.root.join("app", 'apps', "themes"))
19
- self.append_view_path(File.join($camaleon_engine_dir, "app", 'apps', "themes"))
20
18
  end
21
19
 
22
20
  end
@@ -15,8 +15,6 @@ class Apps::ThemesFrontController < FrontendController
15
15
  @theme = current_theme
16
16
  return render_error(404) unless current_theme.slug == theme_name
17
17
  lookup_context.prefixes.prepend(params[:controller].sub("themes/#{theme_name}", "#{theme_name}/views"))
18
- self.append_view_path(Rails.root.join("app", 'apps', "themes"))
19
- self.append_view_path(File.join($camaleon_engine_dir, "app", 'apps', "themes"))
20
18
  end
21
19
 
22
20
  end
@@ -21,6 +21,7 @@ class CamaleonController < ApplicationController
21
21
  include UploaderHelper
22
22
  include Mobu::DetectMobile
23
23
 
24
+ prepend_before_action :camaleon_add_view_paths
24
25
  prepend_before_action :load_custom_models
25
26
  before_action :site_check_existence, except: [:render_error, :captcha]
26
27
  before_action :before_actions, except: [:render_error, :captcha]
@@ -82,7 +83,27 @@ class CamaleonController < ApplicationController
82
83
  def load_custom_models
83
84
  if current_site.present?
84
85
  site_load_custom_models(current_site)
85
- # Site.first.attack
86
+ end
87
+ end
88
+
89
+ # add custom views of camaleon
90
+ def camaleon_add_view_paths
91
+ self.prepend_view_path(File.join($camaleon_engine_dir, "app", "apps", "plugins"))
92
+ self.prepend_view_path(Rails.root.join("app", "apps", 'plugins'))
93
+
94
+ self.prepend_view_path(File.join($camaleon_engine_dir, "app", "views", 'default_theme'))
95
+ self.prepend_view_path(Rails.root.join("app", "views", 'default_theme'))
96
+
97
+ if current_theme.present?
98
+ views_dir = "app/apps/themes/#{current_theme.slug}/views"
99
+ self.prepend_view_path(File.join($camaleon_engine_dir, views_dir).to_s)
100
+ self.prepend_view_path(Rails.root.join(views_dir).to_s)
101
+ end
102
+
103
+ if current_site.present?
104
+ views_site_dir = "app/apps/themes/#{current_site.id}/views"
105
+ self.prepend_view_path(File.join($camaleon_engine_dir, views_site_dir).to_s)
106
+ self.prepend_view_path(Rails.root.join(views_site_dir).to_s)
86
107
  end
87
108
  end
88
109
 
@@ -204,20 +204,6 @@ class FrontendController < CamaleonController
204
204
  lookup_context.prefixes.delete(params[:controller])
205
205
  lookup_context.prefixes.prepend(params[:controller].sub("themes/#{current_theme.slug}/", ""))
206
206
  end
207
-
208
- self.prepend_view_path(File.join($camaleon_engine_dir, "app", "apps", "plugins"))
209
- self.prepend_view_path(Rails.root.join("app", "apps", 'plugins'))
210
-
211
- self.prepend_view_path(File.join($camaleon_engine_dir, "app", "views", 'default_theme'))
212
- self.prepend_view_path(Rails.root.join("app", "views", 'default_theme'))
213
-
214
- views_dir = "app/apps/themes/#{current_theme.slug}/views"
215
- self.prepend_view_path(File.join($camaleon_engine_dir, views_dir).to_s)
216
- self.prepend_view_path(Rails.root.join(views_dir).to_s)
217
-
218
- views_site_dir = "app/apps/themes/#{current_site.id}/views"
219
- self.prepend_view_path(File.join($camaleon_engine_dir, views_site_dir).to_s)
220
- self.prepend_view_path(Rails.root.join(views_site_dir).to_s)
221
207
  theme_init()
222
208
  end
223
209
 
@@ -42,12 +42,12 @@ module HooksHelper
42
42
  send(hook) if params.nil?
43
43
  rescue
44
44
  plugin_load_helpers(plugin)
45
- begin
46
- send(hook, params) unless params.nil?
47
- send(hook) if params.nil?
48
- rescue => e
49
- Rails.logger.info "--------------------------------------- error executing hook '#{hook_key}' for plugin '#{plugin["title"]}': #{e.message} --- #{e.backtrace.join("\n")}"
50
- end
45
+ # begin
46
+ send(hook, params) unless params.nil?
47
+ send(hook) if params.nil?
48
+ # rescue => e
49
+ # Rails.logger.info "--------------------------------------- error executing hook '#{hook_key}' for plugin '#{plugin["title"]}': #{e.message} --- #{e.backtrace.join("\n")}"
50
+ # end
51
51
  end
52
52
  end
53
53
  end
@@ -81,7 +81,8 @@ module PluginsHelper
81
81
  # asset: (String) asset name
82
82
  # sample: <script src="<%= plugin_asset_path("my_plugin", "js/admin.js") %>"></script> => /assets/plugins/my_plugin/assets/css/main-54505620f.css
83
83
  def plugin_asset_path(plugin_key, asset)
84
- asset_url("plugins/#{plugin_key}/assets/#{asset}")
84
+ p = "plugins/#{plugin_key}/assets/#{asset}"
85
+ asset_url(p) rescue p
85
86
  end
86
87
 
87
88
  # return the full url for asset of current plugin:
@@ -90,7 +91,8 @@ module PluginsHelper
90
91
  # sample:
91
92
  # plugin_asset_url("css/main.css") => return: http://myhost.com/assets/plugins/my_plugin/assets/css/main-54505620f.css
92
93
  def plugin_asset_url(asset, plugin_key = nil)
93
- asset_url("plugins/#{plugin_key || self_plugin_key}/assets/#{asset}")
94
+ p = "plugins/#{plugin_key || self_plugin_key}/assets/#{asset}"
95
+ asset_url(p) rescue p
94
96
  end
95
97
 
96
98
 
@@ -16,8 +16,9 @@ module ShortCodeHelper
16
16
  end
17
17
 
18
18
  # add shortcode
19
- # key: chortcode key
19
+ # key: shortcode key
20
20
  # template: template to render, if nil will render "shortcode_templates/<key>"
21
+ # Also can be a function to execute that instead a render, sample: lambda{|attrs, args| return "my custom content"; }
21
22
  # descr: description for shortcode
22
23
  def shortcode_add(key, template = nil, descr = '')
23
24
  @_shortcodes << key
@@ -46,23 +47,39 @@ module ShortCodeHelper
46
47
  args = {owner: args} unless args.is_a?(Hash)
47
48
  content.scan(/(\[(#{@_shortcodes.join("|")})\s?(.*?)\])/) do |item|
48
49
  shortcode, code, attrs = item
49
- res = render :file => (@_shortcodes_template[code].present? ? @_shortcodes_template[code] : "shortcode_templates/#{code}"), :locals => {attributes: _shortcode_parse_attr(attrs), args: args}
50
- content = content.sub(shortcode, res)
50
+ content = content.sub(shortcode, _eval_shortcode(code, attrs, args))
51
51
  end
52
52
  content
53
53
  end
54
54
 
55
55
  # render direct a shortcode
56
- # template: custom template to be rendered for this short code
57
- # sample: render_shortcode("[slider_basic as]")
58
- # sample2: render_shortcode("[slider_basic as]", theme_view("custom_slider"))
59
- def render_shortcode(shortcode, template = nil)
60
- shortcode, code, attrs = shortcode.scan(/(\[(#{@_shortcodes.join("|")})\s?(.*?)\])/).first
61
- template ||= (@_shortcodes_template[code].present? ? @_shortcodes_template[code] : "shortcode_templates/#{code}")
62
- render :file => template, :locals => {attributes: _shortcode_parse_attr(attrs)}
56
+ # text: text that contain the shortcode
57
+ # key: shortcode key
58
+ # template: template to render, if nil this will render default render file
59
+ # Also can be a function to execute that instead a render, sample: lambda{|attrs, args| return "my custom content"; }
60
+ # render_shortcode("asda dasdasdas[owen a='1'] [bbb] sdasdas dasd as das[owen a=213]", "owen", lambda{|attrs, args| puts attrs; return "my test"; })
61
+ def render_shortcode(text, key, template = nil)
62
+ text.scan(/(\[(#{key})\s?(.*?)\])/).each do |item|
63
+ shortcode, code, attrs = item
64
+ text = text.sub(shortcode, _eval_shortcode(code, attrs, {}, template))
65
+ end
66
+ text
63
67
  end
64
68
 
65
69
  private
70
+ # determine the content to replace instead the shortcode
71
+ # return string
72
+ def _eval_shortcode(code, attrs, args={}, template = nil)
73
+ template ||= (@_shortcodes_template[code].present? ? @_shortcodes_template[code] : "shortcode_templates/#{code}")
74
+ if @_shortcodes_template[code].class.name == "Proc"
75
+ res = @_shortcodes_template[code].call(attributes: _shortcode_parse_attr(attrs), args: args)
76
+ else
77
+ res = render :file => template, :locals => {attributes: _shortcode_parse_attr(attrs), args: args}
78
+ end
79
+ res
80
+ end
81
+
82
+ # parse the attributes of a shortcode
66
83
  def _shortcode_parse_attr(text)
67
84
  res = {}
68
85
  return res unless text.present?
@@ -76,7 +93,4 @@ module ShortCodeHelper
76
93
  end
77
94
  res
78
95
  end
79
-
80
-
81
-
82
96
  end
@@ -110,7 +110,8 @@ module SiteHelper
110
110
  def site_load_custom_models(site)
111
111
  PluginRoutes.enabled_apps(site).each{ |app|
112
112
  s = File.join(app["path"], "config", "custom_models.rb")
113
- require_relative s if File.exist?(s)
113
+ # require_relative s if File.exist?(s)
114
+ eval(File.read(s)) if File.exist?(s)
114
115
  }
115
116
  end
116
117
 
@@ -26,7 +26,8 @@ module ThemeHelper
26
26
  # asset: asset file name, if asset is present return full path to this asset
27
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
- asset_url("themes/#{theme_name || current_theme.slug }/assets/#{asset}")
29
+ p = "themes/#{theme_name || current_theme.slug }/assets/#{asset}"
30
+ asset_url(p) rescue p
30
31
  end
31
32
 
32
33
  # return the full url for asset of current theme:
@@ -35,7 +36,8 @@ module ThemeHelper
35
36
  # sample:
36
37
  # theme_asset_url("css/main.css") => return: http://myhost.com/assets/themes/my_theme/assets/css/main-54505620f.css
37
38
  def theme_asset_url(asset, theme_name = nil)
38
- asset_url("themes/#{theme_name || current_theme.slug }/assets/#{asset}")
39
+ p = "themes/#{theme_name || current_theme.slug }/assets/#{asset}"
40
+ asset_url(p) rescue p
39
41
  end
40
42
 
41
43
  # return theme full view path
@@ -85,15 +85,22 @@ module UploaderHelper
85
85
  return res
86
86
  end
87
87
 
88
- TemporalFileJob.set(wait: settings[:is_temporal]).perform_later(file_path) if settings[:temporal_time] > 0
89
- {
90
- "file" => file_path,
91
- "name"=> File.basename(file_path),
92
- "size"=> File.size(file_path),
93
- "url"=> file_path_to_url(file_path),
94
- "type"=> uploaded_io.content_type,
95
- "deleteUrl"=> ""
96
- }
88
+ # check for destroy the file in the future
89
+ if settings[:temporal_time] > 0
90
+ if defined?(ActiveJob::Base)
91
+ TemporalFileJob.set(wait: settings[:is_temporal]).perform_later(file_path)
92
+ {
93
+ "file" => file_path,
94
+ "name"=> File.basename(file_path),
95
+ "size"=> File.size(file_path),
96
+ "url"=> file_path_to_url(file_path),
97
+ "type"=> uploaded_io.content_type,
98
+ "deleteUrl"=> ""
99
+ }
100
+ else
101
+ Rails.logger.error " ******************** Camaleon: This version of rails doesn't support active job, please install a gem or manage your file destroy manually."
102
+ end
103
+ end
97
104
  end
98
105
 
99
106
  # helper to find an available filename for file_path in that directory
@@ -32,7 +32,7 @@ class HtmlMailer < ActionMailer::Base
32
32
  password: current_site.get_option("email_pass"),
33
33
  address: current_site.get_option("email_server"),
34
34
  port: current_site.get_option("email_port"),
35
- domain: "localhost",
35
+ domain: (current_site.the_url.to_s.parse_domain rescue "localhost"),
36
36
  authentication: "plain",
37
37
  enable_starttls_auto: true
38
38
  }
@@ -2,7 +2,7 @@
2
2
  <%= form_for @site, url: save_admin_installers_path, html: {class: 'form-horizontal', style: "color: #ccc;"} do |f| %>
3
3
  <%= render partial: 'layouts/admin/form_error', locals: {data: @site} %>
4
4
  <div class="form-group">
5
- <label>Domain</label><br>
5
+ <%= f.label t('admin.button.domain') %><br>
6
6
  <%= f.text_field :slug, :class => "form-control required" %>
7
7
  </div>
8
8
  <div class="form-group">
@@ -10,7 +10,7 @@
10
10
  <%= f.text_field :name, :class => "form-control required" %>
11
11
  </div>
12
12
  <div class="form-group">
13
- <label>Theme</label><br>
13
+ <%= f.label t('admin.post_type.template') %><br>
14
14
  <%= select_tag :theme, options_for_select(PluginRoutes.all_themes.map{|theme| [theme["name"], theme["key"]] }), :class => "form-control required" %>
15
15
  </div>
16
16
  <div class="form-group">
@@ -0,0 +1,47 @@
1
+ <div>
2
+ <div class="banner">
3
+ <%= image_tag(plugin_asset_path(@plugin["slug"], @plugin["banner"]), class: "banner_bg") if @plugin["banner"].present? %>
4
+ <%= image_tag(plugin_asset_path(@plugin["slug"], @plugin["thumb"]), class: "logo_plugin") if @plugin["thumb"].present? %>
5
+ <h3 class="title_plugin"><%= @plugin["title"] %></h3>
6
+ </div>
7
+ <div class="row">
8
+ <div class="col-md-9">
9
+ <%= @plugin["description"] %>
10
+ </div>
11
+ <div class="col-md-3">
12
+ <%= link_to("Version #{@plugin["version"]}", "", class: "btn btn-primary") %>
13
+ </div>
14
+ </div>
15
+ <!-- Nav tabs -->
16
+ <ul class="nav nav-tabs" role="tablist">
17
+ <% if @plugin["html_description"].present? %>
18
+ <li role="presentation" class="active"><a href="#tab_plugin_descr" aria-controls="home" role="tab" data-toggle="tab">Description</a></li>
19
+ <% end %>
20
+ <% if @plugin["html_installation"].present? %>
21
+ <li role="presentation"><a href="#tab_installation" aria-controls="profile" role="tab" data-toggle="tab">Installation</a></li>
22
+ <% end %>
23
+
24
+ <% if @plugin["screenshots"].present? %>
25
+ <li role="presentation"><a href="#tab_screenshots" aria-controls="messages" role="tab" data-toggle="tab">Screenshots</a></li>
26
+ <% end %>
27
+ </ul>
28
+
29
+ <!-- Tab panes -->
30
+ <div class="tab-content">
31
+ <% if @plugin["html_description"].present? %>
32
+ <div role="tabpanel" class="tab-pane active" id="tab_plugin_descr"> <%= render file: File.join(@plugin["path"], "assets", @plugin["html_description"]) %> </div>
33
+ <% end %>
34
+
35
+ <% if @plugin["html_installation"].present? %>
36
+ <div role="tabpanel" class="tab-pane active" id="tab_installation"> <%= render file: File.join(@plugin["path"], "assets", @plugin["html_installation"]) %> </div>
37
+ <% end %>
38
+
39
+ <% if @plugin["screenshots"].present? %>
40
+ <div role="tabpanel" class="tab-pane" id="tab_screenshots">
41
+ <% @plugin["screenshots"].each do |s| %>
42
+ <%= link_to(image_tag(plugin_asset_path(@plugin["slug"], s)), plugin_asset_path(@plugin["slug"], s), target: "_blank", class: "screen_item") %>
43
+ <% end %>
44
+ </div>
45
+ <% end %>
46
+ </div>
47
+ </div>
@@ -119,6 +119,7 @@
119
119
  </div>
120
120
 
121
121
  <div id="tab-email_settings" class="tab-pane col-md-10 col-md-offset-1">
122
+ <div class="alert alert-info">Gmail Need Permissions: <a href="http://know.mailsbestfriend.com/smtp_error_password_command_failed_5345714-1194946499.shtml" target="_blank">Check here.</a> </div>
122
123
  <div class="form-group">
123
124
  <%= label_tag t('admin.settings.email_enabled') %><br>
124
125
  <%= check_box :options, :mailer_enabled, {checked: @site.get_option("mailer_enabled") == 1}, 1, 0 %>
@@ -1,4 +1,3 @@
1
-
2
1
  <% if flash[:notice] %>
3
2
  <div class="flash_messages">
4
3
  <div class="alert alert-success">
@@ -7,11 +6,11 @@
7
6
  </div>
8
7
  </div>
9
8
  <% end %>
10
- <% if params[:notice] %>
9
+ <% if params[:info] %>
11
10
  <div class="flash_messages">
12
- <div class="alert alert-success">
11
+ <div class="alert alert-info">
13
12
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
14
- <%= raw(params[:notice]) %>
13
+ <%= raw(params[:info]) %>
15
14
  </div>
16
15
  </div>
17
16
  <% end %>
@@ -24,7 +24,7 @@
24
24
  <div class="login-box animated fadeInDown">
25
25
  <div class="login-logo text-center"><%= image_tag("camaleon.png") %></div>
26
26
  <div class="login-body">
27
- <div class="login-title"><%= raw t('admin.installer.Welcome to Camaleon CMS') %> </div>
27
+ <div class="login-title"><%= raw t('camaleon_message', default: "Welcome to Camaleon CMS") %> </div>
28
28
  <div class="">
29
29
  <%= yield %>
30
30
  </div>
@@ -6,6 +6,6 @@
6
6
  <% if key == 'visits-counter' %>
7
7
  <%= render partial: plugin_view("visits_counter", "admin/partials/table") %>
8
8
  <% else %>
9
- <%= raw widget[:description] %>
9
+ <%= raw widget[:description].translate %>
10
10
  <% end %>
11
11
  <% end %>
@@ -1,3 +1,11 @@
1
+ =begin
2
+ Camaleon CMS is a content management system
3
+ Copyright (C) 2015 by Owen Peredo Diaz
4
+ Email: owenperedo@gmail.com
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
+ See the GNU Affero General Public License (GPLv3) for more details.
8
+ =end
1
9
  module ActiveRecordExtras
2
10
  module Relation
3
11
  extend ActiveSupport::Concern
@@ -1,3 +1,11 @@
1
+ =begin
2
+ Camaleon CMS is a content management system
3
+ Copyright (C) 2015 by Owen Peredo Diaz
4
+ Email: owenperedo@gmail.com
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
+ See the GNU Affero General Public License (GPLv3) for more details.
8
+ =end
1
9
  # Be sure to restart your server when you modify this file.
2
10
 
3
11
  # Version of your assets, change this if you want to expire all your assets.
@@ -1,3 +1,11 @@
1
+ =begin
2
+ Camaleon CMS is a content management system
3
+ Copyright (C) 2015 by Owen Peredo Diaz
4
+ Email: owenperedo@gmail.com
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
+ See the GNU Affero General Public License (GPLv3) for more details.
8
+ =end
1
9
  # customizable cache path for cache inline
2
10
  module ActiveSupport
3
11
  module Cache
@@ -0,0 +1,15 @@
1
+ =begin
2
+ Camaleon CMS is a content management system
3
+ Copyright (C) 2015 by Owen Peredo Diaz
4
+ Email: owenperedo@gmail.com
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
+ See the GNU Affero General Public License (GPLv3) for more details.
8
+ =end
9
+ # load all custom initializers of plugins or themes
10
+ PluginRoutes.all_enabled_apps.each do |ap|
11
+ if ap["path"].present?
12
+ f = File.join(ap["path"], "config", "initializer.rb")
13
+ eval(File.read(f)) if File.exist?(f)
14
+ end
15
+ end
@@ -5,10 +5,15 @@ module Net
5
5
  class HTTP
6
6
  alias_method :original_use_ssl=, :use_ssl=
7
7
 
8
+ # fix ssl for facebook connection
8
9
  def use_ssl=(flag)
9
- self.ca_file = Rails.root.join('lib/ca-bundle.crt').to_s
10
- self.verify_mode = OpenSSL::SSL::VERIFY_PEER
11
- self.original_use_ssl = flag
10
+ if @address.include?("facebook.com")
11
+ self.ca_file = Rails.root.join('lib/ca-bundle.crt').to_s
12
+ self.verify_mode = OpenSSL::SSL::VERIFY_PEER
13
+ self.original_use_ssl = flag
14
+ else
15
+ super
16
+ end
12
17
  end
13
18
  end
14
19
  end
@@ -1,3 +1,11 @@
1
+ =begin
2
+ Camaleon CMS is a content management system
3
+ Copyright (C) 2015 by Owen Peredo Diaz
4
+ Email: owenperedo@gmail.com
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
+ See the GNU Affero General Public License (GPLv3) for more details.
8
+ =end
1
9
  module ActionController
2
10
  module Caching
3
11
  module Pages extend ActiveSupport::Concern
@@ -1,3 +1,11 @@
1
+ =begin
2
+ Camaleon CMS is a content management system
3
+ Copyright (C) 2015 by Owen Peredo Diaz
4
+ Email: owenperedo@gmail.com
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7
+ See the GNU Affero General Public License (GPLv3) for more details.
8
+ =end
1
9
  begin
2
10
  require 'rufus-scheduler'
3
11
  $scheduler = Rufus::Scheduler.singleton
@@ -36,9 +44,11 @@ end
36
44
 
37
45
  ####### DELAYED JOBS
38
46
  # auto delete file after a time
39
- class TemporalFileJob < ActiveJob::Base
40
- queue_as "destroy_temporal_file"
41
- def perform(file_path)
42
- FileUtils.rm_rf(file_path) if File.exist?(file_path) && !File.directory?(file_path)
47
+ if defined?(ActiveJob::Base)
48
+ class TemporalFileJob < ActiveJob::Base
49
+ queue_as "destroy_temporal_file"
50
+ def perform(file_path)
51
+ FileUtils.rm_rf(file_path) if File.exist?(file_path) && !File.directory?(file_path)
52
+ end
43
53
  end
44
54
  end
@@ -1,4 +1,5 @@
1
1
  en:
2
+ camaleon_message: "Welcome to Camaleon CMS"
2
3
  admin:
3
4
  button:
4
5
  activity: 'Activity'
@@ -53,6 +54,7 @@ en:
53
54
  yes: 'Yes'
54
55
  out_yes: 'Yes'
55
56
  out_not: 'No'
57
+ domain: "Domain"
56
58
  comments:
57
59
  comments_list_post: 'List Comments Post'
58
60
  responses: 'Responses'
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  es:
3
+ camaleon_message: "Bienvenido a Camaleon CMS"
3
4
  admin:
4
5
  button:
5
6
  activity: 'Actividad'
@@ -54,6 +55,7 @@ es:
54
55
  yes: 'Si'
55
56
  out_yes: 'Si'
56
57
  out_not: 'No'
58
+ domain: "Dominio"
57
59
  comments:
58
60
  comments_list_post: 'Lista Comentarios de Articulos'
59
61
  responses: 'Respuestas'
data/config/system.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "default_template": "default", // default template name for new sites
3
- "locale": "en", // Default locale, here all locales: https://github.com/svenfuchs/rails-i18n
4
- "time_zone": "La Paz", // Default Time zone, here all timezones: http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
5
3
  "hooks": { }, // system hooks
6
4
  "default_plugins": ["front_cache", "contact_form", "attack"], // Default plugins installed for each new site
7
5
  "available_languages": ["es", "en", "fr", "zh", "de", "it", "pt"], // Available languages for frontend panel, here all locales: https://github.com/svenfuchs/rails-i18n
8
6
  "admin_available_languages": ["en", "es"], //Available languages for the admin panel
9
- "base_domain": "localhost:3001", // primary domain
7
+ "base_domain": "localhost:3000", // primary domain
10
8
  "share_sessions": true, // (boolean) share user sessions between subdomains of base_domain (only for users_share_sites = true)
11
9
  "default_user_role": "client", // default user role for all new users
12
- "users_share_sites": true, //(boolean) true: permit to share users between sites, false: All users are assigned for a unique site.
13
- "version": "0.0.1"
10
+ "users_share_sites": true //(boolean) true: permit to share users between sites, false: All users are assigned for a unique site.
14
11
  }
15
12
 
16
13
  // Note: after any change in this file, you need to restart your server to apply changes.
@@ -3,18 +3,11 @@ Dir[File.join($camaleon_engine_dir, "lib", "ext", "**", "*.rb")].each{ |f| requi
3
3
  module CamaleonCms
4
4
  class Engine < ::Rails::Engine
5
5
  config.before_initialize do |app|
6
- app.console do
7
- begin
8
- include SiteHelper
9
- # include PluginsHelper
10
- # include HooksHelper
11
- site = Site.first.decorate
12
- site_console_switch(site)
13
- puts "*************** Camaleon CMS Console Added for \"#{site.the_title}\", change this by: ***************"
14
- puts "- include SiteHelper "
15
- puts "- site_console_switch(site = nil)"
16
- rescue => e
17
- puts "**************** Errors starting camaleon cms in console: #{e.message}"
6
+ if app.respond_to?(:console)
7
+ app.console do
8
+ puts "******** Camaleon CMS: To use custom models and helpers of installed plugins, write this: ********"
9
+ puts "include SiteHelper; site_console_switch(Site.first.decorate);"
10
+ puts "*********** To change current site, use: site_console_switch(site) *************"
18
11
  end
19
12
  end
20
13
  end
@@ -27,8 +20,6 @@ module CamaleonCms
27
20
  engine_dir = File.expand_path("../../../", __FILE__)
28
21
  app.config.i18n.load_path += Dir[File.join($camaleon_engine_dir, 'config', 'locales', '**', '*.{rb,yml}')]
29
22
  app.config.i18n.enforce_available_locales = false
30
- app.config.i18n.default_locale = PluginRoutes.system_info[:locale]
31
- app.config.time_zone = PluginRoutes.system_info[:time_zone]
32
23
  PluginRoutes.all_apps.each{ |info| app.config.i18n.load_path += Dir[File.join(info["path"], "config", "locales", '*.{rb,yml}')] }
33
24
 
34
25
  # assets
@@ -43,9 +34,6 @@ module CamaleonCms
43
34
  app.routes_reloader.paths.push(File.join(engine_dir, "config", "routes", "frontend.rb"))
44
35
  # Dir[File.join(engine_dir, "config", "routes", "*.rb")].each{|r| app.routes_reloader.paths.unshift(r) }
45
36
 
46
- # cache control
47
- app.config.cache_store = :file_store, Rails.root.join("tmp","cache","vars")
48
-
49
37
  # extra configuration for plugins
50
38
  app.config.autoload_paths += %W{#{app.config.root}/app/apps/**/}
51
39
  PluginRoutes.all_plugins.each{ |plugin| app.config.paths["db/migrate"] << File.join(plugin["path"], "migrate") if Dir.exist?(File.join(plugin["path"], "migrate")) }
@@ -1,3 +1,3 @@
1
1
  module CamaleonCms
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -1,7 +1,4 @@
1
1
  {
2
- "default_template": "default", // default template name for new sites
3
- "locale": "en", // Default locale, here all locales: https://github.com/svenfuchs/rails-i18n
4
- "time_zone": "La Paz", // Default Time zone, here all timezones: http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
5
2
  "base_domain": "localhost:3001", // primary domain
6
3
  "share_sessions": true, // (boolean) share user sessions between subdomains of base_domain (only for users_share_sites = true)
7
4
  "default_user_role": "client", // default user role for all new users
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
4
+ version: 0.1.5
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-26 00:00:00.000000000 Z
11
+ date: 2015-08-29 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.
@@ -48,6 +48,7 @@ files:
48
48
  - app/apps/plugins/contact_form/assets/js/form-builder/vendor.js
49
49
  - app/apps/plugins/contact_form/assets/js/readme.txt
50
50
  - app/apps/plugins/contact_form/config/config.json
51
+ - app/apps/plugins/contact_form/config/custom_models.rb
51
52
  - app/apps/plugins/contact_form/config/locales/readme.txt
52
53
  - app/apps/plugins/contact_form/config/locales/translation.yml
53
54
  - app/apps/plugins/contact_form/config/routes_admin.txt
@@ -491,6 +492,7 @@ files:
491
492
  - app/views/admin/media/index.html.erb
492
493
  - app/views/admin/plugins/_plugins_list.html.erb
493
494
  - app/views/admin/plugins/index.html.erb
495
+ - app/views/admin/plugins/info.html.erb
494
496
  - app/views/admin/post_tags/_form.html.erb
495
497
  - app/views/admin/post_tags/edit.html.erb
496
498
  - app/views/admin/post_tags/index.html.erb
@@ -588,6 +590,7 @@ files:
588
590
  - config/initializers/active_record_extension.rb
589
591
  - config/initializers/assets.rb
590
592
  - config/initializers/cache_helper.rb
593
+ - config/initializers/custom_initializers.rb
591
594
  - config/initializers/elfinder.rb
592
595
  - config/initializers/fix_ssl.rb
593
596
  - config/initializers/mobu.rb