kuhsaft 1.8.1 → 1.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6337d1cbb02a8c2d5cda0db4a44502a78b5e1959
4
- data.tar.gz: 493728073fdcdcb4ddf2337c196543ed1e6c819b
3
+ metadata.gz: 73cd2ecb946a2cd746ed66e59a7a42229061598b
4
+ data.tar.gz: 35a05d25261d5763f73b706b099ab7749f780d5b
5
5
  SHA512:
6
- metadata.gz: 1a364e11a91e83222e8a2468a633b3266985f1965885f793b0110e5bcee755d1eb6d07f28a6f502e6f6b7a0128e762a16ae332f4bb2770f507990e4ed1869524
7
- data.tar.gz: cc0629807905eb96c04b6c6156c2e0156664fa65d3aed4671949ba830eef92454652e58109c860bec01734ae00547f9a16ce3c2393b96a169b941a825886f2ad
6
+ metadata.gz: 63f92e9766401476bcc8935e6a1392bf4b3cb50452ee056eb21d818804be056c507f51b74a5e11b23182588a05d9dcf18156a6e21cb00558e20723f16dbf987b
7
+ data.tar.gz: 6ce336e392eb2ab5af483087f1b8ba7b7365856b93927d36ae458ce00abba4acedc211aaebe9d73df6eed747fd3cb48241380083134a55835069921f843e8863
data/README.md CHANGED
@@ -223,6 +223,13 @@ Building a navigation is simple, access to the page tree is available through th
223
223
  end
224
224
  end
225
225
 
226
+ ## Use the `page_title` attribute in your app
227
+
228
+ Kuhsaft::Pages will provide a `%title` tag containing its `page_title` (or the required `title`if no title is present). Simply yield for `:head` in your `application.html` to use it.
229
+
230
+ %head
231
+ = yield(:head)
232
+
226
233
  ## Modifying the backend navigation
227
234
 
228
235
  Simply override the default partial for the main navigation in your app with your own file at `kuhsaft/cms/admin/_main_navigation.html.haml`
data/Rakefile CHANGED
@@ -22,6 +22,9 @@ rescue LoadError
22
22
  RDoc::Task = Rake::RDocTask
23
23
  end
24
24
 
25
+ desc "Run specs"
26
+ RSpec::Core::RakeTask.new(:spec => :setup)
27
+
25
28
  RDoc::Task.new(:rdoc) do |rdoc|
26
29
  rdoc.rdoc_dir = 'rdoc'
27
30
  rdoc.title = 'Kuhsaft'
@@ -30,4 +33,14 @@ RDoc::Task.new(:rdoc) do |rdoc|
30
33
  rdoc.rdoc_files.include('lib/**/*.rb')
31
34
  end
32
35
 
36
+ task :setup do
37
+ Dir.chdir('spec/dummy') do
38
+ `bundle exec rake kuhsaft:install:migrations`
39
+ `bundle exec rails generate kuhsaft:install:assets`
40
+ `bundle exec rake db:create`
41
+ `bundle exec rake db:migrate`
42
+ `bundle exec rake db:test:prepare`
43
+ end
44
+ end
45
+
33
46
  Bundler::GemHelper.install_tasks
@@ -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
- redirect_to "/#{@page.redirect_url}"
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)
@@ -9,6 +9,7 @@ class Kuhsaft::Page < ActiveRecord::Base
9
9
  acts_as_brick_list
10
10
 
11
11
  translate :title,
12
+ :page_title,
12
13
  :slug,
13
14
  :keywords,
14
15
  :description,
@@ -17,6 +18,7 @@ class Kuhsaft::Page < ActiveRecord::Base
17
18
  :url
18
19
 
19
20
  attr_accessible :title,
21
+ :page_title,
20
22
  :slug,
21
23
  :redirect_url,
22
24
  :url,
@@ -10,6 +10,7 @@
10
10
  = simple_form_for @page, :url => url, :html => { :class => 'form-horizontal' } do |form|
11
11
  = form.input :title, :required => false, :input_html => { :class => :span5 }
12
12
  = form.input :slug, :required => false, :input_html => { :class => :span5 }
13
+ = form.input :page_title, :required => false, :input_html => { :class => :span5 }
13
14
  = form.input :parent_id, :collection => Kuhsaft::Page.flat_tree, :label_method => :nesting_name, :selected => params[:parent_id].presence || @page.parent_id.presence, :prompt => 'None', :input_html => { :class => :span3 }
14
15
  = form.input :page_type, :collection => Kuhsaft::PageType.all, :prompt => false, :input_html => { :class => :span3 }
15
16
  = form.input :redirect_url, :as => :string
@@ -1,3 +1,6 @@
1
+ = content_for :head do
2
+ %title= @page.page_title.present? ? @page.page_title : @page.title
3
+
1
4
  - if @page.bricks.map(&:type).include? "Kuhsaft::PlaceholderBrick"
