camaleon_cms 2.4.0 → 2.4.1

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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +2 -2
  4. data/app/assets/javascripts/camaleon_cms/admin/_post.js +1 -1
  5. data/app/assets/javascripts/camaleon_cms/admin/form/cropper.min.js +2994 -1
  6. data/app/assets/javascripts/camaleon_cms/admin/uploader/_media_manager.js.coffee +72 -33
  7. data/app/controllers/camaleon_cms/admin/media_controller.rb +1 -0
  8. data/app/controllers/camaleon_cms/admin/sessions_controller.rb +2 -2
  9. data/app/controllers/camaleon_cms/admin/user_roles_controller.rb +11 -6
  10. data/app/controllers/camaleon_cms/admin/users_controller.rb +1 -1
  11. data/app/controllers/camaleon_cms/apps/plugins_front_controller.rb +1 -1
  12. data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +1 -1
  13. data/app/decorators/camaleon_cms/site_decorator.rb +1 -1
  14. data/app/decorators/camaleon_cms/user_decorator.rb +1 -1
  15. data/app/decorators/camaleon_cms/user_role_decorator.rb +12 -0
  16. data/app/helpers/camaleon_cms/session_helper.rb +1 -1
  17. data/app/helpers/camaleon_cms/short_code_helper.rb +25 -7
  18. data/app/models/concerns/camaleon_cms/user_methods.rb +0 -7
  19. data/app/uploaders/camaleon_cms_aws_uploader.rb +2 -5
  20. data/app/uploaders/camaleon_cms_uploader.rb +6 -2
  21. data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +1 -1
  22. data/app/views/camaleon_cms/admin/settings/custom_fields/form.html.erb +1 -1
  23. data/app/views/camaleon_cms/admin/user_roles/form.html.erb +5 -9
  24. data/app/views/camaleon_cms/admin/user_roles/index.html.erb +3 -3
  25. data/app/views/camaleon_cms/admin/users/form.html.erb +1 -1
  26. data/app/views/camaleon_cms/admin/users/index.html.erb +2 -2
  27. data/config/locales/camaleon_cms/admin/js.yml +2 -0
  28. data/db/migrate/20161215202255_drop_user_relationship_table.rb +5 -0
  29. data/lib/camaleon_cms/version.rb +1 -1
  30. data/spec/dummy/db/schema.rb +1 -11
  31. data/spec/helpers/short_code_helper_spec.rb +64 -0
  32. metadata +6 -3
  33. data/app/models/camaleon_cms/user_relationship.rb +0 -7
@@ -39,7 +39,7 @@
39
39
  </div>
40
40
  <% end %>
41
41
  </div>
42
- <script> jQuery(function(){ build_custom_field_group(<%= raw(params[:field_options].present? ? (r = []; params[:field_options].each{|k, v| val = {}; v.each{|kk, vv| val["#{kk}"] = (vv['values'].values rescue vv['values']); }; r << val }; r.to_json) : record.get_fields_grouped(fields.pluck(:slug).uniq).to_json) %>, '<%= group.id %>', <%= raw group_field_data.to_json %>, <%= group.is_repeat %>); }); </script>
42
+ <script> jQuery(function(){ build_custom_field_group(<%= raw(params[:field_options].present? ? (r = []; params[:field_options].each{|k, v| val = {}; v.each{|kk, vv| val["#{kk}"] = (vv['values'].values rescue vv['values']); }; r << val }; r.to_json) : record.get_fields_grouped(fields.pluck(:slug).uniq).to_json) %>, '<%= group.id %>', <%= raw group_field_data.to_json %>, <%= group.is_repeat %>, '<%= field_name %>'); }); </script>
43
43
  </div>
44
44
  </div>
45
45
  <% if group.is_repeat %>
@@ -111,7 +111,7 @@
111
111
  </div>
112
112
  <div class="panel-body padding-0">
113
113
  <% fields = @field_group.new_record? ? [] : @field_group.fields %>
114
- <ul id="sortable-fields" class="clear">
114
+ <ul id="sortable-fields" class="clear list-unstyled">
115
115
  <% fields.each do |field| @item_value = field; @item_options_value = field.options; @key = field.options[:field_key] %>
116
116
  <li class="item">
117
117
  <%= render "get_items" %>
@@ -1,7 +1,7 @@
1
1
  <div class="page-title">
