enjoy_cms 0.4.0.5 → 0.4.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 +4 -4
- data/README.md +2 -136
- data/app/helpers/enjoy/powered_helper.rb +26 -4
- data/enjoy_cms.gemspec +1 -1
- data/lib/enjoy/rails_admin_ext/patches/enjoy_cms_group.rb +22 -6
- data/lib/enjoy/version.rb +1 -1
- data/lib/generators/enjoy/cms/templates/ability.erb +1 -0
- data/template.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b010f4cca2319b6ea7f28d5b2393e6cbf131c1ed
|
4
|
+
data.tar.gz: c25e445db3a8511d32cfb5de8405c300c10e24cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1a8db45181f8a61a22c3854e08e4e5e331c079d718b591492fb9754bda904f0a1b34ce44e506afeb7837b1fb67187c9e302bad5a9157a904f136c9938662f85
|
7
|
+
data.tar.gz: 51afe156adc0b74a96b700f1a65b07dde3d82a5856ea284c3777f081b3ee88df0cd5e11f051dd8a57290c43440d3cd649836e07e1242b4efb45fd54c7ad350a3
|
data/README.md
CHANGED
@@ -1,139 +1,5 @@
|
|
1
1
|
# EnjoyCMS
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
# DEVELOPMENT VERSION
|
6
|
-
|
7
|
-
Rails + RailsAdmin + Mongoid/PostgreSQL CMS
|
8
|
-
|
9
|
-
Very opinionated and tuned for my needs.
|
10
|
-
|
11
|
-
**Before 1.0 API and class names should be considered unstable and can change at any time!**
|
12
|
-
|
13
|
-
## Installation
|
14
|
-
|
15
|
-
Add this line to your application's Gemfile:
|
16
|
-
|
17
|
-
gem 'enjoy_cms_mongoid'
|
18
|
-
|
19
|
-
or:
|
20
|
-
|
21
|
-
gem 'enjoy_cms_activerecord'
|
22
|
-
|
23
|
-
*Only PostgreSQL is tested or supported for AR(from root repo). Others will probably work, but untested.*
|
24
|
-
|
25
|
-
And then execute:
|
26
|
-
|
27
|
-
$ bundle
|
28
|
-
|
29
|
-
Or install it yourself as:
|
30
|
-
|
31
|
-
$ gem install enjoy_cms
|
32
|
-
|
33
|
-
For activerecord, generate migrations and run them
|
34
|
-
|
35
|
-
rails g rails_admin_settings:migration
|
36
|
-
rails g enjoy_cms:migration
|
37
|
-
rake db:migrate
|
38
|
-
|
39
|
-
## Usage
|
40
|
-
|
41
|
-
### Using app generator
|
42
|
-
|
43
|
-
Make sure you have rails 4.2 installed
|
44
|
-
|
45
|
-
rails -v
|
46
|
-
|
47
|
-
If not, uninstall rails and install again
|
48
|
-
|
49
|
-
gem uninstall rails
|
50
|
-
gem install enjoy_cms
|
51
|
-
|
52
|
-
Then, for mongoid:
|
53
|
-
|
54
|
-
rails new my_app -T -O -m https://raw.githubusercontent.com/enjoycreative/enjoy_cms/master/template.rb
|
55
|
-
|
56
|
-
for ActiveRecord:
|
3
|
+
# NO LONGER MAINTAINED. SEE [HancockCMS](https://github.com/red-rocks/hancock_cms)
|
57
4
|
|
58
|
-
|
59
|
-
|
60
|
-
generator creates a new RVM gemset, so after cd'ing to app dir, you should run `bundle install` again if you use rvm.
|
61
|
-
|
62
|
-
### Localization
|
63
|
-
|
64
|
-
All models included in the gem support localization via either [hstore_translate](https://github.com/Leadformance/hstore_translate) or built-in Mongoid localize: true option.
|
65
|
-
|
66
|
-
You can get a nice admin UI for editing locales by adding [rails_admin_hstore_translate](https://github.com/glebtv/rails_admin_hstore_translate) or [rails_admin_mongoid_localize_field](https://github.com/sudosu/rails_admin_mongoid_localize_field)
|
67
|
-
|
68
|
-
Add to: ```app/models/page.rb```
|
69
|
-
|
70
|
-
```ruby
|
71
|
-
class Page < Enjoy::Page
|
72
|
-
|
73
|
-
def regexp_prefix
|
74
|
-
"(?:\/ru|\/en)?"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
```
|
78
|
-
|
79
|
-
<!-- Wrap your routes with locale scope:
|
80
|
-
|
81
|
-
```ruby
|
82
|
-
scope "(:locale)", locale: /en|ru/ do
|
83
|
-
get 'contacts' => 'contacts#new', as: :contacts
|
84
|
-
post 'contacts' => 'contacts#create', as: :create_contacts
|
85
|
-
end
|
86
|
-
``` -->
|
87
|
-
|
88
|
-
Add to application_controller.rb:
|
89
|
-
|
90
|
-
```ruby
|
91
|
-
class ApplicationController < ActionController::Base
|
92
|
-
include Enjoy::Controller
|
93
|
-
include Enjoy::Localizeable
|
94
|
-
end
|
95
|
-
```
|
96
|
-
|
97
|
-
Enable localization in EnjoyCMS:
|
98
|
-
|
99
|
-
```ruby
|
100
|
-
Enjoy.configure do |enjoy|
|
101
|
-
enjoy.news_image_styles = {small: '107x126#'}
|
102
|
-
enjoy.contacts_captcha = true
|
103
|
-
enjoy.contacts_message_required = true
|
104
|
-
...
|
105
|
-
enjoy.localize = true
|
106
|
-
end
|
107
|
-
```
|
108
|
-
|
109
|
-
Add ```rails_admin_hstore_translate``` or ```hstore_translate``` gem if using PostgreSQL:
|
110
|
-
|
111
|
-
```ruby
|
112
|
-
gem 'rails_admin_hstore_translate'
|
113
|
-
```
|
114
|
-
|
115
|
-
or
|
116
|
-
|
117
|
-
```ruby
|
118
|
-
gem 'hstore_translate'
|
119
|
-
```
|
120
|
-
|
121
|
-
Add ```rails_admin_mongoid_localize_field``` gem if using MongoDB:
|
122
|
-
|
123
|
-
```ruby
|
124
|
-
gem 'rails_admin_mongoid_localize_field'
|
125
|
-
```
|
126
|
-
|
127
|
-
### Documentation
|
128
|
-
|
129
|
-
It's basically Mongoid + Rails Admin + some of my common models and controllers, etc.
|
130
|
-
|
131
|
-
See their documentation for more info
|
132
|
-
|
133
|
-
## Contributing
|
134
|
-
|
135
|
-
1. Fork it
|
136
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
137
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
138
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
139
|
-
5. Create new Pull Request
|
5
|
+
#### Inspired by [RocketCMS](https://github.com/rs-pro/rocket_cms)
|
@@ -1,12 +1,33 @@
|
|
1
1
|
module Enjoy::PoweredHelper
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
# TODO CMS site block
|
4
|
+
# def render_enjoy_powered_by_block
|
5
|
+
# content_tag :div, class: 'enjoy-powered' do
|
6
|
+
# ret = []
|
7
|
+
# ret << content_tag(:span, class: 'powered') do
|
8
|
+
# "Сайт работает на "
|
9
|
+
# end
|
10
|
+
# _attrs = {
|
11
|
+
# class: "powered_by",
|
12
|
+
# target: "_blank",
|
13
|
+
# title: "Enjoy CMS",
|
14
|
+
# data: {
|
15
|
+
# "enjoy-goto-disabled": true
|
16
|
+
# }
|
17
|
+
# }
|
18
|
+
# ret << link_to("Enjoy CMS", "http://cms.enjoycreate.ru", _attrs)
|
19
|
+
# ret.join.html_safe
|
20
|
+
# end
|
21
|
+
# end
|
22
|
+
|
23
|
+
def render_enjoy_created_by_block
|
24
|
+
content_tag :div, class: 'enjoy-created-by' do
|
4
25
|
ret = []
|
5
|
-
ret << content_tag(:span, class: '
|
26
|
+
ret << content_tag(:span, class: 'created-by') do
|
6
27
|
"Сайт разработан"
|
7
28
|
end
|
8
29
|
_attrs = {
|
9
|
-
class: "
|
30
|
+
class: "created_by",
|
10
31
|
target: "_blank",
|
11
32
|
title: "Enjoy Creative studio",
|
12
33
|
data: {
|
@@ -17,4 +38,5 @@ module Enjoy::PoweredHelper
|
|
17
38
|
ret.join.html_safe
|
18
39
|
end
|
19
40
|
end
|
41
|
+
|
20
42
|
end
|
data/enjoy_cms.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'enjoy_cms'
|
7
7
|
spec.version = Enjoy::VERSION
|
8
8
|
spec.authors = ['Alexander Kiseliev']
|
9
|
-
spec.email = ["
|
9
|
+
spec.email = ["i43ack@gmail.com"]
|
10
10
|
spec.description = %q{EnjoyCMS }
|
11
11
|
spec.summary = %q{Please DO NOT use this gem directly, use enjoy_cms_mongoid or enjoy_cms_activerecord instead!}
|
12
12
|
spec.homepage = 'https://github.com/enjoycreative/enjoy_cms'
|
@@ -6,12 +6,26 @@ module Enjoy::RailsAdminGroupPatch
|
|
6
6
|
|
7
7
|
if fields.is_a?(Array)
|
8
8
|
fields.each do |_group|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
_name_default = :default
|
10
|
+
_name = _group.delete(:name) || _name_default
|
11
|
+
_active_default = (_name == :default ? true : false)
|
12
|
+
_fields_default = {}
|
13
|
+
_group_fields = (_group.delete(:fields) || _fields_default)
|
14
|
+
|
15
|
+
config.group _name do
|
16
|
+
_group.each_pair do |name, val|
|
17
|
+
|
18
|
+
# TODO: find more logical sulution
|
19
|
+
begin
|
20
|
+
begin
|
21
|
+
send name, val
|
22
|
+
rescue
|
23
|
+
send name
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
_group_fields.each_pair do |name, type|
|
15
29
|
if type.blank?
|
16
30
|
field name
|
17
31
|
else
|
@@ -22,6 +36,8 @@ module Enjoy::RailsAdminGroupPatch
|
|
22
36
|
end
|
23
37
|
end
|
24
38
|
end
|
39
|
+
|
40
|
+
|
25
41
|
end
|
26
42
|
end
|
27
43
|
|
data/lib/enjoy/version.rb
CHANGED
data/template.rb
CHANGED
@@ -360,7 +360,7 @@ inject_into_file 'app/models/user.rb', before: /^end/ do <<-TEXT
|
|
360
360
|
field :roles do
|
361
361
|
pretty_value do
|
362
362
|
render_object = (bindings[:controller] || bindings[:view])
|
363
|
-
render_object.content_tag(:p, bindings[:object].roles.join(", "))
|
363
|
+
render_object.content_tag(:p, bindings[:object].roles.join(", ")) if render_object
|
364
364
|
end
|
365
365
|
end
|
366
366
|
end
|
@@ -371,14 +371,14 @@ inject_into_file 'app/models/user.rb', before: /^end/ do <<-TEXT
|
|
371
371
|
field :email, :string do
|
372
372
|
visible do
|
373
373
|
render_object = (bindings[:controller] || bindings[:view])
|
374
|
-
render_object.current_user.admin? or (render_object.current_user.manager? and render_object.current_user == bindings[:object])
|
374
|
+
render_object and (render_object.current_user.admin? or (render_object.current_user.manager? and render_object.current_user == bindings[:object]))
|
375
375
|
end
|
376
376
|
end
|
377
377
|
field :name, :string
|
378
378
|
field :login, :string do
|
379
379
|
visible do
|
380
380
|
render_object = (bindings[:controller] || bindings[:view])
|
381
|
-
render_object.current_user.admin?
|
381
|
+
render_object and render_object.current_user.admin?
|
382
382
|
end
|
383
383
|
end
|
384
384
|
end
|
@@ -396,7 +396,7 @@ inject_into_file 'app/models/user.rb', before: /^end/ do <<-TEXT
|
|
396
396
|
|
397
397
|
visible do
|
398
398
|
render_object = (bindings[:controller] || bindings[:view])
|
399
|
-
render_object.current_user.admin?
|
399
|
+
render_object and render_object.current_user.admin?
|
400
400
|
end
|
401
401
|
end
|
402
402
|
end
|
@@ -406,13 +406,13 @@ inject_into_file 'app/models/user.rb', before: /^end/ do <<-TEXT
|
|
406
406
|
field :password do
|
407
407
|
visible do
|
408
408
|
render_object = (bindings[:controller] || bindings[:view])
|
409
|
-
render_object.current_user.admin? or render_object.current_user == bindings[:object]
|
409
|
+
render_object and (render_object.current_user.admin? or render_object.current_user == bindings[:object])
|
410
410
|
end
|
411
411
|
end
|
412
412
|
field :password_confirmation do
|
413
413
|
visible do
|
414
414
|
render_object = (bindings[:controller] || bindings[:view])
|
415
|
-
render_object.current_user.admin? or render_object.current_user == bindings[:object]
|
415
|
+
render_object and (render_object.current_user.admin? or render_object.current_user == bindings[:object])
|
416
416
|
end
|
417
417
|
end
|
418
418
|
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.4.
|
4
|
+
version: 0.4.1
|
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-08-
|
11
|
+
date: 2016-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -208,7 +208,7 @@ dependencies:
|
|
208
208
|
version: '0'
|
209
209
|
description: 'EnjoyCMS '
|
210
210
|
email:
|
211
|
-
-
|
211
|
+
- i43ack@gmail.com
|
212
212
|
executables: []
|
213
213
|
extensions: []
|
214
214
|
extra_rdoc_files: []
|