camaleon_cms 0.1.2 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f649347d40328e102bf97f667dc9a92a4249da23
4
- data.tar.gz: d7b11f5924ce4af26805d9100522b352f2fc536d
3
+ metadata.gz: 172ad82621088cd3ba8a3500d1802dd2d5946297
4
+ data.tar.gz: 7e6d38e9b55c818502af17c5dcbf6e5d7d463cf4
5
5
  SHA512:
6
- metadata.gz: cc798d85dae6d7c2d73c39193990920f491f23c9652d885c81977b943ced6ead22ec380e584c49643aa3e3f56058f5f1c1f1db9d3e19c9caf814f07ded986197
7
- data.tar.gz: 23f2520908e6f8799424849ac178e1a47d2a5684d5eddad644924abd9b49b19c697de2d2df6dfcd634aeb1e7ed044fca1c438273f2414027cadbf852f963c105
6
+ metadata.gz: 4fbe08809da6873778f890d68781a5590dc37c5a1b7494299a593390bbc54ec8be38fc3997157930e15fedbd1078b579fdffdd54ccf1b08d21ea0be260eb3fc0
7
+ data.tar.gz: 2bab345c0dde92e94e82f32329f3bbbf294635fac9e19006720438b71bf0825cb00573efd6dea850d6d2b1b45806cf604580164606b5852d12566efea9821ab8
@@ -50,6 +50,7 @@ class Admin::Settings::CustomFieldsController < Admin::SettingsController
50
50
  render 'form'
51
51
  end
52
52
 
53
+ # create a new custom field group
53
54
  def create
54
55
  post_data = params[:custom_field_group]
55
56
  post_data[:object_class], post_data[:objectid] = post_data[:assign_group].split(',')
@@ -64,12 +65,22 @@ class Admin::Settings::CustomFieldsController < Admin::SettingsController
64
65
  end
65
66
  end
66
67
 
68
+ # destroy a custom field group
67
69
  def destroy
68
70
  @field_group.destroy
69
71
 
70
72
  redirect_to action: :index
71
73
  end
72
74
 
75
+ # reorder custom fields group
76
+ def reorder
77
+ params[:values].to_a.each_with_index do |value, index|
78
+ current_site.custom_field_groups.find(value).update_column('field_order', index)
79
+ end
80
+ json = {size: params[:values].size}
81
+ render json: json
82
+ end
83
+
73
84
  private
74
85
 
75
86
  def set_custom_field_group
@@ -20,11 +20,12 @@ class AdminController < CamaleonController
20
20
  before_action :admin_before_hooks
21
21
  after_action :admin_after_hooks
22
22
 
23
+ # render admin dashabord
23
24
  def index
24
25
 
25
26
  end
26
27
 
27
-
28
+ # render admin dashboard
28
29
  def dashboard
29
30
  render "admin/dashboard/index"
30
31
  end
@@ -19,7 +19,12 @@ module FrontendConcern extend ActiveSupport::Concern
19
19
  format.xml { render(xml: open(path).read) }
20
20
  end
21
21
  else
22
- render text: "Sitemap not found.", status: :not_found
22
+ Thread.abort_on_exception=true
23
+ Thread.new do
24
+ %x(rake camaleon_cms:sitemap)
25
+ ActiveRecord::Base.connection.close
26
+ end
27
+ render text: "Sitemap not found. Generating... Please wait and refresh later.", status: :not_found
23
28
  end
24
29
  end
25
30
 
@@ -17,7 +17,11 @@ module CamaleonHelper
17
17
  # layout_name: path of the template to render
18
18
  # template_name: template name to render in template_path
19
19
  def sendmail(email,subject='Tiene una notificacion',content='',from=nil,attachs=[],template_name = 'mailer', layout_name = 'mailer')
20
- HtmlMailer.sender(email, subject, content, from, attachs, root_url, current_site, template_name, layout_name).deliver_now
20
+ Thread.abort_on_exception=true
21
+ Thread.new do
22
+ HtmlMailer.sender(email, subject, content, from, attachs, root_url, current_site, template_name, layout_name).deliver_now
23
+ ActiveRecord::Base.connection.close
24
+ end
21
25
  end
22
26
 
23
27
  # execute controller action and return response
@@ -65,10 +65,7 @@
65
65
  </optgroup>
66
66
 
67
67
  <optgroup label="<%= t('admin.sidebar.themes') %>">
