kuhsaft 2.5.2 → 2.6.0

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: ef9a363f06a35a948e4efb98b45dfc122b70e4cb
4
- data.tar.gz: f58e57e75f974fea67371e7a86e1b186f5b73a9d
3
+ metadata.gz: 5f6610c85076199dc2cffcb24437ede0ef6e6d07
4
+ data.tar.gz: 56d5e2ed22b7ec384a1fa15731888bfd85699d5c
5
5
  SHA512:
6
- metadata.gz: 940dcb88d844dbba451c0521d24926d16a679e109c93d8ba629dfa33015c079dae07b6c659a4e2a6379662e66e5308e769c403ddd9f90e7af766ea654c1483c4
7
- data.tar.gz: cbbec6e5c2441e11dc65b939ab91aaf610b2e2a8e8d1cc18be24f9b568525a7e0954c45ec990599b857f9a1a867ce0db10a13ecc1ee4933805f11fe6aafc3f92
6
+ metadata.gz: dd6ac9bd19452a2d1e117619c9ead75d8721f108606764ad3f2acc24aba98e5fc08347bc1f9377ab246672f4e4e11d8a15c2a7496b271730e4d0d697d522511b
7
+ data.tar.gz: 1570c92b8e110fe146f381fba81142a452e64d84e34ae4b6c3a9d14d074a14f59e6e1a6b0baec201fa6206d00f30d9f04c10b274b81018840ce61085ca51aa79
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- [![Build Status](https://travis-ci.org/screenconcept/kuhsaft.png)](https://travis-ci.org/screenconcept/kuhsaft)
2
- [![Code Climate](https://codeclimate.com/github/screenconcept/kuhsaft.png)](https://codeclimate.com/github/screenconcept/kuhsaft)
3
- [![Gem Version](https://badge.fury.io/rb/kuhsaft.png)](http://badge.fury.io/rb/kuhsaft)
1
+ Kuhsaft has been replaced by
2
+ [qBrick](http://github.com/screenconcept/qbrick). Please switch as soon
3
+ as possible.
4
4
 
5
5
  # Kuhsaft. A CMS as simple as it could be
6
6
 
@@ -103,6 +103,9 @@ window.stopPropagationOfDisplayStyles = (selector) ->
103
103
  $(document).ajaxSuccess ->
104
104
  sortableBrick()
105
105
 
106
+ $('a.has-spinner').click ->
107
+ $(this).toggleClass('active')
108
+
106
109
  $(document).ready ->
107
110
  loadTextEditor()
108
111
  checkPageType()
@@ -136,3 +139,6 @@ $(document).ready ->
136
139
  $(elem).collapse('hide')
137
140
  $('.resize-toggler').each (index, elem) ->
138
141
  $(elem).addClass('collapsed')
142
+
143
+ $("[data-toggle=tooltip]").tooltip(placement: 'top')
144
+ $("[data-toggle=popover]").popover(placement: 'left', html: true, container: 'body')
@@ -9,6 +9,7 @@ $baseBorderRadius: 0px
9
9
  $borderRadiusLarge: 0px
10
10
  $borderRadiusSmall: 0px
11
11
 
12
+ @import bourbon
12
13
  @import bootstrap
13
14
  // base styles
14
15
 
@@ -79,6 +80,9 @@ form
79
80
  .brick-list
80
81
  padding-left: 2em
81
82
 
83
+ .popover
84
+ max-width: none
85
+
82
86
  // The single column brick and the page-content (the "root") needs no level indentation
83
87
  // It usually acts as a helper container and is therefore not relevant
84
88
  // for the visual hierarchy
@@ -93,6 +97,14 @@ form
93
97
  > .brick-list
94
98
  padding-left: 0
95
99
 
100
+ .nav-tabs
101
+ a.not-translated:after
102
+ content: '*'
103
+ color: #d33
104
+ a
105
+ color: black
106
+
107
+
96
108
  .tab-content
97
109
  display: table
98
110
  width: 100%
@@ -163,6 +175,7 @@ form
163
175
  font-weight: bold
164
176
 
165
177
  .modal
178
+ text-align: left
166
179
  width: 900px
167
180
  margin-left: -450px
168
181
 
@@ -174,6 +187,24 @@ form
174
187
  top: -10px
175
188
  padding-left: 10px
176
189
 
190
+
191
+ .spinner
192
+ display: inline-block
193
+ opacity: 0
194
+ max-width: 0
195
+ @include animation-name(spinIt)
196
+ @include animation-duration(2s)
197
+ @include animation-timing-function(linear)
198
+ @include animation-iteration-count(infinite)
199
+
200
+ @include transition(opacity, 0.25s)
201
+ @include transition(max-width, 0.45s)
202
+
203
+ .has-spinner.active
204
+ .spinner
205
+ opacity: 1
206
+ max-width: 50px
207
+
177
208
  .control-group.text
178
209
  min-height: 310px
179
210
 
@@ -202,3 +233,9 @@ form
202
233
  @import nestable
203
234
  @import bootstrap-responsive
204
235
  @import bootstrap_modal
236
+
237
+ @include keyframes(spinIt)
238
+ from
239
+ @include transform(rotate(0deg))
240
+ to
241
+ @include transform(rotate(360deg))
@@ -23,9 +23,8 @@ module Kuhsaft
23
23
 
24
24
  def update
25
25
  @brick = Kuhsaft::Brick.find(params[:id])
26
- @brick.image_size ||= ImageSize.all.first.name.to_s
27
- params['brick'].delete('image_cache') if params['brick']['image']
28
26
  @brick.update_attributes(brick_params)
27
+
29
28
  #
30
29
  # rails will fall back to html if ajax can't be used
31
30
  # this is the case with the image brick, because ajax does not
@@ -57,6 +57,20 @@ module Kuhsaft
57
57
  Kuhsaft::PageTree.update(params[:page_tree])
58
58
  end
59
59
 
60
+ def mirror
61
+ @page = Kuhsaft::Page.find(params[:page_id])
62
+
63
+ unless @page.bricks.empty?
64
+ if params[:rutheless] == 'true' || @page.bricks.unscoped.where(locale: params[:target_locale]).empty?
65
+ @page.clear_bricks_for_locale(params[:target_locale])
66
+ params[:failed_bricks] = @page.clone_bricks_to(params[:target_locale])
67
+ params[:rutheless] = 'true'
68
+ end
69
+ end
70
+
71
+ respond_to :js, :html
72
+ end
73
+
60
74
  private
61
75
 
62
76
  def page_params
@@ -37,8 +37,10 @@ module Kuhsaft
37
37
  after_save do
38
38
  # TODO: replace callback with fulltext row on each
39
39
  # searchable model
40
- brick_list.update_fulltext
41
- brick_list.save!
40
+ if brick_list
41
+ brick_list.update_fulltext
42
+ brick_list.save!
43
+ end
42
44
  end
43
45
 
44
46
  # TODO: yes. temporary workaround. see above
@@ -89,6 +89,10 @@ module Kuhsaft
89
89
  url.present? && title.present? && slug.present?
90
90
  end
91
91
 
92
+ def translated_to?(locale)
93
+ send("url_#{locale}").present? && send("title_#{locale}").present? && send("slug_#{locale}").present?
94
+ end
95
+
92
96
  def link
93
97
  if bricks.count == 0 && children.count > 0
94
98
  children.first.link
@@ -161,5 +165,43 @@ module Kuhsaft
161
165
  json['url'] = "/pages/#{id}"
162
166
  end
163
167
  end
168
+
169
+ def clear_bricks_for_locale(locale)
170
+ bricks.unscoped.where(locale: locale).destroy_all
171
+ end
172
+
173
+ def copy_assets_to_cloned_brick(brick, new_brick)
174
+ brick.class.uploaders.keys.each do |key|
175
+ new_brick.update_attribute(key.to_s, File.open(brick.send(key.to_s).path))
176
+ end
177
+ end
178
+
179
+ def clone_child_bricks(brick, to_locale, new_brick_list_id)
180
+ brick.bricks.each do |nested_brick|
181
+ clone_brick_to(nested_brick, to_locale, new_brick_list_id)
182
+ end
183
+ end
184
+
185
+ def clone_bricks_to(locale)
186
+ failed_to_clone = []
187
+
188
+ bricks.each do |brick|
189
+ failed_to_clone << brick unless clone_brick_to(brick, locale, id)
190
+ end
191
+ failed_to_clone
192
+ end
193
+
194
+ def clone_brick_to(brick, to_locale, new_brick_list_id)
195
+ new_brick = brick.dup
196
+
197
+ copy_assets_to_cloned_brick(brick, new_brick) if brick.uploader?
198
+
199
+ new_brick.update_attribute(:locale, to_locale)
200
+ new_brick.update_attribute(:brick_list_id, new_brick_list_id)
201
+
202
+ clone_child_bricks(brick, to_locale, new_brick.id) if brick.respond_to?(:bricks)
203
+
204
+ new_brick.save
205
+ end
164
206
  end
165
207
  end
@@ -0,0 +1,16 @@
1
+ - unless @page.bricks.empty?
2
+ .btn-group
3
+ .btn.btn-small{ 'data-toggle' => 'popover', 'data-content' => t('.brick_clone_info'), 'data-original-title' => t('.brick_clone_info_title')}
4
+ %i.icon-info-sign
5
+ %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
6
+ = t('.clone_bricks')
7
+ %span.caret
8
+ %ul.dropdown-menu.pull-right
9
+ - I18n.available_locales.each do |locale|
10
+ - unless I18n.locale == locale
11
+ - if @page.translated_to?(locale)
12
+ %li= link_to t('.to_locale', :locale_name => locale.upcase), cms_page_mirror_path(@page, :target_locale => locale, :rutheless => false), :remote => true
13
+
14
+ - else
15
+ %li.disabled{ 'data-toggle' => 'tooltip', 'title' => t('.not_translated') }
16
+ = link_to t('.to_locale', :locale_name => locale.upcase), '#'
@@ -1,14 +1,15 @@
1
1
  - unless brick_list.brick_types.empty?
2
- - if brick_list.brick_types.allowed.count > 1
3
- %a.btn.btn-small.btn-primary.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
4
- = t('.add_element')
5
- %span.caret
6
- %ul.dropdown-menu.pull-right
7
- - brick_list.brick_types.allowed.group_by(&:group).each do |group, types|
8
- - types.map { |type| cms_brick_item brick_list, type }.compact.each do |brick_type_item|
9
- %li
10
- = brick_type_item
11
- .divider
12
- - else
13
- - brick_list.brick_types.allowed.each do |type|
14
- = link_to t('.add_specific_element', :name => type.class_name.constantize.model_name.human), kuhsaft.new_cms_brick_path(:brick => { :type => type.class_name, :brick_list_id => brick_list.id, :brick_list_type => brick_list.brick_list_type }), :remote => true, :class => 'btn btn-small btn-primary'
2
+ .btn-group
3
+ - if brick_list.brick_types.allowed.count > 1
4
+ %a.btn.btn-small.btn-primary.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
5
+ = t('.add_element')
6
+ %span.caret
7
+ %ul.dropdown-menu.pull-right
8
+ - brick_list.brick_types.allowed.group_by(&:group).each do |group, types|
9
+ - types.map { |type| cms_brick_item brick_list, type }.compact.each do |brick_type_item|
10
+ %li
11
+ = brick_type_item
12
+ .divider
13
+ - else
14
+ - brick_list.brick_types.allowed.each do |type|
15
+ = link_to t('.add_specific_element', :name => type.class_name.constantize.model_name.human), kuhsaft.new_cms_brick_path(:brick => { :type => type.class_name, :brick_list_id => brick_list.id, :brick_list_type => brick_list.brick_list_type }), :remote => true, :class => 'btn btn-small btn-primary'
@@ -1,6 +1,12 @@
1
1
  = link_to 'Kuhsaft CMS', cms_root_path, :class => 'brand'
2
- %p.navbar-text.pull-right
3
- = link_to t('.logout'), '', :method => :delete
4
- %ul.nav
2
+
3
+ %ul.nav.pull-right.language-navigation
4
+ - if render_language_switch?
5
+ - I18n.available_locales.each do |locale|
6
+ %li{ :class => (:active if I18n.locale.to_s == locale.to_s) }
7
+ = link_to_content_locale(locale)
5
8
  %li
6
- = link_to Kuhsaft::Page.model_name.human(:count => 2), kuhsaft.cms_pages_path
9
+ = link_to t('.logout'), '', :method => :delete
10
+
11
+ %ul.nav
12
+ %li= link_to Kuhsaft::Page.model_name.human(:count => 2), kuhsaft.cms_pages_path
@@ -1,5 +1,5 @@
1
1
  .brick-item{ id: brick.to_brick_item_id, class: brick.to_style_class, 'data-id' => brick.id }
2
- = simple_form_for brick, as: :brick, url: kuhsaft.cms_brick_path(brick), remote: true, html: { id: nil }, wrapper: :bootstrap do |form|
2
+ = simple_form_for brick, as: :brick, url: kuhsaft.cms_brick_path(brick), remote: !brick.uploader?, html: { id: nil }, wrapper: :bootstrap do |form|
3
3
  = form.hidden_field :position, class: 'position-field'
4
4
  - brick_content = render(brick.to_edit_partial_path, brick: brick, form: form)
5
5
 
@@ -5,6 +5,13 @@
5
5
  %li{ class: content_tab_active(@page) }
6
6
  = link_to t('.tab_content'), '#page-content', 'data-toggle' => :tab
7
7
 
8
+ - I18n.available_locales.reverse.each do |locale|
9
+ %li.pull-right{ :class => (:active if I18n.locale.to_s == locale.to_s) }
10
+ - if @page.translated_to?(locale)
11
+ = link_to_content_locale(locale)
12
+ - else
13
+ = link_to locale.to_s.upcase, url_for(:action => params[:action], :content_locale => locale), 'data-toggle' => 'tooltip', 'title' => t('.not_translated'), :class => 'not-translated'
14
+
8
15
  .tab-content
9
16
  #page-metadata.tab-pane{ class: metadata_tab_active(@page) }
10
17
  = simple_form_for @page, url: url, html: { class: 'form-horizontal' }, wrapper: :bootstrap do |form|
@@ -39,9 +46,9 @@
39
46
  %i.icon-resize-small
40
47
  = t('.collapse_all')
41
48
 
42
- .btn-group
43
- = render 'brick_type_dropdown', brick_list: @page
49
+ = render 'brick_clone_menu'
50
+ = render 'brick_type_dropdown', :brick_list => @page
44
51
 
45
- = render 'kuhsaft/cms/bricks/brick_list', brick_list: @page
52
+ = render 'kuhsaft/cms/bricks/brick_list', :brick_list => @page
46
53
 
47
54
  = render 'kuhsaft/cms/bricks/sort_form'
@@ -0,0 +1,52 @@
1
+ .modal-header
2
+ %button.close{ 'data-dismiss' => 'modal' }
3
+ ×
4
+ %h3 header
5
+
6
+ - if page.bricks.empty?
7
+ .modal-body
8
+ .alert.alert-info
9
+ = t('.no_bricks_to_clone')
10
+
11
+ .modal-footer
12
+ .clearfix
13
+ .pull-right
14
+ .btn.btn-success{ 'data-dismiss' => 'modal'}
15
+ = t('.okay')
16
+
17
+ - elsif page.bricks.unscoped.where(:locale => params[:target_locale], :brick_list_id => page.id).any? && params[:rutheless] != 'true'
18
+ .modal-body
19
+ .alert.alert-error
20
+ = t('.target_page_contains_bricks', :brick_count => page.bricks.unscoped.where(:locale => params[:target_locale]).count ).html_safe
21
+
22
+ .modal-footer
23
+ .clearfix
24
+ .pull-right
25
+ .btn{ 'data-dismiss' => 'modal'}
26
+ = t('.abort')
27
+ = link_to cms_page_mirror_path(@page, :target_locale => params[:target_locale], :rutheless => true), :class => 'btn btn-warning has-spinner', :remote => true do
28
+ %span.spinner
29
+ %i.icon-refresh.icon-white
30
+ = t('.proceed_replace')
31
+
32
+ - else
33
+ .modal-body
34
+ .alert.alert-info
35
+ = t('.bricks_cloned', :brick_count => (page.bricks.unscoped.where(:locale => params[:target_locale]).count - params[:failed_bricks].count))
36
+ - if params[:failed_bricks].any?
37
+ .alert.alert-error
38
+ = t('.failed_to_clone_folowwing_bricks')
39
+ %ul
40
+ - params[:failed_bricks].each do |failed_brick|
41
+ %li
42
+ = failed_brick.caption
43
+ = failed_brick.type
44
+ = "(Position: #{failed_brick.position})"
45
+
46
+ .modal-footer
47
+ .clearfix
48
+ .pull-right
49
+ = link_to edit_cms_page_path(page, :content_locale => params[:target_locale]), :class => 'btn' do
50
+ = t('.edit_language', :language => params[:target_locale].upcase)
51
+ .btn.btn-success{ 'data-dismiss' => 'modal'}
52
+ = t('.okay')
@@ -0,0 +1,5 @@
1
+ $("#brick-form").empty()
2
+
3
+ $("#brick-form").append("#{j(render('kuhsaft/cms/pages/mirror_modal', :page => @page, :format => :html))}")
4
+
5
+ $("#brick-form").modal('show')
@@ -17,7 +17,6 @@
17
17
  .container.cms
18
18
  .row
19
19
  .span12
20
- = render 'content_language_switch'
21
20
  = render 'flash', :flash => flash
22
21
  = yield
23
22
 
@@ -17,3 +17,4 @@ en:
17
17
  page_type: 'Pagetype'
18
18
  parent_id: 'Parent page'
19
19
  parent: 'Parent page'
20
+ google_verification_key: Google Verification Key
@@ -6,6 +6,29 @@ de:
6
6
  brick_type_dropdown:
7
7
  add_element: 'Element hinzufügen'
8
8
  add_specific_element: '%{name} hinzufügen'
9
+ brick_clone_menu:
10
+ clone_bricks: Bricks kopieren
11
+ to_locale: 'in die Sprachversion %{locale_name}'
12
+ not_translated: 'Noch nicht übersetzt'
13
+ brick_clone_info_title: Kopieren von Bricks
14
+ brick_clone_info: |
15
+ Bricks werden mit gesamten Inhalt in eine andere Sprachversion der Seite kopiert.
16
+ </br>
17
+ Texte werden nicht übersetzt und müssen angepasst werden.
18
+ </br>
19
+ </br>
20
+ Kopieren ist nicht möglich, falls:
21
+ <ul>
22
+ <li>Die gewünschte Sprachversion der Seite nicht Übersetzt ist</li>
23
+ <li>Die Seite keine Bricks enthält</li>
24
+ </ul>
25
+ <span class="label label-warning">Achtung:</span>
26
+ </br>
27
+ Diese Funktion dient zum initialen Setup der Seiten.
28
+ </br>
29
+ Eventuell vorhandene Bricks auf der Zielseite werden überschrieben!
30
+ modal_header: Bricks kopieren
31
+ modal_body: 'Kopiere %{brick_count} Brick(s) von %{from_locale} nach %{to_locale}'
9
32
  empty_state:
10
33
  empty: 'Hier ist bisher noch nichts...'
11
34
  main_navigation:
@@ -7,6 +7,7 @@ de:
7
7
  form:
8
8
  tab_metadata: 'Einstellungen'
9
9
  tab_content: 'Inhalt'
10
+ not_translated: 'Übersetzungen fehlen'
10
11
  hint_keywords: |
11
12
  Geben Sie hier 2 - 6 zentrale Begriffe, welche für diese Seite gelten, als Stichwörter an.
12
13
  </br>
@@ -29,3 +30,15 @@ de:
29
30
  expand_all: Alle aufklappen
30
31
  collapse_all: Alle zuklappen
31
32
  none: Keine
33
+
34
+ mirror_modal:
35
+ no_bricks_to_clone: 'Die Seite enthält keine Bricks zum kopieren.'
36
+ bricks_cloned: '%{brick_count} Brick(s) erfolgreich kopiert.'
37
+ target_page_contains_bricks: |
38
+ <strong>Achtung:</strong>
39
+ Die Zielseite enthält %{brick_count} Brick(s). Diese werden überschrieben.
40
+ abort: Abbrechen
41
+ proceed_replace: 'Kopieren & Ersetzen'
42
+ okay: OK
43
+ edit_language: '%{language} Bricks bearbeiten'
44
+ failed_to_clone_folowwing_bricks: 'Folgende Bricks konnten nicht kopiert werden:'
@@ -3,6 +3,7 @@ Kuhsaft::Engine.routes.draw do
3
3
  namespace :cms do
4
4
  resources :pages, except: :show do
5
5
  post :sort, on: :collection
6
+ get :mirror
6
7
  end
7
8
 
8
9
  resources :bricks, except: [:edit, :index] do
@@ -8,6 +8,7 @@ module Kuhsaft
8
8
  end
9
9
 
10
10
  class Engine < ::Rails::Engine
11
+ warn "[DEPRECATION] Kuhsaft has been replaced by qBrick. Please switch to qBrick as soon as possible."
11
12
  isolate_namespace Kuhsaft
12
13
 
13
14
  config.i18n.fallbacks = [:de]
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = '2.5.2'
2
+ VERSION = '2.6.0'
3
3
  end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kuhsaft::Cms::PagesController do
4
+ subject { described_class }
5
+
6
+ describe 'mirroring' do
7
+ around(:each) do |example|
8
+ I18n.with_locale :de do
9
+ example.run
10
+ end
11
+ end
12
+
13
+ before do
14
+ @page = FactoryGirl.create(:page, url_de: 'de')
15
+ @brick = FactoryGirl.create(:text_brick,
16
+ brick_list_id: @page.id,
17
+ brick_list_type: 'Kuhsaft::Page',
18
+ text: 'DEUTSCH')
19
+ end
20
+
21
+ context 'with no bricks on target locale' do
22
+ it 'clones the existing bricks' do
23
+ xhr :get, :mirror, use_route: :kuhsaft, target_locale: :en, page_id: @page.id
24
+ expect(@page.bricks.unscoped.count).to eq(2)
25
+ end
26
+ end
27
+
28
+ context 'with bricks on target locale' do
29
+ before do
30
+ @brick_en = FactoryGirl.create(:text_brick,
31
+ brick_list_id: @page.id,
32
+ brick_list_type: 'Kuhsaft::Page',
33
+ locale: :en,
34
+ text: 'ENGLISH')
35
+ end
36
+
37
+ it 'does not clone anything without the required parameter' do
38
+ xhr :get, :mirror, use_route: :kuhsaft, target_locale: :en, page_id: @page.id
39
+ expect(@page.bricks.unscoped.where(locale: :en).first.text).to eq('ENGLISH')
40
+ end
41
+
42
+ it 'clones the bricks when required parameter is set' do
43
+ xhr :get, :mirror, use_route: :kuhsaft, target_locale: :en, page_id: @page.id, rutheless: 'true'
44
+ expect(@page.bricks.unscoped.where(locale: :en).first.text).to eq('DEUTSCH')
45
+ end
46
+ end
47
+ end
48
+ end
@@ -20,6 +20,11 @@ FactoryGirl.define do
20
20
  tb.template_name 'foo'
21
21
  end
22
22
 
23
+ factory :image_brick, class: 'Kuhsaft::ImageBrick' do |ib|
24
+ ib.image File.open("#{Kuhsaft::Engine.root}/spec/dummy/app/assets/images/spec-image.png")
25
+ ib.image_size 'gallery'
26
+ end
27
+
23
28
  factory :asset, class: Kuhsaft::Asset do |a|
24
29
  a.file File.open("#{Kuhsaft::Engine.root}/spec/dummy/app/assets/images/spec-image.png")
25
30
  end
@@ -29,7 +29,7 @@ describe 'Cms/Pages', type: :feature do
29
29
  visit kuhsaft.edit_cms_page_path(@page)
30
30
  fill_in 'page_title', with: ''
31
31
  click_on 'Update Page'
32
- within '.nav-pills' do
32
+ within '.language-navigation' do
33
33
  click_on 'EN'
34
34
  end
35
35
  expect(page).to have_content(@page.title_en)
@@ -469,4 +469,37 @@ describe Kuhsaft::Page, type: :model do
469
469
  expect(Kuhsaft::Page.by_identifier(cat_page.identifier)).to eq(cat_page)
470
470
  end
471
471
  end
472
+
473
+ describe '#cloning' do
474
+ around(:each) do |example|
475
+ I18n.with_locale :de do
476
+ example.run
477
+ end
478
+ end
479
+
480
+ before do
481
+ @page = create(:page)
482
+ end
483
+
484
+ it 'should copy the asset to the cloned brick' do
485
+ FactoryGirl.create(:image_brick, brick_list_type: 'Kuhsaft::Page', brick_list_id: @page.id)
486
+
487
+ @page.clone_bricks_to(:en)
488
+ expect(@page.bricks.unscoped.where(locale: :en).first).to be_valid
489
+ end
490
+
491
+ it 'should copy all child bricks' do
492
+ accordion = Kuhsaft::Brick.create(type: 'Kuhsaft::AccordionBrick',
493
+ brick_list_type: 'Kuhsaft::Page',
494
+ brick_list_id: @page.id)
495
+ section = Kuhsaft::Brick.create(type: 'Kuhsaft::AccordionItemBrick',
496
+ caption: 'section',
497
+ brick_list_type: 'Kuhsaft::Brick',
498
+ brick_list_id: accordion.id)
499
+ FactoryGirl.create(:text_brick, brick_list_type: 'Kuhsaft::Brick', brick_list_id: section.id)
500
+
501
+ @page.clone_bricks_to(:en)
502
+ expect(@page.bricks.unscoped.where(locale: :en).count).to eq(3)
503
+ end
504
+ end
472
505
  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: 2.5.2
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Immanuel Häussermann
@@ -12,216 +12,216 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-11-14 00:00:00.000000000 Z
15
+ date: 2014-09-28 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec-rails
19
19
  requirement: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ~>
21
+ - - "~>"
22
22
  - !ruby/object:Gem::Version
23
23
  version: 3.0.1
24
24
  type: :development
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - ~>
28
+ - - "~>"
29
29
  - !ruby/object:Gem::Version
30
30
  version: 3.0.1
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: rspec-activemodel-mocks
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - '>='
35
+ - - ">="
36
36
  - !ruby/object:Gem::Version
37
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
44
  version: '0'
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: factory_girl_rails
47
47
  requirement: !ruby/object:Gem::Requirement
48
48
  requirements:
49
- - - '>='
49
+ - - ">="
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  type: :development
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - '>='
56
+ - - ">="
57
57
  - !ruby/object:Gem::Version
58
58
  version: '0'
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: capybara
61
61
  requirement: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - '>='
63
+ - - ">="
64
64
  - !ruby/object:Gem::Version
65
65
  version: '2.0'
66
66
  type: :development
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - '>='
70
+ - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: '2.0'
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: pg
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - '>='
77
+ - - ">="
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  type: :development
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - '>='
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: launchy
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - '>='
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  type: :development
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - '>='
98
+ - - ">="
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: i18n-tasks
103
103
  requirement: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - '>='
105
+ - - ">="
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  type: :development
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - '>='
112
+ - - ">="
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: rake
117
117
  requirement: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - '>='
119
+ - - ">="
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - '>='
126
+ - - ">="
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  - !ruby/object:Gem::Dependency
130
130
  name: coffee-rails
131
131
  requirement: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - '>='
133
+ - - ">="
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  type: :runtime
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
- - - '>='
140
+ - - ">="
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: remotipart
145
145
  requirement: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - '>='
147
+ - - ">="
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  type: :runtime
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - '>='
154
+ - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: haml
159
159
  requirement: !ruby/object:Gem::Requirement
160
160
  requirements:
161
- - - '>='
161
+ - - ">="
162
162
  - !ruby/object:Gem::Version
163
163
  version: 4.0.3
164
164
  type: :runtime
165
165
  prerelease: false
166
166
  version_requirements: !ruby/object:Gem::Requirement
167
167
  requirements:
168
- - - '>='
168
+ - - ">="
169
169
  - !ruby/object:Gem::Version
170
170
  version: 4.0.3
171
171
  - !ruby/object:Gem::Dependency
172
172
  name: carrierwave
173
173
  requirement: !ruby/object:Gem::Requirement
174
174
  requirements:
175
- - - '>='
175
+ - - ">="
176
176
  - !ruby/object:Gem::Version
177
177
  version: '0'
178
178
  type: :runtime
179
179
  prerelease: false
180
180
  version_requirements: !ruby/object:Gem::Requirement
181
181
  requirements:
182
- - - '>='
182
+ - - ">="
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
185
  - !ruby/object:Gem::Dependency
186
186
  name: mini_magick
187
187
  requirement: !ruby/object:Gem::Requirement
188
188
  requirements:
189
- - - '>='
189
+ - - ">="
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  type: :runtime
193
193
  prerelease: false
194
194
  version_requirements: !ruby/object:Gem::Requirement
195
195
  requirements:
196
- - - '>='
196
+ - - ">="
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  - !ruby/object:Gem::Dependency
200
200
  name: rdiscount
201
201
  requirement: !ruby/object:Gem::Requirement
202
202
  requirements:
203
- - - '>='
203
+ - - ">="
204
204
  - !ruby/object:Gem::Version
205
205
  version: '0'
206
206
  type: :runtime
207
207
  prerelease: false
208
208
  version_requirements: !ruby/object:Gem::Requirement
209
209
  requirements:
210
- - - '>='
210
+ - - ">="
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  - !ruby/object:Gem::Dependency
214
214
  name: ancestry
215
215
  requirement: !ruby/object:Gem::Requirement
216
216
  requirements:
217
- - - '>='
217
+ - - ">="
218
218
  - !ruby/object:Gem::Version
219
219
  version: '0'
220
220
  type: :runtime
221
221
  prerelease: false
222
222
  version_requirements: !ruby/object:Gem::Requirement
223
223
  requirements:
224
- - - '>='
224
+ - - ">="
225
225
  - !ruby/object:Gem::Version
226
226
  version: '0'
227
227
  - !ruby/object:Gem::Dependency
@@ -256,196 +256,196 @@ dependencies:
256
256
  name: pg_search
257
257
  requirement: !ruby/object:Gem::Requirement
258
258
  requirements:
259
- - - '>='
259
+ - - ">="
260
260
  - !ruby/object:Gem::Version
261
261
  version: '0'
262
262
  type: :runtime
263
263
  prerelease: false
264
264
  version_requirements: !ruby/object:Gem::Requirement
265
265
  requirements:
266
- - - '>='
266
+ - - ">="
267
267
  - !ruby/object:Gem::Version
268
268
  version: '0'
269
269
  - !ruby/object:Gem::Dependency
270
270
  name: htmlentities
271
271
  requirement: !ruby/object:Gem::Requirement
272
272
  requirements:
273
- - - '>='
273
+ - - ">="
274
274
  - !ruby/object:Gem::Version
275
275
  version: '0'
276
276
  type: :runtime
277
277
  prerelease: false
278
278
  version_requirements: !ruby/object:Gem::Requirement
279
279
  requirements:
280
- - - '>='
280
+ - - ">="
281
281
  - !ruby/object:Gem::Version
282
282
  version: '0'
283
283
  - !ruby/object:Gem::Dependency
284
284
  name: jquery-rails
285
285
  requirement: !ruby/object:Gem::Requirement
286
286
  requirements:
287
- - - '>='
287
+ - - ">="
288
288
  - !ruby/object:Gem::Version
289
289
  version: '0'
290
290
  type: :runtime
291
291
  prerelease: false
292
292
  version_requirements: !ruby/object:Gem::Requirement
293
293
  requirements:
294
- - - '>='
294
+ - - ">="
295
295
  - !ruby/object:Gem::Version
296
296
  version: '0'
297
297
  - !ruby/object:Gem::Dependency
298
298
  name: database_cleaner
299
299
  requirement: !ruby/object:Gem::Requirement
300
300
  requirements:
301
- - - '>='
301
+ - - ">="
302
302
  - !ruby/object:Gem::Version
303
303
  version: '0'
304
304
  type: :development
305
305
  prerelease: false
306
306
  version_requirements: !ruby/object:Gem::Requirement
307
307
  requirements:
308
- - - '>='
308
+ - - ">="
309
309
  - !ruby/object:Gem::Version
310
310
  version: '0'
311
311
  - !ruby/object:Gem::Dependency
312
312
  name: pry-rails
313
313
  requirement: !ruby/object:Gem::Requirement
314
314
  requirements:
315
- - - '>='
315
+ - - ">="
316
316
  - !ruby/object:Gem::Version
317
317
  version: '0'
318
318
  type: :development
319
319
  prerelease: false
320
320
  version_requirements: !ruby/object:Gem::Requirement
321
321
  requirements:
322
- - - '>='
322
+ - - ">="
323
323
  - !ruby/object:Gem::Version
324
324
  version: '0'
325
325
  - !ruby/object:Gem::Dependency
326
326
  name: pry-debugger
327
327
  requirement: !ruby/object:Gem::Requirement
328
328
  requirements:
329
- - - '>='
329
+ - - ">="
330
330
  - !ruby/object:Gem::Version
331
331
  version: '0'
332
332
  type: :development
333
333
  prerelease: false
334
334
  version_requirements: !ruby/object:Gem::Requirement
335
335
  requirements:
336
- - - '>='
336
+ - - ">="
337
337
  - !ruby/object:Gem::Version
338
338
  version: '0'
339
339
  - !ruby/object:Gem::Dependency
340
340
  name: better_errors
341
341
  requirement: !ruby/object:Gem::Requirement
342
342
  requirements:
343
- - - '>='
343
+ - - ">="
344
344
  - !ruby/object:Gem::Version
345
345
  version: '0'
346
346
  type: :development
347
347
  prerelease: false
348
348
  version_requirements: !ruby/object:Gem::Requirement
349
349
  requirements:
350
- - - '>='
350
+ - - ">="
351
351
  - !ruby/object:Gem::Version
352
352
  version: '0'
353
353
  - !ruby/object:Gem::Dependency
354
354
  name: binding_of_caller
355
355
  requirement: !ruby/object:Gem::Requirement
356
356
  requirements:
357
- - - '>='
357
+ - - ">="
358
358
  - !ruby/object:Gem::Version
359
359
  version: '0'
360
360
  type: :development
361
361
  prerelease: false
362
362
  version_requirements: !ruby/object:Gem::Requirement
363
363
  requirements:
364
- - - '>='
364
+ - - ">="
365
365
  - !ruby/object:Gem::Version
366
366
  version: '0'
367
367
  - !ruby/object:Gem::Dependency
368
368
  name: rubocop
369
369
  requirement: !ruby/object:Gem::Requirement
370
370
  requirements:
371
- - - '>='
371
+ - - ">="
372
372
  - !ruby/object:Gem::Version
373
373
  version: '0'
374
374
  type: :development
375
375
  prerelease: false
376
376
  version_requirements: !ruby/object:Gem::Requirement
377
377
  requirements:
378
- - - '>='
378
+ - - ">="
379
379
  - !ruby/object:Gem::Version
380
380
  version: '0'
381
381
  - !ruby/object:Gem::Dependency
382
382
  name: sass-rails
383
383
  requirement: !ruby/object:Gem::Requirement
384
384
  requirements:
385
- - - ~>
385
+ - - "~>"
386
386
  - !ruby/object:Gem::Version
387
387
  version: 4.0.2
388
388
  type: :runtime
389
389
  prerelease: false
390
390
  version_requirements: !ruby/object:Gem::Requirement
391
391
  requirements:
392
- - - ~>
392
+ - - "~>"
393
393
  - !ruby/object:Gem::Version
394
394
  version: 4.0.2
395
395
  - !ruby/object:Gem::Dependency
396
396
  name: rails
397
397
  requirement: !ruby/object:Gem::Requirement
398
398
  requirements:
399
- - - ~>
399
+ - - "~>"
400
400
  - !ruby/object:Gem::Version
401
401
  version: 4.0.2
402
402
  type: :runtime
403
403
  prerelease: false
404
404
  version_requirements: !ruby/object:Gem::Requirement
405
405
  requirements:
406
- - - ~>
406
+ - - "~>"
407
407
  - !ruby/object:Gem::Version
408
408
  version: 4.0.2
409
409
  - !ruby/object:Gem::Dependency
410
410
  name: simple_form
411
411
  requirement: !ruby/object:Gem::Requirement
412
412
  requirements:
413
- - - ~>
413
+ - - "~>"
414
414
  - !ruby/object:Gem::Version
415
415
  version: 3.0.1
416
416
  type: :runtime
417
417
  prerelease: false
418
418
  version_requirements: !ruby/object:Gem::Requirement
419
419
  requirements:
420
- - - ~>
420
+ - - "~>"
421
421
  - !ruby/object:Gem::Version
422
422
  version: 3.0.1
423
423
  - !ruby/object:Gem::Dependency
424
424
  name: jquery-ui-rails
425
425
  requirement: !ruby/object:Gem::Requirement
426
426
  requirements:
427
- - - '>='
427
+ - - ">="
428
428
  - !ruby/object:Gem::Version
429
429
  version: '0'
430
430
  type: :runtime
431
431
  prerelease: false
432
432
  version_requirements: !ruby/object:Gem::Requirement
433
433
  requirements:
434
- - - '>='
434
+ - - ">="
435
435
  - !ruby/object:Gem::Version
436
436
  version: '0'
437
437
  - !ruby/object:Gem::Dependency
438
438
  name: bourbon
439
439
  requirement: !ruby/object:Gem::Requirement
440
440
  requirements:
441
- - - '>='
441
+ - - ">="
442
442
  - !ruby/object:Gem::Version
443
443
  version: '0'
444
444
  type: :runtime
445
445
  prerelease: false
446
446
  version_requirements: !ruby/object:Gem::Requirement
447
447
  requirements:
448
- - - '>='
448
+ - - ">="
449
449
  - !ruby/object:Gem::Version
450
450
  version: '0'
451
451
  description: Kuhsaft is a Rails engine that offers a simple CMS.
@@ -518,8 +518,8 @@ files:
518
518
  - app/views/kuhsaft/anchor_bricks/anchor_brick/_edit.html.haml
519
519
  - app/views/kuhsaft/asset_bricks/_asset_brick.html.haml
520
520
  - app/views/kuhsaft/asset_bricks/asset_brick/_edit.html.haml
521
+ - app/views/kuhsaft/cms/admin/_brick_clone_menu.html.haml
521
522
  - app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml
522
- - app/views/kuhsaft/cms/admin/_content_language_switch.html.haml
523
523
  - app/views/kuhsaft/cms/admin/_empty_state.html.haml
524
524
  - app/views/kuhsaft/cms/admin/_flash.html.haml
525
525
  - app/views/kuhsaft/cms/admin/_main_navigation.html.haml
@@ -542,8 +542,10 @@ files:
542
542
  - app/views/kuhsaft/cms/ckimages/index.html.haml
543
543
  - app/views/kuhsaft/cms/pages/_branch.html.haml
544
544
  - app/views/kuhsaft/cms/pages/_form.html.haml
545
+ - app/views/kuhsaft/cms/pages/_mirror_modal.html.haml
545
546
  - app/views/kuhsaft/cms/pages/edit.html.haml
546
547
  - app/views/kuhsaft/cms/pages/index.html.haml
548
+ - app/views/kuhsaft/cms/pages/mirror.js.haml
547
549
  - app/views/kuhsaft/cms/pages/new.html.haml
548
550
  - app/views/kuhsaft/cms/pages/show.html.haml
549
551
  - app/views/kuhsaft/cms/pages/sort.js.erb
@@ -672,6 +674,7 @@ files:
672
674
  - Rakefile
673
675
  - README.md
674
676
  - spec/controllers/kuhsaft/api/pages_controller_spec.rb
677
+ - spec/controllers/kuhsaft/cms/pages_controller_spec.rb
675
678
  - spec/controllers/kuhsaft/pages_controller_spec.rb
676
679
  - spec/controllers/kuhsaft/sitemaps_controller_spec.rb
677
680
  - spec/dummy/Rakefile
@@ -755,28 +758,32 @@ homepage: http://github.com/screenconcept/kuhsaft
755
758
  licenses:
756
759
  - MIT
757
760
  metadata: {}
758
- post_install_message:
761
+ post_install_message: |2
762
+ ! The kuhsaft gem has been deprecated and has been replaced by qBrick.
763
+ ! See: https://rubygems.org/gems/qbrick
764
+ ! And: https://github.com/screenconcept/kuhsaft
759
765
  rdoc_options: []
760
766
  require_paths:
761
767
  - lib
762
768
  required_ruby_version: !ruby/object:Gem::Requirement
763
769
  requirements:
764
- - - '>='
770
+ - - ">="
765
771
  - !ruby/object:Gem::Version
766
772
  version: '0'
767
773
  required_rubygems_version: !ruby/object:Gem::Requirement
768
774
  requirements:
769
- - - '>='
775
+ - - ">="
770
776
  - !ruby/object:Gem::Version
771
777
  version: '0'
772
778
  requirements: []
773
779
  rubyforge_project: kuhsaft
774
- rubygems_version: 2.0.3
780
+ rubygems_version: 2.1.10
775
781
  signing_key:
776
782
  specification_version: 4
777
783
  summary: A tool that helps you to manage your content within your app.
778
784
  test_files:
779
785
  - spec/controllers/kuhsaft/api/pages_controller_spec.rb
786
+ - spec/controllers/kuhsaft/cms/pages_controller_spec.rb
780
787
  - spec/controllers/kuhsaft/pages_controller_spec.rb
781
788
  - spec/controllers/kuhsaft/sitemaps_controller_spec.rb
782
789
  - spec/dummy/Rakefile
@@ -856,4 +863,3 @@ test_files:
856
863
  - spec/support/kuhsaft_spec_helper.rb
857
864
  - spec/support/write_expectation.rb
858
865
  - spec/views/kuhsaft/sitemaps/index.xml.haml_spec.rb
859
- has_rdoc:
@@ -1,7 +0,0 @@
1
- - if render_language_switch?
2
- .pull-right
3
- %ul.nav.nav-pills
4
- - I18n.available_locales.each do |locale|
5
- %li{ :class => (:active if I18n.locale.to_s == locale.to_s) }
6
- = link_to_content_locale(locale)
7
- .clear