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.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +2 -0
  3. data/.gitignore +6 -1
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +18 -0
  6. data/README.md +4 -0
  7. data/Rakefile +17 -2
  8. data/app/assets/javascripts/chr.coffee +13 -26
  9. data/app/assets/javascripts/chr/{core/chr.coffee → chr.coffee} +4 -1
  10. data/app/assets/javascripts/chr/{core/chr_router.coffee → chr_router.coffee} +0 -0
  11. data/app/assets/javascripts/chr/{core/item.coffee → item.coffee} +2 -1
  12. data/app/assets/javascripts/chr/{core/list.coffee → list.coffee} +1 -1
  13. data/app/assets/javascripts/chr/{core/list_config.coffee → list_config.coffee} +0 -0
  14. data/app/assets/javascripts/chr/{core/list_pagination.coffee → list_pagination.coffee} +15 -4
  15. data/app/assets/javascripts/chr/{core/list_reorder.coffee → list_reorder.coffee} +0 -0
  16. data/app/assets/javascripts/chr/{core/list_search.coffee → list_search.coffee} +1 -1
  17. data/app/assets/javascripts/chr/{core/module.coffee → module.coffee} +0 -0
  18. data/app/assets/javascripts/chr/{core/utils.coffee → utils.coffee} +0 -0
  19. data/app/assets/javascripts/chr/{core/view.coffee → view.coffee} +21 -9
  20. data/app/assets/javascripts/chr/{core/view_local-storage.coffee → view_local-storage.coffee} +0 -0
  21. data/app/assets/javascripts/{chr/store/array-store.coffee → stores/array.coffee} +0 -0
  22. data/app/assets/javascripts/{chr/store/object-store.coffee → stores/object.coffee} +0 -0
  23. data/app/assets/javascripts/{chr/store/rails-array-store.coffee → stores/rails-array.coffee} +0 -0
  24. data/app/assets/javascripts/{chr/store → stores}/rails-form-object-parser.coffee +4 -1
  25. data/app/assets/javascripts/{chr/store/rails-object-store.coffee → stores/rails-object.coffee} +0 -0
  26. data/app/assets/javascripts/{chr/store/rest-array-store.coffee → stores/rest-array.coffee} +5 -2
  27. data/app/assets/javascripts/{chr/store/rest-object-store.coffee → stores/rest-object.coffee} +0 -0
  28. data/app/assets/stylesheets/{_chr.scss → chr.scss} +2 -7
  29. data/app/assets/stylesheets/chr/{_icons.scss → icons.scss} +0 -0
  30. data/app/assets/stylesheets/chr/{_main.scss → main.scss} +10 -3
  31. data/app/assets/stylesheets/chr/{_mixins.scss → mixins.scss} +0 -77
  32. data/app/assets/stylesheets/chr/{_settings.scss → settings.scss} +1 -1
  33. data/bin/chr +13 -0
  34. data/bin/rake +16 -0
  35. data/bin/setup +13 -0
  36. data/chr.gemspec +41 -21
  37. data/docs/tests.md +64 -0
  38. data/lib/chr.rb +10 -2
  39. data/lib/chr/app_builder.rb +385 -0
  40. data/lib/chr/generators/app_generator.rb +213 -0
  41. data/lib/chr/version.rb +3 -1
  42. data/lib/generators/chr/controller_generator.rb +18 -0
  43. data/templates/Gemfile.erb +38 -0
  44. data/templates/Procfile +1 -0
  45. data/templates/README.md.erb +45 -0
  46. data/templates/_analytics.html.erb +9 -0
  47. data/templates/_flashes.html.erb +7 -0
  48. data/templates/_javascript.html.erb +12 -0
  49. data/templates/application.coffee +2 -0
  50. data/templates/application.scss +1 -0
  51. data/templates/application.yml +6 -0
  52. data/templates/application_gitignore +14 -0
  53. data/templates/application_layout.html.erb.erb +29 -0
  54. data/templates/asset_sync.rb +28 -0
  55. data/templates/bin_setup.erb +36 -0
  56. data/templates/body_class_helper.rb +19 -0
  57. data/templates/bundler_audit.rake +12 -0
  58. data/templates/carrierwave.rb +23 -0
  59. data/templates/character_admin.coffee.erb +28 -0
  60. data/templates/character_admin.scss +3 -0
  61. data/templates/character_admin_index.html.erb +2 -0
  62. data/templates/character_admin_layout.html.erb +21 -0
  63. data/templates/character_base_controller.rb +16 -0
  64. data/templates/development_seeds.rb +12 -0
  65. data/templates/devise_overrides_passwords_controller.rb +10 -0
  66. data/templates/devise_overrides_passwords_edit.html.erb +30 -0
  67. data/templates/devise_overrides_passwords_new.html.erb +21 -0
  68. data/templates/devise_overrides_sessions_controller.rb +12 -0
  69. data/templates/devise_overrides_sessions_new.html.erb +31 -0
  70. data/templates/errors.rb +34 -0
  71. data/templates/json_encoding.rb +1 -0
  72. data/templates/newrelic.yml.erb +34 -0
  73. data/templates/puma.rb +18 -0
  74. data/templates/routes.rb +90 -0
  75. data/templates/sample.env +6 -0
  76. data/templates/secrets.yml +14 -0
  77. data/templates/smtp.rb +9 -0
  78. data/templates/staging.rb +5 -0
  79. data/test/factories/article_factory.rb +19 -0
  80. data/test/files/test.jpg +0 -0
  81. data/test/integration/article_fullsize_test.rb +33 -0
  82. data/test/integration/article_test.rb +33 -0
  83. data/test/integration/magazine_article_test.rb +33 -0
  84. data/test/integration/restricted_article_test.rb +33 -0
  85. data/test/integration/sport_article_test.rb +34 -0
  86. data/test/rails_app/Rakefile +6 -0
  87. data/test/rails_app/app/assets/javascripts/admin.coffee +137 -0
  88. data/test/rails_app/app/assets/javascripts/application.js +1 -0
  89. data/test/rails_app/app/assets/stylesheets/admin.scss +1 -0
  90. data/test/rails_app/app/assets/stylesheets/application.css +1 -0
  91. data/test/rails_app/app/controllers/admin/articles_controller.rb +7 -0
  92. data/test/rails_app/app/controllers/admin/base_controller.rb +8 -0
  93. data/test/rails_app/app/controllers/application_controller.rb +5 -0
  94. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  95. data/test/rails_app/app/models/article.rb +46 -0
  96. data/test/rails_app/app/uploaders/article_image_uploader.rb +16 -0
  97. data/test/rails_app/app/views/admin/index.html.erb +4 -0
  98. data/test/rails_app/app/views/layouts/admin.html.erb +17 -0
  99. data/test/rails_app/app/views/layouts/application.html.erb +14 -0
  100. data/test/rails_app/bin/bundle +3 -0
  101. data/test/rails_app/bin/rails +8 -0
  102. data/test/rails_app/bin/rake +8 -0
  103. data/test/rails_app/bin/setup +29 -0
  104. data/test/rails_app/bin/spring +15 -0
  105. data/test/rails_app/config.ru +4 -0
  106. data/test/rails_app/config/application.rb +36 -0
  107. data/test/rails_app/config/boot.rb +3 -0
  108. data/test/rails_app/config/environment.rb +5 -0
  109. data/test/rails_app/config/environments/development.rb +38 -0
  110. data/test/rails_app/config/environments/production.rb +76 -0
  111. data/test/rails_app/config/environments/test.rb +46 -0
  112. data/test/rails_app/config/initializers/assets.rb +12 -0
  113. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  114. data/test/rails_app/config/initializers/carrierwave.rb +5 -0
  115. data/test/rails_app/config/initializers/cookies_serializer.rb +3 -0
  116. data/test/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  117. data/test/rails_app/config/initializers/inflections.rb +16 -0
  118. data/test/rails_app/config/initializers/mime_types.rb +4 -0
  119. data/test/rails_app/config/initializers/session_store.rb +3 -0
  120. data/test/rails_app/config/initializers/wrap_parameters.rb +9 -0
  121. data/test/rails_app/config/locales/en.yml +23 -0
  122. data/test/rails_app/config/mongoid.yml +9 -0
  123. data/test/rails_app/config/routes.rb +8 -0
  124. data/test/rails_app/config/secrets.yml +22 -0
  125. data/test/rails_app/db/seeds.rb +7 -0
  126. data/test/rails_app/public/404.html +67 -0
  127. data/test/rails_app/public/422.html +67 -0
  128. data/test/rails_app/public/500.html +66 -0
  129. data/{app/assets/javascripts/form/input-date.coffee → test/rails_app/public/favicon.ico} +0 -0
  130. data/test/rails_app/public/robots.txt +5 -0
  131. data/test/support/character_front_end.rb +196 -0
  132. data/test/support/chr/item.rb +32 -0
  133. data/test/support/chr/list.rb +31 -0
  134. data/test/support/chr/list_pagination.rb +163 -0
  135. data/test/support/chr/list_reorder.rb +46 -0
  136. data/test/support/chr/list_search.rb +41 -0
  137. data/test/support/chr/view.rb +112 -0
  138. data/test/support/stores/array.rb +20 -0
  139. data/test/support/stores/rest-array.rb +34 -0
  140. data/test/test_helper.rb +68 -0
  141. metadata +373 -80
  142. data/Gruntfile.coffee +0 -101
  143. data/app/assets/javascripts/form/expandable-group.coffee +0 -30
  144. data/app/assets/javascripts/form/form.coffee +0 -221
  145. data/app/assets/javascripts/form/input-checkbox.coffee +0 -83
  146. data/app/assets/javascripts/form/input-color.coffee +0 -55
  147. data/app/assets/javascripts/form/input-file.coffee +0 -144
  148. data/app/assets/javascripts/form/input-form.coffee +0 -171
  149. data/app/assets/javascripts/form/input-form_reorder.coffee +0 -67
  150. data/app/assets/javascripts/form/input-hidden.coffee +0 -57
  151. data/app/assets/javascripts/form/input-list.coffee +0 -154
  152. data/app/assets/javascripts/form/input-list_reorder.coffee +0 -39
  153. data/app/assets/javascripts/form/input-list_typeahead.coffee +0 -55
  154. data/app/assets/javascripts/form/input-password.coffee +0 -32
  155. data/app/assets/javascripts/form/input-select.coffee +0 -84
  156. data/app/assets/javascripts/form/input-select2.coffee +0 -33
  157. data/app/assets/javascripts/form/input-string.coffee +0 -160
  158. data/app/assets/javascripts/form/input-text.coffee +0 -43
  159. data/app/assets/javascripts/input-html.coffee +0 -81
  160. data/app/assets/javascripts/input-markdown.coffee +0 -93
  161. data/app/assets/javascripts/input-redactor.coffee +0 -1
  162. data/app/assets/javascripts/redactor/input-redactor.coffee +0 -53
  163. data/app/assets/javascripts/redactor/input-redactor_character.coffee +0 -83
  164. data/app/assets/javascripts/redactor/input-redactor_images.coffee +0 -166
  165. data/app/assets/javascripts/vendor/ace.js +0 -18280
  166. data/app/assets/javascripts/vendor/jquery.scrollparent.js +0 -14
  167. data/app/assets/javascripts/vendor/jquery.textarea_autosize.js +0 -55
  168. data/app/assets/javascripts/vendor/jquery.typeahead.js +0 -1782
  169. data/app/assets/javascripts/vendor/marked.js +0 -1272
  170. data/app/assets/javascripts/vendor/mode-html.js +0 -2436
  171. data/app/assets/javascripts/vendor/mode-markdown.js +0 -2820
  172. data/app/assets/javascripts/vendor/redactor.fixedtoolbar.js +0 -107
  173. data/app/assets/javascripts/vendor/select2.js +0 -5274
  174. data/app/assets/stylesheets/_input-redactor.scss +0 -35
  175. data/app/assets/stylesheets/form/_expandable-group.scss +0 -16
  176. data/app/assets/stylesheets/form/_input-select2.scss +0 -94
  177. data/app/assets/stylesheets/form/_main.scss +0 -180
  178. data/app/assets/stylesheets/vendor/select2.css +0 -258
  179. data/bower.json +0 -38
  180. data/dist/chr.js +0 -5949
  181. data/dist/input-ace.js +0 -24946
  182. data/dist/input-redactor.js +0 -1
  183. data/lib/mongoid/character.rb +0 -30
  184. data/package.json +0 -10