2
2
  <h2>
3
3
  <span class="fa fa-users"></span>
4
- <%= t('camaleon_cms.admin.page_title.edit') + " " + @user_role.name if !@user_role.new_record? %>
4
+ <%= t('camaleon_cms.admin.page_title.edit') + " " + @user_role.the_title if !@user_role.new_record? %>
5
5
  <%= t('camaleon_cms.admin.users.create_user') if @user_role.new_record? %>
6
6
  </h2>
7
7
  </div>
@@ -91,11 +91,10 @@
91
91
  <div class="panel-heading ui-draggable-handle">
92
92
  <h3 class="panel-title"><%= t('camaleon_cms.admin.page_title.details')%> </h3>
93
93
  </div>
94
-
95
94
  <div class="panel-body">
96
95
  <div class="form-group">
97
96
  <%= f.label t('camaleon_cms.admin.table.name') %>
98
- <%= f.text_field :name, :class => "form-control required", disabled: @user_role.editable? ? false : 'disabled' %>
97
+ <%= f.text_field :name, :class => "form-control required translatable" %>
99
98
  </div>
100
99
  <div class="form-group">
101
100
  <%= f.label t('camaleon_cms.admin.table.slug') %>
@@ -103,16 +102,13 @@
103
102
  </div>
104
103
  <div class="form-group">
105
104
  <%= f.label t('camaleon_cms.admin.table.description') %>
106
- <%= f.text_area :description, :class => "form-control " , disabled: @user_role.editable? ? false : 'disabled' %>
105
+ <%= f.text_area :description, :class => "form-control translatable" %>
107
106
  </div>
108
-
109
107
  </div>
110
108
 
111
109
  <div class="panel-footer">
112
- <a class="btn btn-default" role="back" href="<%= url_for action: :index %>"><%= t('camaleon_cms.admin.button.back') %></a>
113
- <% if @user_role.editable? %>
114
- <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit') %></button>
115
- <% end %>
110
+ <a class="btn btn-default" role="back" href="<%= url_for action: :index %>"><%= t('camaleon_cms.admin.button.back') %></a>
111
+ <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit') %></button>
116
112
  </div>
117
113
 
118
114
  </div>
@@ -23,11 +23,11 @@
23
23
  </tr>
24
24
  </thead>
25
25
  <tbody>
26
- <% @user_roles.each do |f| %>
26
+ <% @user_roles.decorate.each do |f| %>
27
27
  <tr>
28
28
  <td><%= f.id %></td>
29
- <td><%= f.name %></td>
30
- <td><%= f.description %></td>
29
+ <td><%= f.the_title %></td>
30
+ <td><%= f.the_content %></td>
31
31
  <td>
32
32
  <%= link_to raw('<i class="fa fa-pencil"></i>'), {action: :edit, id: f.id }, class: "btn btn-default btn-xs cama_ajax_request", title: "#{t('camaleon_cms.admin.button.edit')}" %>
33
33
  <%= link_to raw('<i class="fa fa-times"></i>'), { action: :destroy, id: f.id },
@@ -54,7 +54,7 @@
54
54
  <div class="">
55
55
  <%= f.label "#{t('camaleon_cms.admin.table.role')}", class: "control-label" %>
56
56
  <div class="">
57
- <%= f.select :role,current_site.user_roles.reorder(:name).all.map{|role| [role.name, role.slug]}, {}, {:class => "form-control required"}%>
57
+ <%= f.select :role,current_site.user_roles.reorder(:name).decorate.map{|role| [role.the_title, role.slug]}, {}, {:class => "form-control required"}%>
58
58
  </div>
59
59
  </div>
60
60
  <hr>
@@ -32,8 +32,8 @@
32
32
  <td><%= f.id %></td>
33
33
  <td><%= f.username %></td>
34
34
  <td><%= f.email %></td>
35
- <td><%= f.role %></td>
36
- <td><%= f.last_login_at.strftime("%Y-%m-%d %H:%M:%S") if f.last_login_at.present? %></td>
35
+ <td><%= f.the_role %></td>
36
+ <td><%= l(f.last_login_at, format: :long) if f.last_login_at.present? %></td>
37
37
  <td>
