alchemy_cms 3.0.4 → 3.1.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -6
- data/Gemfile +4 -7
- data/README.md +207 -115
- data/alchemy_cms.gemspec +10 -9
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +2 -2
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js.coffee +2 -2
- data/app/assets/javascripts/alchemy/alchemy.js +6 -7
- data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +1 -43
- data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +1 -1
- data/app/assets/stylesheets/alchemy/_mixins.scss +2 -1
- data/app/assets/stylesheets/alchemy/buttons.scss +0 -5
- data/app/assets/stylesheets/alchemy/dialogs.scss +1 -0
- data/app/assets/stylesheets/alchemy/frame.scss +9 -12
- data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +11 -2
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +9 -1
- data/app/controllers/alchemy/admin/attachments_controller.rb +2 -4
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +34 -38
- data/app/controllers/alchemy/api/base_controller.rb +19 -0
- data/app/controllers/alchemy/api/contents_controller.rb +35 -0
- data/app/controllers/alchemy/api/elements_controller.rb +29 -0
- data/app/controllers/alchemy/api/pages_controller.rb +32 -0
- data/app/controllers/alchemy/contents_controller.rb +1 -0
- data/app/controllers/alchemy/elements_controller.rb +5 -2
- data/app/controllers/alchemy/pages_controller.rb +4 -1
- data/app/controllers/alchemy/pictures_controller.rb +4 -36
- data/app/helpers/alchemy/admin/essences_helper.rb +5 -2
- data/app/helpers/alchemy/essences_helper.rb +14 -1
- data/app/models/alchemy/content.rb +32 -4
- data/app/models/alchemy/element.rb +2 -16
- data/app/models/alchemy/element/presenters.rb +2 -2
- data/app/models/alchemy/essence_file.rb +5 -0
- data/app/models/alchemy/essence_picture.rb +12 -8
- data/app/models/alchemy/picture.rb +1 -74
- data/app/models/alchemy/picture/transformations.rb +249 -0
- data/app/serializers/alchemy/content_serializer.rb +3 -10
- data/app/serializers/alchemy/element_serializer.rb +6 -3
- data/app/serializers/alchemy/legacy_element_serializer.rb +17 -0
- data/app/views/alchemy/admin/dashboard/_sites.html.erb +14 -4
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +8 -5
- data/app/views/alchemy/admin/pages/edit.html.erb +9 -9
- data/app/views/alchemy/admin/pictures/info.html.erb +2 -3
- data/app/views/alchemy/admin/tags/edit.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +8 -7
- data/app/views/alchemy/essences/_essence_boolean_view.html.erb +3 -3
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +8 -2
- data/app/views/alchemy/essences/_essence_date_view.html.erb +10 -8
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +48 -53
- data/app/views/alchemy/essences/_essence_file_view.html.erb +5 -5
- data/app/views/alchemy/essences/_essence_html_editor.html.erb +5 -4
- data/app/views/alchemy/essences/_essence_link_editor.html.erb +17 -15
- data/app/views/alchemy/essences/_essence_link_view.html.erb +11 -7
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +4 -2
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +4 -2
- data/app/views/alchemy/essences/_essence_richtext_view.html.erb +5 -4
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +22 -32
- data/app/views/alchemy/essences/_essence_text_view.html.erb +7 -6
- data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +1 -1
- data/app/views/layouts/alchemy/admin.html.erb +5 -3
- data/config/initializers/inflections.rb +3 -0
- data/config/initializers/simple_form.rb +1 -1
- data/config/locales/alchemy.en.yml +0 -1
- data/config/routes.rb +14 -0
- data/lib/alchemy/capistrano.rb +71 -0
- data/lib/alchemy/engine.rb +0 -3
- data/lib/alchemy/essence.rb +1 -1
- data/lib/alchemy/permissions.rb +19 -5
- data/lib/alchemy/picture_attributes.rb +1 -1
- data/lib/alchemy/test_support/auth_helpers.rb +1 -1
- data/lib/alchemy/test_support/essence_shared_examples.rb +37 -22
- data/lib/alchemy/test_support/integration_helpers.rb +1 -1
- data/lib/alchemy/tinymce.rb +21 -4
- data/lib/alchemy/upgrader/three_point_one.rb +43 -0
- data/lib/alchemy/upgrader/three_point_zero.rb +13 -0
- data/lib/alchemy/version.rb +2 -1
- data/lib/rails/generators/alchemy/module/module_generator.rb +30 -0
- data/lib/rails/generators/alchemy/module/templates/ability.rb.tt +11 -0
- data/lib/rails/generators/alchemy/module/templates/controller.rb.tt +2 -0
- data/lib/rails/generators/alchemy/module/templates/module_config.rb.tt +15 -0
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +0 -1
- data/lib/rails/templates/alchemy.rb +2 -2
- data/lib/tasks/alchemy/db.rake +7 -1
- data/spec/controllers/admin/attachments_controller_spec.rb +38 -38
- data/spec/controllers/admin/base_controller_spec.rb +18 -18
- data/spec/controllers/admin/clipboard_controller_spec.rb +23 -18
- data/spec/controllers/admin/contents_controller_spec.rb +33 -27
- data/spec/controllers/admin/dashboard_controller_spec.rb +14 -14
- data/spec/controllers/admin/elements_controller_spec.rb +125 -105
- data/spec/controllers/admin/essence_files_controller_spec.rb +6 -7
- data/spec/controllers/admin/essence_pictures_controller_spec.rb +52 -42
- data/spec/controllers/admin/languages_controller_spec.rb +3 -3
- data/spec/controllers/admin/pages_controller_spec.rb +81 -71
- data/spec/controllers/admin/pictures_controller_spec.rb +69 -72
- data/spec/controllers/admin/resources_controller_spec.rb +5 -5
- data/spec/controllers/admin/trash_controller_spec.rb +15 -12
- data/spec/controllers/alchemy/admin/tags_controller_spec.rb +8 -8
- data/spec/controllers/alchemy/api/contents_controller_spec.rb +73 -0
- data/spec/controllers/alchemy/api/elements_controller_spec.rb +69 -0
- data/spec/controllers/alchemy/api/pages_controller_spec.rb +86 -0
- data/spec/controllers/attachments_controller_spec.rb +8 -8
- data/spec/controllers/contents_controller_spec.rb +22 -0
- data/spec/controllers/elements_controller_spec.rb +10 -4
- data/spec/controllers/messages_controller_spec.rb +35 -34
- data/spec/controllers/pages_controller_spec.rb +37 -28
- data/spec/controllers/pictures_controller_spec.rb +90 -23
- data/spec/dummy/app/models/dummy_user.rb +0 -4
- data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_editor.html.erb +11 -0
- data/spec/dummy/config/alchemy/elements.yml +22 -1
- data/spec/dummy/config/alchemy/page_layouts.yml +4 -0
- data/spec/dummy/config/application.rb +2 -1
- data/spec/dummy/config/environments/test.rb +3 -1
- data/spec/features/admin/dashboard_spec.rb +41 -6
- data/spec/features/admin/language_tree_feature_spec.rb +3 -3
- data/spec/features/admin/legacy_page_url_management_spec.rb +1 -1
- data/spec/features/admin/link_overlay_spec.rb +7 -7
- data/spec/features/admin/locale_select_feature_spec.rb +5 -2
- data/spec/features/admin/modules_integration_spec.rb +1 -1
- data/spec/features/admin/page_creation_feature_spec.rb +3 -2
- data/spec/features/admin/page_editing_feature_spec.rb +66 -79
- data/spec/features/admin/picture_library_integration_spec.rb +8 -8
- data/spec/features/admin/resources_integration_spec.rb +21 -21
- data/spec/features/admin/tinymce_feature_spec.rb +36 -0
- data/spec/features/navigation_spec.rb +1 -1
- data/spec/features/page_feature_spec.rb +34 -34
- data/spec/features/picture_security_spec.rb +4 -4
- data/spec/features/security_spec.rb +1 -1
- data/spec/features/translation_integration_spec.rb +7 -7
- data/spec/helpers/admin/base_helper_spec.rb +51 -49
- data/spec/helpers/admin/contents_helper_spec.rb +11 -11
- data/spec/helpers/admin/elements_helper_spec.rb +20 -17
- data/spec/helpers/admin/essences_helper_spec.rb +42 -11
- data/spec/helpers/admin/navigation_helper_spec.rb +64 -54
- data/spec/helpers/admin/pages_helper_spec.rb +10 -10
- data/spec/helpers/admin/tags_helper_spec.rb +16 -16
- data/spec/helpers/base_helper_spec.rb +11 -11
- data/spec/helpers/elements_block_helper_spec.rb +24 -24
- data/spec/helpers/elements_helper_spec.rb +46 -46
- data/spec/helpers/essences_helper_spec.rb +90 -17
- data/spec/helpers/pages_helper_spec.rb +53 -53
- data/spec/helpers/picture_url_helpers_spec.rb +6 -6
- data/spec/helpers/url_helper_spec.rb +32 -32
- data/spec/libraries/config_spec.rb +9 -9
- data/spec/libraries/controller_actions_spec.rb +14 -14
- data/spec/libraries/i18n_spec.rb +6 -6
- data/spec/libraries/kaminari/scoped_pagination_url_helper_spec.rb +4 -4
- data/spec/libraries/modules_spec.rb +4 -4
- data/spec/libraries/mount_point_spec.rb +13 -13
- data/spec/libraries/page_layout_spec.rb +24 -24
- data/spec/libraries/permissions_spec.rb +97 -80
- data/spec/libraries/resource_spec.rb +37 -37
- data/spec/libraries/resources_helper_spec.rb +19 -19
- data/spec/libraries/shell_spec.rb +17 -17
- data/spec/libraries/template_tracker_spec.rb +14 -14
- data/spec/libraries/tinymce_spec.rb +8 -8
- data/spec/libraries/userstamp_spec.rb +2 -2
- data/spec/mailers/messages_spec.rb +4 -4
- data/spec/models/attachment_spec.rb +86 -30
- data/spec/models/cell_spec.rb +10 -10
- data/spec/models/content_spec.rb +106 -46
- data/spec/models/element_spec.rb +94 -115
- data/spec/models/essence_date_spec.rb +1 -1
- data/spec/models/essence_file_spec.rb +4 -4
- data/spec/models/essence_picture_spec.rb +56 -25
- data/spec/models/essence_richtext_spec.rb +1 -1
- data/spec/models/essence_text_spec.rb +7 -7
- data/spec/models/language_spec.rb +12 -12
- data/spec/models/legacy_page_url_spec.rb +2 -2
- data/spec/models/message_spec.rb +12 -5
- data/spec/models/page_spec.rb +259 -235
- data/spec/models/picture_spec.rb +72 -166
- data/spec/models/site_spec.rb +41 -41
- data/spec/models/tag_spec.rb +7 -7
- data/spec/routing/api_routing_spec.rb +150 -0
- data/spec/routing/routing_spec.rb +28 -28
- data/spec/spec_helper.rb +6 -5
- data/spec/support/hint_examples.rb +5 -5
- data/spec/support/transformation_examples.rb +173 -0
- data/spec/tasks/helpers_spec.rb +29 -29
- data/spec/views/essences/essence_boolean_editor_spec.rb +32 -0
- data/spec/views/essences/essence_boolean_view_spec.rb +2 -2
- data/spec/views/essences/essence_date_view_spec.rb +1 -1
- data/spec/views/essences/essence_link_view_spec.rb +11 -0
- data/spec/views/essences/essence_picture_view_spec.rb +56 -11
- data/spec/views/essences/essence_richtext_view_spec.rb +12 -0
- data/spec/views/essences/essence_text_view_spec.rb +12 -0
- data/vendor/assets/javascripts/tinymce/langs/de.js +20 -2
- data/vendor/assets/javascripts/tinymce/langs/fr.js +14 -1
- data/vendor/assets/javascripts/tinymce/langs/nl.js +22 -4
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/themes/modern/theme.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/tinymce.min.js +11 -10
- metadata +72 -42
- data/app/views/alchemy/messages/contact_form_mail.es.text.erb +0 -12
- data/config/locales/alchemy.es.yml +0 -958
- data/config/locales/alchemy.ru.yml +0 -837
- data/config/locales/simple_form.es.yml +0 -6
- data/config/locales/simple_form.ru.yml +0 -25
- data/lib/rails/generators/alchemy/scaffold/files/alchemy.es.yml +0 -31
- data/vendor/assets/javascripts/tinymce/langs/es.js +0 -197
- data/vendor/assets/javascripts/tinymce/langs/ru.js +0 -197
|
@@ -18,6 +18,7 @@ module Dummy
|
|
|
18
18
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
19
19
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
20
20
|
# config.i18n.default_locale = :de
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
I18n.enforce_available_locales = true
|
|
22
23
|
end
|
|
23
24
|
end
|
|
@@ -5,7 +5,7 @@ Dummy::Application.configure do
|
|
|
5
5
|
# test suite. You never need to work with it otherwise. Remember that
|
|
6
6
|
# your test database is "scratch space" for the test suite and is wiped
|
|
7
7
|
# and recreated between test runs. Don't rely on the data there!
|
|
8
|
-
config.cache_classes =
|
|
8
|
+
config.cache_classes = false
|
|
9
9
|
|
|
10
10
|
# Do not eager load code on boot. This avoids loading your whole application
|
|
11
11
|
# just for the purpose of running a single test. If you are using a tool that
|
|
@@ -33,4 +33,6 @@ Dummy::Application.configure do
|
|
|
33
33
|
|
|
34
34
|
# Print deprecation notices to the stderr.
|
|
35
35
|
config.active_support.deprecation = :stderr
|
|
36
|
+
|
|
37
|
+
I18n.enforce_available_locales = false
|
|
36
38
|
end
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe 'Dashboard feature' do
|
|
4
|
-
let(:
|
|
4
|
+
let(:user) { DummyUser.new }
|
|
5
5
|
|
|
6
6
|
before do
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
authorize_as_admin(@user)
|
|
7
|
+
user.update_attributes(alchemy_roles: %w(admin), name: "Joe User", id: 1)
|
|
8
|
+
authorize_as_admin(user)
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
describe 'Locked pages summary' do
|
|
12
|
+
let(:a_page) { FactoryGirl.create(:public_page, visible: true) }
|
|
13
|
+
|
|
13
14
|
it "should initially show no pages are locked" do
|
|
14
15
|
visit admin_dashboard_path
|
|
15
16
|
locked_pages_widget = all('div[@class="widget"]').first
|
|
@@ -19,7 +20,7 @@ describe 'Dashboard feature' do
|
|
|
19
20
|
|
|
20
21
|
context 'When locked by current user' do
|
|
21
22
|
it "should show locked by me" do
|
|
22
|
-
a_page.lock_to!(
|
|
23
|
+
a_page.lock_to!(user)
|
|
23
24
|
visit admin_dashboard_path
|
|
24
25
|
locked_pages_widget = all('div[@class="widget"]').first
|
|
25
26
|
expect(locked_pages_widget).to have_content "Currently locked pages:"
|
|
@@ -33,7 +34,7 @@ describe 'Dashboard feature' do
|
|
|
33
34
|
user = DummyUser.new
|
|
34
35
|
user.update_attributes(alchemy_roles: %w(admin), name: "Sue Smith", id: 2)
|
|
35
36
|
a_page.lock_to!(user)
|
|
36
|
-
DummyUser.
|
|
37
|
+
allow(DummyUser).to receive(:find_by).and_return(user)
|
|
37
38
|
visit admin_dashboard_path
|
|
38
39
|
locked_pages_widget = all('div[@class="widget"]').first
|
|
39
40
|
expect(locked_pages_widget).to have_content "Currently locked pages:"
|
|
@@ -42,4 +43,38 @@ describe 'Dashboard feature' do
|
|
|
42
43
|
end
|
|
43
44
|
end
|
|
44
45
|
end
|
|
46
|
+
|
|
47
|
+
describe 'Sites widget' do
|
|
48
|
+
context 'with multiple sites' do
|
|
49
|
+
let!(:site) { Alchemy::Site.create!(name: 'Site', host: 'site.com') }
|
|
50
|
+
|
|
51
|
+
it "lists all sites" do
|
|
52
|
+
visit admin_dashboard_path
|
|
53
|
+
sites_widget = all('div[@class="widget sites"]').first
|
|
54
|
+
expect(sites_widget).to have_content "Websites:"
|
|
55
|
+
expect(sites_widget).to have_content "Default Site"
|
|
56
|
+
expect(sites_widget).to have_content "Site"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
context 'with alchemy url proxy object having `login_url`' do
|
|
60
|
+
before do
|
|
61
|
+
allow_any_instance_of(ActionDispatch::Routing::RoutesProxy).to receive(:login_url).and_return('http://site.com/admin/login')
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "links to login page of every site" do
|
|
65
|
+
visit admin_dashboard_path
|
|
66
|
+
sites_widget = all('div[@class="widget sites"]').first
|
|
67
|
+
expect(sites_widget).to have_selector 'a[href="http://site.com/admin/login"]'
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
context 'with only one site' do
|
|
73
|
+
it "does not display" do
|
|
74
|
+
visit admin_dashboard_path
|
|
75
|
+
sites_widget = all('div[@class="widget sites"]').first
|
|
76
|
+
expect(sites_widget).to be_nil
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
45
80
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe 'Language tree feature', js: true do
|
|
3
|
+
describe 'Language tree feature', type: :feature, js: true do
|
|
4
4
|
|
|
5
5
|
let(:klingonian) { FactoryGirl.create(:klingonian) }
|
|
6
6
|
let(:german_root) { FactoryGirl.create(:language_root_page) }
|
|
@@ -17,7 +17,7 @@ describe 'Language tree feature', js: true do
|
|
|
17
17
|
it "one should be able to switch the language tree" do
|
|
18
18
|
visit('/admin/pages')
|
|
19
19
|
page.select 'Klingonian', from: 'language_id'
|
|
20
|
-
page.
|
|
20
|
+
expect(page).to have_selector('#sitemap', text: 'Klingonian')
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@ describe 'Language tree feature', js: true do
|
|
|
27
27
|
it "it should display the form for creating language root" do
|
|
28
28
|
visit('/admin/pages')
|
|
29
29
|
page.select 'Klingonian', from: 'language_id'
|
|
30
|
-
page.
|
|
30
|
+
expect(page).to have_content('This language tree does not exist')
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -10,17 +10,17 @@ describe "Link overlay" do
|
|
|
10
10
|
|
|
11
11
|
it "has a tab for linking internal pages" do
|
|
12
12
|
visit link_admin_pages_path
|
|
13
|
-
within('#overlay_tabs') { page.
|
|
13
|
+
within('#overlay_tabs') { expect(page).to have_content('Internal')}
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it "has a tab for linking external pages" do
|
|
17
17
|
visit link_admin_pages_path
|
|
18
|
-
within('#overlay_tabs') { page.
|
|
18
|
+
within('#overlay_tabs') { expect(page).to have_content('External')}
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it "has a tab for linking files" do
|
|
22
22
|
visit link_admin_pages_path
|
|
23
|
-
within('#overlay_tabs') { page.
|
|
23
|
+
within('#overlay_tabs') { expect(page).to have_content('File')}
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
end
|
|
@@ -38,15 +38,15 @@ describe "Link overlay" do
|
|
|
38
38
|
|
|
39
39
|
it "should have a tree of internal pages" do
|
|
40
40
|
visit link_admin_pages_path
|
|
41
|
-
page.
|
|
41
|
+
expect(page).to have_selector('ul#sitemap li a')
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
it "should not have a link for pages that redirect to external" do
|
|
45
45
|
redirect = FactoryGirl.create(:page, :parent_id => lang_root.id, :name => 'Google', :urlname => 'http://www.google.com')
|
|
46
|
-
Alchemy::Page.
|
|
46
|
+
allow_any_instance_of(Alchemy::Page).to receive(:definition).and_return({'redirects_to_external' => true})
|
|
47
47
|
visit link_admin_pages_path
|
|
48
|
-
page.
|
|
49
|
-
Alchemy::Page.
|
|
48
|
+
expect(page).not_to have_selector('ul#sitemap li div[name="/http-www-google-com"] a')
|
|
49
|
+
allow_any_instance_of(Alchemy::Page).to receive(:definition).and_call_original
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
end
|
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
|
3
3
|
describe 'Locale select' do
|
|
4
4
|
let(:a_page) { FactoryGirl.create(:public_page) }
|
|
5
5
|
before do
|
|
6
|
-
Alchemy::I18n.
|
|
6
|
+
allow(Alchemy::I18n).to receive(:translation_files).and_return ['alchemy.kl.yml', 'alchemy.jp.yml', 'alchemy.cz.yml']
|
|
7
7
|
authorize_as_admin
|
|
8
8
|
end
|
|
9
9
|
|
|
@@ -13,7 +13,10 @@ describe 'Locale select' do
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
context 'when having available_locales set for Alchemy::I18n' do
|
|
16
|
-
before
|
|
16
|
+
before do
|
|
17
|
+
allow(Alchemy::I18n).to receive(:available_locales).and_return [:jp, :cz]
|
|
18
|
+
end
|
|
19
|
+
|
|
17
20
|
it "provides only that locales" do
|
|
18
21
|
visit admin_dashboard_path
|
|
19
22
|
expect(page).to have_select('change_locale', options: ['Jp', 'Cz'])
|
|
@@ -13,7 +13,9 @@ module Alchemy
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
context "when having a Page in the clipboard" do
|
|
16
|
-
before
|
|
16
|
+
before do
|
|
17
|
+
expect(Page).to receive(:all_from_clipboard_for_select).and_return [build_stubbed(:page)]
|
|
18
|
+
end
|
|
17
19
|
|
|
18
20
|
it "contains tabs for creating a new page and pasting from clipboard" do
|
|
19
21
|
visit new_admin_page_path
|
|
@@ -45,6 +47,5 @@ module Alchemy
|
|
|
45
47
|
end
|
|
46
48
|
end
|
|
47
49
|
end
|
|
48
|
-
|
|
49
50
|
end
|
|
50
51
|
end
|
|
@@ -1,108 +1,95 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe 'Page editing feature' do
|
|
4
|
-
let(:a_page) { create(:
|
|
4
|
+
let(:a_page) { FactoryGirl.create(:public_page, visible: true) }
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
before { authorize_as_admin(build(:author_user)) }
|
|
6
|
+
before { authorize_as_admin }
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
visit alchemy.edit_admin_page_path(a_page)
|
|
11
|
-
expect(page).to_not have_selector('#publish_page_form')
|
|
12
|
-
end
|
|
13
|
-
end
|
|
8
|
+
context "in configure overlay" do
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context 'while editing a global page' do
|
|
25
|
-
let(:a_page) { create(:page, layoutpage: true) }
|
|
26
|
-
|
|
27
|
-
it 'cannot publish page.' do
|
|
28
|
-
visit alchemy.edit_admin_page_path(a_page)
|
|
29
|
-
expect(page).to_not have_selector('#publish_page_form')
|
|
10
|
+
context "when editing a normal page" do
|
|
11
|
+
it "should show all relevant input fields" do
|
|
12
|
+
visit alchemy.configure_admin_page_path(a_page)
|
|
13
|
+
expect(page).to have_selector('input#page_urlname')
|
|
14
|
+
expect(page).to have_selector('input#page_title')
|
|
15
|
+
expect(page).to have_selector('input#page_robot_index')
|
|
16
|
+
expect(page).to have_selector('input#page_robot_follow')
|
|
30
17
|
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
context 'as admin' do
|
|
35
|
-
let(:a_page) { FactoryGirl.create(:public_page, visible: true) }
|
|
36
18
|
|
|
37
|
-
|
|
19
|
+
context "with sitemaps show_flag config option set to true" do
|
|
20
|
+
before do
|
|
21
|
+
allow(Alchemy::Config).to receive(:get) { |arg| arg == :sitemap ? {'show_flag' => true} : Alchemy::Config.show[arg.to_s] }
|
|
22
|
+
end
|
|
38
23
|
|
|
39
|
-
|
|
40
|
-
context "when editing a normal page" do
|
|
41
|
-
it "should show all relevant input fields" do
|
|
24
|
+
it "should show sitemap checkbox" do
|
|
42
25
|
visit alchemy.configure_admin_page_path(a_page)
|
|
43
|
-
expect(page).to have_selector('input#
|
|
44
|
-
expect(page).to have_selector('input#page_title')
|
|
45
|
-
expect(page).to have_selector('input#page_robot_index')
|
|
46
|
-
expect(page).to have_selector('input#page_robot_follow')
|
|
26
|
+
expect(page).to have_selector('input[type="checkbox"]#page_sitemap')
|
|
47
27
|
end
|
|
28
|
+
end
|
|
48
29
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
it "should show sitemap checkbox" do
|
|
55
|
-
visit alchemy.configure_admin_page_path(a_page)
|
|
56
|
-
expect(page).to have_selector('input[type="checkbox"]#page_sitemap')
|
|
57
|
-
end
|
|
30
|
+
context "with sitemaps show_flag config option set to false" do
|
|
31
|
+
before do
|
|
32
|
+
allow(Alchemy::Config).to receive(:get) { |arg| arg == :sitemap ? {'show_flag' => false} : Alchemy::Config.show[arg.to_s] }
|
|
58
33
|
end
|
|
59
34
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
it "should show sitemap checkbox" do
|
|
66
|
-
visit alchemy.configure_admin_page_path(a_page)
|
|
67
|
-
expect(page).to_not have_selector('input[type="checkbox"]#page_sitemap')
|
|
68
|
-
end
|
|
35
|
+
it "should show sitemap checkbox" do
|
|
36
|
+
visit alchemy.configure_admin_page_path(a_page)
|
|
37
|
+
expect(page).to_not have_selector('input[type="checkbox"]#page_sitemap')
|
|
69
38
|
end
|
|
70
39
|
end
|
|
40
|
+
end
|
|
71
41
|
|
|
72
|
-
|
|
73
|
-
|
|
42
|
+
context "when editing a global page" do
|
|
43
|
+
let(:layout_page) { FactoryGirl.create(:page, layoutpage: true) }
|
|
74
44
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
end
|
|
45
|
+
it "should not show the input fields for normal pages" do
|
|
46
|
+
visit alchemy.edit_admin_layoutpage_path(layout_page)
|
|
47
|
+
expect(page).to_not have_selector('input#page_urlname')
|
|
48
|
+
expect(page).to_not have_selector('input#page_title')
|
|
49
|
+
expect(page).to_not have_selector('input#page_robot_index')
|
|
50
|
+
expect(page).to_not have_selector('input#page_robot_follow')
|
|
82
51
|
end
|
|
52
|
+
end
|
|
83
53
|
|
|
84
|
-
|
|
85
|
-
|
|
54
|
+
context "when page is taggable" do
|
|
55
|
+
before { expect_any_instance_of(Alchemy::Page).to receive(:taggable?).and_return(true) }
|
|
86
56
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
end
|
|
57
|
+
it "should show the tag_list input field" do
|
|
58
|
+
visit alchemy.configure_admin_page_path(a_page)
|
|
59
|
+
expect(page).to have_selector('input#page_tag_list')
|
|
91
60
|
end
|
|
92
61
|
end
|
|
62
|
+
end
|
|
93
63
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
64
|
+
context "in preview frame" do
|
|
65
|
+
it "the menubar does not render on the page" do
|
|
66
|
+
visit alchemy.admin_page_path(a_page)
|
|
67
|
+
expect(page).not_to have_selector('#alchemy_menubar')
|
|
68
|
+
end
|
|
99
69
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
end
|
|
70
|
+
it "navigation links are not clickable" do
|
|
71
|
+
visit alchemy.admin_page_path(a_page)
|
|
72
|
+
within('#navigation') do
|
|
73
|
+
expect(page).to have_selector('a[href="javascript: void(0)"]')
|
|
105
74
|
end
|
|
106
75
|
end
|
|
107
76
|
end
|
|
77
|
+
|
|
78
|
+
context 'in element panel' do
|
|
79
|
+
let!(:everything_page) { create(:page, page_layout: 'everything', do_not_autogenerate: false) }
|
|
80
|
+
|
|
81
|
+
it "renders essence editors for all elements" do
|
|
82
|
+
visit alchemy.admin_elements_path(page_id: everything_page.id)
|
|
83
|
+
|
|
84
|
+
expect(page).to have_selector('div.content_editor.essence_boolean')
|
|
85
|
+
expect(page).to have_selector('div.content_editor.essence_date')
|
|
86
|
+
expect(page).to have_selector('div.content_editor.essence_file')
|
|
87
|
+
expect(page).to have_selector('div.content_editor.essence_html_editor')
|
|
88
|
+
expect(page).to have_selector('div.content_editor.essence_link')
|
|
89
|
+
expect(page).to have_selector('div.content_editor.essence_picture_editor')
|
|
90
|
+
expect(page).to have_selector('div.content_editor.essence_richtext')
|
|
91
|
+
expect(page).to have_selector('div.content_editor.essence_select')
|
|
92
|
+
expect(page).to have_selector('div.content_editor.essence_text')
|
|
93
|
+
end
|
|
94
|
+
end
|
|
108
95
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe "Picture Library", js: true do
|
|
3
|
+
describe "Picture Library", type: :feature, js: true do
|
|
4
4
|
|
|
5
5
|
before do
|
|
6
6
|
authorize_as_admin
|
|
@@ -16,23 +16,23 @@ describe "Picture Library", js: true do
|
|
|
16
16
|
it "it should be possible to filter tags by clicking on its name in the tag list" do
|
|
17
17
|
visit '/admin/pictures'
|
|
18
18
|
click_on 'tag1 (1)'
|
|
19
|
-
page.
|
|
20
|
-
page.
|
|
19
|
+
expect(page).to have_content 'TaggedWith1'
|
|
20
|
+
expect(page).not_to have_content 'TaggedWith2'
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it "it should be possible to undo tag filtering by clicking on an active tag name" do
|
|
24
24
|
visit '/admin/pictures'
|
|
25
25
|
click_on 'tag1 (1)'
|
|
26
|
-
page.
|
|
26
|
+
expect(page).not_to have_content 'TaggedWith2'
|
|
27
27
|
click_on 'tag1 (1)'
|
|
28
|
-
page.
|
|
28
|
+
expect(page).to have_content 'TaggedWith2'
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it "it should be possible to tighten the tag scope by clicking on another tag name" do
|
|
32
32
|
visit '/admin/pictures'
|
|
33
33
|
click_on 'tag1 (1)'
|
|
34
34
|
click_on 'tag2 (1)'
|
|
35
|
-
page.
|
|
35
|
+
expect(page).to have_content "You don't have any images in your archive"
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
end
|
|
@@ -45,13 +45,13 @@ describe "Picture Library", js: true do
|
|
|
45
45
|
|
|
46
46
|
it "should list all applied tags" do
|
|
47
47
|
visit '/admin/pictures'
|
|
48
|
-
page.
|
|
48
|
+
expect(page).to have_content 'bla'
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
it "should be possible to filter pictures by tag" do
|
|
52
52
|
visit '/admin/pictures'
|
|
53
53
|
click_on 'bla (1)'
|
|
54
|
-
page.
|
|
54
|
+
expect(page).to have_content 'bla'
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
end
|