kuhsaft 2.2.6 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -0
  3. data/Rakefile +6 -5
  4. data/app/assets/javascripts/ckeditor/plugins/adv_link/LICENSE.txt +674 -0
  5. data/app/assets/javascripts/ckeditor/plugins/adv_link/README.md +62 -0
  6. data/app/assets/javascripts/ckeditor/plugins/adv_link/dialogs/anchor.js.coffee +81 -0
  7. data/app/assets/javascripts/ckeditor/plugins/adv_link/dialogs/link.js.coffee +1353 -0
  8. data/app/assets/javascripts/ckeditor/plugins/adv_link/images/anchor.png +0 -0
  9. data/app/assets/javascripts/ckeditor/plugins/adv_link/images/hidpi/anchor.png +0 -0
  10. data/app/assets/javascripts/ckeditor/plugins/adv_link/lang/de.js +68 -0
  11. data/app/assets/javascripts/ckeditor/plugins/adv_link/lang/en.js +68 -0
  12. data/app/assets/javascripts/ckeditor/plugins/adv_link/plugin.js.coffee +282 -0
  13. data/app/assets/javascripts/kuhsaft/cms/application.js.coffee.erb +42 -4
  14. data/app/assets/stylesheets/kuhsaft/application.css.sass +0 -3
  15. data/app/assets/stylesheets/kuhsaft/cms/application.css.sass +26 -11
  16. data/app/controllers/kuhsaft/api/pages_controller.rb +14 -0
  17. data/app/controllers/kuhsaft/cms/admin_controller.rb +1 -1
  18. data/app/controllers/kuhsaft/cms/assets_controller.rb +7 -7
  19. data/app/controllers/kuhsaft/cms/bricks_controller.rb +15 -4
  20. data/app/controllers/kuhsaft/cms/pages_controller.rb +8 -15
  21. data/app/controllers/kuhsaft/pages_controller.rb +16 -6
  22. data/app/controllers/kuhsaft/sitemaps_controller.rb +13 -0
  23. data/app/helpers/cms_helper.rb +4 -4
  24. data/app/helpers/kuhsaft/admin_helper.rb +0 -1
  25. data/app/helpers/kuhsaft/cms/admin_helper.rb +1 -2
  26. data/app/helpers/kuhsaft/cms/pages_helper.rb +2 -7
  27. data/app/helpers/pages_helper.rb +8 -37
  28. data/app/helpers/sitemaps_helper.rb +12 -0
  29. data/app/models/kuhsaft/accordion_item_brick.rb +1 -1
  30. data/app/models/kuhsaft/anchor_brick.rb +1 -1
  31. data/app/models/kuhsaft/asset.rb +26 -23
  32. data/app/models/kuhsaft/asset_brick.rb +2 -1
  33. data/app/models/kuhsaft/brick.rb +38 -16
  34. data/app/models/kuhsaft/brick_type.rb +2 -2
  35. data/app/models/kuhsaft/brick_type_filter.rb +0 -2
  36. data/app/models/kuhsaft/column_brick.rb +0 -1
  37. data/app/models/kuhsaft/image_brick.rb +2 -2
  38. data/app/models/kuhsaft/image_size.rb +0 -1
  39. data/app/models/kuhsaft/link_brick.rb +1 -1
  40. data/app/models/kuhsaft/page.rb +111 -107
  41. data/app/models/kuhsaft/page_type.rb +1 -1
  42. data/app/models/kuhsaft/partition.rb +12 -12
  43. data/app/models/kuhsaft/placeholder_brick.rb +8 -0
  44. data/app/models/kuhsaft/publish_state.rb +9 -10
  45. data/app/models/kuhsaft/slider_brick.rb +0 -2
  46. data/app/models/kuhsaft/text_brick.rb +1 -1
  47. data/app/models/kuhsaft/two_column_brick.rb +0 -1
  48. data/app/models/kuhsaft/video_brick.rb +1 -2
  49. data/app/uploaders/kuhsaft/asset_brick_asset_uploader.rb +39 -38
  50. data/app/uploaders/kuhsaft/asset_uploader.rb +43 -43
  51. data/app/uploaders/kuhsaft/image_brick_image_uploader.rb +7 -34
  52. data/app/views/kuhsaft/asset_bricks/asset_brick/_edit.html.haml +3 -2
  53. data/app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml +2 -2
  54. data/app/views/kuhsaft/cms/bricks/_brick_item.html.haml +17 -10
  55. data/app/views/kuhsaft/cms/bricks/_new.html.haml +34 -0
  56. data/app/views/kuhsaft/cms/bricks/create.js.haml +6 -0
  57. data/app/views/kuhsaft/cms/bricks/destroy.js.haml +4 -0
  58. data/app/views/kuhsaft/cms/bricks/new.js.haml +11 -0
  59. data/app/views/kuhsaft/cms/pages/_branch.html.haml +2 -2
  60. data/app/views/kuhsaft/cms/pages/_form.html.haml +29 -18
  61. data/app/views/kuhsaft/image_bricks/_image_brick.html.haml +9 -7
  62. data/app/views/kuhsaft/image_bricks/image_brick/_edit.html.haml +3 -0
  63. data/app/views/kuhsaft/pages/show.html.haml +1 -9
  64. data/app/views/kuhsaft/placeholder_bricks/_placeholder_brick.html.haml +1 -1
  65. data/app/views/kuhsaft/sitemaps/index.xml.haml +9 -0
  66. data/app/views/kuhsaft/video_bricks/_video_brick.html.haml +4 -4
  67. data/app/views/layouts/kuhsaft/cms/application.html.haml +4 -3
  68. data/config/initializers/simple_form.rb +4 -4
  69. data/config/initializers/simple_form_bootstrap.rb +14 -14
  70. data/config/locales/de.yml +203 -0
  71. data/config/locales/en.yml +282 -0
  72. data/config/locales/kuhsaft.de.yml +14 -0
  73. data/config/locales/kuhsaft.en.yml +60 -0
  74. data/config/locales/models/kuhsaft/image_brick/de.yml +1 -0
  75. data/config/locales/models/kuhsaft/image_brick/en.yml +16 -0
  76. data/config/locales/models/kuhsaft/text_brick/de.yml +3 -0
  77. data/config/locales/models/kuhsaft/text_brick/en.yml +16 -0
  78. data/config/locales/models/kuhsaft/video_brick/en.yml +15 -0
  79. data/config/locales/views/kuhsaft/cms/pages/de.yml +3 -0
  80. data/config/locales/views/kuhsaft/cms/video_bricks/de.yml +1 -1
  81. data/config/routes.rb +18 -9
  82. data/db/migrate/10_add_redirect_url_to_kuhsaft_pages.rb +1 -1
  83. data/db/migrate/11_update_url_and_redirect_url_value.rb +4 -4
  84. data/db/migrate/13_add_page_title_to_pages.rb +1 -1
  85. data/db/migrate/15_add_alt_text_to_bricks.rb +5 -0
  86. data/db/migrate/16_update_default_value_for_page_type.rb +9 -0
  87. data/db/migrate/17_set_page_type_to_content_for_empty_fields.rb +7 -0
  88. data/lib/generators/kuhsaft/assets/install_generator.rb +1 -2
  89. data/lib/generators/kuhsaft/translations/add_generator.rb +19 -4
  90. data/lib/kuhsaft.rb +1 -0
  91. data/lib/kuhsaft/brick_list.rb +6 -8
  92. data/lib/kuhsaft/engine.rb +5 -1
  93. data/lib/kuhsaft/orderable.rb +22 -19
  94. data/lib/kuhsaft/partial_extractor.rb +1 -1
  95. data/lib/kuhsaft/searchable.rb +8 -11
  96. data/lib/kuhsaft/translatable.rb +35 -19
  97. data/lib/kuhsaft/version.rb +1 -1
  98. data/lib/tasks/kuhsaft_tasks.rake +12 -0
  99. data/lib/templates/kuhsaft/assets/ck-config.js.coffee +7 -0
  100. data/lib/templates/kuhsaft/translations/add_translation.html.erb +4 -10
  101. data/spec/controllers/kuhsaft/api/pages_controller_spec.rb +70 -0
  102. data/spec/controllers/kuhsaft/pages_controller_spec.rb +18 -14
  103. data/spec/controllers/kuhsaft/sitemaps_controller_spec.rb +13 -0
  104. data/spec/dummy/app/assets/javascripts/kuhsaft/cms/ck-config.js.coffee +7 -0
  105. data/spec/dummy/config/application.rb +2 -1
  106. data/spec/dummy/config/database.yml +1 -1
  107. data/spec/factories.rb +3 -3
  108. data/spec/features/cms_pages_spec.rb +13 -13
  109. data/spec/features/search_spec.rb +16 -18
  110. data/spec/helpers/kuhsaft/cms/pages_helper_spec.rb +2 -1
  111. data/spec/kuhsaft_spec.rb +1 -1
  112. data/spec/lib/brick_list_spec.rb +1 -1
  113. data/spec/lib/page_tree_spec.rb +10 -6
  114. data/spec/lib/searchable_spec.rb +4 -4
  115. data/spec/lib/translatable_spec.rb +114 -44
  116. data/spec/models/anchor_brick_spec.rb +1 -1
  117. data/spec/models/asset_spec.rb +1 -1
  118. data/spec/models/brick_spec.rb +1 -1
  119. data/spec/models/page_spec.rb +48 -37
  120. data/spec/models/publish_state_spec.rb +9 -9
  121. data/spec/spec_helper.rb +43 -21
  122. data/spec/support/kuhsaft_spec_helper.rb +2 -2
  123. data/spec/support/write_expectation.rb +57 -0
  124. data/spec/views/kuhsaft/sitemaps/index.xml.haml_spec.rb +67 -0
  125. metadata +119 -4
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "2.2.6"
2
+ VERSION = '2.3.0'
3
3
  end
