enjoy_cms 0.3.6.2 → 0.3.7

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: c158c7ee68ca2a611f66332947e0139f9b61b9bd
4
- data.tar.gz: 3bdb3f23ee1119a132168dfa34a6bac5b20308e9
3
+ metadata.gz: d1498d8db8ce0758077a4c20c2cec3ea63c0c228
4
+ data.tar.gz: cb2ef030d270a5be3c8d80c5562cd0573a4fddff
5
5
  SHA512:
6
- metadata.gz: 96f31a367452269b83a3ed89a43ffcba7a8ad283c4480ca3707d59c2072d22abfabb7259b65f48a4ec109545ec7d117380368f38aac9fec49df4676b294061d2
7
- data.tar.gz: ecf0efcd23fd851673fe725ddcdef0146a011483ddb1fce4602fef41a0a7f571795d45e2fb280cabff4a30c245e3eeaa650b0c11584ba7cad5407e21632953b1
6
+ metadata.gz: 5c48c1f6b9eacfd8d2b06dcd842250d1278480cb55cb144dc0db6216dfc9365270147214950189f6a85a12bbdf05b8af81ce50dd59c7768f3ecf582e7170f5ba
7
+ data.tar.gz: d06dcaae72d76c9f9ceed2b0a984249be281891bbddf7d809ee10219ad7afed42c1e87a21aefe2093efd7c37dcaf31ed0d21761360ec10db66c907006358df91
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enjoy_cms (0.3.6.2)
4
+ enjoy_cms (0.3.7)
5
5
  ack_rails_admin_jcrop
6
6
  addressable
7
7
  ckeditor
@@ -12,7 +12,7 @@ PATH
12
12
  jquery-rails
13
13
  kaminari
14
14
  rails (= 4.2.4)
15
- rails_admin
15
+ rails_admin (~> 0.8.1)
16
16
  rails_admin_mongoid_localize_field
17
17
  rails_admin_nested_set
18
18
  rails_admin_settings
@@ -195,7 +195,7 @@ GEM
195
195
  activesupport (= 4.2.4)
196
196
  rake (>= 0.8.7)
197
197
  thor (>= 0.18.1, < 2.0)
198
- rake (11.0.1)
198
+ rake (11.1.1)
199
199
  remotipart (1.2.1)
200
200
  responders (2.1.1)
201
201
  railties (>= 4.2.0, < 5.1)
@@ -9,7 +9,7 @@ module Enjoy::Localizeable
9
9
  end
10
10
  private
11
11
  def default_url_options(options={})
12
- {locale: params[:locale]}
12
+ {locale: I18n.locale}
13
13
  end
14
14
  def nav_get_menu_items(type)
15
15
  pages = menu_class.find(type.to_s).pages.enabled
@@ -38,11 +38,16 @@ module Enjoy::Localizeable
38
38
  else
39
39
  _url = item.redirect.blank? ? item.fullpath : item.redirect
40
40
  end
