camaleon_cms 2.4.5.5 → 2.4.5.7

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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/app/apps/themes/default/views/partials/_comments.html.erb +36 -21
  3. data/app/apps/themes/default/views/post.html.erb +1 -1
  4. data/app/assets/javascripts/camaleon_cms/admin/uploader/_media_manager.js.coffee +4 -4
  5. data/app/controllers/camaleon_cms/admin/categories_controller.rb +3 -0
  6. data/app/controllers/camaleon_cms/admin/media_controller.rb +9 -6
  7. data/app/controllers/camaleon_cms/admin/sessions_controller.rb +1 -1
  8. data/app/controllers/camaleon_cms/admin/settings/post_types_controller.rb +2 -0
  9. data/app/controllers/concerns/camaleon_cms/frontend_concern.rb +17 -13
  10. data/app/decorators/camaleon_cms/post_decorator.rb +0 -1
  11. data/app/helpers/camaleon_cms/captcha_helper.rb +1 -1
  12. data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +1 -0
  13. data/app/helpers/camaleon_cms/hooks_helper.rb +6 -1
  14. data/app/helpers/camaleon_cms/site_helper.rb +1 -1
  15. data/app/helpers/camaleon_cms/uploader_helper.rb +36 -27
  16. data/app/models/camaleon_cms/custom_fields_relationship.rb +6 -0
  17. data/app/models/camaleon_cms/media.rb +54 -0
  18. data/app/models/camaleon_cms/post.rb +1 -0
  19. data/app/models/camaleon_cms/site.rb +7 -0
  20. data/app/uploaders/camaleon_cms_aws_uploader.rb +21 -23
  21. data/app/uploaders/camaleon_cms_local_uploader.rb +20 -26
  22. data/app/uploaders/camaleon_cms_uploader.rb +17 -45
  23. data/app/views/camaleon_cms/admin/categories/index.html.erb +2 -2
  24. data/app/views/camaleon_cms/admin/media/_render_file_item.html.erb +53 -36
  25. data/app/views/camaleon_cms/admin/media/index.html.erb +1 -1
  26. data/app/views/camaleon_cms/admin/post_tags/index.html.erb +4 -4
  27. data/app/views/camaleon_cms/admin/posts/index.html.erb +1 -0
  28. data/app/views/camaleon_cms/admin/settings/_configuration_settings.html.erb +5 -1
  29. data/app/views/camaleon_cms/admin/settings/post_types/_form.html.erb +1 -1
  30. data/app/views/camaleon_cms/default_theme/partials/_comments.html.erb +45 -28
  31. data/app/views/camaleon_cms/default_theme/single.html.erb +1 -1
  32. data/config/locales/camaleon_cms/admin/es.yml +1 -0
  33. data/config/locales/camaleon_cms/admin/js.yml +54 -3
  34. data/config/locales/camaleon_cms/admin/ru.yml +39 -28
  35. data/db/migrate/20180124132318_create_media.rb +17 -0
  36. data/lib/camaleon_cms/version.rb +1 -1
  37. data/lib/ext/string.rb +8 -0
  38. data/lib/generators/camaleon_cms/gem_plugin_generator.rb +29 -25
  39. data/lib/plugin_routes.rb +27 -0
  40. data/spec/dummy/config/application.rb +1 -0
  41. data/spec/dummy/config/environments/test.rb +2 -0
  42. data/spec/dummy/db/schema.rb +1 -140
  43. data/spec/dummy/db/test.sqlite3 +0 -0
  44. data/spec/dummy/public/favicon.ico +0 -0
  45. data/spec/factories/post_type.rb +17 -0
  46. data/spec/factories/site.rb +8 -0
  47. data/spec/features/{categories_spec.rb → admin/categories_spec.rb} +1 -1
  48. data/spec/features/{comments_spec.rb → admin/comments_spec.rb} +16 -9
  49. data/spec/features/{contact_form_spec.rb → admin/contact_form_spec.rb} +16 -9
  50. data/spec/features/{content_groups_spec.rb → admin/content_groups_spec.rb} +19 -11
  51. data/spec/features/{custom_fields_spec.rb → admin/custom_fields_spec.rb} +1 -1
  52. data/spec/features/{languages_spec.rb → admin/languages_spec.rb} +1 -1
  53. data/spec/features/{media_spec.rb → admin/media_spec.rb} +1 -1
  54. data/spec/features/{menus_spec.rb → admin/menus_spec.rb} +2 -2
  55. data/spec/features/{pages_spec.rb → admin/pages_spec.rb} +1 -1
  56. data/spec/features/{plugins_spec.rb → admin/plugins_spec.rb} +1 -1
  57. data/spec/features/{posts_spec.rb → admin/posts_spec.rb} +4 -3
  58. data/spec/features/admin/session_spec.rb +102 -0
  59. data/spec/features/{settings_spec.rb → admin/settings_spec.rb} +1 -1
  60. data/spec/features/{shortcodes_spec.rb → admin/shortcodes_spec.rb} +1 -1
  61. data/spec/features/{sites_spec.rb → admin/sites_spec.rb} +22 -14
  62. data/spec/features/{tags_spec.rb → admin/tags_spec.rb} +17 -8
  63. data/spec/features/{themes_spec.rb → admin/themes_spec.rb} +1 -1
  64. data/spec/features/{user_roles_spec.rb → admin/user_roles_spec.rb} +25 -19
  65. data/spec/features/{users_spec.rb → admin/users_spec.rb} +2 -2
  66. data/spec/features/{widgets_spec.rb → admin/widgets_spec.rb} +19 -12
  67. data/spec/features/frontend/pages_spec.rb +86 -5
  68. data/spec/features/frontend/post_type_spec.rb +16 -0
  69. data/spec/helpers/email_helper_spec.rb +1 -1
  70. data/spec/helpers/uploader_helper_spec.rb +56 -0
  71. data/spec/mailers/send_mail_spec.rb +3 -3
  72. data/spec/{decorators/camaleon_cms/post_decorator_spec.rb → models/post_spec.rb} +3 -3
  73. data/spec/rails_helper.rb +79 -0
  74. data/spec/spec_helper.rb +25 -56
  75. data/spec/support/common.rb +10 -24
  76. data/spec/support/fixtures/rails.png +0 -0
  77. data/spec/support/fixtures/rails_tmp.png +0 -0
  78. metadata +64 -50
  79. data/app/views/camaleon_cms/admin/media/_files_list.html.erb +0 -2
  80. data/app/views/camaleon_cms/admin/media/_render_folder_item.html.erb +0 -15
  81. data/spec/decorators/post_type_spec.rb +0 -13
  82. data/spec/features/session_spec.rb +0 -74
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the Custom Fields", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "Custom fields list" do
6
6
  admin_sign_in
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the Languages", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "Languages list" do
6
6
  admin_sign_in
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the Media", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "list media" do
6
6
  admin_sign_in
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the Menus", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "Menus list" do
6
6
  admin_sign_in
@@ -42,7 +42,7 @@ describe "the Menus", js: true do
42
42
  it "Menus Create and Delete" do
43
43
  admin_sign_in
44
44
  visit "#{cama_root_relative_path}/admin/appearances/nav_menus"
45
- page.execute_script('$("#switch_nav_menu_form .btn-danger").click()')
45
+ page.execute_script('jQuery("#switch_nav_menu_form .btn-danger").click()')
46
46
  confirm_dialog
47
47
  expect(page).to have_css('.alert-success')
48
48
  end
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the signin process", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "create new page" do
6
6
  admin_sign_in
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the Menus", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "Plugins list" do
6
6
  admin_sign_in
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the signin process", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "create new post" do
6
6
  admin_sign_in
@@ -20,7 +20,7 @@ describe "the signin process", js: true do
20
20
 
21
21
  it "create edit post" do
22
22
  admin_sign_in
23
- visit "#{cama_root_relative_path}/admin/post_type/2/posts/#{get_content_attr("post", "id", "last")}/edit"
23
+ visit "#{cama_root_relative_path}/admin/post_type/2/posts/#{@post.id}/edit"
24
24
  wait(2)
25
25
  within("#form-post") do
26
26
  fill_in 'post_title', :with => 'Test Title changed'
@@ -29,8 +29,9 @@ describe "the signin process", js: true do
29
29
  end
30
30
  click_button 'Update'
31
31
  expect(page).to have_css('.alert-success')
32
+
32
33
  # visit page in frontend
33
- visit "#{get_content_attr("post", "the_path", "last")}"
34
+ visit @post.the_url(as_path: true)
34
35
  expect(page).to have_content("Test Title changed")
35
36
  end
36
37
  end