@@ -8,3 +8,15 @@ namespace :kuhsaft do
8
8
  end
9
9
 
10
10
  Rake::Task['db:seed'].enhance ['kuhsaft:db:seed']
11
+
12
+ desc "Create nondigest versions of all ckeditor digest assets"
13
+ task "assets:precompile" do
14
+ fingerprint = /\-[0-9a-f]{32}\./
15
+ for file in Dir["public/assets/kuhsaft/cms/ck-config*"]
16
+ next unless file =~ fingerprint
17
+ nondigest = file.sub fingerprint, '.'
18
+ if !File.exist?(nondigest) or File.mtime(file) > File.mtime(nondigest)
19
+ FileUtils.cp file, nondigest, verbose: true
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,6 @@
1
1
  CKEDITOR.editorConfig = (config) ->
2
2
  config.language = "de"
3
+ config.extraAllowedContent = 'iframe[*]'
3
4
  config.removeButtons = "Anchor,Underline,Strike,Subscript,Superscript"
4
5
  config.format_tags = "p;h1;h2;h3;h4;pre"
5
6
  config.toolbar = [["Format"],
@@ -9,6 +10,12 @@ CKEDITOR.editorConfig = (config) ->
9
10
  ["Source", "-", "ShowBlocks", "-", "About"],
10
11
  ["Maximize"]]
