kuhsaft 1.4.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,11 +3,11 @@ module Kuhsaft
|
|
3
3
|
respond_to :html
|
4
4
|
|
5
5
|
def show
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
url = locale.to_s
|
7
|
+
url += "/#{params[:url]}" if params[:url].present?
|
8
|
+
@page = Kuhsaft::Page.find_by_url(url)
|
9
|
+
|
10
|
+
unless @page.present?
|
11
11
|
if respond_to?(:handle_404)
|
12
12
|
handle_404
|
13
13
|
else
|
data/config/routes.rb
CHANGED
@@ -9,5 +9,8 @@ Kuhsaft::Engine.routes.draw do
|
|
9
9
|
root :to => 'pages#index'
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
scope ":locale", :locale => /#{I18n.available_locales.join('|')}/ do
|
13
|
+
resources :pages, :only => [:index]
|
14
|
+
match '*url' => 'pages#show'
|
15
|
+
end
|
13
16
|
end
|
data/lib/kuhsaft/version.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Kuhsaft::PagesController do
|
4
|
+
subject { described_class }
|
5
|
+
|
6
|
+
describe '#show' do
|
7
|
+
context 'without url' do
|
8
|
+
before do
|
9
|
+
@page = FactoryGirl.create(:page, :url_de => 'de')
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'with matching locale' do
|
13
|
+
it 'sets the corresponding page' do
|
14
|
+
I18n.with_locale(:de) do
|
15
|
+
get(:show, { :use_route => :kuhsaft })
|
16
|
+
end
|
17
|
+
assigns(:page).should eq(@page)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'without matching locale' do
|
22
|
+
it 'raises a routing error' do
|
23
|
+
I18n.with_locale(:en) do
|
24
|
+
expect { get(:show, { :use_route => :kuhsaft }) }.to raise_error(ActionController::RoutingError)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
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: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -467,6 +467,7 @@ files:
|
|
467
467
|
- lib/templates/kuhsaft/translations/add_translation.html.erb
|
468
468
|
- Rakefile
|
469
469
|
- README.md
|
470
|
+
- spec/controllers/kuhsaft/pages_controller_spec.rb
|
470
471
|
- spec/dummy/Rakefile
|
471
472
|
- spec/dummy/app/assets/images/spec-image.png
|
472
473
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -541,7 +542,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
541
542
|
version: '0'
|
542
543
|
segments:
|
543
544
|
- 0
|
544
|
-
hash:
|
545
|
+
hash: 1500188424572130827
|
545
546
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
546
547
|
none: false
|
547
548
|
requirements:
|
@@ -550,7 +551,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
550
551
|
version: '0'
|
551
552
|
segments:
|
552
553
|
- 0
|
553
|
-
hash:
|
554
|
+
hash: 1500188424572130827
|
554
555
|
requirements: []
|
555
556
|
rubyforge_project: kuhsaft
|
556
557
|
rubygems_version: 1.8.24
|
@@ -558,6 +559,7 @@ signing_key:
|
|
558
559
|
specification_version: 3
|
559
560
|
summary: A tool that helps you to manage your content within your app.
|
560
561
|
test_files:
|
562
|
+
- spec/controllers/kuhsaft/pages_controller_spec.rb
|
561
563
|
- spec/dummy/Rakefile
|
562
564
|
- spec/dummy/app/assets/images/spec-image.png
|
563
565
|
- spec/dummy/app/assets/javascripts/application.js
|