@@ -0,0 +1,102 @@
1
+ require "rails_helper"
2
+ describe "the signin process", js: true do
3
+ init_site
4
+ it "signs me in not valid" do
5
+ visit "#{cama_root_relative_path}/admin/login"
6
+ within("#login_user") do
7
+ fill_in 'user_username', :with => 'admin'
8
+ fill_in 'user_password', :with => 'ADMIN'
9
+ end
10
+ click_button 'Log In'
11
+ expect(page).to have_css('#user_username')
12
+ end
13
+
14
+ it "forgot pass" do
15
+ visit "#{cama_root_relative_path}/admin/forgot"
16
+ within("#login_user") do
17
+ fill_in 'user_email', :with => 'admin@local.com'
18
+ end
19
+ click_button 'Submit'
20
+ expect(page).to have_content 'Send email reset success'
21
+ end
22
+
23
+ it "Enable Register" do
24
+ admin_sign_in
25
+ visit "#{cama_root_relative_path}/admin/settings/site?tab=config"
26
+ within '#site_settings_form' do
27
+ check "options_permit_create_account"
28
+ click_button 'Submit'
29
+ end
30
+ expect(page).to have_css('.alert-success')
31
+ end
32
+
33
+
34
+ describe 'user registration' do
35
+ before(:each) do
36
+ @site.set_option('permit_create_account', true) # enable user registration
37
+ end
38
+
39
+ it "Enable Register with Captcha" do
40
+ admin_sign_in
41
+ visit "#{cama_root_relative_path}/admin/settings/site?tab=config"
42
+ within '#site_settings_form' do
43
+ check "options_security_captcha_user_register"
44
+ click_button 'Submit'
45
+ end
46
+ expect(page).to have_css('.alert-success')
47
+ end
48
+
49
+ it "Register User" do
50
+ visit "#{cama_root_relative_path}/admin/register"
51
+ within("#login_user") do
52
+ fill_in 'user[first_name]', :with => 'Name'
53
+ fill_in 'user[last_name]', :with => 'Last Name'
54
+ fill_in 'user[email]', :with => 'test@tester.com'
55
+ fill_in 'user[username]', :with => 'tester'
56
+ fill_in 'user[password]', :with => 'passsword'
57
+ fill_in 'user[password_confirmation]', :with => 'passsword'
58
+ end
59
+ click_button 'Sign Up'
60
+ expect(page).to have_css('.alert-success')
61
+ end
62
+
63
+ it "Register User with error in captcha" do
64
+ @site.set_option('security_captcha_user_register', true) # enable captcha security for user registration
65
+ visit "#{cama_root_relative_path}/admin/register"
66
+ within("#login_user") do
67
+ fill_in 'user[first_name]', :with => 'Name'
68
+ fill_in 'user[last_name]', :with => 'Last Name'
69
+ fill_in 'user[email]', :with => "test_#{Time.current.to_i}@tester.com"
70
+ fill_in 'user[username]', :with => "tester_#{Time.current.to_i}"
71
+ fill_in 'user[password]', :with => 'passsword'
72
+ fill_in 'user[password_confirmation]', :with => 'passsword'
73
+ fill_in 'captcha', :with => 'password'
74
+ end
75
+ click_button 'Sign Up'
76
+ expect(page).not_to have_css('.alert-success')
77
+ end
78
+
79
+ it "Register User with no error in Captcha" do
80
+ @site.set_option('security_captcha_user_register', true) # enable captcha security for user registration
81
+ Capybara.using_session("test session") do
82
+ visit cama_captcha_path(len: 4, t: Time.current.to_i)
83
+ captcha = page.get_rack_session['cama_captcha']
84
+ visit "#{cama_root_relative_path}/admin/register"
85
+ within("#login_user") do
86
+ fill_in 'user[first_name]', :with => 'Name'
87
+ fill_in 'user[last_name]', :with => 'Last Name'
88
+ fill_in 'user[email]', :with => "test_#{Time.current.to_i}@tester.com"
89
+ fill_in 'user[username]', :with => "tester_#{Time.current.to_i}"
90
+ fill_in 'user[password]', :with => 'passsword'
91
+ fill_in 'user[password_confirmation]', :with => 'passsword'
92
+ fill_in 'captcha', :with => captcha
93
+ end
94
+ click_button 'Sign Up'
95
+ expect(page).to have_css('.alert-success')
96
+ end
97
+ end
98
+
99
+ end
100
+
101
+
102
+ end
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the Site Settings", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "Settings Form" do
6
6
  admin_sign_in
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the Shortcodes", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "Shortcodes list" do
6
6
  admin_sign_in
@@ -1,27 +1,34 @@
1
1
  require "rails_helper"
