kuhsaft 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -189,7 +189,7 @@ Finally, add the new translation locale to your `available_locales` inside your
189
189
 
190
190
  By default, the text editor lets you add the following tags, for which you should supply some styles in your app:
191
191
 
192
- p, h1, h2, h3, ul, ol, table, a, strong, em
192
+ p, h1, h2, h3, h4, table, a, strong, em
193
193
 
194
194
  ## Building a navigation
195
195
 
@@ -1,10 +1,14 @@
1
1
  module Kuhsaft
2
2
  module Cms
3
- class AdminController < ApplicationController
3
+ class AdminController < ActionController::Base
4
4
  respond_to :html
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
+
8
12
  def set_content_locale
9
13
  if params[:content_locale].present?
10
14
  I18n.locale = params[:content_locale]
@@ -1,5 +1,5 @@
1
1
  module Kuhsaft
2
- class PagesController < ApplicationController
2
+ class PagesController < ::ApplicationController
3
3
  respond_to :html
4
4
 
5
5
  def show
@@ -1,5 +1,5 @@
1
1
  module Kuhsaft
2
- module ApplicationHelper
2
+ module AdminHelper
3
3
 
4
4
  #
5
5
  # When rendering the layout of our host application,
@@ -1,6 +1,6 @@
1
1
  module Kuhsaft
2
2
  module Cms
3
- module ApplicationHelper
3
+ module AdminHelper
4
4
 
5
5
  def render_language_switch?
6
6
  I18n.available_locales.size > 1
@@ -9,7 +9,7 @@ module Kuhsaft
9
9
  end
10
10
 
11
11
  def metadata_tab_active(page)
12
- if page.errors.present? || !page.persisted?
12
+ if page.errors.present? || !page.persisted? || page.redirect?
13
13
  :active
14
14
  end
15
15
  end
@@ -4,8 +4,8 @@ module Kuhsaft
4
4
 
5
5
  belongs_to :brick_list, :polymorphic => true, :touch => true
6
6
 
7
- scope :localized, lambda { where(:locale => I18n.locale) }
8
- default_scope order('position ASC').localized
7
+ scope :localized, -> { where(:locale => I18n.locale) }
8
+ default_scope -> { order('position ASC').localized }
9
9
 
10
10
  serialize :display_styles, Array
11
11
 
@@ -16,7 +16,6 @@ module Kuhsaft
16
16
  :brick_list_type,
17
17
  :display_styles
18
18
 
19
- before_validation :set_locale
20
19
  before_validation :set_position
21
20
 
22
21
  validates :locale,
@@ -64,10 +63,6 @@ module Kuhsaft
64
63
  p.reverse
65
64
  end
66
65
 
67
- def set_locale
68
- self.locale = self.locale.presence || I18n.locale
69
- end
70
-
71
66
  def set_position
72
67
  self.position = if self.position.present?
73
68
  self.position
@@ -1,8 +1,9 @@
1
1
  %ul.nav.nav-tabs.js-tabs
2
2
  %li{ :class => metadata_tab_active(@page) }
3
3
  = link_to t('.tab_metadata'), '#page-metadata', 'data-toggle' => :tab
4
- %li{ :class => content_tab_active(@page) }
5
- = link_to t('.tab_content'), '#page-content', 'data-toggle' => :tab
4
+ - unless @page.redirect?
5
+ %li{ :class => content_tab_active(@page) }
6
+ = link_to t('.tab_content'), '#page-content', 'data-toggle' => :tab
6
7
 
7
8
  .tab-content
8
9
  #page-metadata.tab-pane{ :class => metadata_tab_active(@page) }
@@ -19,12 +20,13 @@
19
20
  .form-actions
20
21
  = form.button :submit, :class => 'btn btn-primary'
21
22
 
22
- #page-content.tab-pane{ :class => content_tab_active(@page) }
23
- - if @page.persisted?
24
- .clearfix
25
- .actions
26
- .btn-group
27
- = render 'brick_type_dropdown', :brick_list => @page
28
- = render 'kuhsaft/cms/bricks/brick_list', :brick_list => @page
23
+ - unless @page.redirect?
24
+ #page-content.tab-pane{ :class => content_tab_active(@page) }
25
+ - if @page.persisted?
26
+ .clearfix
27
+ .actions
28
+ .btn-group
29
+ = render 'brick_type_dropdown', :brick_list => @page
30
+ = render 'kuhsaft/cms/bricks/brick_list', :brick_list => @page
29
31
 
30
32
  = render 'kuhsaft/cms/bricks/sort_form'
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "1.3.1"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Kuhsaft::Cms::ApplicationHelper do
3
+ describe Kuhsaft::Cms::AdminHelper do
4
4
  describe '#render_language_switch?' do