41
- (params[:locale].blank? ? "" : "/#{params[:locale]}") + _url
41
+ _localizable_regexp = Regexp.new("^(#{I18n.available_locales.map { |l| "\\/#{l}"}.join("|")})")
42
+ ((params[:locale].blank? or _url != _localizable_regexp) ? "" : "/#{params[:locale]}") + _url
42
43
  end
43
44
  def find_seo_extra(path)
44
45
  _localizable_regexp = Regexp.new("^(#{I18n.available_locales.map { |l| "\\/#{l}"}.join("|")})")
45
- page_class.enabled.where(fullpath: path.sub(_localizable_regexp, "")).first
46
+ _path = path.sub(_localizable_regexp, "")
47
+ if _path[0] != '/'
48
+ _path = '/' + _path
49
+ end
50
+ page_class.enabled.where(fullpath: _path).first
46
51
  end
47
52
 
48
53
  def page_class_name
@@ -2,6 +2,7 @@ module Enjoy
2
2
  class HomeController < ApplicationController
3
3
 
4
4
  def index
5
+ render layout: Enjoy.config.main_index_layout
5
6
  end
6
7
 
7
8
  include Enjoy::Decorators::Home
@@ -1 +1,8 @@
1
- = form.text_area field.string_method, rows: 10, cols: 80, class: 'form-control'
1
+ ruby:
2
+ _opts = {}
3
+ _opts[:rows] = 10
4
+ _opts[:cols] = 80
5
+ _opts[:class] = 'form-control'
6
+ _opts[:value] = field.formatted_value
7
+ _opts[:style] = "font-family: monospace"
8
+ = form.text_area field.string_method, _opts
@@ -2,6 +2,26 @@
2
2
 
3
3
  ru:
4
4
  admin:
5
+ js:
6
+ true: Да
7
+ false: Нет
8
+ is_present: Существует
9
+ is_blank: Пустое
10
+ date: Дата ...
11
+ between_and_: Между ... и ...
12
+ today: Сегодня
13
+ yesterday: Вчера
14
+ this_week: На этой неделе
15
+ last_week: На прошлой неделе
16
+ number: Номер ...
17
+ contains: Содержит
18
+ is_exactly: В точности
19
+ starts_with: Начинается с
20
+ ends_with: Кончается на
21
+ too_many_objects: "Слишком много объектов, используйте фильтры и поиск"
22
+ no_objects: Ничего не найдено
23
+ loading: Загрузка...
24
+ toggle_navigation: Скрыть/Показать навигацию
5
25
  home:
6
26
  name: "Главная"
7
27
  pagination:
data/enjoy_cms.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency 'devise'
30
30
  spec.add_dependency 'turbolinks'
31
31
  spec.add_dependency 'validates_email_format_of'
32
- spec.add_dependency 'rails_admin'
32
+ spec.add_dependency 'rails_admin', '~> 0.8.1'
33
33
  spec.add_dependency 'rails_admin_nested_set'
34
34
  spec.add_dependency 'rails_admin_toggleable'
35
35
 
@@ -7,10 +7,18 @@ module Enjoy
7
7
  field :c_at do
8
8
  read_only true
9
9
  end
10
- field :name
11
- field :content, :text
12
- field :email
13
- field :phone
10
+ field :name do
11
+ searchable true
12
+ end
13
+ field :content, :text do
14
+ searchable true
15
+ end
16
+ field :email do
17
+ searchable true
18
+ end
19
+ field :phone do
20
+ searchable true
21
+ end
14
22
 
15
23
  Enjoy.config.contacts_fields.each_pair do |fn, ft|
16
24
  next if ft.nil?
@@ -4,8 +4,12 @@ module Enjoy
4
4
  def self.config(_navigation_label = I18n.t('enjoy.cms'), fields = {})
5
5
  Proc.new {
6
6
  # navigation_label(_navigation_label) unless _navigation_label.nil?
7
- field :enabled, :toggle
8
- field :name, :string
7
+ field :enabled, :toggle do
8
+ searchable false
9
+ end
10
+ field :name, :string do
11
+ searchable true
12
+ end
9
13
 
10
14
  Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
11
15
 
@@ -4,11 +4,16 @@ module Enjoy
4
4
  def self.config(fields = {})
5
5
  Proc.new {
6
6
  # navigation_label I18n.t('enjoy.gallery')
7
- field :enabled, :toggle
7
+ field :enabled, :toggle do
8
+ searchable false
9
+ end
8
10
 
9
- field :name, :string
11
+ field :name, :string do
12
+ searchable true
13
+ end
10
14
  group :URL do
11
15
  active false
16
+ searchable true
12
17
  field :slugs, :enum do
13
18
  enum_method do
14
19
  :slugs
@@ -4,11 +4,17 @@ module Enjoy
4
4
  def self.config(without_gallery = false, fields = {})
5
5
  Proc.new {
6
6
  # navigation_label I18n.t('enjoy.gallery')
7
- field :enabled, :toggle
7
+ field :enabled, :toggle do
8
+ searchable false
9
+ end
8
10
  unless without_gallery
9
- field :gallery
11
+ field :gallery do
12
+ searchable :name
13
+ end
14
+ end
15
+ field :name, :string do
16
+ searchable true
10
17
  end
11
- field :name, :string
12
18
  field :image, :jcrop do
13
19
  jcrop_options :image_jcrop_options
14
20
  end
@@ -5,9 +5,15 @@ module Enjoy
5
5
  Proc.new {
6
6
  # navigation_label 'CMS'
7
7
 
8
- field :enabled, :toggle
9
- field :text_slug
10
- field :name
8
+ field :enabled, :toggle do
9
+ searchable false
10
+ end
11
+ field :text_slug do
12
+ searchable true
13
+ end
14
+ field :name do
15
+ searchable true
16
+ end
11
17
 
12
18
  Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
13
19
 
@@ -8,11 +8,16 @@ module Enjoy
8
8
  scopes [:by_date, :enabled, nil]
9
9
  end
10
10
 
11
- field :enabled, :toggle
11
+ field :enabled, :toggle do
12
+ searchable false
13
+ end
12
14
  field :time do
15
+ searchable false
13
16
  sort_reverse true
14
17
  end
15
- field :name
18
+ field :name do
19
+ searchable true
20
+ end
16
21
  field :connected_pages, :enjoy_connectable
17
22
  unless Enjoy.config.news_image_styles.nil?
18
23
  field :image, :jcrop do
@@ -21,13 +26,16 @@ module Enjoy
21
26
  end
22
27
  group :content do
23
28
  active false
24
- field :excerpt, :enjoy_html
29
+ field :excerpt, :enjoy_html do
30
+ searchable true
31
+ end
25
32
  # field :excerpt_html, :ck_editor
26
33
  # field :excerpt_clear, :toggle
27
34
  end
28
35
  group :URL do
29
36
  active false
30
37
  field :slugs, :enum do
38
+ searchable true
31
39
  enum_method do
32
40
  :slugs
33
41
  end
@@ -38,7 +46,9 @@ module Enjoy
38
46
  true
39
47
  end
40
48
  end
41
- field :text_slug
49
+ field :text_slug do
50
+ searchable true
51
+ end
42
52
  end
43
53
 
44
54
  list do
@@ -7,17 +7,30 @@ module Enjoy
7
7
  list do
8
8
  scopes [:sorted, :enabled, nil]
9
9
 
10
- field :enabled, :toggle
11
- field :menus, :menu
12
- field :name
13
- field :connectable
10
+ field :enabled, :toggle do
11
+ searchable false
12
+ end
13
+ field :menus, :menu do
14
+ searchable :name
15
+ end
16
+ field :name do
17
+ searchable true
18
+ end
19
+ field :connectable do
20
+ searchable :name
21
+ end
14
22
  field :fullpath do
23
+ searchable true
15
24
  pretty_value do
16
25
  bindings[:view].content_tag(:a, bindings[:object].fullpath, href: bindings[:object].fullpath)
17
26
  end
18
27
  end
19
- field :redirect
20
- field :slug
28
+ field :redirect do
29
+ searchable true
30
+ end
31
+ field :slug do
32
+ searchable true
33
+ end
21
34
  end
22
35
 
23
36
  edit do
@@ -5,12 +5,22 @@ module Enjoy
5
5
  Proc.new {
6
6
  # navigation_label 'CMS'
7
7
 
8
- field :enabled, :toggle
9
- field :partial, :toggle
10
- field :name
11
- field :file_path, :string
8
+ field :enabled, :toggle do
9
+ searchable false
10
+ end
11
+ field :partial, :toggle do
12
+ searchable false
13
+ end
14
+ field :name do
15
+ searchable true
16
+ end
17
+ field :file_path, :string do
18
+ searchable true
19
+ end
12
20
 
13
- field :content, :enjoy_html
21
+ field :content, :enjoy_html do
22
+ searchable true
23
+ end
14
24
  # field :content_html, :ck_editor
15
25
  # field :content_clear, :toggle
16
26
 
@@ -5,11 +5,19 @@ module Enjoy
5
5
  Proc.new {
6
6
  # navigation_label 'CMS'
7
7
 
8
- field :enabled, :toggle
9
- field :text_slug
10
- field :name
8
+ field :enabled, :toggle do
9
+ searchable false
10
+ end
11
+ field :text_slug do
12
+ searchable true
13
+ end
14
+ field :name do
15
+ searchable true
16
+ end
11
17
 
12
- field :blocks
18
+ field :blocks do
19
+ searchable :name
20
+ end
13
21
 
14
22
  Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
15
23
 
@@ -7,13 +7,23 @@ module Enjoy
7
7
  field :seoable do
8
8
  read_only true
9
9
  end
10
- field :h1, :string
11
- field :title, :string
12
- field :keywords, :text
13
- field :description, :text
10
+ field :h1, :string do
11
+ searchable true
12
+ end
13
+ field :title, :string do
14
+ searchable true
15
+ end
16
+ field :keywords, :text do
17
+ searchable true
18
+ end
19
+ field :description, :text do
20
+ searchable true
21
+ end
14
22
  field :robots, :string
15
23
 
16
- field :og_title, :string
24
+ field :og_title, :string do
25
+ searchable true
26
+ end
17
27
 
18
28
  field :og_image, :jcrop do
19
29
  jcrop_options :og_image_jcrop_options
@@ -16,6 +16,7 @@ module Enjoy
16
16
  attr_accessor :news_excerpt
17
17
  attr_accessor :news_content_required
18
18
 
19
+ attr_accessor :main_index_layout
19
20
  attr_accessor :error_layout
20
21
  attr_accessor :menu_max_depth
21
22
 
@@ -41,6 +42,7 @@ module Enjoy
41
42
  @news_excerpt = 12
42
43
  @news_content_required = true
43
44
 
45
+ @main_index_layout = 'application'
44
46
  @error_layout = 'application'
45
47
  @menu_max_depth = 2
46
48
 
@@ -21,6 +21,12 @@ module Enjoy
21
21
  before_validation do
22
22
  self.fullpath = "/pages/#{slug}" if self.fullpath.blank?
23
23
  end
24
+
25
+ before_save do
26
+ self.connectable_id = nil if self.connectable_type.nil?
27
+ self.connectable_type = nil if self.connectable_id.nil?
28
+ self
29
+ end
24
30
  end
25
31
 
26
32
  def page_h1
@@ -62,7 +68,7 @@ module Enjoy
62
68
  end
63
69
 
64
70
  def regexp_prefix
65
- ""
71
+ Enjoy.config.localize ? "(?:#{I18n.available_locales.map { |l| "\\/#{l}"}.join("|")})?" : ""
66
72
  end
67
73
 
68
74
  def clean_regexp
@@ -1,4 +1,5 @@
1
1
  require 'rails_admin/config/fields/types/text'
2
+ require 'json'
2
3
 
3
4
  module RailsAdmin
4
5
  module Config
@@ -20,6 +21,18 @@ module RailsAdmin
20
21
  register_instance_option :partial do
21
22
  :enjoy_hash
22
23
  end
24
+
25
+ register_instance_option :formatted_value do
26
+ begin
27
+ JSON.pretty_generate(JSON.parse(bindings[:object].send string_method))
28
+ rescue
29
+ bindings[:object].send string_method
30
+ end
31
+ end
32
+
33
+ register_instance_option :pretty_value do
34
+ ("<pre>" + JSON.pretty_generate(value) + "</pre>").html_safe
35
+ end
23
36
  end
24
37
  end
25
38
  end
data/lib/enjoy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Enjoy
2
- VERSION = "0.3.6.2"
2
+ VERSION = "0.3.7"
3
3
  end
@@ -8,6 +8,7 @@ Enjoy.configure do |config|
8
8
  # config.news_excerpt = 12
9
9
  # config.news_content_required = true
10
10
  #
11
+ # config.main_index_layout = 'application'
11
12
  # config.error_layout = 'application'
12
13
  # config.menu_max_depth = 2
13
14
  #
@@ -23,5 +24,4 @@ Enjoy.configure do |config|
23
24
  # config.recreate_contact_message_action = "new"
24
25
  #
25
26
  # config.localize = false
26
-
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enjoy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6.2
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -154,16 +154,16 @@ dependencies:
154
154
  name: rails_admin
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: 0.8.1
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: 0.8.1
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rails_admin_nested_set
169
169
  requirement: !ruby/object:Gem::Requirement