2
+
3
+ # create a new site
4
+ def create_site
5
+ visit "#{cama_root_relative_path}/admin/settings/sites"
6
+ expect(page).to have_content("List Sites")
7
+
8
+ # create user role
9
+ within '#admin_content' do
10
+ click_link "Add Site"
11
+ end
12
+ expect(page).to have_css("#new_site")
13
+ within '#new_site' do
14
+ fill_in "site_slug", with: 'owen'
15
+ fill_in "site_name", with: 'Owen sub site'
16
+ click_button "Submit"
17
+ end
18
+ end
19
+
2
20
  describe "the Sites", js: true do
3
- login_success
21
+ init_site
4
22
 
5
23
  it "Sites list" do
6
24
  admin_sign_in
7
- visit "#{cama_root_relative_path}/admin/settings/sites"
8
- expect(page).to have_content("List Sites")
9
-
10
- # create user role
11
- within '#admin_content' do
12
- click_link "Add Site"
13
- end
14
- expect(page).to have_css("#new_site")
15
- within '#new_site' do
16
- fill_in "site_slug", with: 'owen'
17
- fill_in "site_name", with: 'Owen sub site'
18
- click_button "Submit"
19
- end
25
+ create_site
20
26
  expect(page).to have_css('.alert-success')
21
27
  end
22
28
 
23
29
  it "Site Edit" do
24
30
  admin_sign_in
31
+ create_site
25
32
  visit "#{cama_root_relative_path}/admin/settings/sites"
26
33
  within '#admin_content' do
27
34
  all(".btn-default").last.click
@@ -35,6 +42,7 @@ describe "the Sites", js: true do
35
42
 
36
43
  it "Site destroy" do
37
44
  admin_sign_in
45
+ create_site
38
46
  visit "#{cama_root_relative_path}/admin/settings/sites"
39
47
  within '#admin_content' do
40
48
  all(".btn-danger").last.click
@@ -1,21 +1,30 @@
1
1
  require "rails_helper"
2
+
3
+ # create a new post tag
4
+ def create_tag
5
+ visit "#{cama_root_relative_path}/admin/post_type/2/post_tags"
6
+ within("#new_post_tag") do
7
+ fill_in 'post_tag_name', :with => 'Test tag'
8
+ fill_in 'post_tag_slug', :with => 'test-tag'
9
+ end
10
+ click_button 'Submit'
11
+ end
12
+
2
13
  describe "the signin process", js: true do
3
- login_success
14
+ init_site
4
15
 
5
16
  it "create new tag" do
6
17
  admin_sign_in
7
- visit "#{cama_root_relative_path}/admin/post_type/2/post_tags"
8
- within("#new_post_tag") do
9
- fill_in 'post_tag_name', :with => 'Test tag'
10
- fill_in 'post_tag_slug', :with => 'test-tag'
11
- end
12
- click_button 'Submit'
18
+ create_tag
13
19
  expect(page).to have_css('.alert-success')
14
20
  end
15
21
 
16
22
  it "create edit tag" do
17
23
  admin_sign_in
18
- visit "#{cama_root_relative_path}/admin/post_type/2/post_tags/#{get_tag_attr("id", "last")}/edit"
24
+ create_tag
25
+ within '.page-content-wrap' do
26
+ all(".btn_edit").last.click
27
+ end
19
28
  within("#edit_post_tag") do
20
29
  fill_in 'post_tag_name', :with => 'Test tag update'
21
30
  end
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the Themes", js: true do
3
- login_success
3
+ init_site
4
4
 
5
5
  it "Themes list" do
6
6
  admin_sign_in
@@ -1,6 +1,25 @@
1
1
  require "rails_helper"
2
+
3
+ # create a new user role
4
+ def create_role
5
+ visit "#{cama_root_relative_path}/admin/user_roles"
6
+ within '#admin_content' do
7
+ click_link "Add User Role"
8
+ end
9
+ expect(page).to have_css("#new_user_role")
10
+ within '#new_user_role' do
11
+ fill_in "user_role_name", with: 'Test Role'
12
+ fill_in "user_role_slug", with: 'tester-role'
13
+ fill_in "user_role_description", with: 'tester descr'
14
+ check "Comments"
15
+ check "Themes"
16
+ click_button "Submit"
17
+ end
18
+
19
+ end
20
+
2
21
  describe "the User Roles", js: true do
3
- login_success
22
+ init_site
4
23
 
5
24
  it "User Roles list" do
6
25
  admin_sign_in
@@ -10,34 +29,20 @@ describe "the User Roles", js: true do
10
29
  expect(page).to have_content("Editor")
11
30
  expect(page).to have_content("Contributor")
12
31
 