11
12
 
13
+ config.linkShowAdvancedTab = false
14
+ config.linkShowTargetTab = false
15
+
16
+ config.removePlugins = 'link'
17
+ config.extraPlugins = 'adv_link'
18
+
12
19
  true
13
20
 
14
21
  # FULL OPTIONS:
@@ -1,14 +1,8 @@
1
- class Add<%= get_locale.classify %>Translation < ActiveRecord::Migration
1
+ class Add<%= formatted_locale.classify %>Translation < ActiveRecord::Migration
2
2
 
3
3
  def change
4
- add_column :kuhsaft_pages, :title_<%= get_locale %>, :string
5
- add_column :kuhsaft_pages, :slug_<%= get_locale %>, :string
6
- add_column :kuhsaft_pages, :keywords_<%= get_locale %>, :string
7
- add_column :kuhsaft_pages, :description_<%= get_locale %>, :text
8
- add_column :kuhsaft_pages, :body_<%= get_locale %>, :text
9
- add_column :kuhsaft_pages, :url_<%= get_locale %>, :text
10
- add_column :kuhsaft_pages, :redirect_url_<%= get_locale %>, :text
11
- add_column :kuhsaft_pages, :fulltext_<%= get_locale %>, :text
4
+ <%- translated_columns.each do |column_hash| %>
5
+ add_column :kuhsaft_pages, "<%= get_attribute(column_hash).to_s %>", :<%= get_type(column_hash).to_sym %>
6
+ <%- end %>
12
7
  end
13
-
14
8
  end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kuhsaft::Api::PagesController do
4
+ describe '#index' do
5
+ before do
6
+ @pages = []
7
+ @pages << @page1 = create(:page, published: true, title_de: 'foobar de',
8
+ url_de: 'de/foobar-de', title_en: 'foobar en', url_en: 'en/foobar-en')
9
+ @pages << @page2 = create(:page, published: true, title_de: 'barfoo de',
10
+ url_de: 'de/barfoo-de', title_en: 'barfoo en', url_en: 'en/barfoo-en')
11
+ @pages << @unpublished = create(:page, published: false, title_de: 'unpublished de',
12
+ url_de: 'de/unpublished-de', title_en: 'unpublished en',
13
+ url_en: 'en/unpublished-en')
14
+ end
15
+
16
+ it 'gets only published pages' do
17
+ I18n.with_locale :de do
18
+ get :index, use_route: :kuhsaft
19
+ expect(JSON.parse(response.body)).to eq([@page1, @page2].as_json)
20
+ end
21
+ end
22
+
23
+ it 'gets specific translated pages for each locale' do
24
+ I18n.with_locale :de do
25
+ @pages << @only_german = create(:page, published: true, title: 'foobar de', url: 'de/foobar-de')
26
+ get :index, use_route: :kuhsaft
27
+ expect(JSON.parse(response.body)).to eq([@page1, @page2, @only_german].as_json)
28
+ end
29
+
30
+ I18n.with_locale :en do
31
+ get :index, use_route: :kuhsaft
32
+ expect(JSON.parse(response.body)).to eq([@page1, @page2].as_json)
33
+ end
34
+ end
35
+ end
36
+
37
+ describe 'expected json format of a page' do
38
+ before do
39
+ @pages = []
40
+ @pages << @page1 = create(:page, published: true, title_de: 'foobar de',
41
+ url_de: 'de/foobar-de', title_en: 'foobar en', url_en: 'en/foobar-en')
42
+ @pages << @page2 = create(:page, published: true, title_de: 'barfoo de',
43
+ url_de: 'de/barfoo-de', title_en: 'barfoo en', url_en: 'en/barfoo-en')
44
+
45
+ I18n.with_locale :de do
46
+ get :index, use_route: :kuhsaft
47
+ @json = JSON.parse(response.body)
48
+ @page_hash = @json.first
49
+ end
50
+ end
51
+
52
+ it 'contains the title' do
53
+ I18n.with_locale :de do
54
+ expect(@page_hash['title']).to eq(@page1.title)
55
+ end
56
+ end
57
+
58
+ it 'contains the url with page ID' do
59
+ I18n.with_locale :de do
60
+ expect(@page_hash['url']).to eq('/pages/' + @page1.id.to_s)
61
+ end
62
+ end
63
+
64
+ it 'does not contain the slug' do
65
+ I18n.with_locale :de do
66
+ expect(@page_hash['slug']).to eq(nil)
67
+ end
68
+ end
69
+ end
70
+ end
@@ -6,15 +6,15 @@ describe Kuhsaft::PagesController do
6
6
  describe '#index' do
7
7
  before do
8
8
  @pages = [
9
- create(:page, :page_type => Kuhsaft::PageType::CONTENT, :published => true, :fulltext_de => 'foobar'),
10
- create(:page, :page_type => Kuhsaft::PageType::CONTENT, :published => true, :fulltext_de => 'barfoo')
9
+ create(:page, published: true, fulltext_de: 'foobar'),
10
+ create(:page, published: true, fulltext_de: 'barfoo')
11
11
  ]
12
12
  end
13
13
 
14
14
  context 'with search parameter' do
15
15
  it 'assigns the search results' do
16
16
  I18n.with_locale :de do
17
- get(:index, { :use_route => :kuhsaft, :search => 'foobar' })
17
+ get(:index, use_route: :kuhsaft, search: 'foobar')
18
18
  end
19
19
  assigns(:pages).should eq([@pages.first])
20
20
  end
@@ -25,13 +25,13 @@ describe Kuhsaft::PagesController do
25
25
  describe 'routing' do
26
26
  context 'without url' do
27
27
  before do
28
- @page = FactoryGirl.create(:page, :url_de => 'de')
28
+ @page = FactoryGirl.create(:page, url_de: 'de')
29
29
  end
30
30
 
31
31
  context 'with matching locale' do
32
32
  it 'sets the corresponding page' do
33
33
  I18n.with_locale(:de) do
34
- get(:show, { :use_route => :kuhsaft })
34
+ get(:show, use_route: :kuhsaft)
35
35
  end
36
36
  assigns(:page).should eq(@page)
37
37
  end