@@ -0,0 +1,6 @@
1
+ # http://ddollar.github.com/foreman/
2
+ ASSET_HOST = localhost:3000
3
+ APPLICATION_HOST = localhost:3000
4
+ RACK_ENV = development
5
+ SECRET_KEY_BASE = development_secret
6
+ EXECJS_RUNTIME = Node
@@ -0,0 +1,14 @@
1
+ default: &default
2
+ secret_key_base: <%%= ENV.fetch('SECRET_KEY_BASE', 'development_secret') %>
3
+
4
+ development:
5
+ <<: *default
6
+
7
+ test:
8
+ <<: *default
9
+
10
+ staging:
11
+ <<: *default
12
+
13
+ production:
14
+ <<: *default
@@ -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,5 @@
1
+ require_relative "production"
2
+
3
+ Mail.register_interceptor(
4
+ RecipientInterceptor.new(ENV.fetch("EMAIL_RECIPIENTS"))
5
+ )
@@ -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
+
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,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -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,7 @@
1
+ class Admin::ArticlesController < Admin::BaseController
2
+ mongosteen
3
+
4
+ has_scope :sport_articles, type: :boolean
5
+
6
+ json_config methods: [ :test_method ]
7
+ end
@@ -0,0 +1,8 @@
1
+ class Admin::BaseController < ActionController::Base
2
+ protect_from_forgery
3
+
4
+ def index
5
+ render '/admin/index', layout: 'admin'
6
+ end
7
+
8
+ end
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -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
+