38
38
  <%= link_to raw('<i class="fa fa-pencil"></i>'), {action: :edit, id: f.id }, class: "btn btn-default btn-xs cama_ajax_request", title: "#{t('camaleon_cms.admin.button.edit')}" %>
39
39
  <%= link_to raw('<i class="fa fa-times"></i>'), { action: :destroy, id: f.id },
@@ -193,6 +193,8 @@ es:
193
193
  root: "Raiz"
194
194
  replace_image: 'Reemplazar Imagen'
195
195
  save_new_image: 'Guardar Nueva Imagen'
196
+ auto_crop: 'Recorte Automático'
197
+ edit_image: 'Editar Imagen'
196
198
 
197
199
  it:
198
200
  camaleon_cms:
@@ -0,0 +1,5 @@
1
+ class DropUserRelationshipTable < ActiveRecord::Migration
2
+ def change
3
+ drop_table "#{PluginRoutes.static_system_info["db_prefix"]}user_relationships"
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module CamaleonCms
2
- VERSION = '2.4.0'
2
+ VERSION = '2.4.1'
3
3
  end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20160609121449) do
14
+ ActiveRecord::Schema.define(version: 20161215202255) do
15
15
 
16
16
  create_table "comments", force: :cascade do |t|
17
17
  t.string "author"
@@ -147,16 +147,6 @@ ActiveRecord::Schema.define(version: 20160609121449) do
147
147
  add_index "term_taxonomy", ["term_order"], name: "index_term_taxonomy_on_term_order"
148
148
  add_index "term_taxonomy", ["user_id"], name: "index_term_taxonomy_on_user_id"
149
149
 
150
- create_table "user_relationships", force: :cascade do |t|
151
- t.integer "term_order"
152
- t.integer "active", default: 1
153
- t.integer "term_taxonomy_id"
154
- t.integer "user_id"
155
- end
156
-
157
- add_index "user_relationships", ["term_taxonomy_id"], name: "index_user_relationships_on_term_taxonomy_id"
158
- add_index "user_relationships", ["user_id"], name: "index_user_relationships_on_user_id"
159
-
160
150
  create_table "users", force: :cascade do |t|
161
151
  t.string "username"
162
152
  t.string "role", default: "client"
@@ -0,0 +1,64 @@
1
+ require 'rails_helper'
2
+
3
+ def shortcode_tests
4
+ before(:each) do
5
+ helper.shortcodes_init
6
+ helper.shortcode_add("hello_world", lambda{|attrs, args|
7
+ "Hello World"
8
+ })
9
+ helper.shortcode_add("hello", lambda{|attrs, args|
10
+ "Hello #{attrs['name']}"
11
+ })
12
+ helper.shortcode_add("user_info", lambda{|attrs, args|
13
+ "#{attrs['name']} #{attrs['lastname']}"
14
+ })
15
+ helper.shortcode_add("modal", lambda{|attrs, args|
16
+ "modal body = #{args[:shortcode_content]}"
17
+ })
18
+ helper.shortcode_add("title", lambda{|attrs, args|
19
+ "<h1>#{args[:shortcode_content]}</h1>"
20
+ })
21
+ helper.shortcode_add("sub_title", lambda{|attrs, args|
22
+ "<h2 style='#{attrs['style']}'>#{args[:shortcode_content]}</h2>"
23
+ })
24
+ helper.shortcode_add("sub_title2", lambda{|attrs, args|
25
+ "<h2 style='#{attrs['style']}' class='#{attrs['class']}'>#{args[:shortcode_content]}</h2>"
26
+ })
27
+ end
28
+ end
29
+
30
+ describe "CamaleonCms::ShortCodeHelper" do
31
+ # get_current_test_site()
32
+ describe "Shortcode Simple" do
33
+ shortcode_tests
34
+ it "No attributes" do
35
+ expect(helper.do_shortcode('This is my first [hello_world]')).to include('Hello World')
36
+ end
37
+ it "With attribute" do
38
+ expect(helper.do_shortcode('Say [hello name="Owen"]')).to be == 'Say Hello Owen'
39
+ end
40
+ it "With attributes" do
41
+ expect(helper.do_shortcode('Hi [user_info name="Owen" lastname="Peredo"], Good morning')).to be == 'Hi Owen Peredo, Good morning'
42
+ end
43
+ end
44
+
45
+ describe "Shortcode with Block" do
46
+ shortcode_tests
47
+ it "No attributes" do
48
+ expect(helper.do_shortcode('Sample [title]This is title[/title].')).to include('Sample <h1>This is title</h1>.')
49
+ end
50
+ it "With attribute" do
51
+ expect(helper.do_shortcode('Sample [sub_title style="color: red;"]This is sub title[/sub_title].')).to include('Sample <h2 style=\'color: red;\'>This is sub title</h2>.')
52
+ end
53
+ it "With attributes" do
54
+ expect(helper.do_shortcode('Sample [sub_title2 style="color: red;" class="center"]This is sub title[/sub_title2].')).to include('Sample <h2 style=\'color: red;\' class=\'center\'>This is sub title</h2>.')
55
+ end
56
+ end
57
+
58
+ describe "Shortcode Multiple" do
59
+ shortcode_tests
60
+ it "Many Shortcodes" do
61
+ expect(helper.do_shortcode('[title][hello name="Owen"][/title] and [hello_world].')).to include('<h1>Hello Owen</h1> and Hello World.')
62
+ end
63
+ end
64
+ 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: 2.4.0
4
+ version: 2.4.1
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: 2016-12-15 00:00:00.000000000 Z
11
+ date: 2016-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt
@@ -677,6 +677,7 @@ files:
677
677
  - app/decorators/camaleon_cms/term_taxonomy_decorator.rb