@@ -40,7 +40,7 @@ describe Kuhsaft::PagesController do
40
40
  context 'without matching locale' do
41
41
  it 'raises a routing error' do
42
42
  I18n.with_locale(:en) do
43
- expect { get(:show, { :use_route => :kuhsaft }) }.to raise_error(ActionController::RoutingError)
43
+ expect { get(:show, use_route: :kuhsaft) }.to raise_error(ActionController::RoutingError)
44
44
  end
45
45
  end
46
46
  end
@@ -56,28 +56,32 @@ describe Kuhsaft::PagesController do
56
56
 
57
57
  context 'when page is not a redirect page' do
58
58
  it 'responds with page' do
59
- page = FactoryGirl.create(:page, :slug => 'dumdidum', :url => 'de/dumdidum')
60
- get :show, { :url => page.slug, :use_route => :kuhsaft }
59
+ page = FactoryGirl.create(:page, slug: 'dumdidum',
60
+ url: 'de/dumdidum')
61
+ get :show, url: page.slug, use_route: :kuhsaft
61
62
  assigns(:page).should eq(page)
62
63
  end
63
64
  end
64
65
 
65
66
  context 'when page is a redirect page' do
66
67
  it 'redirects to the redirected url' do
67
- page = FactoryGirl.create(:page, :page_type => 'redirect', :slug => 'dumdidum', :url => 'de/dumdidum', :redirect_url => 'de/redirect_page')
68
- get :show, { :url => page.slug, :use_route => :kuhsaft }
68
+ page = FactoryGirl.create(:page, page_type: 'redirect', slug: 'dumdidum',
69
+ url: 'de/dumdidum', redirect_url: 'de/redirect_page')
70
+ get :show, url: page.slug, use_route: :kuhsaft
69
71
  expect(response).to redirect_to('/de/redirect_page')
70
72
  end
71
73
 
72
74
  it 'redirects to invalid redirect urls with too many preceding slashes' do
73
- page = FactoryGirl.create(:page, :page_type => 'redirect', :slug => 'dumdidum', :url => 'de/dumdidum', :redirect_url => '///de/redirect_page')
74
- get :show, { :url => page.slug, :use_route => :kuhsaft }
75
+ page = FactoryGirl.create(:page, page_type: 'redirect', slug: 'dumdidum',
76
+ url: 'de/dumdidum', redirect_url: '///de/redirect_page')
77
+ get :show, url: page.slug, use_route: :kuhsaft
75
78
  expect(response).to redirect_to('/de/redirect_page')
76
79
  end
77
80
 
78
81
  it 'redirects to root' do
79
- page = FactoryGirl.create(:page, :page_type => 'redirect', :slug => 'dumdidum', :url => 'de/dumdidum', :redirect_url => '/')
80
- get :show, { :url => page.slug, :use_route => :kuhsaft }
82
+ page = FactoryGirl.create(:page, page_type: 'redirect', slug: 'dumdidum',
83
+ url: 'de/dumdidum', redirect_url: '/')
84
+ get :show, url: page.slug, use_route: :kuhsaft
81
85
  expect(response).to redirect_to('/')
82
86
  end
83
87
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kuhsaft::SitemapsController do
4
+ describe '#index' do
5
+ before do
6
+ @page = FactoryGirl.create(:page)
7
+ end
8
+
9
+ it 'should be able to send a xml file' do
10
+ get(:index, use_route: :kuhsaft, format: 'xml')
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,6 @@
1
1
  CKEDITOR.editorConfig = (config) ->
2
2
  config.language = "de"
3
+ config.extraAllowedContent = 'iframe[*]'
3
4
  config.removeButtons = "Anchor,Underline,Strike,Subscript,Superscript"
4
5
  config.format_tags = "p;h1;h2;h3;h4;pre"
5
6
  config.toolbar = [["Format"],
@@ -9,6 +10,12 @@ CKEDITOR.editorConfig = (config) ->
9
10
  ["Source", "-", "ShowBlocks", "-", "About"],
10
11
  ["Maximize"]]
11
12
 
13
+ config.linkShowAdvancedTab = false
14
+ config.linkShowTargetTab = false
15
+
16
+ config.removePlugins = 'link'
17
+ config.extraPlugins = 'adv_link'
18
+
12
19
  true
13
20
 
14
21
  # FULL OPTIONS:
@@ -20,6 +20,7 @@ module Dummy
20
20
 
