kuhsaft 2.3.2 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14bb5aeb1a5309483829aab10bf7bceac2e38b3c
4
- data.tar.gz: 5dded00a1779710696198f876f92fb1ba42af761
3
+ metadata.gz: 23a7e481b85437904c69767c374fd47f697b8ac7
4
+ data.tar.gz: 1059cc4a31bc8d46d0fe0341221bb6cc469f5c47
5
5
  SHA512:
6
- metadata.gz: 0daea3d88813548db540a8bc18c36cdc482caf6e18fc3b0f62946fa77ba9d092030d9f2866a51c4336c17c497ca159151106ce1f947d7b651f77ae4342b0092e
7
- data.tar.gz: fdfd8ce2ab6565e7848e6ecb63faaac81cb362b5dd3245003dbb265797d94bd0e463d0d3e695c61f3141ec664c73e8bf4d49ccbcf9c69846e2d43e170058e110
6
+ metadata.gz: e530b6adab5c29963d6f4d95a52c0174b9a973e4ea3b2f31c9896695ef8085519570c80b5dc019ea9516b59eae822584f45404f4d6cd14cb3ed758d7950038c5
7
+ data.tar.gz: 7e28072b2f648c183bc78e9bdda0f67c9975a68e8e96ce61da26b755789fe247dad422f5b33faaa01d2bf7639200514f5958a52aef35108f3f3420ac71f58e68
data/README.md CHANGED
@@ -183,6 +183,17 @@ de:
183
183
  style2: 'My Style 2'
184
184
  ```
185
185
 
186
+ ## Configuring Grid settings for Bricks
187
+
188
+ Include the Kuhsaft::Gridded Module on every Brick you want to display in a grid. Default grid options are 1 to 12 (representing columns) wich can be configured via the class method `available_grid_sizes` (should return an array of integers).
189
+ Each instance of a gridded class will have a method `gridded?` wich returns true if a column size is set.
190
+
191
+ If the Gridded Module is added to a Custom Brick, it should provide a col_count integer field with default value 0.
192
+
193
+ ```
194
+ add_column :your_awesome_brick, :col_count, :integer, default: 0
195
+ ```
196
+
186
197
  ## Adding custom templates with placeholder bricks
187
198
 
188
199
  * Save your partial in `views/kuhsaft/placeholder_bricks/partials/_your_partial.html.haml`
@@ -169,13 +169,13 @@ form
169
169
  .modal-body
170
170
  max-height: none
171
171
 
172
- #display-styles
173
- position: absolute
174
- top: 7px
175
- right: 15px
172
+ .btn-group
173
+ position: relative
174
+ top: -10px
175
+ padding-left: 10px
176
176
 
177
177
  .control-group.text
178
- height: 310px
178
+ min-height: 310px
179
179
 
180
180
  textarea
181
181
  height: 263px
@@ -0,0 +1,43 @@
1
+ .pull-left
2
+ - if brick_content.present?
3
+ .resize-toggler.btn.btn-small{ 'data-toggle' => 'collapse', 'data-target' => "#brick-content-#{brick.id}" }
4
+ %i.icon-resize-full
5
+ %i.icon-resize-small
6
+ - if brick.caption.present?
7
+ = brick.caption
8
+ %span.muted
9
+ = brick.backend_label(parenthesis: true)
10
+ .pull-right
11
+ .btn-toolbar
12
+ - if brick.persisted?
13
+
14
+ - # addable child dropdown menu
15
+ - if brick.respond_to?(:brick_list)
16
+ .btn-group
17
+ = render('brick_type_dropdown', brick_list: brick)
18
+
19
+ - # grid selection
20
+ - if brick.class.include? Kuhsaft::Gridded
21
+ .btn-group
22
+ %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
23
+ %i.icon-th
24
+ %span.caret
25
+ %ul.dropdown-menu.pull-right
26
+ %li
27
+ = form.input :col_count, collection: brick.class.available_grid_sizes, as: :radio_buttons, label_method: lambda { |col_count| t("kuhsaft.cms.bricks.columns", count: col_count) }
28
+
29
+ - # possible styles
30
+ - unless brick.available_display_styles.empty?
31
+ #display-styles.btn-group
32
+ %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
33
+ %i.icon-tint
34
+ %span.caret
35
+ %ul.dropdown-menu.pull-right
36
+ %li
37
+ = form.input :display_styles, collection: brick.translated_available_display_styles, as: :check_boxes
38
+
39
+ -# delete button
40
+ - if brick.user_can_delete?
41
+ .btn-group
42
+ = link_to kuhsaft.cms_brick_path(brick), class: 'btn btn-small btn-danger', data: { confirm: t('kuhsaft.cms.bricks.brick_item.confirm') }, method: :delete, remote: true do
43
+ %i.icon-trash.icon-white
@@ -1,57 +1,25 @@
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 => !brick.uploader?, :html => { :id => nil }, :wrapper => :bootstrap do |form|
3
- = form.hidden_field :position, :class => 'position-field'
4
- - brick_content = render(brick.to_edit_partial_path, :brick => brick, :form => form)
5
- .brick-item-header.clearfix
6
- .pull-left
7
- - if brick_content.present?
8
- .resize-toggler.btn.btn-small{ 'data-toggle' => 'collapse', 'data-target' => "#brick-content-#{brick.id}" }
9
- %i.icon-resize-full
10
- %i.icon-resize-small
11
- - if brick.caption.present?
12
- = brick.caption
13
- %span.muted
14
- = brick.backend_label(:parenthesis => true)
15
- .pull-right
16
- .btn-toolbar
17
- - if brick.persisted?
18
-
19
- - # possible styles
20
- - unless brick.available_display_styles.empty?
21
- #display-styles.btn-group
22
- .btn.btn-small
23
- %i.icon-tint
24
- %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
25
- %span.caret
26
- %ul.dropdown-menu.pull-right
27
- %li
28
- = form.input :display_styles, :collection => brick.translated_available_display_styles, :as => :check_boxes
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: !brick.uploader?, html: { id: nil }, wrapper: :bootstrap do |form|
3
+ = form.hidden_field :position, class: 'position-field'
4
+ - brick_content = render(brick.to_edit_partial_path, brick: brick, form: form)
29
5
 
30
- -# delete button
31
- - if brick.user_can_delete?
32
- .btn-group
33
- = link_to kuhsaft.cms_brick_path(brick), :class => 'btn btn-small btn-danger', data: { confirm: t('kuhsaft.cms.bricks.brick_item.confirm') }, :method => :delete, :remote => true do
34
- %i.icon-trash.icon-white
35
-
36
- - # addable child dropdown menu
37
- - if brick.respond_to?(:brick_list)
38
- .btn-group
39
- = render 'brick_type_dropdown', :brick_list => brick
6
+ .brick-item-header.clearfix
7
+ = render('kuhsaft/cms/bricks/brick_header', brick: brick, brick_content: brick_content, form: form)
40
8
 
41
9
  - if brick_content.present?
42
- .brick-item-content.collapse.in{ :id => "brick-content-#{brick.id}", 'data-toggle' => true }
10
+ .brick-item-content.collapse.in{ id: "brick-content-#{brick.id}", 'data-toggle' => true }
43
11
  = brick_content
44
12
  - if brick.user_can_save?
45
13
  - # save button
46
14
  .clearfix
47
15
  .pull-right
48
- %a.submit{ :href => '#', :class => 'btn btn-success btn-small ', 'data-title' => '', 'data-content' => t('.saved') }
16
+ %a.submit{ href: '#', class: 'btn btn-success btn-small ', 'data-title' => '', 'data-content' => t('.saved') }
49
17
  = t('.save')
50
18
 
51
19
  - if brick.renders_own_childs?
52
20
  .brick-item-childs
53
- = render brick.to_edit_childs_partial_path, :brick => brick
21
+ = render(brick.to_edit_childs_partial_path, brick: brick)
54
22
  - else
55
23
  - if brick.respond_to?(:bricks)
56
24
  .brick-item-childs
57
- = render 'kuhsaft/cms/bricks/brick_list', :brick_list => brick
25
+ = render('kuhsaft/cms/bricks/brick_list', brick_list: brick)
@@ -14,14 +14,22 @@
14
14
 
15
15
  - unless @brick.available_display_styles.empty?
16
16
  #display-styles.btn-group.pull-right
17
- .btn.btn-small
18
- %i.icon-tint
19
17
  %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
18
+ %i.icon-tint
20
19
  %span.caret
21
20
  %ul.dropdown-menu.pull-right
22
21
  %li
23
22
  = form.input :display_styles, :collection => @brick.translated_available_display_styles, :as => :check_boxes
24
23
 
24
+ - if brick.class.include? Kuhsaft::Gridded
25
+ .btn-group.pull-right
26
+ %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
27
+ %i.icon-th
28
+ %span.caret
29
+ %ul.dropdown-menu.pull-right
30
+ %li
31
+ = form.input :col_count, collection: brick.class.available_grid_sizes, as: :radio_buttons, label_method: lambda { |col_count| t("kuhsaft.cms.bricks.columns", count: col_count) }
32
+
25
33
  - if brick_content.present?
26
34
  = brick_content
27
35
  - else
@@ -8,7 +8,17 @@ de:
8
8
  confirm: 'Wirklich löschen?'
9
9
  empty: 'Hier ist noch nichts.'
10
10
 
11
+ columns:
12
+ zero: Nicht ins Grid integrieren
13
+ one: "%{count} Spalte"
14
+ other: "%{count} Spalten"
15
+
11
16
  image_bricks:
12
17
  image_brick:
13
18
  edit:
14
19
  image_preview: 'Vorschau'
20
+
21
+ activerecord:
22
+ attributes:
23
+ kuhsaft/brick:
24
+ col_count: 'Breite im Grid'
@@ -0,0 +1,5 @@
1
+ class AddColCountToBricks < ActiveRecord::Migration
2
+ def change
3
+ add_column :kuhsaft_bricks, :col_count, :integer, default: 0
4
+ end
5
+ end
@@ -4,6 +4,7 @@ module Kuhsaft
4
4
  require 'kuhsaft/image_uploader_mounting'
5
5
  require 'kuhsaft/translatable'
6
6
  require 'kuhsaft/searchable'
7
+ require 'kuhsaft/gridded'
7
8
  require 'kuhsaft/brick_list'
8
9
  require 'kuhsaft/partial_extractor'
9
10
  require 'kuhsaft/touch_placeholders'
@@ -0,0 +1,20 @@
1
+ module Kuhsaft
2
+ module Gridded
3
+ def self.included(base)
4
+ base.extend(ClassMethods)
5
+ base.send :include, InstanceMethods
6
+ end
7
+
8
+ module InstanceMethods
9
+ def gridded?
10
+ col_count != 0
11
+ end
12
+ end
13
+
14
+ module ClassMethods
15
+ def available_grid_sizes
16
+ (0..12).to_a
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = '2.3.2'
2
+ VERSION = '2.3.3'
3
3
  end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kuhsaft::Gridded do
4
+
5
+ context 'included gridded module' do
6
+ class GridClass
7
+ include Kuhsaft::Gridded
8
+ end
9
+
10
+ it 'returns an array for the gridded class' do
11
+ expect(GridClass.available_grid_sizes).to be_kind_of(Array)
12
+ end
13
+
14
+ it 'returns false on gridded? if no col count is set' do
15
+ expect_any_instance_of(GridClass).to receive(:col_count).at_least(:once).and_return(0)
16
+ expect(GridClass.new.gridded?).to be_false
17
+ end
18
+
19
+ it 'returns true on gridded? if a col count is set' do
20
+ expect_any_instance_of(GridClass).to receive(:col_count).at_least(:once).and_return(10)
21
+ expect(GridClass.new.gridded?).to be_true
22
+ end
23
+ end
24
+ 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.3.2
4
+ version: 2.3.3
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: 2014-04-02 00:00:00.000000000 Z
15
+ date: 2014-04-16 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -539,6 +539,7 @@ files:
539
539
  - app/views/kuhsaft/cms/assets/edit.html.haml
540
540
  - app/views/kuhsaft/cms/assets/index.html.haml
541
541
  - app/views/kuhsaft/cms/assets/new.html.haml
542
+ - app/views/kuhsaft/cms/bricks/_brick_header.html.haml
542
543
  - app/views/kuhsaft/cms/bricks/_brick_item.html.haml
543
544
  - app/views/kuhsaft/cms/bricks/_brick_list.html.haml
544
545
  - app/views/kuhsaft/cms/bricks/_new.html.haml
@@ -627,12 +628,14 @@ files:
627
628
  - db/migrate/15_add_alt_text_to_bricks.rb
628
629
  - db/migrate/16_update_default_value_for_page_type.rb
629
630
  - db/migrate/17_set_page_type_to_content_for_empty_fields.rb
630
- - db/migrate/20140327141200_add_identifier_to_kuhsaft_pages.rb
631
+ - db/migrate/18_add_identifier_to_kuhsaft_pages.rb
632
+ - db/migrate/19_add_col_count_to_bricks.rb
631
633
  - db/seeds.rb
632
634
  - lib/generators/kuhsaft/assets/install_generator.rb
633
635
  - lib/generators/kuhsaft/translations/add_generator.rb
634
636
  - lib/kuhsaft/brick_list.rb
635
637
  - lib/kuhsaft/engine.rb
638
+ - lib/kuhsaft/gridded.rb
636
639
  - lib/kuhsaft/image_uploader_mounting.rb
637
640
  - lib/kuhsaft/orderable.rb
638
641
  - lib/kuhsaft/page_tree.rb
@@ -706,6 +709,7 @@ files:
706
709
  - spec/kuhsaft_spec.rb
707
710
  - spec/lib/brick_list_spec.rb
708
711
  - spec/lib/engine_spec.rb
712
+ - spec/lib/gridded_spec.rb
709
713
  - spec/lib/image_uploader_mounting_spec.rb
710
714
  - spec/lib/page_tree_spec.rb
711
715
  - spec/lib/searchable_spec.rb
@@ -810,6 +814,7 @@ test_files:
810
814
  - spec/kuhsaft_spec.rb
811
815
  - spec/lib/brick_list_spec.rb
812
816
  - spec/lib/engine_spec.rb
817
+ - spec/lib/gridded_spec.rb
813
818
  - spec/lib/image_uploader_mounting_spec.rb
814
819
  - spec/lib/page_tree_spec.rb
815
820
  - spec/lib/searchable_spec.rb