kuhsaft 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -1
- data/app/controllers/kuhsaft/cms/admin_controller.rb +0 -4
- data/app/controllers/kuhsaft/pages_controller.rb +2 -1
- data/app/views/kuhsaft/cms/pages/_branch.html.haml +0 -1
- data/config/locales/kuhsaft.de.yml +4 -1
- data/config/locales/kuhsaft.en.yml +3 -0
- data/lib/kuhsaft/version.rb +1 -1
- data/spec/controllers/kuhsaft/pages_controller_spec.rb +13 -25
- data/spec/spec_helper.rb +0 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eecde1b2e276afa2b521baaf04bd0312a4ec74d9
|
4
|
+
data.tar.gz: 257ed6496e7b45df88df4f8d556875164eef0013
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ed475ede79f506ecfb728f9eefa525e9116f2cb956949cbf661ff13dd3953fa957e4285e38e44868a7acec6934ce2bec7c64f046f5613eaac217c3ca52ace7c
|
7
|
+
data.tar.gz: 131744bc047b4d30e1626f4c69b90d4f3c221f1f9ce6488ba59db4ad0371873676edf54c6d734ee18c3f4c5fc8b26ccc650754636d581fbad4f2b4bbd6a867b9
|
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ rescue LoadError
|
|
12
12
|
end
|
13
13
|
|
14
14
|
desc "Run specs"
|
15
|
-
RSpec::Core::RakeTask.new
|
15
|
+
RSpec::Core::RakeTask.new(:spec => :setup)
|
16
16
|
|
17
17
|
RDoc::Task.new(:rdoc) do |rdoc|
|
18
18
|
rdoc.rdoc_dir = 'rdoc'
|
@@ -24,6 +24,8 @@ end
|
|
24
24
|
|
25
25
|
task :setup do
|
26
26
|
Dir.chdir('spec/dummy') do
|
27
|
+
`bundle exec rake kuhsaft:install:migrations`
|
28
|
+
`bundle exec rails generate kuhsaft:install:assets`
|
27
29
|
`bundle exec rake db:create`
|
28
30
|
`bundle exec rake db:migrate`
|
29
31
|
`bundle exec rake db:test:prepare`
|
@@ -5,10 +5,6 @@ module Kuhsaft
|
|
5
5
|
layout 'kuhsaft/cms/application'
|
6
6
|
before_filter :set_content_locale
|
7
7
|
|
8
|
-
def url_options
|
9
|
-
{ content_locale: I18n.locale }.merge(super)
|
10
|
-
end
|
11
|
-
|
12
8
|
def set_content_locale
|
13
9
|
if params[:content_locale].present?
|
14
10
|
I18n.locale = params[:content_locale]
|
@@ -15,7 +15,8 @@ module Kuhsaft
|
|
15
15
|
@page = Kuhsaft::Page.find_by_url(url)
|
16
16
|
|
17
17
|
if @page.present? && @page.redirect? && @page.redirect_url.present?
|
18
|
-
|
18
|
+
redirect_url = @page.redirect_url.sub(/\A\/+/,'') # remove all preceding slashes
|
19
|
+
redirect_to "/#{redirect_url}"
|
19
20
|
elsif @page.present?
|
20
21
|
respond_with @page
|
21
22
|
elsif @page.blank? && respond_to?(:handle_404)
|
@@ -5,6 +5,9 @@ de:
|
|
5
5
|
admin:
|
6
6
|
pages_nav: 'Seiten'
|
7
7
|
assets_nav: 'Assets'
|
8
|
+
cms:
|
9
|
+
flash:
|
10
|
+
success: 'Seite wurde erfolgreich aktualisiert'
|
8
11
|
kuhsaft:
|
9
12
|
page_part:
|
10
13
|
markdown: 'Formatierter Text'
|
@@ -44,4 +47,4 @@ de:
|
|
44
47
|
title: 'Seiten Titel'
|
45
48
|
slug: 'URL Segment'
|
46
49
|
page_part_type: 'Element hinzufügen'
|
47
|
-
_destroy: 'Diese Element löschen'
|
50
|
+
_destroy: 'Diese Element löschen'
|
data/lib/kuhsaft/version.rb
CHANGED
@@ -22,30 +22,6 @@ describe Kuhsaft::PagesController do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
describe '#show' do
|
25
|
-
describe 'redirect' do
|
26
|
-
around(:each) do |example|
|
27
|
-
I18n.with_locale :de do
|
28
|
-
example.run
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'when page is not a redirect page' do
|
33
|
-
it 'responds with page' do
|
34
|
-
page = FactoryGirl.create(:page, :slug => 'dumdidum', :url => 'de/dumdidum')
|
35
|
-
get :show, { :url => page.slug, :use_route => :kuhsaft }
|
36
|
-
assigns(:page).should eq(page)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'when page is a redirect page' do
|
41
|
-
it 'redirects to the redirected url' do
|
42
|
-
page = FactoryGirl.create(:page, :page_type => 'redirect', :slug => 'dumdidum', :url => 'de/dumdidum', :redirect_url => 'de/redirect_page')
|
43
|
-
get :show, { :url => page.slug, :use_route => :kuhsaft }
|
44
|
-
expect(response).to redirect_to("/de/redirect_page")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
25
|
describe 'routing' do
|
50
26
|
context 'without url' do
|
51
27
|
before do
|
@@ -90,7 +66,19 @@ describe Kuhsaft::PagesController do
|
|
90
66
|
it 'redirects to the redirected url' do
|
91
67
|
page = FactoryGirl.create(:page, :page_type => 'redirect', :slug => 'dumdidum', :url => 'de/dumdidum', :redirect_url => 'de/redirect_page')
|
92
68
|
get :show, { :url => page.slug, :use_route => :kuhsaft }
|
93
|
-
expect(response).to redirect_to(
|
69
|
+
expect(response).to redirect_to('/de/redirect_page')
|
70
|
+
end
|
71
|
+
|
72
|
+
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
|
+
expect(response).to redirect_to('/de/redirect_page')
|
76
|
+
end
|
77
|
+
|
78
|
+
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 }
|
81
|
+
expect(response).to redirect_to('/')
|
94
82
|
end
|
95
83
|
end
|
96
84
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -35,18 +35,8 @@ RSpec.configure do |config|
|
|
35
35
|
config.include FactoryGirl::Syntax::Methods
|
36
36
|
|
37
37
|
config.before :suite do
|
38
|
-
|
39
|
-
load File.expand_path("../dummy/Rakefile", __FILE__)
|
40
|
-
Dir.chdir(File.join(File.dirname(__FILE__), './dummy')) do
|
41
|
-
Rake::Task['kuhsaft:install:migrations'].invoke
|
42
|
-
Rails::Generators.invoke('kuhsaft:install:assets')
|
43
|
-
end
|
44
|
-
|
45
38
|
DatabaseCleaner.strategy = :transaction
|
46
39
|
DatabaseCleaner.clean_with(:truncation)
|
47
|
-
# Drop all records and run any available migration
|
48
|
-
ActiveRecord::Base.connection.tables.each { |table| ActiveRecord::Base.connection.drop_table(table) }
|
49
|
-
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
50
40
|
end
|
51
41
|
|
52
42
|
config.after :suite do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuhsaft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Immanuel Häussermann
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-07-
|
15
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rspec
|