21
21
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
22
22
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
23
- # config.i18n.default_locale = :de
23
+ config.i18n.available_locales = [:de, :en]
24
+ #config.i18n.default_locale = :de
24
25
  end
25
26
  end
@@ -10,7 +10,7 @@ development:
10
10
 
11
11
  test:
12
12
  adapter: postgresql
13
- database: kuhsaft_development
13
+ database: kuhsaft_test
14
14
  username: screenconcept
15
15
  password:
16
16
  host: localhost
data/spec/factories.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  FactoryGirl.define do
2
2
  sequence(:title) { |n| n }
3
3
 
4
- factory :page, :class => 'Kuhsaft::Page' do |p|
4
+ factory :page, class: 'Kuhsaft::Page' do |p|
5
5
  p.parent nil
6
6
  p.position 1
7
7
  p.title { "English Title #{FactoryGirl.generate(:title)}" }
@@ -10,12 +10,12 @@ FactoryGirl.define do
10
10
  p.url ''
11
11
  end
12
12
 
13
- factory :text_brick, :class => 'Kuhsaft::TextBrick' do |tb|
13
+ factory :text_brick, class: 'Kuhsaft::TextBrick' do |tb|
14
14
  tb.type 'Kuhsaft::TextBrick'
15
15
  tb.text 'DummyText'
16
16
  end
17
17
 
18
- factory :asset, :class => Kuhsaft::Asset do |a|
18
+ factory :asset, class: Kuhsaft::Asset do |a|
19
19
  a.file File.open("#{Kuhsaft::Engine.root}/spec/dummy/app/assets/images/spec-image.png")
20
20
  end
21
21
  end
@@ -7,9 +7,9 @@ describe 'Cms/Pages' do
7
7
  context '#new' do
8
8
  before do
9
9
  visit kuhsaft.new_cms_page_path
10
- fill_in 'Titel', :with => 'The Title of the page'
11
- fill_in 'Stichwörter', :with => 'My keywords'
12
- fill_in 'Beschreibung', :with => 'My Description'
10
+ fill_in 'Titel', with: 'The Title of the page'
11
+ fill_in 'Stichwörter', with: 'My keywords'
12
+ fill_in 'Beschreibung', with: 'My Description'
13
13
  end
14
14
 
15
15
  describe '#create' do
@@ -25,9 +25,9 @@ describe 'Cms/Pages' do
25
25
 
26
26
  context 'when page is invalid' do
27
27
  it 'does not create a routing error by switching the locale' do
28
- @page = FactoryGirl.create(:page, :title => 'DummyPage', :title_en => 'DummyEN', :slug => 'dummy_page')
28
+ @page = FactoryGirl.create(:page, title: 'DummyPage', title_en: 'DummyEN', slug: 'dummy_page')
29
29
  visit kuhsaft.edit_cms_page_path(@page)
30
- fill_in 'page_title', :with => ''
30
+ fill_in 'page_title', with: ''
31
31
  click_on 'Update Seite'
32
32
  within '.nav-pills' do
33
33
  click_on 'EN'
@@ -40,24 +40,24 @@ describe 'Cms/Pages' do
40
40
  describe '#update' do
41
41
  context 'when creating a redirect page' do
42
42
  before do
43
- @page = FactoryGirl.create(:page, :url => 'de/dumdidum')
43
+ @page = FactoryGirl.create(:page, url: 'de/dumdidum')
44
44
  visit kuhsaft.edit_cms_page_path(@page)
45
- select 'redirect', :from => 'Seitentyp'
45
+ select 'redirect', from: 'Seitentyp'
46
46
  end
47
47
 
48
48
  it 'has a value in redirect_page' do
49
- fill_in 'Redirect URL', :with => 'target_page'
50
- expect { click_on 'Update Seite' }.to change{ @page.reload.redirect_url }.to('target_page')
49
+ fill_in 'Redirect URL', with: 'target_page'
50
+ expect { click_on 'Update Seite' }.to change { @page.reload.redirect_url }.to('target_page')
51
51
  end
52
52
 
53
53
  it 'is invalid when no value is in redirect_page' do
54
54
  click_on 'Update Seite'
55
- page.should have_css('.error', :count => 1)
55
+ page.should have_css('.error', count: 1)
56
56
  end
57
57
 
58
58
  it 'does not change the value in url' do
59
- fill_in 'Redirect URL', :with => 'target_page'
60
- expect { click_on 'Update Seite' }.to_not change{ @page.reload.url }
59
+ fill_in 'Redirect URL', with: 'target_page'
60
+ expect { click_on 'Update Seite' }.to_not change { @page.reload.url }
61
61
  end
62
62
  end
63
63
  end
@@ -70,7 +70,7 @@ describe 'Cms/Pages' do
70
70
  invalid_brick.save(validate: false)
71
71
 
72
72
  visit kuhsaft.edit_cms_page_path(@page)
73
- page.should have_css('.error', :count => 1)
73
+ page.should have_css('.error', count: 1)
74
74
  end
75
75
  end
76
76
  end
@@ -4,35 +4,33 @@ describe 'pages#index' do
4
4
  context 'with search parameter' do
5
5
  let! :page1 do
6
6
  p = create :page,
7
- :page_type => Kuhsaft::PageType::CONTENT,
8
- :published => true,
9
- :title => 'Chromodorididae Ardeadoris'
10
- p.bricks << Kuhsaft::TextBrick.new(:locale => I18n.locale, :text => "#{'foo bar' * 300} Chromodorididae #{'foo bar' * 300}")
7
+ published: true,
8
+ title: 'Chromodorididae Ardeadoris'
9
+ p.bricks << Kuhsaft::TextBrick.new(locale: I18n.locale,
10
+ text: "#{'foo bar' * 300} Chromodorididae #{'foo bar' * 300}")
11
11
  p.save!
12
12
  p
13
13
  end
14
14
 
15
15
  let! :page2 do
16
16
  create :page,
17
- :page_type => Kuhsaft::PageType::CONTENT,
18
- :published => true,
19
- :title => 'Chromodorididae Berlanguella'
17
+ published: true,
18
+ title: 'Chromodorididae Berlanguella'
20
19
  end
21
20
 
22
21
  let! :page3 do
23
22
  create :page,
24
- :page_type => Kuhsaft::PageType::CONTENT,
25
- :published => true,
26
- :title => 'Gastropoda'
23
+ published: true,
24
+ title: 'Gastropoda'
27
25
  end
28
26
 
29
27
  context 'with fulltext' do
30
28
  before do
31
- visit kuhsaft.pages_path(:locale => :en, :search => 'Chromodorididae')
29
+ visit kuhsaft.pages_path(locale: :en, search: 'Chromodorididae')
32
30
  end
33
31
 
34
32
  it 'highlights search term in preview' do
35
- within("ul.search-results.success") do
33
+ within('ul.search-results.success') do
36
34
  page.should have_content('Chromodorididae')
37
35
  end
38
36
  end
@@ -44,15 +42,15 @@ describe 'pages#index' do
44
42
 
45
43
  context 'with multiple matches' do
46
44
  before do
47
- visit kuhsaft.pages_path(:locale => :en, :search => 'Chromodorididae')
45
+ visit kuhsaft.pages_path(locale: :en, search: 'Chromodorididae')
48
46
  end
49
47
 
50
48
  it 'renders match count' do
51
- page.should have_content("2 results")
49
+ page.should have_content('2 results')
52
50
  end
53
51
 
54
52
  it 'renders the search results list' do
55
- within("ul.search-results.success") do
53
+ within('ul.search-results.success') do
56
54
  page.should have_content('Chromodorididae Ardeadoris')
57
55
  page.should have_content('Chromodorididae Berlanguella')
58
56
  page.should_not have_content('Gastropoda')
@@ -60,7 +58,7 @@ describe 'pages#index' do
60
58
  end
61
59
 
62
60
  it 'renders links to the pages' do
63
- within("ul.search-results.success") do
61
+ within('ul.search-results.success') do
64
62
  page.should have_link('Chromodorididae Ardeadoris', href: page1.link)
65
63
  page.should have_link('Chromodorididae Berlanguella', href: page2.link)
66
64
  end
@@ -69,11 +67,11 @@ describe 'pages#index' do
69
67
 
70
68
  context 'without matches' do
71
69
  before do
72
- visit kuhsaft.pages_path(:locale => :en, :search => 'foobar')
70
+ visit kuhsaft.pages_path(locale: :en, search: 'foobar')
73
71
  end
74
72
 
75
73
  it 'renders match count' do
76
- page.should have_content("No results")
74
+ page.should have_content('No results')
77
75
  end
78
76
  end
79
77
  end