68
- <% PluginRoutes.all_themes.each do |theme| %>
69
- <% value = "Theme,#{theme[:key]}" %>
70
- <option value="<%= value %>" data-help="<%= "#{t('admin.settings.tooltip.add_custom_field_themes')}"+ theme[:name] %>"><%= theme[:name] %></option>
71
- <% end %>
68
+ <option value="Theme,<%= current_theme.id %>" data-help=""><%= current_theme.name %></option>
72
69
  </optgroup>
73
70
 
74
71
  <optgroup label="<%= t('admin.sidebar.widgets') %>">
@@ -52,12 +52,11 @@
52
52
  <!-- END BASIC TABLE SAMPLE -->
53
53
  </div>
54
54
  </div>
55
-
56
55
  </div>
57
56
 
58
57
  <script>
59
58
  run.push(function(){
60
- $('#table_custom_groups').table_order({url: '<%= admin_api_path('reorder', {model: 'field_groups'}) %>', on_success: function(obj){
59
+ $('#table_custom_groups').table_order({url: '<%= reorder_admin_settings_custom_fields_path %>', on_success: function(obj){
61
60
  if(obj.res.error){
62
61
  $.fn.alert({title: obj.res.error, type: 'error'})
63
62
  }else{
@@ -2,7 +2,7 @@ begin
2
2
  require 'rufus-scheduler'
3
3
  $scheduler = Rufus::Scheduler.singleton
4
4
  $scheduler.cron '00 05 * * *' do
5
- system("rake sitemap:generate")
5
+ system("rake camaleon_cms:sitemap")
6
6
  end
7
7
  #cronjob for hook by site
8
8
  begin
@@ -49,6 +49,7 @@ Rails.application.routes.draw do
49
49
  resources :custom_fields do
50
50
  collection do
51
51
  post 'get_items/:key', action: :get_items, as: :get_items
52
+ post "reorder"
52
53
  end
53
54
  end
54
55
 
data/config/sitemap.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  require 'uri'
2
2
  h = PluginRoutes.system_info["base_domain"]
3
3
 
4
+ # create sitemap directory
5
+ sitemaps_dir = Rails.root.join("public", "sitemaps").to_s
6
+ FileUtils.mkdir(sitemaps_dir) unless Dir.exist?(sitemaps_dir)
7
+
4
8
  Site.all.each do |site|
5
9
  site = site.decorate
6
10
  folder "sitemaps/#{site.slug}"
@@ -1,3 +1,3 @@
1
1
  module CamaleonCms
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -9,7 +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
- # copy_file "Gemfile", "lib/Gemfile_camaleon"
12
+ copy_file "../../../Gemfile", "lib/Gemfile_camaleon"
13
13
  directory("apps", "app/apps")
14
14
  append_to_file 'Gemfile' do
15
15
  "\n\n#################### Camaleon CMS include all gems for plugins and themes #################### \nrequire './lib/plugin_routes' \ninstance_eval(PluginRoutes.draw_gems)"
@@ -229,7 +229,7 @@ class PluginRoutes
229
229
  if camaleon_gem = get_gem('camaleon_cms')
230
230
  res << File.read(File.join(camaleon_gem.gem_dir, "lib", "Gemfile")).gsub("source 'https://rubygems.org'", "")
231
231
  else
232
- puts "You need to install camaleon_cms gem."
232
+ puts "******** Warning: You need to install camaleon_cms gem. *********"
233
233
  return ""
234
234
  end
235
235
  (self.all_themes + self.all_plugins).each do |item|
@@ -2,3 +2,22 @@
2
2
  # task :camaleon_cms do
3
3
  # # Task goes here
4
4
  # end
5
+
6
+ namespace :camaleon_cms do
7
+ task :sitemap => :environment do
8
+ include Rails.application.routes.url_helpers
9
+ include Frontend::ApplicationHelper
10
+ include SiteHelper
11
+ include PluginsHelper
12
+ include HooksHelper
13
+
14
+ DynamicSitemaps.configure do |config|
15
+ config.config_path = File.join($camaleon_engine_dir, "config", "sitemap.rb")
16
+ end
17
+
18
+ start_time = Time.now
19
+ DynamicSitemaps::Logger.info "Generating sitemap..."
20
+ DynamicSitemaps.generate_sitemap
21
+ DynamicSitemaps::Logger.info "Done generating sitemap in #{Time.now - start_time} seconds."
22
+ end
23
+ end
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.2
4
+ version: 0.1.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-08-23 00:00:00.000000000 Z
11
+ date: 2015-08-24 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.