chr 0.3.5 → 0.4.9
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/.coveralls.yml +2 -0
- data/.gitignore +6 -1
- data/.ruby-version +1 -0
- data/.travis.yml +18 -0
- data/README.md +4 -0
- data/Rakefile +17 -2
- data/app/assets/javascripts/chr.coffee +13 -26
- data/app/assets/javascripts/chr/{core/chr.coffee → chr.coffee} +4 -1
- data/app/assets/javascripts/chr/{core/chr_router.coffee → chr_router.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/item.coffee → item.coffee} +2 -1
- data/app/assets/javascripts/chr/{core/list.coffee → list.coffee} +1 -1
- data/app/assets/javascripts/chr/{core/list_config.coffee → list_config.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/list_pagination.coffee → list_pagination.coffee} +15 -4
- data/app/assets/javascripts/chr/{core/list_reorder.coffee → list_reorder.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/list_search.coffee → list_search.coffee} +1 -1
- data/app/assets/javascripts/chr/{core/module.coffee → module.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/utils.coffee → utils.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/view.coffee → view.coffee} +21 -9
- data/app/assets/javascripts/chr/{core/view_local-storage.coffee → view_local-storage.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/array-store.coffee → stores/array.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/object-store.coffee → stores/object.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/rails-array-store.coffee → stores/rails-array.coffee} +0 -0
- data/app/assets/javascripts/{chr/store → stores}/rails-form-object-parser.coffee +4 -1
- data/app/assets/javascripts/{chr/store/rails-object-store.coffee → stores/rails-object.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/rest-array-store.coffee → stores/rest-array.coffee} +5 -2
- data/app/assets/javascripts/{chr/store/rest-object-store.coffee → stores/rest-object.coffee} +0 -0
- data/app/assets/stylesheets/{_chr.scss → chr.scss} +2 -7
- data/app/assets/stylesheets/chr/{_icons.scss → icons.scss} +0 -0
- data/app/assets/stylesheets/chr/{_main.scss → main.scss} +10 -3
- data/app/assets/stylesheets/chr/{_mixins.scss → mixins.scss} +0 -77
- data/app/assets/stylesheets/chr/{_settings.scss → settings.scss} +1 -1
- data/bin/chr +13 -0
- data/bin/rake +16 -0
- data/bin/setup +13 -0
- data/chr.gemspec +41 -21
- data/docs/tests.md +64 -0
- data/lib/chr.rb +10 -2
- data/lib/chr/app_builder.rb +385 -0
- data/lib/chr/generators/app_generator.rb +213 -0
- data/lib/chr/version.rb +3 -1
- data/lib/generators/chr/controller_generator.rb +18 -0
- data/templates/Gemfile.erb +38 -0
- data/templates/Procfile +1 -0
- data/templates/README.md.erb +45 -0
- data/templates/_analytics.html.erb +9 -0
- data/templates/_flashes.html.erb +7 -0
- data/templates/_javascript.html.erb +12 -0
- data/templates/application.coffee +2 -0
- data/templates/application.scss +1 -0
- data/templates/application.yml +6 -0
- data/templates/application_gitignore +14 -0
- data/templates/application_layout.html.erb.erb +29 -0
- data/templates/asset_sync.rb +28 -0
- data/templates/bin_setup.erb +36 -0
- data/templates/body_class_helper.rb +19 -0
- data/templates/bundler_audit.rake +12 -0
- data/templates/carrierwave.rb +23 -0
- data/templates/character_admin.coffee.erb +28 -0
- data/templates/character_admin.scss +3 -0
- data/templates/character_admin_index.html.erb +2 -0
- data/templates/character_admin_layout.html.erb +21 -0
- data/templates/character_base_controller.rb +16 -0
- data/templates/development_seeds.rb +12 -0
- data/templates/devise_overrides_passwords_controller.rb +10 -0
- data/templates/devise_overrides_passwords_edit.html.erb +30 -0
- data/templates/devise_overrides_passwords_new.html.erb +21 -0
- data/templates/devise_overrides_sessions_controller.rb +12 -0
- data/templates/devise_overrides_sessions_new.html.erb +31 -0
- data/templates/errors.rb +34 -0
- data/templates/json_encoding.rb +1 -0
- data/templates/newrelic.yml.erb +34 -0
- data/templates/puma.rb +18 -0
- data/templates/routes.rb +90 -0
- data/templates/sample.env +6 -0
- data/templates/secrets.yml +14 -0
- data/templates/smtp.rb +9 -0
- data/templates/staging.rb +5 -0
- data/test/factories/article_factory.rb +19 -0
- data/test/files/test.jpg +0 -0
- data/test/integration/article_fullsize_test.rb +33 -0
- data/test/integration/article_test.rb +33 -0
- data/test/integration/magazine_article_test.rb +33 -0
- data/test/integration/restricted_article_test.rb +33 -0
- data/test/integration/sport_article_test.rb +34 -0
- data/test/rails_app/Rakefile +6 -0
- data/test/rails_app/app/assets/javascripts/admin.coffee +137 -0
- data/test/rails_app/app/assets/javascripts/application.js +1 -0
- data/test/rails_app/app/assets/stylesheets/admin.scss +1 -0
- data/test/rails_app/app/assets/stylesheets/application.css +1 -0
- data/test/rails_app/app/controllers/admin/articles_controller.rb +7 -0
- data/test/rails_app/app/controllers/admin/base_controller.rb +8 -0
- data/test/rails_app/app/controllers/application_controller.rb +5 -0
- data/test/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/rails_app/app/models/article.rb +46 -0
- data/test/rails_app/app/uploaders/article_image_uploader.rb +16 -0
- data/test/rails_app/app/views/admin/index.html.erb +4 -0
- data/test/rails_app/app/views/layouts/admin.html.erb +17 -0
- data/test/rails_app/app/views/layouts/application.html.erb +14 -0
- data/test/rails_app/bin/bundle +3 -0
- data/test/rails_app/bin/rails +8 -0
- data/test/rails_app/bin/rake +8 -0
- data/test/rails_app/bin/setup +29 -0
- data/test/rails_app/bin/spring +15 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +36 -0
- data/test/rails_app/config/boot.rb +3 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +38 -0
- data/test/rails_app/config/environments/production.rb +76 -0
- data/test/rails_app/config/environments/test.rb +46 -0
- data/test/rails_app/config/initializers/assets.rb +12 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/carrierwave.rb +5 -0
- data/test/rails_app/config/initializers/cookies_serializer.rb +3 -0
- data/test/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/rails_app/config/initializers/inflections.rb +16 -0
- data/test/rails_app/config/initializers/mime_types.rb +4 -0
- data/test/rails_app/config/initializers/session_store.rb +3 -0
- data/test/rails_app/config/initializers/wrap_parameters.rb +9 -0
- data/test/rails_app/config/locales/en.yml +23 -0
- data/test/rails_app/config/mongoid.yml +9 -0
- data/test/rails_app/config/routes.rb +8 -0
- data/test/rails_app/config/secrets.yml +22 -0
- data/test/rails_app/db/seeds.rb +7 -0
- data/test/rails_app/public/404.html +67 -0
- data/test/rails_app/public/422.html +67 -0
- data/test/rails_app/public/500.html +66 -0
- data/{app/assets/javascripts/form/input-date.coffee → test/rails_app/public/favicon.ico} +0 -0
- data/test/rails_app/public/robots.txt +5 -0
- data/test/support/character_front_end.rb +196 -0
- data/test/support/chr/item.rb +32 -0
- data/test/support/chr/list.rb +31 -0
- data/test/support/chr/list_pagination.rb +163 -0
- data/test/support/chr/list_reorder.rb +46 -0
- data/test/support/chr/list_search.rb +41 -0
- data/test/support/chr/view.rb +112 -0
- data/test/support/stores/array.rb +20 -0
- data/test/support/stores/rest-array.rb +34 -0
- data/test/test_helper.rb +68 -0
- metadata +373 -80
- data/Gruntfile.coffee +0 -101
- data/app/assets/javascripts/form/expandable-group.coffee +0 -30
- data/app/assets/javascripts/form/form.coffee +0 -221
- data/app/assets/javascripts/form/input-checkbox.coffee +0 -83
- data/app/assets/javascripts/form/input-color.coffee +0 -55
- data/app/assets/javascripts/form/input-file.coffee +0 -144
- data/app/assets/javascripts/form/input-form.coffee +0 -171
- data/app/assets/javascripts/form/input-form_reorder.coffee +0 -67
- data/app/assets/javascripts/form/input-hidden.coffee +0 -57
- data/app/assets/javascripts/form/input-list.coffee +0 -154
- data/app/assets/javascripts/form/input-list_reorder.coffee +0 -39
- data/app/assets/javascripts/form/input-list_typeahead.coffee +0 -55
- data/app/assets/javascripts/form/input-password.coffee +0 -32
- data/app/assets/javascripts/form/input-select.coffee +0 -84
- data/app/assets/javascripts/form/input-select2.coffee +0 -33
- data/app/assets/javascripts/form/input-string.coffee +0 -160
- data/app/assets/javascripts/form/input-text.coffee +0 -43
- data/app/assets/javascripts/input-html.coffee +0 -81
- data/app/assets/javascripts/input-markdown.coffee +0 -93
- data/app/assets/javascripts/input-redactor.coffee +0 -1
- data/app/assets/javascripts/redactor/input-redactor.coffee +0 -53
- data/app/assets/javascripts/redactor/input-redactor_character.coffee +0 -83
- data/app/assets/javascripts/redactor/input-redactor_images.coffee +0 -166
- data/app/assets/javascripts/vendor/ace.js +0 -18280
- data/app/assets/javascripts/vendor/jquery.scrollparent.js +0 -14
- data/app/assets/javascripts/vendor/jquery.textarea_autosize.js +0 -55
- data/app/assets/javascripts/vendor/jquery.typeahead.js +0 -1782
- data/app/assets/javascripts/vendor/marked.js +0 -1272
- data/app/assets/javascripts/vendor/mode-html.js +0 -2436
- data/app/assets/javascripts/vendor/mode-markdown.js +0 -2820
- data/app/assets/javascripts/vendor/redactor.fixedtoolbar.js +0 -107
- data/app/assets/javascripts/vendor/select2.js +0 -5274
- data/app/assets/stylesheets/_input-redactor.scss +0 -35
- data/app/assets/stylesheets/form/_expandable-group.scss +0 -16
- data/app/assets/stylesheets/form/_input-select2.scss +0 -94
- data/app/assets/stylesheets/form/_main.scss +0 -180
- data/app/assets/stylesheets/vendor/select2.css +0 -258
- data/bower.json +0 -38
- data/dist/chr.js +0 -5949
- data/dist/input-ace.js +0 -24946
- data/dist/input-redactor.js +0 -1
- data/lib/mongoid/character.rb +0 -30
- data/package.json +0 -10
data/templates/smtp.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
SMTP_SETTINGS = {
|
|
2
|
+
address: ENV.fetch("SMTP_ADDRESS"), # example: "smtp.sendgrid.net"
|
|
3
|
+
authentication: :plain,
|
|
4
|
+
domain: ENV.fetch("SMTP_DOMAIN"), # example: "heroku.com"
|
|
5
|
+
enable_starttls_auto: true,
|
|
6
|
+
password: ENV.fetch("SMTP_PASSWORD"),
|
|
7
|
+
port: "587",
|
|
8
|
+
user_name: ENV.fetch("SMTP_USERNAME")
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
FactoryGirl.define do
|
|
2
|
+
factory :article do
|
|
3
|
+
sequence(:title) { Faker::Name.title}
|
|
4
|
+
sequence(:description) { Faker::Lorem.sentence }
|
|
5
|
+
sequence(:body_html) { Faker::Lorem.sentence }
|
|
6
|
+
|
|
7
|
+
factory :article_with_sport_scope do
|
|
8
|
+
after(:create) do |article|
|
|
9
|
+
# if rand(2) == 1
|
|
10
|
+
article.description = 'Sport News'
|
|
11
|
+
article.save
|
|
12
|
+
# end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
data/test/files/test.jpg
ADDED
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#-------------------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
## Config
|
|
4
|
+
|
|
5
|
+
# disableNewItems: true - do not show new item button in list header
|
|
6
|
+
# showWithParent: true - show list on a aside from parent
|
|
7
|
+
# disableFormCache: true
|
|
8
|
+
# searchable: true - add search button
|
|
9
|
+
# reorderable: true - permit reorder items
|
|
10
|
+
# disableDelete: true - do not add delete button below the form
|
|
11
|
+
# disableSave: true - do not add save button in header
|
|
12
|
+
# fullsizeView: true - use fullsize layout in desktop mode
|
|
13
|
+
# urlParams: Article.sport_articles - additional parameter to be included into request
|
|
14
|
+
# sortReverse: true - reverse objects sorting (descending order), default: false
|
|
15
|
+
|
|
16
|
+
# compoundModule: true - add this, if module is compound (add extra test)
|
|
17
|
+
# pagination: true - add this, if there are many objects (add extra test)
|
|
18
|
+
# uploaderImage: true - run tests, for checking uploader
|
|
19
|
+
|
|
20
|
+
#-------------------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
require 'test_helper'
|
|
23
|
+
class ArticleFullSizeFrontEndTest < ActionDispatch::IntegrationTest
|
|
24
|
+
|
|
25
|
+
factory_name = 'article'
|
|
26
|
+
class_name = Article
|
|
27
|
+
list_of_modules = ['fullsize_articles']
|
|
28
|
+
config = {fullsizeView: true}
|
|
29
|
+
character_front_end(factory_name, class_name, list_of_modules, config)
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#-------------------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
## Config
|
|
4
|
+
|
|
5
|
+
# disableNewItems: true - do not show new item button in list header
|
|
6
|
+
# showWithParent: true - show list on a aside from parent
|
|
7
|
+
# disableFormCache: true - do disable cache (desirable use in set with reorderable)
|
|
8
|
+
# searchable: true - add search button
|
|
9
|
+
# reorderable: true - permit reorder items
|
|
10
|
+
# disableDelete: true - do not add delete button below the form
|
|
11
|
+
# disableSave: true - do not add save button in header
|
|
12
|
+
# fullsizeView: true - use fullsize layout in desktop mode
|
|
13
|
+
# urlParams: Article.sport_articles - additional parameter to be included into request
|
|
14
|
+
# sortReverse: true - reverse objects sorting (descending order), default: false
|
|
15
|
+
# pagination: true - add this, if there are many objects (add extra test)
|
|
16
|
+
|
|
17
|
+
# compoundModule: true - add this, if module is compound (add extra test)
|
|
18
|
+
# uploaderImage: true - run tests, for checking uploader
|
|
19
|
+
|
|
20
|
+
#-------------------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
require 'test_helper'
|
|
23
|
+
class ArticleFrontEndTest < ActionDispatch::IntegrationTest
|
|
24
|
+
|
|
25
|
+
factory_name = 'article'
|
|
26
|
+
class_name = Article
|
|
27
|
+
list_of_modules = ['articles']
|
|
28
|
+
config = {searchable: true, reorderable: true, pagination: true, uploaderImage: true}
|
|
29
|
+
character_front_end(factory_name, class_name, list_of_modules, config)
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#-------------------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
## Config
|
|
4
|
+
|
|
5
|
+
# disableNewItems: true - do not show new item button in list header
|
|
6
|
+
# showWithParent: true - show list on a aside from parent
|
|
7
|
+
# disableFormCache: true
|
|
8
|
+
# searchable: true - add search button
|
|
9
|
+
# reorderable: true - permit reorder items
|
|
10
|
+
# disableDelete: true - do not add delete button below the form
|
|
11
|
+
# disableSave: true - do not add save button in header
|
|
12
|
+
# fullsizeView: true - use fullsize layout in desktop mode
|
|
13
|
+
# urlParams: Article.sport_articles - additional parameter to be included into request
|
|
14
|
+
# sortReverse: true - reverse objects sorting (descending order), default: false
|
|
15
|
+
|
|
16
|
+
# compoundModule: true - add this, if module is compound (add extra test)
|
|
17
|
+
# pagination: true - add this, if there are many objects (add extra test)
|
|
18
|
+
# uploaderImage: true - run tests, for checking uploader
|
|
19
|
+
|
|
20
|
+
#-------------------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
require 'test_helper'
|
|
23
|
+
class MagazineArticleFrontEndTest < ActionDispatch::IntegrationTest
|
|
24
|
+
|
|
25
|
+
factory_name = 'article'
|
|
26
|
+
class_name = Article
|
|
27
|
+
list_of_modules = ['magazine', 'pages', 'articles']
|
|
28
|
+
config = {compoundModule: true, sortReverse: true}
|
|
29
|
+
character_front_end(factory_name, class_name, list_of_modules, config)
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#-------------------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
## Config
|
|
4
|
+
|
|
5
|
+
# disableNewItems: true - do not show new item button in list header
|
|
6
|
+
# showWithParent: true - show list on a aside from parent
|
|
7
|
+
# disableFormCache: true
|
|
8
|
+
# searchable: true - add search button
|
|
9
|
+
# reorderable: true - permit reorder items
|
|
10
|
+
# disableDelete: true - do not add delete button below the form
|
|
11
|
+
# disableSave: true - do not add save button in header
|
|
12
|
+
# fullsizeView: true - use fullsize layout in desktop mode
|
|
13
|
+
# urlParams: Article.sport_articles - additional parameter to be included into request
|
|
14
|
+
# sortReverse: true - reverse objects sorting (descending order), default: false
|
|
15
|
+
|
|
16
|
+
# compoundModule: true - add this, if module is compound (add extra test)
|
|
17
|
+
# pagination: true - add this, if there are many objects (add extra test)
|
|
18
|
+
# uploaderImage: true - run tests, for checking uploader
|
|
19
|
+
|
|
20
|
+
#-------------------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
require 'test_helper'
|
|
23
|
+
class RestrictedArticleFrontEndTest < ActionDispatch::IntegrationTest
|
|
24
|
+
|
|
25
|
+
factory_name = 'article'
|
|
26
|
+
class_name = Article
|
|
27
|
+
list_of_modules = ['restricted_articles']
|
|
28
|
+
config = {disableNewItems: true, disableDelete: true, disableSave: true}
|
|
29
|
+
character_front_end(factory_name, class_name, list_of_modules, config)
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#-------------------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
## Config
|
|
4
|
+
|
|
5
|
+
# disableNewItems: true - do not show new item button in list header
|
|
6
|
+
# showWithParent: true - show list on a aside from parent
|
|
7
|
+
# disableFormCache: true - do disable cache (desirable use in set with reorderable)
|
|
8
|
+
# searchable: true - add search button
|
|
9
|
+
# reorderable: true - permit reorder items
|
|
10
|
+
# disableDelete: true - do not add delete button below the form
|
|
11
|
+
# disableSave: true - do not add save button in header
|
|
12
|
+
# fullsizeView: true - use fullsize layout in desktop mode
|
|
13
|
+
# urlParams: Article.sport_articles - additional parameter to be included into request
|
|
14
|
+
# sortReverse: true - reverse objects sorting (descending order), default: false
|
|
15
|
+
|
|
16
|
+
# compoundModule: true - add this, if module is compound (add extra test)
|
|
17
|
+
# pagination: true - add this, if there are many objects (add extra test)
|
|
18
|
+
# uploaderImage: true - run tests, for checking uploader
|
|
19
|
+
|
|
20
|
+
#-------------------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
require 'test_helper'
|
|
23
|
+
class SportArticleFrontEndTest < ActionDispatch::IntegrationTest
|
|
24
|
+
|
|
25
|
+
factory_name = 'article_with_sport_scope'
|
|
26
|
+
class_name = Article
|
|
27
|
+
list_of_modules = ['sport_articles']
|
|
28
|
+
urlParams = class_name.sport_articles
|
|
29
|
+
config = {urlParams: urlParams}
|
|
30
|
+
character_front_end(factory_name, class_name, list_of_modules, config)
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#= require jquery
|
|
2
|
+
#= require jquery_ujs
|
|
3
|
+
#= require chr
|
|
4
|
+
|
|
5
|
+
# ----------------------------------------------------------------------------------------
|
|
6
|
+
# TEST NOTES
|
|
7
|
+
# ----------------------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
## Module
|
|
10
|
+
# showNestedListsAside - We don`t use it anymore? — Yes, we do, please add to tests.
|
|
11
|
+
|
|
12
|
+
## List
|
|
13
|
+
# disableNewItems: true tested
|
|
14
|
+
# showWithParent: true tested
|
|
15
|
+
# disableFormCache: true tested
|
|
16
|
+
|
|
17
|
+
## View
|
|
18
|
+
# disableDelete - do not add delete button below the form tested
|
|
19
|
+
# disableSave - do not add save button in header tested
|
|
20
|
+
# fullsizeView — use fullsize layout in desktop mode tested
|
|
21
|
+
# onViewShow - on show callback
|
|
22
|
+
# defaultNewObject - used to generate new form
|
|
23
|
+
|
|
24
|
+
## Rest-Array
|
|
25
|
+
# urlParams: true tested
|
|
26
|
+
# searchable: true tested
|
|
27
|
+
|
|
28
|
+
## Array
|
|
29
|
+
# sortBy — objects field name which is used for sorting, does not sort
|
|
30
|
+
# when parameter is not provided, default: nil
|
|
31
|
+
# sortReverse — reverse objects sorting (descending order), default: false
|
|
32
|
+
# reorderable tested
|
|
33
|
+
|
|
34
|
+
# ----------------------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
$ ->
|
|
37
|
+
config =
|
|
38
|
+
modules:
|
|
39
|
+
fullsize_articles:
|
|
40
|
+
fullsizeView: true
|
|
41
|
+
|
|
42
|
+
arrayStore: new RailsArrayStore({
|
|
43
|
+
resource: 'article'
|
|
44
|
+
path: '/admin/articles'
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
formSchema:
|
|
49
|
+
title: { type: 'string' }
|
|
50
|
+
description: { type: 'text' }
|
|
51
|
+
body_html: { type: 'text' }
|
|
52
|
+
|
|
53
|
+
restricted_articles:
|
|
54
|
+
|
|
55
|
+
disableNewItems: true
|
|
56
|
+
disableDelete: true
|
|
57
|
+
disableSave: true
|
|
58
|
+
|
|
59
|
+
arrayStore: new RailsArrayStore({
|
|
60
|
+
resource: 'article'
|
|
61
|
+
path: '/admin/articles'
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
formSchema:
|
|
66
|
+
title: { type: 'string' }
|
|
67
|
+
description: { type: 'text' }
|
|
68
|
+
body_html: { type: 'text' }
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
articles:
|
|
72
|
+
|
|
73
|
+
disableFormCache: true
|
|
74
|
+
arrayStore: new RailsArrayStore({
|
|
75
|
+
resource: 'article'
|
|
76
|
+
path: '/admin/articles'
|
|
77
|
+
searchable: true
|
|
78
|
+
reorderable: { positionFieldName: '_position' }
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
formSchema:
|
|
83
|
+
title: { type: 'string' }
|
|
84
|
+
description: { type: 'text' }
|
|
85
|
+
_position: { type: 'float' }
|
|
86
|
+
body_html: { type: 'text' }
|
|
87
|
+
image: { type: 'image', label: 'Image <small>(600x375)</small>', thumbnail: (o) -> o.image.thumbnail_2x.url }
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
magazine:
|
|
91
|
+
title: 'Magazine'
|
|
92
|
+
items:
|
|
93
|
+
pages:
|
|
94
|
+
title: 'Pages'
|
|
95
|
+
showWithParent: true
|
|
96
|
+
disableFormCache: true
|
|
97
|
+
items:
|
|
98
|
+
articles:
|
|
99
|
+
|
|
100
|
+
arrayStore: new RailsArrayStore({
|
|
101
|
+
resource: 'article'
|
|
102
|
+
path: '/admin/articles'
|
|
103
|
+
sortBy: '_position'
|
|
104
|
+
sortReverse: true
|
|
105
|
+
searchable: true
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
formSchema:
|
|
110
|
+
title: { type: 'string' }
|
|
111
|
+
description: { type: 'text' }
|
|
112
|
+
_position: { type: 'float' }
|
|
113
|
+
body_html: { type: 'text' }
|
|
114
|
+
|
|
115
|
+
sport_articles:
|
|
116
|
+
|
|
117
|
+
disableFormCache: true
|
|
118
|
+
arrayStore: new RailsArrayStore({
|
|
119
|
+
resource: 'article'
|
|
120
|
+
path: '/admin/articles'
|
|
121
|
+
urlParams: { sport_articles: true }
|
|
122
|
+
searchable: true
|
|
123
|
+
reorderable: { positionFieldName: '_position' }
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
formSchema:
|
|
128
|
+
title: { type: 'string' }
|
|
129
|
+
description: { type: 'text' }
|
|
130
|
+
_position: { type: 'float' }
|
|
131
|
+
body_html: { type: 'text' }
|
|
132
|
+
|
|
133
|
+
chr.start(config)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Nothing is in here */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "chr";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Nothing is in here */
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
class Article
|
|
2
|
+
include Mongoid::Document
|
|
3
|
+
include Mongoid::Timestamps
|
|
4
|
+
include Mongoid::Search
|
|
5
|
+
|
|
6
|
+
include Ants::Id
|
|
7
|
+
include Ants::Orderable
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Attributes
|
|
11
|
+
field :title
|
|
12
|
+
field :description
|
|
13
|
+
field :body_html
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Uploader
|
|
17
|
+
mount_uploader :image, ArticleImageUploader
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Search
|
|
21
|
+
search_in :title, :description
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Scopes
|
|
25
|
+
scope :sport_articles, -> { where(description: 'Sport News') }
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Indexes
|
|
29
|
+
index({ description: 1 })
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Helpers
|
|
33
|
+
def _list_item_title
|
|
34
|
+
title
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _list_item_thumbnail
|
|
39
|
+
image? ? image.thumbnail_2x.url : ''
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|