enjoy_cms 0.2.1 → 0.3.0.2
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 +4 -4
- data/Gemfile.lock +33 -3
- data/app/controllers/concerns/enjoy/decorators/contacts.rb +5 -0
- data/app/controllers/concerns/enjoy/decorators/home.rb +5 -0
- data/app/controllers/concerns/enjoy/decorators/news.rb +5 -0
- data/app/controllers/concerns/enjoy/decorators/pages.rb +5 -0
- data/app/controllers/concerns/enjoy/decorators/search.rb +5 -0
- data/app/controllers/enjoy/contacts_controller.rb +2 -0
- data/app/controllers/enjoy/home_controller.rb +3 -0
- data/app/controllers/enjoy/news_controller.rb +2 -0
- data/app/controllers/enjoy/pages_controller.rb +2 -0
- data/app/controllers/enjoy/search_controller.rb +2 -0
- data/app/models/concerns/enjoy/html_field.rb +23 -0
- data/app/models/concerns/enjoy/mongoid_paperclip.rb +13 -0
- data/app/models/concerns/enjoy/rails_admin_patch.rb +16 -0
- data/app/views/rails_admin/main/_check_boxes.html.slim +1 -1
- data/app/views/rails_admin/main/_enjoy_html.html.slim +13 -0
- data/app/views/rails_admin/main/_enum_check_boxes.html.slim +1 -1
- data/app/views/rails_admin/main/_enum_radio_buttons.html.slim +1 -1
- data/config/initializers/simple_captcha.rb +1 -1
- data/enjoy_cms.gemspec +6 -0
- data/lib/enjoy/admin/news.rb +2 -2
- data/lib/enjoy/admin/page.rb +3 -3
- data/lib/enjoy/model.rb +2 -1
- data/lib/enjoy/models/contact_message.rb +0 -9
- data/lib/enjoy/models/embedded_element.rb +0 -9
- data/lib/enjoy/models/embedded_gallery_image.rb +0 -9
- data/lib/enjoy/models/gallery.rb +0 -9
- data/lib/enjoy/models/gallery_image.rb +0 -9
- data/lib/enjoy/models/menu.rb +0 -11
- data/lib/enjoy/models/mongoid/embedded_gallery_image.rb +6 -0
- data/lib/enjoy/models/mongoid/gallery.rb +5 -0
- data/lib/enjoy/models/mongoid/gallery_image.rb +4 -0
- data/lib/enjoy/models/mongoid/news.rb +6 -3
- data/lib/enjoy/models/mongoid/page.rb +4 -2
- data/lib/enjoy/models/mongoid/seo.rb +8 -5
- data/lib/enjoy/models/news.rb +0 -9
- data/lib/enjoy/models/page.rb +0 -9
- data/lib/enjoy/models/seo.rb +0 -9
- data/lib/enjoy/models/sitemap_data.rb +0 -9
- data/lib/enjoy/rails_admin_enjoy_html.rb +40 -0
- data/lib/enjoy/version.rb +1 -1
- data/lib/enjoy_cms.rb +3 -0
- data/template.rb +7 -6
- metadata +67 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a31b07bd2773130f799f9cece76e6d15c7f74522
|
|
4
|
+
data.tar.gz: 3a01393c4a260036190025c18413a9f201991d58
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ae824740984bb5108a3a4f9be73e5517b2f4a0022bcb1d70076199292db8872818582b2492c440ec753e7891f10e7ced292fa71568e97cff625b77b0a59a80f
|
|
7
|
+
data.tar.gz: e6df80fe7c147ee781fa6d9d88d48cdb445aaaaaffac512eb5c1000851e887dc5203ae3d1164a865e9be323106cb50977a05d7c259f3572f6dfb6963de9b9b6b
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
enjoy_cms (0.2
|
|
4
|
+
enjoy_cms (0.3.0.2)
|
|
5
5
|
ack_rails_admin_jcrop
|
|
6
6
|
addressable
|
|
7
7
|
ckeditor
|
|
@@ -9,13 +9,17 @@ PATH
|
|
|
9
9
|
devise
|
|
10
10
|
geocoder
|
|
11
11
|
glebtv-simple_captcha
|
|
12
|
+
image_optim
|
|
13
|
+
image_optim_pack
|
|
12
14
|
jquery-rails
|
|
13
15
|
kaminari
|
|
16
|
+
paperclip-optimizer
|
|
14
17
|
rails (= 4.2.4)
|
|
15
18
|
rails_admin
|
|
16
19
|
rails_admin_mongoid_localize_field
|
|
17
20
|
rails_admin_nested_set
|
|
18
21
|
rails_admin_settings
|
|
22
|
+
rails_admin_sort_embedded
|
|
19
23
|
rails_admin_toggleable
|
|
20
24
|
simple-navigation
|
|
21
25
|
simple_form
|
|
@@ -98,8 +102,10 @@ GEM
|
|
|
98
102
|
warden (~> 1.2.3)
|
|
99
103
|
erubis (2.7.0)
|
|
100
104
|
execjs (2.6.0)
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
exifr (1.2.4)
|
|
106
|
+
font-awesome-rails (4.5.0.1)
|
|
107
|
+
railties (>= 3.2, < 5.1)
|
|
108
|
+
fspath (2.1.1)
|
|
103
109
|
geocoder (1.3.0)
|
|
104
110
|
glebtv-simple_captcha (0.6.7)
|
|
105
111
|
globalid (0.3.6)
|
|
@@ -108,6 +114,17 @@ GEM
|
|
|
108
114
|
tilt
|
|
109
115
|
htmlentities (4.3.4)
|
|
110
116
|
i18n (0.7.0)
|
|
117
|
+
image_optim (0.22.0)
|
|
118
|
+
exifr (~> 1.2, >= 1.2.2)
|
|
119
|
+
fspath (~> 2.1)
|
|
120
|
+
image_size (~> 1.3)
|
|
121
|
+
in_threads (~> 1.3)
|
|
122
|
+
progress (~> 3.0, >= 3.0.1)
|
|
123
|
+
image_optim_pack (0.2.1.20160119)
|
|
124
|
+
fspath (~> 2.1)
|
|
125
|
+
image_optim (~> 0.19)
|
|
126
|
+
image_size (1.4.1)
|
|
127
|
+
in_threads (1.3.1)
|
|
111
128
|
jquery-rails (4.1.0)
|
|
112
129
|
rails-dom-testing (~> 1.0)
|
|
113
130
|
railties (>= 4.2.0)
|
|
@@ -123,6 +140,7 @@ GEM
|
|
|
123
140
|
mail (2.6.3)
|
|
124
141
|
mime-types (>= 1.16, < 3)
|
|
125
142
|
mime-types (2.99)
|
|
143
|
+
mimemagic (0.3.0)
|
|
126
144
|
mini_magick (4.4.0)
|
|
127
145
|
mini_portile2 (2.0.0)
|
|
128
146
|
minitest (5.8.4)
|
|
@@ -138,6 +156,16 @@ GEM
|
|
|
138
156
|
mini_portile2 (~> 2.0.0.rc2)
|
|
139
157
|
origin (2.2.0)
|
|
140
158
|
orm_adapter (0.5.0)
|
|
159
|
+
paperclip (4.3.5)
|
|
160
|
+
activemodel (>= 3.2.0)
|
|
161
|
+
activesupport (>= 3.2.0)
|
|
162
|
+
cocaine (~> 0.5.5)
|
|
163
|
+
mime-types
|
|
164
|
+
mimemagic (= 0.3.0)
|
|
165
|
+
paperclip-optimizer (2.0.0)
|
|
166
|
+
image_optim (~> 0.19)
|
|
167
|
+
paperclip (>= 3.4)
|
|
168
|
+
progress (3.1.1)
|
|
141
169
|
rack (1.6.4)
|
|
142
170
|
rack-pjax (0.8.0)
|
|
143
171
|
nokogiri (~> 1.5)
|
|
@@ -185,6 +213,8 @@ GEM
|
|
|
185
213
|
rails_admin_nested_set (0.4.5)
|
|
186
214
|
rails_admin
|
|
187
215
|
rails_admin_settings (1.1.3)
|
|
216
|
+
rails_admin_sort_embedded (0.1.4)
|
|
217
|
+
rails_admin
|
|
188
218
|
rails_admin_toggleable (0.6.0)
|
|
189
219
|
rails_admin
|
|
190
220
|
railties (4.2.4)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
if Enjoy.mongoid?
|
|
2
|
+
module Enjoy::HtmlField
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
module ClassMethods
|
|
6
|
+
def enjoy_cms_html_field(name, opts = {})
|
|
7
|
+
clear_by_default = opts.delete(:clear_by_default)
|
|
8
|
+
clear_by_default = false unless clear_by_default == true
|
|
9
|
+
|
|
10
|
+
field "#{name}_html", opts
|
|
11
|
+
field "#{name}_clear", type: Boolean, default: clear_by_default
|
|
12
|
+
|
|
13
|
+
class_eval <<-EVAL
|
|
14
|
+
def #{name}
|
|
15
|
+
self.#{name}_html ||= ""
|
|
16
|
+
return self.#{name}_html unless self.#{name}_clear
|
|
17
|
+
Rails::Html::FullSanitizer.new.sanitize(self.#{name}_html.strip)
|
|
18
|
+
end
|
|
19
|
+
EVAL
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -12,6 +12,13 @@ if Enjoy.mongoid?
|
|
|
12
12
|
jcrop_options = opts.delete(:jcrop_options)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
opts[:processors] ||= []
|
|
16
|
+
opts[:processors] << :paperclip_optimizer
|
|
17
|
+
opts[:processors].flatten!
|
|
18
|
+
opts[:processors].uniq!
|
|
19
|
+
|
|
20
|
+
opts[:convert_options] = {all: "-quality 75 -strip"} if opts[:convert_options].blank?
|
|
21
|
+
|
|
15
22
|
has_mongoid_attached_file name, opts
|
|
16
23
|
validates_attachment name, content_type: content_type unless content_type.blank?
|
|
17
24
|
class_eval <<-EVAL
|
|
@@ -23,6 +30,12 @@ if Enjoy.mongoid?
|
|
|
23
30
|
file_name = val[0..val.size-extension.size-1]
|
|
24
31
|
self[:#{name}_file_name] = "\#{file_name.filename_to_slug}.\#{extension.filename_to_slug}"
|
|
25
32
|
end
|
|
33
|
+
|
|
34
|
+
before_#{name}_post_process do
|
|
35
|
+
p_o = self.#{name}.processors.delete :paperclip_optimizer
|
|
36
|
+
self.#{name}.processors << p_o if p_o
|
|
37
|
+
true
|
|
38
|
+
end
|
|
26
39
|
EVAL
|
|
27
40
|
if jcrop_options
|
|
28
41
|
class_eval <<-EVAL
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Enjoy::RailsAdminPatch
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
def rails_admin_model
|
|
5
|
+
self.class.to_param.gsub("::", "~").underscore
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module ClassMethods
|
|
9
|
+
def rails_admin_add_fields
|
|
10
|
+
{}
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def rails_admin_add_config(config)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
controller.list_entries(config, :index, field.associated_collection_scope, false).map { |o| [o.send(field.associated_object_label_method), o.send(field.associated_primary_key)] }.sort_by {|a| [selected_ids.index(a[1]) || selected_ids.size, i+=1] }
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
= form.collection_check_boxes field.method_name, collection, :last, :
|
|
27
|
+
= form.collection_check_boxes field.method_name, collection, :last, :first, {}, {} { |i| i.label( class: 'checkbox' ) { i.check_box + i.text } }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
ruby:
|
|
2
|
+
js_data = {
|
|
3
|
+
jspath: field.location ? field.location : field.base_location + "ckeditor.js",
|
|
4
|
+
base_location: field.base_location,
|
|
5
|
+
options: {
|
|
6
|
+
customConfig: field.config_js ? field.config_js : field.base_location + "config.js"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
= form.text_area "#{field.method_name}_html", field.html_attributes.reverse_merge(data: { richtext: 'ckeditor', options: js_data.to_json }).reverse_merge({ value: field.form_value[:html] })
|
|
10
|
+
|
|
11
|
+
label{style='display: block;'}
|
|
12
|
+
span{style='float: left'}= form.send field.boolean_view_helper, "#{field.method_name}_clear", field.html_attributes.reverse_merge({ value: field.form_value[:clear], checked: field.form_value[:clear].in?([true, '1']), required: field.required, class: "form-control"})
|
|
13
|
+
div{style='margin-left: 35px; line-height: 40px;'} Убирать теги
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
values = form.object.class.send(field.method_name).values.map { |v|
|
|
3
3
|
[t("enumerize.#{form.object.class.name.downcase}.#{field.method_name}.#{v}", default: t("enumerize.defaults.#{field.method_name}.#{v}")), v]
|
|
4
4
|
}
|
|
5
|
-
= form.collection_check_boxes field.method_name, values, :last, :
|
|
5
|
+
= form.collection_check_boxes field.method_name, values, :last, :first, {}, {} { |i| i.label( class: 'checkbox' ) { i.check_box + i.text } }
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
values = form.object.class.send(field.method_name).values.map { |v|
|
|
3
3
|
[t("enumerize.#{form.object.class.name.downcase}.#{field.method_name}.#{v}", default: t("enumerize.defaults.#{field.method_name}.#{v}")), v]
|
|
4
4
|
}
|
|
5
|
-
= form.collection_radio_buttons field.method_name, values, :last, :
|
|
5
|
+
= form.collection_radio_buttons field.method_name, values, :last, :first, {}, {} { |i| i.label(class: 'radio') { i.radio_button + i.text } }
|
|
@@ -21,7 +21,7 @@ SimpleCaptcha.setup do |sc|
|
|
|
21
21
|
sc.length = 4
|
|
22
22
|
sc.charset = "1234567890"
|
|
23
23
|
|
|
24
|
-
sc.add_image_style("enjoy_cms_style", ["-alpha set", "-fill '
|
|
24
|
+
sc.add_image_style("enjoy_cms_style", ["-alpha set", "-fill 'red'", "-background 'transparent'", "-size 200x50", "xc:transparent"])
|
|
25
25
|
|
|
26
26
|
sc.image_style = 'enjoy_cms_style'
|
|
27
27
|
|
data/enjoy_cms.gemspec
CHANGED
|
@@ -50,4 +50,10 @@ Gem::Specification.new do |spec|
|
|
|
50
50
|
spec.add_dependency 'stringex'
|
|
51
51
|
spec.add_dependency 'thor'
|
|
52
52
|
spec.add_dependency 'smart_excerpt'
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
spec.add_dependency 'rails_admin_sort_embedded'
|
|
56
|
+
spec.add_dependency 'image_optim'
|
|
57
|
+
spec.add_dependency 'image_optim_pack'
|
|
58
|
+
spec.add_dependency 'paperclip-optimizer'
|
|
53
59
|
end
|
data/lib/enjoy/admin/news.rb
CHANGED
|
@@ -18,7 +18,7 @@ module Enjoy
|
|
|
18
18
|
jcrop_options :image_jcrop_options
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
|
-
field :excerpt, :
|
|
21
|
+
field :excerpt, :enjoy_html
|
|
22
22
|
field :slugs, :enum do
|
|
23
23
|
enum_method do
|
|
24
24
|
:slugs
|
|
@@ -37,7 +37,7 @@ module Enjoy
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
edit do
|
|
40
|
-
field :content, :
|
|
40
|
+
field :content, :enjoy_html
|
|
41
41
|
fields.each_pair do |name, type|
|
|
42
42
|
if type.nil?
|
|
43
43
|
field name
|
data/lib/enjoy/admin/page.rb
CHANGED
|
@@ -18,11 +18,11 @@ module Enjoy
|
|
|
18
18
|
field :redirect
|
|
19
19
|
field :slug
|
|
20
20
|
end
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
edit do
|
|
23
23
|
field :name
|
|
24
|
-
field :excerpt, :
|
|
25
|
-
field :content, :
|
|
24
|
+
field :excerpt, :enjoy_html
|
|
25
|
+
field :content, :enjoy_html
|
|
26
26
|
|
|
27
27
|
group :menu do
|
|
28
28
|
label I18n.t('enjoy.menu')
|
data/lib/enjoy/model.rb
CHANGED
|
@@ -11,15 +11,6 @@ module Enjoy
|
|
|
11
11
|
included do
|
|
12
12
|
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
|
|
13
13
|
end
|
|
14
|
-
|
|
15
|
-
module ClassMethods
|
|
16
|
-
def rails_admin_add_fields
|
|
17
|
-
{}
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def rails_admin_add_config(config)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
14
|
end
|
|
24
15
|
end
|
|
25
16
|
end
|
data/lib/enjoy/models/gallery.rb
CHANGED
|
@@ -16,15 +16,6 @@ module Enjoy
|
|
|
16
16
|
|
|
17
17
|
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
|
|
18
18
|
end
|
|
19
|
-
|
|
20
|
-
module ClassMethods
|
|
21
|
-
def rails_admin_add_fields
|
|
22
|
-
{}
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def rails_admin_add_config(config)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
19
|
end
|
|
29
20
|
end
|
|
30
21
|
end
|
|
@@ -14,15 +14,6 @@ module Enjoy
|
|
|
14
14
|
|
|
15
15
|
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
|
|
16
16
|
end
|
|
17
|
-
|
|
18
|
-
module ClassMethods
|
|
19
|
-
def rails_admin_add_fields
|
|
20
|
-
{}
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def rails_admin_add_config(config)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
17
|
end
|
|
27
18
|
end
|
|
28
19
|
end
|
data/lib/enjoy/models/menu.rb
CHANGED
|
@@ -9,8 +9,6 @@ module Enjoy
|
|
|
9
9
|
include Enjoy.orm_specific('Menu')
|
|
10
10
|
|
|
11
11
|
included do
|
|
12
|
-
|
|
13
|
-
field :name, type: String
|
|
14
12
|
manual_slug :name
|
|
15
13
|
|
|
16
14
|
after_save do
|
|
@@ -20,15 +18,6 @@ module Enjoy
|
|
|
20
18
|
Rails.cache.delete 'menus'
|
|
21
19
|
end
|
|
22
20
|
end
|
|
23
|
-
|
|
24
|
-
module ClassMethods
|
|
25
|
-
def rails_admin_add_fields
|
|
26
|
-
{}
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def rails_admin_add_config(config)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
21
|
end
|
|
33
22
|
end
|
|
34
23
|
end
|
|
@@ -9,13 +9,19 @@ module Enjoy
|
|
|
9
9
|
|
|
10
10
|
enjoy_cms_mongoid_attached_file(:image,
|
|
11
11
|
styles: lambda { |attachment| attachment.instance.image_styles },
|
|
12
|
+
convert_options: lambda { |attachment| attachment.instance.image_convert_options },
|
|
12
13
|
content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] }
|
|
13
14
|
)
|
|
14
15
|
end
|
|
15
16
|
|
|
17
|
+
|
|
16
18
|
def image_styles
|
|
17
19
|
{}
|
|
18
20
|
end
|
|
21
|
+
def image_convert_options
|
|
22
|
+
{}
|
|
23
|
+
end
|
|
24
|
+
|
|
19
25
|
end
|
|
20
26
|
end
|
|
21
27
|
end
|
|
@@ -14,6 +14,7 @@ module Enjoy
|
|
|
14
14
|
|
|
15
15
|
enjoy_cms_mongoid_attached_file(:image,
|
|
16
16
|
styles: lambda { |attachment| attachment.instance.image_styles },
|
|
17
|
+
convert_options: lambda { |attachment| attachment.instance.image_convert_options },
|
|
17
18
|
content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] }
|
|
18
19
|
)
|
|
19
20
|
end
|
|
@@ -21,6 +22,10 @@ module Enjoy
|
|
|
21
22
|
def image_styles
|
|
22
23
|
{}
|
|
23
24
|
end
|
|
25
|
+
def image_convert_options
|
|
26
|
+
{}
|
|
27
|
+
end
|
|
28
|
+
|
|
24
29
|
end
|
|
25
30
|
end
|
|
26
31
|
end
|
|
@@ -12,6 +12,7 @@ module Enjoy
|
|
|
12
12
|
|
|
13
13
|
enjoy_cms_mongoid_attached_file(:image,
|
|
14
14
|
styles: lambda { |attachment| attachment.instance.image_styles },
|
|
15
|
+
convert_options: lambda { |attachment| attachment.instance.image_convert_options },
|
|
15
16
|
content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] }
|
|
16
17
|
)
|
|
17
18
|
end
|
|
@@ -19,6 +20,9 @@ module Enjoy
|
|
|
19
20
|
def image_styles
|
|
20
21
|
{}
|
|
21
22
|
end
|
|
23
|
+
def image_convert_options
|
|
24
|
+
{}
|
|
25
|
+
end
|
|
22
26
|
end
|
|
23
27
|
end
|
|
24
28
|
end
|
|
@@ -7,20 +7,23 @@ module Enjoy
|
|
|
7
7
|
include Enjoy::MongoidPaperclip
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
include Enjoy::HtmlField
|
|
11
|
+
|
|
10
12
|
included do
|
|
11
13
|
field :name, type: String, localize: Enjoy.config.localize, default: ""
|
|
12
|
-
|
|
14
|
+
|
|
13
15
|
field :time, type: Time
|
|
14
16
|
index({enabled: 1, time: 1})
|
|
15
17
|
unless Enjoy.config.news_image_styles.nil?
|
|
16
18
|
enjoy_cms_mongoid_attached_file(:image,
|
|
17
19
|
styles: Enjoy.configuration.news_image_styles,
|
|
20
|
+
convert_options: Enjoy.configuration.news_image_convert_options,
|
|
18
21
|
content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] }
|
|
19
22
|
)
|
|
20
23
|
end
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
enjoy_cms_html_field :excerpt, type: String, localize: Enjoy.configuration.localize, default: ""
|
|
26
|
+
enjoy_cms_html_field :content, type: String, localize: Enjoy.configuration.localize, default: ""
|
|
24
27
|
|
|
25
28
|
scope :after_now, -> { where(:time.lt => Time.now) }
|
|
26
29
|
scope :by_date, -> { desc(:time) }
|
|
@@ -4,13 +4,15 @@ module Enjoy
|
|
|
4
4
|
module Page
|
|
5
5
|
extend ActiveSupport::Concern
|
|
6
6
|
|
|
7
|
+
include Enjoy::HtmlField
|
|
8
|
+
|
|
7
9
|
included do
|
|
8
10
|
field :name, type: String, localize: Enjoy.config.localize, default: ""
|
|
9
11
|
|
|
10
12
|
field :regexp, type: String, default: ""
|
|
11
13
|
field :redirect, type: String, default: ""
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
enjoy_cms_html_field :excerpt, type: String, localize: Enjoy.config.localize, default: ""
|
|
15
|
+
enjoy_cms_html_field :content, type: String, localize: Enjoy.config.localize, default: ""
|
|
14
16
|
field :fullpath, type: String, default: ""
|
|
15
17
|
|
|
16
18
|
has_and_belongs_to_many :menus, inverse_of: :pages, class_name: "Enjoy::Menu"
|
|
@@ -16,16 +16,19 @@ module Enjoy
|
|
|
16
16
|
|
|
17
17
|
field :og_title, type: String, localize: Enjoy.config.localize
|
|
18
18
|
enjoy_cms_mongoid_attached_file(:og_image,
|
|
19
|
-
styles: og_image_styles,
|
|
19
|
+
styles: lambda { |attachment| attachment.instance.og_image_styles },
|
|
20
|
+
convert_options: lambda { |attachment| attachment.instance.og_image_convert_options },
|
|
20
21
|
content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] }
|
|
21
22
|
)
|
|
22
23
|
end
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{thumb: "800x600>"}
|
|
27
|
-
end
|
|
25
|
+
def og_image_styles
|
|
26
|
+
{thumb: "800x600>"}
|
|
28
27
|
end
|
|
28
|
+
def og_image_convert_options
|
|
29
|
+
{}
|
|
30
|
+
end
|
|
31
|
+
|
|
29
32
|
end
|
|
30
33
|
end
|
|
31
34
|
end
|
data/lib/enjoy/models/news.rb
CHANGED
data/lib/enjoy/models/page.rb
CHANGED
data/lib/enjoy/models/seo.rb
CHANGED
|
@@ -12,15 +12,6 @@ module Enjoy
|
|
|
12
12
|
|
|
13
13
|
validates_attachment_content_type :og_image, content_type: /\Aimage\/.*\Z/, if: :og_image?
|
|
14
14
|
end
|
|
15
|
-
|
|
16
|
-
module ClassMethods
|
|
17
|
-
def rails_admin_add_fields
|
|
18
|
-
{}
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def rails_admin_add_config(config)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
15
|
end
|
|
25
16
|
end
|
|
26
17
|
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module RailsAdmin
|
|
2
|
+
module Config
|
|
3
|
+
module Fields
|
|
4
|
+
module Types
|
|
5
|
+
class EnjoyHtml < RailsAdmin::Config::Fields::Types::CKEditor
|
|
6
|
+
# Register field type for the type loader
|
|
7
|
+
RailsAdmin::Config::Fields::Types::register(self)
|
|
8
|
+
include RailsAdmin::Engine.routes.url_helpers
|
|
9
|
+
|
|
10
|
+
register_instance_option :pretty_value do
|
|
11
|
+
bindings[:object].send(name + "_html")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
register_instance_option :form_value do
|
|
15
|
+
{
|
|
16
|
+
html: bindings[:object].send("#{name}_html"),
|
|
17
|
+
clear: bindings[:object].send("#{name}_clear")
|
|
18
|
+
}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
register_instance_option :formatted_value do
|
|
22
|
+
pretty_value
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
register_instance_option :export_value do
|
|
26
|
+
pretty_value
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
register_instance_option :boolean_view_helper do
|
|
30
|
+
:check_box
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
register_instance_option :partial do
|
|
34
|
+
:enjoy_html
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
data/lib/enjoy/version.rb
CHANGED
data/lib/enjoy_cms.rb
CHANGED
|
@@ -29,10 +29,13 @@ require 'turbolinks'
|
|
|
29
29
|
require 'simple-navigation'
|
|
30
30
|
require 'ack_rails_admin_jcrop'
|
|
31
31
|
|
|
32
|
+
require 'paperclip-optimizer'
|
|
33
|
+
|
|
32
34
|
require 'enjoy/configuration'
|
|
33
35
|
require 'enjoy/elastic_search'
|
|
34
36
|
require 'enjoy/model'
|
|
35
37
|
require 'enjoy/rails_admin_menu'
|
|
38
|
+
require 'enjoy/rails_admin_enjoy_html'
|
|
36
39
|
require 'enjoy/engine'
|
|
37
40
|
require 'enjoy/controller'
|
|
38
41
|
|
data/template.rb
CHANGED
|
@@ -15,14 +15,14 @@ create_file 'Gemfile' do <<-TEXT
|
|
|
15
15
|
source 'https://rubygems.org'
|
|
16
16
|
|
|
17
17
|
gem 'rails', '4.2.4' #'~> 5.0.0.beta1'
|
|
18
|
-
#{if mongoid then "gem 'mongoid'
|
|
18
|
+
#{if mongoid then "gem 'mongoid'" else "gem 'pg'" end}
|
|
19
19
|
|
|
20
|
-
gem 'sass'
|
|
20
|
+
gem 'sass'
|
|
21
21
|
gem 'sass-rails'
|
|
22
|
-
gem 'compass-rails'
|
|
23
|
-
gem 'compass'
|
|
22
|
+
gem 'compass-rails'
|
|
23
|
+
gem 'compass'
|
|
24
24
|
|
|
25
|
-
#{if mongoid then "gem 'enjoy_cms_mongoid'" else "gem 'enjoy_cms_activerecord'" end}, '~> 0.
|
|
25
|
+
#{if mongoid then "gem 'enjoy_cms_mongoid'" else "gem 'enjoy_cms_activerecord'" end}, '~> 0.3.0'
|
|
26
26
|
|
|
27
27
|
gem 'devise'
|
|
28
28
|
|
|
@@ -34,7 +34,8 @@ gem 'cloner'
|
|
|
34
34
|
gem 'unicorn'
|
|
35
35
|
gem 'x-real-ip'
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
#temp
|
|
38
|
+
#gem 'sentry-raven'
|
|
38
39
|
|
|
39
40
|
group :development do
|
|
40
41
|
gem 'better_errors'
|
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.2
|
|
4
|
+
version: 0.3.0.2
|
|
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-02-
|
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -374,6 +374,62 @@ dependencies:
|
|
|
374
374
|
- - ">="
|
|
375
375
|
- !ruby/object:Gem::Version
|
|
376
376
|
version: '0'
|
|
377
|
+
- !ruby/object:Gem::Dependency
|
|
378
|
+
name: rails_admin_sort_embedded
|
|
379
|
+
requirement: !ruby/object:Gem::Requirement
|
|
380
|
+
requirements:
|
|
381
|
+
- - ">="
|
|
382
|
+
- !ruby/object:Gem::Version
|
|
383
|
+
version: '0'
|
|
384
|
+
type: :runtime
|
|
385
|
+
prerelease: false
|
|
386
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
387
|
+
requirements:
|
|
388
|
+
- - ">="
|
|
389
|
+
- !ruby/object:Gem::Version
|
|
390
|
+
version: '0'
|
|
391
|
+
- !ruby/object:Gem::Dependency
|
|
392
|
+
name: image_optim
|
|
393
|
+
requirement: !ruby/object:Gem::Requirement
|
|
394
|
+
requirements:
|
|
395
|
+
- - ">="
|
|
396
|
+
- !ruby/object:Gem::Version
|
|
397
|
+
version: '0'
|
|
398
|
+
type: :runtime
|
|
399
|
+
prerelease: false
|
|
400
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
401
|
+
requirements:
|
|
402
|
+
- - ">="
|
|
403
|
+
- !ruby/object:Gem::Version
|
|
404
|
+
version: '0'
|
|
405
|
+
- !ruby/object:Gem::Dependency
|
|
406
|
+
name: image_optim_pack
|
|
407
|
+
requirement: !ruby/object:Gem::Requirement
|
|
408
|
+
requirements:
|
|
409
|
+
- - ">="
|
|
410
|
+
- !ruby/object:Gem::Version
|
|
411
|
+
version: '0'
|
|
412
|
+
type: :runtime
|
|
413
|
+
prerelease: false
|
|
414
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
415
|
+
requirements:
|
|
416
|
+
- - ">="
|
|
417
|
+
- !ruby/object:Gem::Version
|
|
418
|
+
version: '0'
|
|
419
|
+
- !ruby/object:Gem::Dependency
|
|
420
|
+
name: paperclip-optimizer
|
|
421
|
+
requirement: !ruby/object:Gem::Requirement
|
|
422
|
+
requirements:
|
|
423
|
+
- - ">="
|
|
424
|
+
- !ruby/object:Gem::Version
|
|
425
|
+
version: '0'
|
|
426
|
+
type: :runtime
|
|
427
|
+
prerelease: false
|
|
428
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
429
|
+
requirements:
|
|
430
|
+
- - ">="
|
|
431
|
+
- !ruby/object:Gem::Version
|
|
432
|
+
version: '0'
|
|
377
433
|
description: 'EnjoyCMS '
|
|
378
434
|
email:
|
|
379
435
|
- dev@enjoycreate.ru
|
|
@@ -399,6 +455,11 @@ files:
|
|
|
399
455
|
- app/assets/stylesheets/enjoy_cms/flash.sass
|
|
400
456
|
- app/assets/stylesheets/enjoy_cms/normalize.scss
|
|
401
457
|
- app/assets/stylesheets/enjoy_cms/powered.sass
|
|
458
|
+
- app/controllers/concerns/enjoy/decorators/contacts.rb
|
|
459
|
+
- app/controllers/concerns/enjoy/decorators/home.rb
|
|
460
|
+
- app/controllers/concerns/enjoy/decorators/news.rb
|
|
461
|
+
- app/controllers/concerns/enjoy/decorators/pages.rb
|
|
462
|
+
- app/controllers/concerns/enjoy/decorators/search.rb
|
|
402
463
|
- app/controllers/concerns/enjoy/errors.rb
|
|
403
464
|
- app/controllers/concerns/enjoy/fancybox.rb
|
|
404
465
|
- app/controllers/concerns/enjoy/localizeable.rb
|
|
@@ -426,9 +487,11 @@ files:
|
|
|
426
487
|
- app/models/concerns/enjoy/decorators/sitemap_data.rb
|
|
427
488
|
- app/models/concerns/enjoy/enableable.rb
|
|
428
489
|
- app/models/concerns/enjoy/geocodeable.rb
|
|
490
|
+
- app/models/concerns/enjoy/html_field.rb
|
|
429
491
|
- app/models/concerns/enjoy/mappable.rb
|
|
430
492
|
- app/models/concerns/enjoy/model_localizeable.rb
|
|
431
493
|
- app/models/concerns/enjoy/mongoid_paperclip.rb
|
|
494
|
+
- app/models/concerns/enjoy/rails_admin_patch.rb
|
|
432
495
|
- app/models/concerns/enjoy/seoable.rb
|
|
433
496
|
- app/models/concerns/enjoy/sitemap_data_field.rb
|
|
434
497
|
- app/models/concerns/enjoy/sort_field.rb
|
|
@@ -466,6 +529,7 @@ files:
|
|
|
466
529
|
- app/views/errors/error_500.html.slim
|
|
467
530
|
- app/views/layouts/application.html.slim
|
|
468
531
|
- app/views/rails_admin/main/_check_boxes.html.slim
|
|
532
|
+
- app/views/rails_admin/main/_enjoy_html.html.slim
|
|
469
533
|
- app/views/rails_admin/main/_enum_check_boxes.html.slim
|
|
470
534
|
- app/views/rails_admin/main/_enum_radio_buttons.html.slim
|
|
471
535
|
- app/views/rails_admin/main/_form_raw.html.slim
|
|
@@ -538,6 +602,7 @@ files:
|
|
|
538
602
|
- lib/enjoy/models/page.rb
|
|
539
603
|
- lib/enjoy/models/seo.rb
|
|
540
604
|
- lib/enjoy/models/sitemap_data.rb
|
|
605
|
+
- lib/enjoy/rails_admin_enjoy_html.rb
|
|
541
606
|
- lib/enjoy/rails_admin_menu.rb
|
|
542
607
|
- lib/enjoy/simple_form_patch.rb
|
|
543
608
|
- lib/enjoy/tasks.rb
|