678
678
  - app/decorators/camaleon_cms/theme_decorator.rb
679
679
  - app/decorators/camaleon_cms/user_decorator.rb
680
+ - app/decorators/camaleon_cms/user_role_decorator.rb
680
681
  - app/decorators/camaleon_cms/widget_decorator.rb
681
682
  - app/helpers/camaleon_cms/admin/application_helper.rb
682
683
  - app/helpers/camaleon_cms/admin/breadcrumb_helper.rb
@@ -724,7 +725,6 @@ files:
724
725
  - app/models/camaleon_cms/term_taxonomy.rb
725
726
  - app/models/camaleon_cms/theme.rb
726
727
  - app/models/camaleon_cms/user.rb
727
- - app/models/camaleon_cms/user_relationship.rb
728
728
  - app/models/camaleon_cms/user_role.rb
729
729
  - app/models/camaleon_cms/widget.rb
730
730
  - app/models/camaleon_cms/widget/assigned.rb
@@ -961,6 +961,7 @@ files:
961
961
  - db/migrate/20160606135421_improve_menus_structure.rb
962
962
  - db/migrate/20160609121449_add_group_to_custom_field_values.rb
963
963
  - db/migrate/20161206211917_install_migrated_seo_plugin.rb
964
+ - db/migrate/20161215202255_drop_user_relationship_table.rb
964
965
  - lib/camaleon_cms.rb
965
966
  - lib/camaleon_cms/engine.rb
966
967
  - lib/camaleon_cms/version.rb
@@ -1063,6 +1064,7 @@ files:
1063
1064
  - spec/features/users_spec.rb
1064
1065
  - spec/features/widgets_spec.rb
1065
1066
  - spec/helpers/email_helper_spec.rb
1067
+ - spec/helpers/short_code_helper_spec.rb
1066
1068
  - spec/mailers/send_mail_spec.rb
1067
1069
  - spec/models/user_spec.rb
1068
1070
  - spec/rails_helper.rb
@@ -1153,6 +1155,7 @@ test_files:
1153
1155
  - spec/features/users_spec.rb
1154
1156
  - spec/features/widgets_spec.rb
1155
1157
  - spec/helpers/email_helper_spec.rb
1158
+ - spec/helpers/short_code_helper_spec.rb
1156
1159
  - spec/mailers/send_mail_spec.rb
1157
1160
  - spec/models/user_spec.rb
1158
1161
  - spec/rails_helper.rb
@@ -1,7 +0,0 @@
1
- class CamaleonCms::UserRelationship < ActiveRecord::Base
2
- self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}user_relationships"
3
- # attr_accessible :user_id, :term_taxonomy_id, :term_order, :active
4
-
5
- belongs_to :term_taxonomies, :class_name => "CamaleonCms::TermTaxonomy", foreign_key: :term_taxonomy_id, inverse_of: :user_relationships
6
- belongs_to :user, :class_name => "CamaleonCms::User", foreign_key: :user_id
7
- end