kuhsaft 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/kuhsaft/cms/{application.js.coffee → application.js.coffee.erb} +7 -4
- data/app/assets/stylesheets/kuhsaft/cms/application.css.sass +1 -1
- data/app/controllers/kuhsaft/cms/admin_controller.rb +2 -2
- data/app/helpers/kuhsaft/cms/pages_helper.rb +7 -3
- data/app/models/kuhsaft/page.rb +4 -0
- data/app/views/kuhsaft/cms/bricks/create.js.haml +1 -1
- data/app/views/kuhsaft/cms/bricks/update.js.haml +1 -1
- data/app/views/kuhsaft/cms/pages/_form.html.haml +2 -2
- data/app/views/kuhsaft/pages/show.html.haml +1 -1
- data/app/views/kuhsaft/text_bricks/text_brick/_edit.html.haml +2 -2
- data/lib/kuhsaft.rb +1 -2
- data/lib/kuhsaft/version.rb +1 -1
- data/lib/templates/kuhsaft/assets/ck-config.js.coffee +8 -6
- data/spec/dummy/app/assets/javascripts/kuhsaft/cms/ck-config.js.coffee +8 -6
- data/spec/helpers/kuhsaft/cms/pages_helper_spec.rb +45 -0
- data/spec/models/page_spec.rb +14 -0
- metadata +9 -23
- data/spec/controllers/kuhsaft/cms/admin_controller_spec.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb1fd5cd01b12e0073bc958764ab539ee15cbb15
|
4
|
+
data.tar.gz: 5234c1898170292b3b0e58907ef2162438920206
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
11
|
+
#= require ckeditor-jquery
|
12
12
|
#= require jquery.nestable
|
13
13
|
#= require_tree .
|
14
14
|
|
15
|
-
|
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('
|
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.
|
52
|
+
$('textarea.ckeditor').each (index, elem) ->
|
50
53
|
CKEDITOR.instances[elem.id].updateElement()
|
51
54
|
|
52
55
|
form = $(this).closest('form')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Kuhsaft
|
2
2
|
module Cms
|
3
|
-
class AdminController <
|
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
|
-
|
7
|
-
:active
|
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
|
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
|
data/app/models/kuhsaft/page.rb
CHANGED
@@ -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.
|
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.
|
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
|
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
|
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
|
@@ -1,2 +1,2 @@
|
|
1
|
-
= form.input :text, :as => :text, :input_html => { :class => '
|
2
|
-
= form.input :read_more_text, :as => :text, :input_html => { :class => '
|
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
data/lib/kuhsaft/version.rb
CHANGED
@@ -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.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
data/spec/models/page_spec.rb
CHANGED
@@ -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.
|
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-
|
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:
|
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.
|
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.
|
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.
|
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
|