5
5
  context 'when there is one language' do
6
6
  before do
@@ -6,11 +6,6 @@ describe Kuhsaft::Brick do
6
6
  end
7
7
 
8
8
  describe '#valid?' do
9
- it 'sets a default locale' do
10
- brick.should_receive(:set_locale)
11
- brick.valid?
12
- end
13
-
14
9
  it 'sets a default position' do
15
10
  brick.should_receive(:set_position)
16
11
  brick.valid?
@@ -33,22 +28,6 @@ describe Kuhsaft::Brick do
33
28
  end
34
29
  end
35
30
 
36
- describe '#set_locale' do
37
- context 'witout a locale' do
38
- it 'sets a default' do
39
- brick.set_locale
40
- brick.locale.should == I18n.locale
41
- end
42
- end
43
-
44
- context 'with a locale' do
45
- it 'does not change' do
46
- brick.locale = 'de'
47
- expect { brick.set_locale }.to_not change(brick, :locale)
48
- end
49
- end
50
- end
51
-
52
31
  describe '#brick_list_type' do
53
32
  it 'returns Kuhsaft::Brick' do
54
33
  brick.brick_list_type.should == 'Kuhsaft::Brick'
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.3.1
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,11 @@ authors:
9
9
  - Felipe Kaufmann
10
10
  - Phil Schilter
11
11
  - Donat Baier
12
+ - Franca Rast
12
13
  autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2013-04-12 00:00:00.000000000 Z
16
+ date: 2013-05-03 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: rspec
@@ -330,7 +331,6 @@ files:
330
331
  - app/assets/stylesheets/kuhsaft/application.css.sass
331
332
  - app/assets/stylesheets/kuhsaft/cms/application.css.sass
332
333
  - app/assets/stylesheets/kuhsaft/modules/_text_brick.css.sass
333
- - app/controllers/kuhsaft/application_controller.rb
334
334
  - app/controllers/kuhsaft/cms/admin_controller.rb
335
335
  - app/controllers/kuhsaft/cms/assets_controller.rb
336
336
  - app/controllers/kuhsaft/cms/bricks_controller.rb
@@ -338,7 +338,7 @@ files:
338
338
  - app/controllers/kuhsaft/pages_controller.rb
339
339
  - app/helpers/cms_helper.rb
340
340
  - app/helpers/kuhsaft/application_helper.rb
341
- - app/helpers/kuhsaft/cms/application_helper.rb
341
+ - app/helpers/kuhsaft/cms/admin_helper.rb
342
342
  - app/helpers/kuhsaft/cms/pages_helper.rb
343
343
  - app/helpers/pages_helper.rb
344
344
  - app/models/kuhsaft/accordion_brick.rb
@@ -502,7 +502,7 @@ files:
502
502
  - spec/dummy/script/rails
503
503
  - spec/factories.rb
504
504
  - spec/features/cms_pages_spec.rb
505
- - spec/helpers/kuhsaft/cms/application_helper_spec.rb
505
+ - spec/helpers/kuhsaft/cms/admin_helper_spec.rb
506
506
  - spec/kuhsaft_spec.rb
507
507
  - spec/lib/brick_list_spec.rb
508
508
  - spec/lib/engine_spec.rb
@@ -541,7 +541,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
541
541
  version: '0'
542
542
  segments:
543
543
  - 0
544
- hash: 4323696798110964651
544
+ hash: 4093169498580563011
545
545
  required_rubygems_version: !ruby/object:Gem::Requirement
546
546
  none: false
547
547
  requirements:
@@ -550,10 +550,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
550
550
  version: '0'
551
551
  segments:
552
552
  - 0
553
- hash: 4323696798110964651
553
+ hash: 4093169498580563011
554
554
  requirements: []
555
555
  rubyforge_project: kuhsaft
556
- rubygems_version: 1.8.25
556
+ rubygems_version: 1.8.24
557
557
  signing_key:
558
558
  specification_version: 3
559
559
  summary: A tool that helps you to manage your content within your app.
@@ -593,7 +593,7 @@ test_files:
593
593
  - spec/dummy/script/rails
594
594
  - spec/factories.rb
595
595
  - spec/features/cms_pages_spec.rb
596
- - spec/helpers/kuhsaft/cms/application_helper_spec.rb
596
+ - spec/helpers/kuhsaft/cms/admin_helper_spec.rb
597
597
  - spec/kuhsaft_spec.rb
598
598
  - spec/lib/brick_list_spec.rb
599
599
  - spec/lib/engine_spec.rb
@@ -1,5 +0,0 @@
1
- module Kuhsaft
2
- class ApplicationController < ActionController::Base
3
- layout 'application'
4
- end
5
- end