13
- # create user role
14
- within '#admin_content' do
15
- click_link "Add User Role"
16
- end
17
- expect(page).to have_css("#new_user_role")
18
- within '#new_user_role' do
19
- fill_in "user_role_name", with: 'Test Role'
20
- fill_in "user_role_slug", with: 'tester-role'
21
- fill_in "user_role_description", with: 'tester descr'
22
- check "Comments"
23
- check "Themes"
24
- click_button "Submit"
25
- end
32
+ create_role
26
33
  expect(page).to have_css('.alert-success')
27
34
  end
28
35
 
29
36
  # TODO verification of all roles
30
37
  # it "Users Verify Role" do
31
- # admin_sign_in(false, "tester", "tester")
38
+ # admin_sign_in("tester", "tester")
32
39
  # end
33
40
 
34
41
  it "User Role Edit" do
35
42
  admin_sign_in
36
- visit "#{cama_root_relative_path}/admin/user_roles"
37
- within '#admin_content' do
38
- all(".btn-default").last.click
39
- end
43
+ create_role
40
44
  expect(page).to have_checked_field("Themes")
45
+ expect(page).to have_checked_field("Comments")
41
46
  within '#edit_user_role' do
42
47
  fill_in "user_role_name", with: 'Test Role updated'
43
48
  fill_in "user_role_slug", with: 'tester-role-updated'
@@ -50,6 +55,7 @@ describe "the User Roles", js: true do
50
55
 
51
56
  it "User Group destroy" do
52
57
  admin_sign_in
58
+ create_role
53
59
  visit "#{cama_root_relative_path}/admin/user_roles"
54
60
  within '#admin_content' do
55
61
  all(".btn-danger").last.click
@@ -1,6 +1,6 @@
1
1
  require "rails_helper"
2
2
  describe "the Users", js: true do
3
- login_success
3
+ init_site
4
4
  uname = "testerr_#{Time.current.to_i}"
5
5
  uemail = "testerr_#{Time.current.to_i}@gmail.com"
6
6
  it "Users list" do
@@ -29,7 +29,7 @@ describe "the Users", js: true do
29
29
  end
30
30
 
31
31
  it "Users login new user" do
32
- admin_sign_in(false, uname, "tester123")
32
+ admin_sign_in(uname, "tester123")
33
33
  end
34
34
 
35
35
  it "Users Edit" do
@@ -1,22 +1,27 @@
1
1
  require "rails_helper"
2
+
3
+ # create a widget
4
+ def create_widget
5
+ within "#view_widget_list" do
6
+ first('#new_widget_link').click
7
+ wait_for_ajax
8
+ end
9
+ within '#widget_form' do
10
+ fill_in "widget_main_name", with: "test widget"
11
+ fill_in "widget_main_slug", with: "test-widget"
12
+ fill_in "widget_main_description", with: "lorem ipsum"
13
+ click_button "Submit"
14
+ end
15
+ end
16
+
2
17
  describe "the Widgets", js: true do
3
- login_success
18
+ init_site
4
19
 
5
20
  it "Widgets list" do
6
21
  admin_sign_in
7
22
  visit "#{cama_root_relative_path}/admin/appearances/widgets/main"
8
23
  expect(page).to have_css('#view_widget_list')
9
- within "#view_widget_list" do
10
- first('#new_widget_link').click
11
- wait_for_ajax
12
- end
13
- screenshot_and_save_page
14
- within '#widget_form' do
15
- fill_in "widget_main_name", with: "test widget"
16
- fill_in "widget_main_slug", with: "test-widget"
17
- fill_in "widget_main_description", with: "lorem ipsum"
18
- click_button "Submit"
19
- end
24
+ create_widget
20
25
  expect(page).to have_css('.alert-success')
21
26
  expect(page).to have_content("test-widget")
22
27
  end
@@ -24,6 +29,7 @@ describe "the Widgets", js: true do
24
29
  it "Widgets Edit" do
25
30
  admin_sign_in
26
31
  visit "#{cama_root_relative_path}/admin/appearances/widgets/main"
32
+ create_widget
27
33
  within "#view_widget_list" do
28
34
  first('.edit_link').click
29
35
  wait_for_ajax
@@ -41,6 +47,7 @@ describe "the Widgets", js: true do
41
47
  it "Widgets destroy" do
42
48
  admin_sign_in
43
49
  visit "#{cama_root_relative_path}/admin/appearances/widgets/main"
50
+ create_widget
44
51
  within "#view_widget_list" do
45
52
  first('.del_link').click
46
53
  end