kuhsaft 1.2.2 → 1.2.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.
@@ -0,0 +1,7 @@
1
+ #= require bootstrap
2
+ #= require_self
3
+ #= require_tree ./views
4
+
5
+ $ ->
6
+ $('.kuhsaft-text-brick').each ->
7
+ new ReadMoreView($(this))
@@ -35,6 +35,28 @@ sortableBrick = ->
35
35
  $(this).children('form').trigger('submit')
36
36
  )
37
37
 
38
+ window.initSubmitLinks = (selector = null)->
39
+ selector ||= $('body')
40
+
41
+ selector.find('a.submit')
42
+ .click (e)->
43
+ form = $(this).closest('form')
44
+ form.submit()
45
+ e.preventDefault()
46
+
47
+ window.initSavePopover = (selector) ->
48
+ link = selector.find('a.submit')
49
+ link.popover(placement: 'top', trigger: 'manual')
50
+
51
+ # initial delay
52
+ setTimeout ->
53
+ link.popover('show')
54
+ # fade out delay
55
+ setTimeout ->
56
+ link.popover('hide')
57
+ , 1500
58
+ , 50
59
+
38
60
  $(document).ajaxSuccess ->
39
61
  loadTextEditor($("body"))
40
62
  sortableBrick()
@@ -43,6 +65,7 @@ $(document).ready ->
43
65
  loadTextEditor($(document))
44
66
  checkPageType()
45
67
  sortableBrick()
68
+ initSubmitLinks()
46
69
  $('#page_page_type').change ->
47
70
  checkPageType()
48
71
 
@@ -0,0 +1,17 @@
1
+ class window.ReadMoreView
2
+
3
+ constructor: (readMoreElem)->
4
+ @readMoreElem = readMoreElem
5
+ @readMoreElem.on 'show', @handleShow
6
+ @readMoreElem.on 'hide', @handleClose
7
+ @readMoreElem.find('.button-read-more').on 'click', @handleClick
8
+
9
+ handleShow: (e) =>
10
+ @readMoreElem.addClass('is-open')
11
+
12
+ handleClose: (e) =>
13
+ @readMoreElem.removeClass('is-open')
14
+
15
+ handleClick: (e) =>
16
+ if e.preventDefault
17
+ e.preventDefault()
@@ -1,4 +1,4 @@
1
- // = require_self
1
+ //= require_self
2
2
 
3
3
  @import bootstrap
4
-
4
+ @import modules/*
@@ -88,6 +88,7 @@ form
88
88
  border: 1px solid #e3e3e3
89
89
  // collapse multiple borders
90
90
  margin: -1px
91
+ background: #fff
91
92
 
92
93
  .brick-item-content
93
94
  padding: 1em
@@ -0,0 +1,11 @@
1
+ .kuhsaft-text-brick
2
+ .read-more-text
3
+ display: block
4
+ .read-less-text
5
+ display: none
6
+
7
+ &.is-open
8
+ .read-more-text
9
+ display: none
10
+ .read-less-text
11
+ display: block
@@ -58,4 +58,11 @@ module PagesHelper
58
58
  def current_page_class page
59
59
  :current if active_page_class(page) == :active
60
60
  end
61
+
62
+ def read_more_link(id)
63
+ link_to(id, :'data-toggle' => 'collapse', :'data-target' => id, :class => 'button button-read-more') do
64
+ @content = content_tag(:p, t('.read_more'), :class => 'read-more-text')
65
+ @content << content_tag(:p, t('.read_less'), :class => 'read-less-text')
66
+ end
67
+ end
61
68
  end
@@ -0,0 +1,19 @@
1
+ module Kuhsaft
2
+ class AnchorBrick < Brick
3
+ attr_accessible :caption
4
+
5
+ validates :caption, :presence => true
6
+
7
+ def user_can_add_childs?
8
+ false
9
+ end
10
+
11
+ def collect_fulltext
12
+ [super, caption].join(' ')
13
+ end
14
+
15
+ def to_id
16
+ "anchor-#{caption.parameterize}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1 @@
1
+ %div{ :class => anchor_brick.to_style_class, :id => anchor_brick.to_id }
@@ -0,0 +1 @@
1
+ = form.input :caption, :as => :string, :input_html => { :class => 'span6' }
@@ -27,7 +27,8 @@
27
27
  - # save button
28
28
  .clearfix
29
29
  .pull-right
30
- = form.button :submit, :class => 'btn btn-success btn-small ', :value => t('.save')
30
+ %a.submit{ :href => '#', :class => 'btn btn-success btn-small ', 'data-title' => '', 'data-content' => t('.saved') }
31
+ = t('.save')
31
32
 
32
33
 
33
34
  - if brick.renders_own_childs?
@@ -1,2 +1,6 @@
1
1
  $("##{@brick.to_brick_item_id}").replaceWith("#{j(render('kuhsaft/cms/bricks/brick_item', :brick => @brick))}")
2
- $("##{@brick.to_brick_item_id}").addClass("saved")
2
+
3
+ // need a reference to the new dom node, so a new query is needed here
4
+ var newlyInsertedBrick = $("##{@brick.to_brick_item_id}")
5
+ initSavePopover(newlyInsertedBrick)
6
+ initSubmitLinks(newlyInsertedBrick)
@@ -1,12 +1,10 @@
1
1
  %div{ :class => text_brick.to_style_class }
2
2
  - if text_brick.read_more_text.present?
3
- .expandable{ :id => text_brick.to_style_id }
4
- = text_brick.text.html_safe
5
- %a.more{ :href => '#' }
6
- = t('.read_more')
7
- .expandable-content.hidden
8
- = text_brick.read_more_text.to_s.html_safe
9
- %a.less{ :href => "##{text_brick.to_style_id}" }
10
- = t('.read_less')
3
+ = text_brick.text.html_safe
4
+
5
+ = read_more_link("##{text_brick.to_style_id}")
6
+ %div.collapse{ :id => text_brick.to_style_id }
7
+ = text_brick.read_more_text.to_s.html_safe
8
+
11
9
  - else
12
10
  = text_brick.text.to_s.html_safe
@@ -0,0 +1,7 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ kuhsaft/anchor_brick: 'Anker'
5
+ attributes:
6
+ kuhsaft/anchor_brick:
7
+ caption: 'Name'
@@ -3,6 +3,7 @@ de:
3
3
  cms:
4
4
  bricks:
5
5
  brick_item:
6
- save: 'Speichern '
6
+ save: 'Speichern ...'
7
+ saved: 'Gespeichert! ✔'
7
8
  confirm: 'Wirklich löschen?'
8
9
  empty: 'Hier ist noch nichts.'
@@ -8,7 +8,7 @@ class CreateKuhsaftBricks < ActiveRecord::Migration
8
8
  t.string :locale # all bricks
9
9
  t.text :text # TextBrick
10
10
  t.text :read_more_text # TextBrick
11
- t.string :caption # LinkBrick, ImageBrick, #AccordionItemBrick
11
+ t.string :caption # LinkBrick, ImageBrick, AccordionItemBrick, AnchorBrick
12
12
  t.text :href # LinkBrick, ImageBrick, VideoBrick
13
13
  t.string :link_style # LinkBrick
14
14
  t.integer :partitioning # TwoColumnBrick
@@ -9,3 +9,4 @@ Kuhsaft::BrickType.create(:class_name => 'Kuhsaft::TwoColumnBrick', :group => 'l
9
9
  Kuhsaft::BrickType.create(:class_name => 'Kuhsaft::SliderBrick', :group => 'elements')
10
10
  Kuhsaft::BrickType.create(:class_name => 'Kuhsaft::ImageBrick', :group => 'elements')
11
11
  Kuhsaft::BrickType.create(:class_name => 'Kuhsaft::PlaceholderBrick', :group => 'elements')
12
+ Kuhsaft::BrickType.create(:class_name => 'Kuhsaft::AnchorBrick', :group => 'elements')
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kuhsaft::AnchorBrick do
4
+
5
+ let :anchor_brick do
6
+ Kuhsaft::AnchorBrick.new(:caption => 'test-anchor')
7
+ end
8
+
9
+ describe '#bricks' do
10
+ it 'can not have childs' do
11
+ anchor_brick.should_not respond_to(:bricks)
12
+ end
13
+ end
14
+
15
+ describe '#user_can_add_childs?' do
16
+ it 'returns false' do
17
+ anchor_brick.user_can_add_childs?.should be_false
18
+ end
19
+ end
20
+
21
+ describe '#to_id' do
22
+ it 'returns a parameterized id' do
23
+ anchor_brick.to_id.should == 'anchor-test-anchor'
24
+ end
25
+ end
26
+ 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: 1.2.2
4
+ version: 1.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-02-26 00:00:00.000000000 Z
14
+ date: 2013-02-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
@@ -307,12 +307,14 @@ executables: []
307
307
  extensions: []
308
308
  extra_rdoc_files: []
309
309
  files:
310
- - app/assets/javascripts/kuhsaft/application.js
310
+ - app/assets/javascripts/kuhsaft/application.js.coffee
311
311
  - app/assets/javascripts/kuhsaft/cms/application.js.coffee
312
312
  - app/assets/javascripts/kuhsaft/cms/customizations.js
313
+ - app/assets/javascripts/kuhsaft/views/read_more_view.js.coffee
313
314
  - app/assets/stylesheets/kuhsaft/application.css.sass
314
315
  - app/assets/stylesheets/kuhsaft/cms/application.css.sass
315
316
  - app/assets/stylesheets/kuhsaft/cms/customizations.css.sass
317
+ - app/assets/stylesheets/kuhsaft/modules/_text_brick.css.sass
316
318
  - app/controllers/kuhsaft/application_controller.rb
317
319
  - app/controllers/kuhsaft/cms/admin_controller.rb
318
320
  - app/controllers/kuhsaft/cms/assets_controller.rb
@@ -326,6 +328,7 @@ files:
326
328
  - app/helpers/pages_helper.rb
327
329
  - app/models/kuhsaft/accordion_brick.rb
328
330
  - app/models/kuhsaft/accordion_item_brick.rb
331
+ - app/models/kuhsaft/anchor_brick.rb
329
332
  - app/models/kuhsaft/asset.rb
330
333
  - app/models/kuhsaft/brick.rb
331
334
  - app/models/kuhsaft/brick_type.rb
@@ -350,6 +353,8 @@ files:
350
353
  - app/views/kuhsaft/accordion_bricks/accordion_brick/_edit.html.haml
351
354
  - app/views/kuhsaft/accordion_item_bricks/_accordion_item_brick.html.haml
352
355
  - app/views/kuhsaft/accordion_item_bricks/accordion_item_brick/_edit.html.haml
356
+ - app/views/kuhsaft/anchor_bricks/_anchor_brick.html.haml
357
+ - app/views/kuhsaft/anchor_bricks/anchor_brick/_edit.html.haml
353
358
  - app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml
354
359
  - app/views/kuhsaft/cms/admin/_content_language_switch.html.haml
355
360
  - app/views/kuhsaft/cms/admin/_empty_state.html.haml
@@ -396,6 +401,7 @@ files:
396
401
  - config/locales/kuhsaft.en.yml
397
402
  - config/locales/models/kuhsaft/accordion_brick/de.yml
398
403
  - config/locales/models/kuhsaft/accordion_item_brick/de.yml
404
+ - config/locales/models/kuhsaft/anchor_brick/de.yml
399
405
  - config/locales/models/kuhsaft/column_brick/de.yml
400
406
  - config/locales/models/kuhsaft/image_brick/de.yml
401
407
  - config/locales/models/kuhsaft/image_size/de.yml
@@ -477,6 +483,7 @@ files:
477
483
  - spec/lib/translatable_spec.rb
478
484
  - spec/models/accordion_brick_spec.rb
479
485
  - spec/models/accordion_item_brick_spec.rb
486
+ - spec/models/anchor_brick_spec.rb
480
487
  - spec/models/asset_spec.rb
481
488
  - spec/models/brick_spec.rb
482
489
  - spec/models/brick_type_filter_spec.rb
@@ -507,7 +514,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
507
514
  version: '0'
508
515
  segments:
509
516
  - 0
510
- hash: 958653048592020401
517
+ hash: 615329233639926034
511
518
  required_rubygems_version: !ruby/object:Gem::Requirement
512
519
  none: false
513
520
  requirements:
@@ -516,7 +523,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
516
523
  version: '0'
517
524
  segments:
518
525
  - 0
519
- hash: 958653048592020401
526
+ hash: 615329233639926034
520
527
  requirements: []
521
528
  rubyforge_project: kuhsaft
522
529
  rubygems_version: 1.8.24
@@ -565,6 +572,7 @@ test_files:
565
572
  - spec/lib/translatable_spec.rb
566
573
  - spec/models/accordion_brick_spec.rb
567
574
  - spec/models/accordion_item_brick_spec.rb
575
+ - spec/models/anchor_brick_spec.rb
568
576
  - spec/models/asset_spec.rb
569
577
  - spec/models/brick_spec.rb
570
578
  - spec/models/brick_type_filter_spec.rb
@@ -1,2 +0,0 @@
1
- //= require bootstrap
2
- //= require_self