kuhsaft 2.1.0 → 2.1.1

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: a644e28bc6049a19a8878e3476d648d7257000e2
4
- data.tar.gz: dd5345fd7f913827a6efb2056cd9f79dfb598f36
3
+ metadata.gz: eb1fd5cd01b12e0073bc958764ab539ee15cbb15
4
+ data.tar.gz: 5234c1898170292b3b0e58907ef2162438920206
5
5
  SHA512:
6
- metadata.gz: a884c25283286b6a15e7b450e6467b870d9220c0e940af760ead60e369fb1a8a6ffaf1a8119d267c0b1ee7743a4f5b216810f0522fb0fc8ab620531198218daa
7
- data.tar.gz: 95fb7cce42f9f7919ea94a4da3e9d47096e15651f32b56ddca2d188c84db3c9f104c1078dac92ae575a078c9c144adf384c21f40f16e32d0bfd254d36a3c1364
6
+ metadata.gz: 4615e27fd351dfbbb4574be8d1fa24548301dbc747658825d4e397f8033162b5549763e8a1af9131c1e0814f47b624be23c0ed84d4771db31f7c61d27cc24894
7
+ data.tar.gz: 03d92616ceefbfc8a7df1ab07322cfd7437bd5e518cc04338620ed126ff1c6fa11375c01ac6ff640d2418f240b14732f3a202bbf434cc5ed85100372ad9d1fa3
@@ -8,14 +8,17 @@
8
8
  #= require jquery_ujs
9
9
  #= require jquery.ui.all
10
10
  #= require bootstrap
11
- #= require ckeditor/init
11
+ #= require ckeditor-jquery
12
12
  #= require jquery.nestable
13
13
  #= require_tree .
14
14
 
15
- CKEDITOR.config.customConfig = '/assets/kuhsaft/cms/ck-config.js'
15
+ # As @ryabrody & @k-graefenhain found out there is obviously a bug which causes the asset_path_helper to return paths always without digest:
16
+ # https://github.com/rails/sprockets-rails/issues/66
17
+ # That's why we need the environment switch here:
18
+ CKEDITOR.config.customConfig = "<%= Rails.env.development? ? asset_path('kuhsaft/cms/ck-config.js') : asset_path('assets/' + Rails.application.assets.find_asset('kuhsaft/cms/ck-config.js').digest_path) %>"
16
19
 
17
20
  loadTextEditor = ->
18
- CKEDITOR.replaceAll('editor')
21
+ CKEDITOR.replaceAll('ckeditor')
19
22
 
20
23
  checkPageType = ->
21
24
  redirect_url_input = $('#page_redirect_url')
@@ -46,7 +49,7 @@ window.initSubmitLinks = (selector = null)->
46
49
 
47
50
  selector.find('a.submit')
48
51
  .click (e)->
49
- $('textarea.editor').each (index, elem) ->
52
+ $('textarea.ckeditor').each (index, elem) ->
50
53
  CKEDITOR.instances[elem.id].updateElement()
51
54
 
52
55
  form = $(this).closest('form')
@@ -150,7 +150,7 @@ form
150
150
  .control-label
151
151
  font-weight: bold
152
152
 
153
- textarea.editor
153
+ textarea.ckeditor
154
154
  height: 263px
155
155
  display: block !important
156
156
  visibility: show !important
@@ -1,6 +1,6 @@
1
1
  module Kuhsaft
2
2
  module Cms
3
- class AdminController < InheritedResources::Base
3
+ class AdminController < ActionController::Base
4
4
  respond_to :html
5
5
  layout 'kuhsaft/cms/application'
6
6
  before_filter :set_content_locale
@@ -16,4 +16,4 @@ module Kuhsaft
16
16
  end
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -3,16 +3,20 @@ module Kuhsaft
3
3
  module PagesHelper
4
4
 
5
5
  def content_tab_active(page)
6
- if page.errors.blank?
7
- :active if page.persisted?
6
+ unless hide_content_tab?(page)
7
+ :active
8
8
  end
9
9
  end
10
10
 
11
11
  def metadata_tab_active(page)
12
- if page.errors.present? || !page.persisted? || page.redirect?
12
+ if hide_content_tab?(page)
13
13
  :active
14
14
  end
15
15
  end
16
+
17
+ def hide_content_tab?(page)
18
+ page.redirect? || !page.translated? || !page.persisted? || page.errors.present?
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -83,6 +83,10 @@ class Kuhsaft::Page < ActiveRecord::Base
83
83
  ancestors
84
84
  end
85
85
 
86
+ def translated?
87
+ url.present? && title.present? && slug.present?
88
+ end
89
+
86
90
  def link
87
91
  if bricks.count == 0 && children.count > 0
88
92
  children.first.link
@@ -5,4 +5,4 @@ var newlyInsertedBrick = $("##{@brick.to_brick_item_id}")
5
5
  initSavePopover(newlyInsertedBrick)
6
6
  initSubmitLinks(newlyInsertedBrick)
7
7
 
8
- $(newlyInsertedBrick).find('textarea.editor').each(function (index, elem) { initCKEditor(elem.id) })
8
+ $(newlyInsertedBrick).find('textarea.ckeditor').each(function (index, elem) { initCKEditor(elem.id) })
@@ -5,4 +5,4 @@ var newlyInsertedBrick = $("##{@brick.to_brick_item_id}")
5
5
  initSavePopover(newlyInsertedBrick)
6
6
  initSubmitLinks(newlyInsertedBrick)
7
7
 
8
- $(newlyInsertedBrick).find('textarea.editor').each(function (index, elem) { initCKEditor(elem.id) })
8
+ $(newlyInsertedBrick).find('textarea.ckeditor').each(function (index, elem) { initCKEditor(elem.id) })
@@ -1,7 +1,7 @@
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
- - unless @page.redirect?
4
+ - unless hide_content_tab?(@page)
5
5
  %li{ :class => content_tab_active(@page) }
6
6
  = link_to t('.tab_content'), '#page-content', 'data-toggle' => :tab
7
7
 
@@ -22,7 +22,7 @@
22
22
  .form-actions
23
23
  = form.button :submit, :class => 'btn btn-primary'
24
24
 
25
- - unless @page.redirect?
25
+ - unless hide_content_tab?(@page)
26
26
  #page-content.tab-pane{ :class => content_tab_active(@page) }
27
27
  - if @page.persisted?
28
28
  .clearfix
@@ -9,7 +9,7 @@
9
9
  = render brick
10
10
 
11
11
  - else
12
- - cache [@page, I18n.locale] do
12
+ - cache [@page, I18n.locale, @page.children] do
13
13
  - unless @page.blank?
14
14
  .page-content
15
15
  -# TODO: refactor into scopes or simplify otherwise:
@@ -1,2 +1,2 @@
1
- = form.input :text, :as => :text, :input_html => { :class => 'editor', :id => "#{brick.to_style_id}-text" }
2
- = form.input :read_more_text, :as => :text, :input_html => { :class => 'editor', :id => "#{brick.to_style_id}-read-more" }
1
+ = form.input :text, :as => :text, :input_html => { :class => 'ckeditor', :id => "#{brick.to_style_id}-text" }
2
+ = form.input :read_more_text, :as => :text, :input_html => { :class => 'ckeditor', :id => "#{brick.to_style_id}-read-more" }
data/lib/kuhsaft.rb CHANGED
@@ -14,6 +14,5 @@ module Kuhsaft
14
14
  require 'ancestry'
15
15
  require 'bootstrap-sass'
16
16
  require 'haml'
17
- require 'ckeditor'
18
- require 'inherited_resources'
17
+ require 'ckeditor_rails'
19
18
  end
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -2,12 +2,14 @@ CKEDITOR.editorConfig = (config) ->
2
2
  config.language = "de"
3
3
  config.removeButtons = "Anchor,Underline,Strike,Subscript,Superscript"
4
4
  config.format_tags = "p;h1;h2;h3;h4;pre"
5
- config.toolbarGroups = [["Format"],
6
- ["Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript"],
7
- ["Table", "HorizontalRule", "SpecialChar"], ["Link", "Unlink"],
8
- ["Undo", "Redo", "-", "RemoveFormat", "Cut", "Copy", "Paste"],
9
- ["Source", "-", "ShowBlocks", "-", "About"],
10
- ["Maximize"]]
5
+ config.toolbar = [["Format"],
6
+ ["Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript"],
7
+ ["Table", "HorizontalRule", "SpecialChar"], ["Link", "Unlink"],
8
+ ["Undo", "Redo", "-", "RemoveFormat", "Cut", "Copy", "Paste"],
9
+ ["Source", "-", "ShowBlocks", "-", "About"],
10
+ ["Maximize"]]
11
+
12
+ true
11
13
 
12
14
  # FULL OPTIONS:
13
15
  #[
@@ -2,12 +2,14 @@ CKEDITOR.editorConfig = (config) ->
2
2
  config.language = "de"
3
3
  config.removeButtons = "Anchor,Underline,Strike,Subscript,Superscript"
4
4
  config.format_tags = "p;h1;h2;h3;h4;pre"
5
- config.toolbarGroups = [["Format"],
6
- ["Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript"],
7
- ["Table", "HorizontalRule", "SpecialChar"], ["Link", "Unlink"],
8
- ["Undo", "Redo", "-", "RemoveFormat", "Cut", "Copy", "Paste"],
9
- ["Source", "-", "ShowBlocks", "-", "About"],
10
- ["Maximize"]]
5
+ config.toolbar = [["Format"],
6
+ ["Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript"],
7
+ ["Table", "HorizontalRule", "SpecialChar"], ["Link", "Unlink"],
8
+ ["Undo", "Redo", "-", "RemoveFormat", "Cut", "Copy", "Paste"],
9
+ ["Source", "-", "ShowBlocks", "-", "About"],
10
+ ["Maximize"]]
11
+
12
+ true
11
13
 
12
14
  # FULL OPTIONS:
13
15
  #[
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kuhsaft::Cms::PagesHelper do
4
+ describe '#content_tab_active' do
5
+ it 'returns active when page has a title and no errors' do
6
+ @page = create(:page, title: 'Page 1', slug: 'page1')
7
+ expect(helper.content_tab_active(@page)).to be(:active)
8
+ end
9
+
10
+ it 'returns nil when page has no translation' do
11
+ @page = create(:page, title: 'Page 1', slug: 'page1')
12
+ I18n.with_locale :de do
13
+ expect(helper.content_tab_active(@page)).to be_nil
14
+ end
15
+ end
16
+ end
17
+
18
+ describe '#metadata_tab_active' do
19
+ it 'returns active when page is not translated' do
20
+ @page = create(:page, title: 'Page 1', slug: 'page1')
21
+ I18n.with_locale :de do
22
+ expect(helper.metadata_tab_active(@page)).to be(:active)
23
+ end
24
+ end
25
+ end
26
+
27
+ describe '#hide_content_tab?' do
28
+ it 'has a page without translations' do
29
+ @page = create(:page, title: 'Page 1', slug: 'page1')
30
+ I18n.with_locale :de do
31
+ expect(helper.hide_content_tab?(@page)).to be_true
32
+ end
33
+ end
34
+
35
+ it 'has a redirect page' do
36
+ @page = create(:page, title: 'Page 1', slug: 'page1', page_type: Kuhsaft::PageType::REDIRECT, redirect_url: 'en/references')
37
+ expect(helper.hide_content_tab?(@page)).to be_true
38
+ end
39
+
40
+ it 'has a not saved page' do
41
+ @page = Kuhsaft::Page.new
42
+ expect(helper.hide_content_tab?(@page)).to be_true
43
+ end
44
+ end
45
+ end
@@ -309,6 +309,20 @@ describe Kuhsaft::Page do
309
309
  end
310
310
  end
311
311
 
312
+ describe '#translated?' do
313
+ it 'returns true when page is translated' do
314
+ @page = create(:page, title: 'Page 1', slug: 'page1')
315
+ expect(@page.translated?).to be_true
316
+ end
317
+
318
+ it 'returns false when page has no translation' do
319
+ @page = create(:page, title: 'Page 1', slug: 'page1')
320
+ I18n.with_locale :de do
321
+ expect(@page.translated?).to be_false
322
+ end
323
+ end
324
+ end
325
+
312
326
  describe '#fulltext' do
313
327
  let :page do
314
328
  p = create(:page, :keywords => 'key words', :description => 'descrip tion', :title => 'my title')
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.1.0
4
+ version: 2.1.1
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-08-21 00:00:00.000000000 Z
15
+ date: 2013-09-03 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -211,19 +211,19 @@ dependencies:
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  - !ruby/object:Gem::Dependency
214
- name: ckeditor
214
+ name: ckeditor_rails
215
215
  requirement: !ruby/object:Gem::Requirement
216
216
  requirements:
217
217
  - - '='
218
218
  - !ruby/object:Gem::Version
219
- version: 4.0.2
219
+ version: '4.2'
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
- version: 4.0.2
226
+ version: '4.2'
227
227
  - !ruby/object:Gem::Dependency
228
228
  name: pg_search
229
229
  requirement: !ruby/object:Gem::Requirement
@@ -322,20 +322,6 @@ dependencies:
322
322
  - - '>='
323
323
  - !ruby/object:Gem::Version
324
324
  version: '0'
325
- - !ruby/object:Gem::Dependency
326
- name: inherited_resources
327
- requirement: !ruby/object:Gem::Requirement
328
- requirements:
329
- - - '>='
330
- - !ruby/object:Gem::Version
331
- version: '0'
332
- type: :runtime
333
- prerelease: false
334
- version_requirements: !ruby/object:Gem::Requirement
335
- requirements:
336
- - - '>='
337
- - !ruby/object:Gem::Version
338
- version: '0'
339
325
  - !ruby/object:Gem::Dependency
340
326
  name: rails
341
327
  requirement: !ruby/object:Gem::Requirement
@@ -399,7 +385,7 @@ extensions: []
399
385
  extra_rdoc_files: []
400
386
  files:
401
387
  - app/assets/javascripts/kuhsaft/application.js.coffee
402
- - app/assets/javascripts/kuhsaft/cms/application.js.coffee
388
+ - app/assets/javascripts/kuhsaft/cms/application.js.coffee.erb
403
389
  - app/assets/javascripts/kuhsaft/views/read_more_view.js.coffee
404
390
  - app/assets/stylesheets/kuhsaft/application.css.sass
405
391
  - app/assets/stylesheets/kuhsaft/cms/application.css.sass
@@ -556,7 +542,6 @@ files:
556
542
  - vendor/assets/stylesheets/nestable.css
557
543
  - Rakefile
558
544
  - README.md
559
- - spec/controllers/kuhsaft/cms/admin_controller_spec.rb
560
545
  - spec/controllers/kuhsaft/pages_controller_spec.rb
561
546
  - spec/dummy/Rakefile
562
547
  - spec/dummy/app/assets/images/spec-image.png
@@ -602,6 +587,7 @@ files:
602
587
  - spec/features/cms_pages_spec.rb
603
588
  - spec/features/search_spec.rb
604
589
  - spec/helpers/kuhsaft/cms/admin_helper_spec.rb
590
+ - spec/helpers/kuhsaft/cms/pages_helper_spec.rb
605
591
  - spec/helpers/kuhsaft/pages_helper_spec.rb
606
592
  - spec/kuhsaft_spec.rb
607
593
  - spec/lib/brick_list_spec.rb
@@ -649,12 +635,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
649
635
  version: '0'
650
636
  requirements: []
651
637
  rubyforge_project: kuhsaft
652
- rubygems_version: 2.0.3
638
+ rubygems_version: 2.0.6
653
639
  signing_key:
654
640
  specification_version: 4
655
641
  summary: A tool that helps you to manage your content within your app.
656
642
  test_files:
657
- - spec/controllers/kuhsaft/cms/admin_controller_spec.rb
658
643
  - spec/controllers/kuhsaft/pages_controller_spec.rb
659
644
  - spec/dummy/Rakefile
660
645
  - spec/dummy/app/assets/images/spec-image.png
@@ -700,6 +685,7 @@ test_files:
700
685
  - spec/features/cms_pages_spec.rb
701
686
  - spec/features/search_spec.rb
702
687
  - spec/helpers/kuhsaft/cms/admin_helper_spec.rb
688
+ - spec/helpers/kuhsaft/cms/pages_helper_spec.rb
703
689
  - spec/helpers/kuhsaft/pages_helper_spec.rb
704
690
  - spec/kuhsaft_spec.rb
705
691
  - spec/lib/brick_list_spec.rb
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Kuhsaft::Cms::AdminController do
4
- subject { described_class }
5
-
6
- it { expect(Kuhsaft::Cms::AdminController.ancestors).to include(InheritedResources::Base) }
7
- end