2
5
  - unless @page.blank?
3
6
  .page-content
@@ -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'
@@ -5,6 +5,9 @@ en:
5
5
  admin:
6
6
  pages_nav: 'Pages'
7
7
  assets_nav: 'Assets'
8
+ cms:
9
+ flash:
10
+ success: 'Page was updated successfully'
8
11
  kuhsaft:
9
12
  page_part:
10
13
  markdown: 'Formatted Text'
@@ -8,6 +8,7 @@ de:
8
8
  kuhsaft/page:
9
9
  title: 'Titel'
10
10
  slug: 'URL Name'
11
+ page_title: 'Seitentitel (im Browser)'
11
12
  keywords: 'Stichwörter'
12
13
  description: 'Beschreibung'
13
14
  redirect_url: 'Redirect URL'
@@ -0,0 +1,7 @@
1
+ class AddPageTitleToPages < ActiveRecord::Migration
2
+ def change
3
+ I18n.available_locales.each do |locale|
4
+ add_column :kuhsaft_pages, "page_title_#{locale}", :text
5
+ end
6
+ end
7
+ end
@@ -33,6 +33,7 @@ module Kuhsaft
33
33
  {
34
34
  :against => {
35
35
  locale_attr(:title) => 'A',
36
+ locale_attr(:page_title) => 'A',
36
37
  locale_attr(:keywords) => 'B',
37
38
  locale_attr(:description) => 'C',
38
39
  locale_attr(:fulltext) => 'C',
@@ -61,9 +62,10 @@ module Kuhsaft
61
62
  stmt = ""
62
63
  stmt += "#{locale_attr(:keywords)} LIKE ? OR "
63
64
  stmt += "#{locale_attr(:title)} LIKE ? OR "
65
+ stmt += "#{locale_attr(:page_title)} LIKE ? OR "
64
66
  stmt += "#{locale_attr(:description)} LIKE ? OR "
65
67
  stmt += "#{locale_attr(:fulltext)} LIKE ?"
66
- where(stmt, *(["%#{query}%"] * 4))
68
+ where(stmt, *(["%#{query}%"] * 5))
67
69
  end
68
70
  }
69
71
  end
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "1.8.1"
2
+ VERSION = "1.8.4"
3
3
  end
@@ -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("/de/redirect_page")
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
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Dummy</title>
4
+ <%= yield(:head) %>
5
5
  <%= stylesheet_link_tag "application", :media => "all" %>
6
6
  <%= javascript_include_tag "application" %>
7
7
  <%= csrf_meta_tags %>
@@ -36,16 +36,8 @@ RSpec.configure do |config|
36
36
  config.include FactoryGirl::Syntax::Methods
37
37
 
38
38
  config.before :suite do
39
-
40
- load File.expand_path("../dummy/Rakefile", __FILE__)
41
- Rake::Task['kuhsaft:install:migrations'].invoke
42
- Rails::Generators.invoke('kuhsaft:install:assets')
43
-
44
39
  DatabaseCleaner.strategy = :transaction
45
40
  DatabaseCleaner.clean_with(:truncation)
46
- # Drop all records and run any available migration
47
- ActiveRecord::Base.connection.tables.each { |table| ActiveRecord::Base.connection.drop_table(table) }
48
- ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
49
41
  end
50
42
 
51
43
  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: 1.8.1
4
+ version: 1.8.4
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-16 00:00:00.000000000 Z
15
+ date: 2013-07-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -32,16 +32,16 @@ dependencies:
32
32
  name: rspec-rails
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - ~>
35
+ - - '>='
36
36
  - !ruby/object:Gem::Version
37
- version: '2.13'
37
+ version: '0'
38
38
  type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - ~>
42
+ - - '>='
43
43
  - !ruby/object:Gem::Version
44
- version: '2.13'
44
+ version: '0'
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: factory_girl_rails
47
47
  requirement: !ruby/object:Gem::Requirement
@@ -449,6 +449,7 @@ files:
449
449
  - db/migrate/10_add_redirect_url_to_kuhsaft_pages.rb
450
450
  - db/migrate/11_update_url_and_redirect_url_value.rb
451
451
  - db/migrate/12_regenerate_fulltext.rb
452
+ - db/migrate/13_add_page_title_to_pages.rb
452
453
  - db/seeds.rb
453
454
  - lib/generators/kuhsaft/assets/install_generator.rb
454
455
  - lib/generators/kuhsaft/translations/add_generator.rb
@@ -556,7 +557,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
556
557
  version: '0'
557
558
  requirements: []
558
559
  rubyforge_project: kuhsaft
559
- rubygems_version: 2.0.3
560
+ rubygems_version: 2.0.5
560
561
  signing_key:
561
562
  specification_version: 4
562
563
  summary: A tool that helps you to manage your content within your app.