ecm_cms2 2.0.2 → 2.0.3

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: e1707440044dae2f74e476338ba1cb70beba1f0b
4
- data.tar.gz: 5c38d25ea7c5bc14af5ed74010b0add39288b009
3
+ metadata.gz: 1e6364fc3164fd1c55e586159b1a29398d37b2b0
4
+ data.tar.gz: 3ede2082907be277aa14133b0da47b90833f4555
5
5
  SHA512:
6
- metadata.gz: 2bf055d316ccafcf21289db136779fcbe23483017ef1dd73edfa50f620b5dd102e138a0c923a6b2c85feabd11982f3b857a1a68a8cffd5e6376dff67b17f631d
7
- data.tar.gz: f7c48ee4aef4c8b2ea6769b4ebf3d269f66c4486f524388416cdf4db1a10e34bad71f988238c4205706be5b9d9abbc76d12c83c9e78da5b704804eaee39db5ef
6
+ metadata.gz: fce777ff95913a00b6f0f4df4b51f0659e21e61f994ce2ff636bff931729eb737cbfa8665fffb4c38b1d50e47b1450fc3cbd8e9d77ebcd0d4c4c7e09cf981606
7
+ data.tar.gz: b1193f91d736d099f532f5c17bde07242169a678053b9e8851568ae21bdc66a73138c6eae2b278f5c771d373e8fa22f080c6a4aa2c3e86bd562cb7ba912efa3c
@@ -20,6 +20,7 @@ class Ecm::Cms::PageController < Ecm::Cms::Configuration.base_controller.constan
20
20
  def respond
21
21
  respond_to do |format|
22
22
  format.html { render template: params[:page] }
23
+ format.txt { render template: params[:page], layout: false, formats: [:text] }
23
24
  format.pdf do
24
25
  output = render_to_string template: params[:page], formats: [:html, :pdf], layout: false
25
26
  self.response_body = WickedPdf.new.pdf_from_string(output)
@@ -10,6 +10,9 @@ module Ecm::CmsHelper
10
10
  level_as_array = (level).is_a?(Range) ? level.to_a : [level]
11
11
 
12
12
  navigation = Ecm::Cms::Navigation.where(name: name.to_s, locale: I18n.locale.to_s).first
13
+ if navigation.nil? && (locale = Ecm::Cms::Configuration.navigation_locale_fallback.call(name, I18n.locale))
14
+ navigation = Ecm::Cms::Navigation.where(name: name.to_s, locale: locale).first
15
+ end
13
16
  unless navigation
14
17
  return I18n.t('ecm.cms.navigation.messages.not_found', lang: I18n.locale.to_s, name: name.to_s)
15
18
  end
@@ -0,0 +1 @@
1
+ Mime::Type.register "text/plain", :txt
@@ -25,6 +25,8 @@ module Ecm
25
25
  []
26
26
  end
27
27
 
28
+ mattr_accessor(:navigation_locale_fallback) { ->(navigation_name, locale) {false} }
29
+
28
30
  def default_handlers=(default_handlers)
29
31
  @@default_handlers = HashWithIndifferentAccess.new(default_handlers)
30
32
  end
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Cms
3
- VERSION = '2.0.2'
3
+ VERSION = '2.0.3'
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@ module Ecm
7
7
  source_root File.expand_path('../templates', __FILE__)
8
8
 
9
9
  def generate_intializer
10
- copy_file 'ecm_cms.rb', 'config/initializers/ecm_cms.rb'
10
+ copy_file 'initializer.rb', 'config/initializers/ecm_cms.rb'
11
11
  end
12
12
  end
13
13
  end
@@ -34,4 +34,14 @@ Ecm::Cms.configure do |config|
34
34
  # Default: config.navigation_item_properties = [:data_add_icon]
35
35
  #
36
36
  config.navigation_item_properties = [:data_add_icon]
37
+
38
+ # Fallback to the given locale, if no navigation is found for the actual locale.
39
+ # Set to false to disable fallback. Must be a proc. Two params are passend to the
40
+ # proc: The navigation name and the actual locale.
41
+ #
42
+ # Example: config.navigation_locale_fallback = ->(navigation_name, locale) { navigation_name, localeI18n.locale }
43
+ #
44
+ # Default: config.navigation_locale_fallback = ->(navigation_name, locale) { false }
45
+ #
46
+ config.navigation_locale_fallback = ->(navigation_name, locale) { I18n.default_locale }
37
47
  end
@@ -5,5 +5,11 @@ namespace :ecm do
5
5
  args.with_defaults(view_path: Rails.root.join(*%(app views)), force: false)
6
6
  Ecm::Cms::ImportPartialsService.call(args)
7
7
  end
8
+
9
+ desc 'Adds homepages for all (or given) locales'
10
+ task :add_homepages, [:locales] => [:environment] do |_t, args|
11
+ args.with_defaults(locales: I18n.available_locales)
12
+ Ecm::Cms::AddHomepagesService.call(args)
13
+ end
8
14
  end
9
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_cms2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -434,6 +434,7 @@ files:
434
434
  - app/services/ecm/cms/add_homepages_service.rb
435
435
  - app/services/ecm/cms/import_partials_service.rb
436
436
  - app/views/ecm/cms/_link_to_top.html.erb
437
+ - config/initializers/mime_types.rb
437
438
  - config/locales/ecm.cms.content_box.de.yml
438
439
  - config/locales/ecm.cms.content_box.en.yml
439
440
  - config/locales/ecm.cms.de.yml
@@ -479,7 +480,7 @@ files:
479
480
  - lib/ecm/cms/version.rb
480
481
  - lib/ecm_cms2.rb
481
482
  - lib/generators/ecm/cms/install/install_generator.rb
482
- - lib/generators/ecm/cms/install/templates/ecm_cms.rb
483
+ - lib/generators/ecm/cms/install/templates/initializer.rb
483
484
  - lib/generators/ecm/cms/locales/locales_generator.rb
484
485
  - lib/tasks/ecm_cms_tasks.rake
485
486
  homepage: https://github.com/robotex82/ecm_cms2
@@ -506,3 +507,4 @@ signing_key:
506
507
  specification_version: 4
507
508
  summary: CMS base module for ruby on rails.
508
509
  test_files: []
510
+ has_rdoc: