kuhsaft 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,10 +2,16 @@ module Kuhsaft
2
2
  class PagesController < ApplicationController
3
3
 
4
4
  respond_to :html
5
+ before_filter :complete_url
5
6
 
6
7
  def show
7
8
  @page = Kuhsaft::Page.find_by_url(params[:url])
8
9
  respond_with @page
9
10
  end
11
+
12
+ private
13
+ def complete_url
14
+ params[:url] = "#{params[:locale]}/#{params[:url]}" if params[:url].present? && params[:locale].present?
15
+ end
10
16
  end
11
17
  end
@@ -9,5 +9,5 @@ Rails.application.routes.draw do
9
9
  end
10
10
  end
11
11
  end
12
- match '/*url' => 'kuhsaft/pages#show'
12
+ match '/:locale/*url' => 'kuhsaft/pages#show'
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "0.2"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -16,7 +16,7 @@ describe Kuhsaft::PagesController do
16
16
 
17
17
  describe 'should render successfully' do
18
18
  it '#show' do
19
- get :show, :url => '/en/english-title'
19
+ get :show, :locale => 'en', :url => '/english-title'
20
20
  response.should be_success
21
21
  end
22
22
  end
@@ -5,7 +5,8 @@ describe 'routing to Kuhsaft::PagesController' do
5
5
  { :get => '/en/my-slug' }.should route_to(
6
6
  :controller => 'kuhsaft/pages',
7
7
  :action => 'show',
8
- :url => 'en/my-slug'
8
+ :url => 'my-slug',
9
+ :locale => 'en'
9
10
  )
10
11
  end
11
12
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuhsaft
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- version: "0.2"
9
+ - 1
10
+ version: 0.2.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - "Immanuel H\xC3\xA4ussermann"
@@ -16,7 +17,7 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2011-07-13 00:00:00 +02:00
20
+ date: 2011-07-15 00:00:00 +02:00
20
21
  default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency