cambium 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +339 -15
  4. data/{lib/generators/cambium/templates/app/assets/javascripts/admin/admin.js.coffee → app/assets/javascripts/cambium/admin/application.js.coffee} +4 -10
  5. data/app/assets/javascripts/cambium/admin/routers/router.js.coffee +25 -0
  6. data/app/assets/javascripts/cambium/admin/users.js +2 -0
  7. data/app/assets/javascripts/cambium/admin/views/dropdown_menu.js.coffee +24 -0
  8. data/app/assets/javascripts/cambium/admin/views/pickadate.js.coffee +15 -0
  9. data/app/assets/stylesheets/cambium/admin/application.scss +27 -0
  10. data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_colors.scss +7 -7
  11. data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones.scss +18 -18
  12. data/app/assets/stylesheets/cambium/admin/partials/_globals.scss +21 -0
  13. data/app/assets/stylesheets/cambium/admin/partials/activity.scss +52 -0
  14. data/app/assets/stylesheets/cambium/admin/partials/components.scss +64 -0
  15. data/app/assets/stylesheets/cambium/admin/partials/dashboard.scss +48 -0
  16. data/app/assets/stylesheets/cambium/admin/partials/forms.scss +107 -0
  17. data/app/assets/stylesheets/cambium/admin/partials/header.scss +113 -0
  18. data/app/assets/stylesheets/cambium/admin/partials/page_title.scss +42 -0
  19. data/app/assets/stylesheets/cambium/admin/partials/sidebar.scss +41 -0
  20. data/app/assets/stylesheets/cambium/admin/partials/tables.scss +80 -0
  21. data/app/assets/stylesheets/cambium/admin/partials/typography.scss +5 -0
  22. data/app/assets/stylesheets/cambium/admin/partials/wireframe.scss +52 -0
  23. data/app/assets/stylesheets/cambium/admin/users.css +4 -0
  24. data/app/controllers/cambium/admin/dashboard_controller.rb +12 -0
  25. data/app/controllers/cambium/admin/search_controller.rb +9 -0
  26. data/app/controllers/cambium/admin/users_controller.rb +30 -0
  27. data/app/controllers/cambium/admin_controller.rb +90 -0
  28. data/app/helpers/cambium/cambium_helper.rb +205 -0
  29. data/app/presenters/cambium/admin_presenter.rb +127 -0
  30. data/app/views/cambium/admin/_activity.html.erb +6 -0
  31. data/app/views/cambium/admin/_header.html.erb +41 -0
  32. data/app/views/cambium/admin/_sidebar.html.erb +19 -0
  33. data/app/views/cambium/admin/_status.html.erb +5 -0
  34. data/app/views/cambium/admin/dashboard/show.html.erb +5 -0
  35. data/app/views/cambium/admin/edit.html.erb +7 -0
  36. data/app/views/cambium/admin/index.html.erb +7 -0
  37. data/app/views/cambium/admin/new.html.erb +7 -0
  38. data/app/views/cambium/admin/paper_trail/versions/_version.html.erb +20 -0
  39. data/app/views/cambium/admin/search/index.html.erb +38 -0
  40. data/app/views/layouts/admin.html.erb +25 -0
  41. data/bin/rails +12 -0
  42. data/cambium.gemspec +19 -15
  43. data/config/routes.rb +10 -0
  44. data/lib/cambium/configuration.rb +28 -0
  45. data/lib/cambium/engine.rb +2 -1
  46. data/lib/cambium/version.rb +1 -1
  47. data/lib/cambium.rb +12 -1
  48. data/lib/generators/cambium/admin_generator.rb +104 -0
  49. data/lib/generators/cambium/app_generator.rb +205 -0
  50. data/lib/generators/cambium/controller_generator.rb +81 -0
  51. data/lib/generators/cambium/gemfile_generator.rb +36 -0
  52. data/lib/generators/cambium/install_generator.rb +19 -0
  53. data/lib/generators/cambium/user_generator.rb +40 -0
  54. data/lib/generators/{cambium/helpers → helpers}/generators_helper.rb +32 -24
  55. data/lib/generators/templates/Gemfile.erb +79 -0
  56. data/lib/generators/{cambium/templates/app/assets/javascripts/backbone/app.js.coffee → templates/app/assets/javascripts/application.js.coffee} +9 -1
  57. data/lib/generators/templates/app/assets/javascripts/views/default_helpers.js.coffee +16 -0
  58. data/lib/generators/templates/app/assets/stylesheets/admin/admin.scss +3 -0
  59. data/lib/generators/templates/app/controllers/admin/controller.rb.erb +2 -0
  60. data/lib/generators/{cambium/templates → templates}/app/controllers/application_controller.rb +1 -5
  61. data/lib/generators/{cambium/templates → templates}/app/models/user.rb +4 -4
  62. data/lib/generators/templates/app/views/application/_status.html.erb +3 -0
  63. data/lib/generators/{cambium/templates → templates}/app/views/layouts/application.html.erb +1 -1
  64. data/lib/generators/templates/config/admin/controller.yml.erb +24 -0
  65. data/lib/generators/templates/config/admin/sidebar.yml +9 -0
  66. data/lib/generators/templates/config/admin/users.yml +31 -0
  67. data/lib/generators/{cambium/templates → templates}/config/application.rb +6 -4
  68. data/lib/generators/templates/config/initializers/_hash.rb +23 -0
  69. data/lib/generators/templates/config/initializers/_settings.rb +18 -0
  70. data/lib/generators/templates/config/initializers/assets.rb +1 -0
  71. data/lib/generators/templates/config/initializers/cambium.rb +16 -0
  72. data/lib/generators/templates/config/private.yml +16 -0
  73. data/lib/generators/templates/config/routes.rb +54 -0
  74. data/lib/generators/templates/config/settings.yml +16 -0
  75. data/lib/generators/{cambium/templates → templates}/gitignore +1 -1
  76. data/lib/help/cambium_prereqs.txt +13 -0
  77. data/lib/help/pg_search_post_install.txt +13 -0
  78. data/lib/{generators/cambium/templates/lib/tasks → tasks}/db.rake +2 -2
  79. data/lib/{generators/cambium/templates/lib/tasks → tasks}/rename.rake +1 -1
  80. data/test/controllers/cambium/admin/dashboard_controller_test.rb +9 -0
  81. data/test/controllers/cambium/admin/users_controller_test.rb +9 -0
  82. data/test/controllers/cambium/admin_controller_test.rb +9 -0
  83. metadata +192 -152
  84. data/bin/cambium +0 -16
  85. data/lib/generators/cambium/helpers/dependencies_helper.rb +0 -58
  86. data/lib/generators/cambium/install/admin_generator.rb +0 -110
  87. data/lib/generators/cambium/install/app_generator.rb +0 -162
  88. data/lib/generators/cambium/install/config_generator.rb +0 -182
  89. data/lib/generators/cambium/install/utilities_generator.rb +0 -57
  90. data/lib/generators/cambium/model/image_generator.rb +0 -67
  91. data/lib/generators/cambium/model/page_generator.rb +0 -131
  92. data/lib/generators/cambium/model/post_generator.rb +0 -71
  93. data/lib/generators/cambium/model/tag_generator.rb +0 -40
  94. data/lib/generators/cambium/model/user_generator.rb +0 -78
  95. data/lib/generators/cambium/templates/Gemfile +0 -43
  96. data/lib/generators/cambium/templates/Gemfile.erb +0 -40
  97. data/lib/generators/cambium/templates/_partials/pages/admin_icon.rb +0 -6
  98. data/lib/generators/cambium/templates/app/assets/javascripts/.DS_Store +0 -0
  99. data/lib/generators/cambium/templates/app/assets/javascripts/admin/collections/.gitkeep +0 -0
  100. data/lib/generators/cambium/templates/app/assets/javascripts/admin/models/.gitkeep +0 -0
  101. data/lib/generators/cambium/templates/app/assets/javascripts/admin/models/image.js.coffee +0 -14
  102. data/lib/generators/cambium/templates/app/assets/javascripts/admin/models/tag.js.coffee +0 -14
  103. data/lib/generators/cambium/templates/app/assets/javascripts/admin/parser_rules/custom.js +0 -552
  104. data/lib/generators/cambium/templates/app/assets/javascripts/admin/routers/router.js.coffee +0 -37
  105. data/lib/generators/cambium/templates/app/assets/javascripts/admin/tag.jst.ejs +0 -7
  106. data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/image.jst.ejs +0 -3
  107. data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/paginator_controls.jst.ejs +0 -8
  108. data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/paginator_nav.jst.ejs +0 -11
  109. data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/post_tag.jst.ejs +0 -1
  110. data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/accordion.js.coffee +0 -33
  111. data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/counter.js.coffee +0 -25
  112. data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/dropdown_toggle.js.coffee +0 -16
  113. data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/image_upload.js.coffee +0 -28
  114. data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/init_counter.js.coffee +0 -13
  115. data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/paginator.js.coffee +0 -86
  116. data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/publishable.js.coffee +0 -12
  117. data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/tags.js.coffee +0 -158
  118. data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/wysiwyg.js.coffee +0 -87
  119. data/lib/generators/cambium/templates/app/assets/javascripts/admin/wysihtml5.js +0 -9521
  120. data/lib/generators/cambium/templates/app/assets/javascripts/application.js +0 -10
  121. data/lib/generators/cambium/templates/app/assets/javascripts/backbone/templates/.keep +0 -0
  122. data/lib/generators/cambium/templates/app/assets/stylesheets/admin/admin.scss +0 -14
  123. data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_content.scss +0 -88
  124. data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_form.scss +0 -470
  125. data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_globals.scss +0 -39
  126. data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_header.scss +0 -121
  127. data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_nav.scss +0 -45
  128. data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_wireframe.scss +0 -24
  129. data/lib/generators/cambium/templates/app/assets/stylesheets/admin/wysihtml5.css +0 -7
  130. data/lib/generators/cambium/templates/app/controllers/admin/images_controller.rb +0 -45
  131. data/lib/generators/cambium/templates/app/controllers/admin/pages_controller.rb +0 -42
  132. data/lib/generators/cambium/templates/app/controllers/admin/posts_controller.rb +0 -39
  133. data/lib/generators/cambium/templates/app/controllers/admin/taggings_controller.rb +0 -69
  134. data/lib/generators/cambium/templates/app/controllers/admin/tags_controller.rb +0 -11
  135. data/lib/generators/cambium/templates/app/controllers/admin/users_controller.rb +0 -13
  136. data/lib/generators/cambium/templates/app/controllers/admin_controller.rb +0 -97
  137. data/lib/generators/cambium/templates/app/controllers/images_controller.rb +0 -45
  138. data/lib/generators/cambium/templates/app/controllers/pages_controller.rb +0 -12
  139. data/lib/generators/cambium/templates/app/controllers/posts_controller.rb +0 -11
  140. data/lib/generators/cambium/templates/app/helpers/admin/pages_controller.rb +0 -47
  141. data/lib/generators/cambium/templates/app/helpers/admin_helper.rb +0 -121
  142. data/lib/generators/cambium/templates/app/models/concerns/name.rb +0 -7
  143. data/lib/generators/cambium/templates/app/models/concerns/title.rb +0 -7
  144. data/lib/generators/cambium/templates/app/models/image.rb +0 -43
  145. data/lib/generators/cambium/templates/app/models/page.rb +0 -81
  146. data/lib/generators/cambium/templates/app/models/post.rb +0 -45
  147. data/lib/generators/cambium/templates/app/models/tag.rb +0 -33
  148. data/lib/generators/cambium/templates/app/models/tagging.rb +0 -20
  149. data/lib/generators/cambium/templates/app/uploaders/image_uploader.rb +0 -91
  150. data/lib/generators/cambium/templates/app/views/admin/_buttons.html.erb +0 -5
  151. data/lib/generators/cambium/templates/app/views/admin/_form.html.erb +0 -11
  152. data/lib/generators/cambium/templates/app/views/admin/_title.html.erb +0 -1
  153. data/lib/generators/cambium/templates/app/views/admin/edit.html.erb +0 -2
  154. data/lib/generators/cambium/templates/app/views/admin/images/_image.html.erb +0 -1
  155. data/lib/generators/cambium/templates/app/views/admin/images/create.js.erb +0 -7
  156. data/lib/generators/cambium/templates/app/views/admin/images/index.json.jbuilder +0 -4
  157. data/lib/generators/cambium/templates/app/views/admin/index.html.erb +0 -50
  158. data/lib/generators/cambium/templates/app/views/admin/new.html.erb +0 -2
  159. data/lib/generators/cambium/templates/app/views/admin/pages/_form.html.erb +0 -26
  160. data/lib/generators/cambium/templates/app/views/admin/posts/_form.html.erb +0 -40
  161. data/lib/generators/cambium/templates/app/views/admin/shared/_footer.html.erb +0 -2
  162. data/lib/generators/cambium/templates/app/views/admin/shared/_header.html.erb +0 -2
  163. data/lib/generators/cambium/templates/app/views/admin/shared/_insert_image.html.erb +0 -12
  164. data/lib/generators/cambium/templates/app/views/admin/shared/_nav.html.erb +0 -12
  165. data/lib/generators/cambium/templates/app/views/admin/shared/_status.html.erb +0 -3
  166. data/lib/generators/cambium/templates/app/views/admin/shared/forms/_editor.html.erb +0 -54
  167. data/lib/generators/cambium/templates/app/views/admin/shared/forms/_form_column_left.html.erb +0 -9
  168. data/lib/generators/cambium/templates/app/views/admin/shared/forms/_form_column_right.html.erb +0 -9
  169. data/lib/generators/cambium/templates/app/views/admin/shared/forms/_form_page.html.erb +0 -22
  170. data/lib/generators/cambium/templates/app/views/admin/shared/forms/_form_section.html.erb +0 -8
  171. data/lib/generators/cambium/templates/app/views/admin/shared/forms/_publishable.html.erb +0 -33
  172. data/lib/generators/cambium/templates/app/views/admin/users/_form.html.erb +0 -11
  173. data/lib/generators/cambium/templates/app/views/application/_status.html.erb +0 -3
  174. data/lib/generators/cambium/templates/app/views/layouts/.DS_Store +0 -0
  175. data/lib/generators/cambium/templates/app/views/layouts/admin.html.erb +0 -44
  176. data/lib/generators/cambium/templates/app/views/page_templates/default.html.erb +0 -2
  177. data/lib/generators/cambium/templates/app/views/posts/_post.html.erb +0 -4
  178. data/lib/generators/cambium/templates/app/views/posts/index.html.erb +0 -1
  179. data/lib/generators/cambium/templates/app/views/posts/show.html.erb +0 -10
  180. data/lib/generators/cambium/templates/config/app_routes.rb +0 -77
  181. data/lib/generators/cambium/templates/config/database.mysql2.yml.erb +0 -15
  182. data/lib/generators/cambium/templates/config/database.pg.yml.erb +0 -14
  183. data/lib/generators/cambium/templates/config/database.sqlite3.yml.erb +0 -18
  184. data/lib/generators/cambium/templates/config/initializers/_settings.rb +0 -11
  185. data/lib/generators/cambium/templates/config/initializers/assets.rb +0 -1
  186. data/lib/generators/cambium/templates/config/routes.rb.erb +0 -42
  187. data/lib/generators/cambium/templates/config/settings.yml +0 -15
  188. data/lib/generators/cambium/templates/config/settings_private.sample.yml +0 -15
  189. data/lib/generators/cambium/templates/config/settings_private.yml +0 -13
  190. data/lib/generators/cambium/templates/db/migrate/create_pages.rb.erb +0 -24
  191. data/lib/generators/cambium/templates/db/migrate/create_posts.rb +0 -19
  192. data/lib/generators/cambium/templates/lib/.DS_Store +0 -0
  193. data/lib/help/cambium +0 -7
  194. /data/{lib/generators/cambium/templates/app/assets/javascripts/backbone/collections → app/assets/javascripts/cambium/admin/templates}/.keep +0 -0
  195. /data/{lib/generators/cambium/templates/app/assets/javascripts/backbone → app/assets/javascripts/cambium/admin}/views/default_helpers.js.coffee +0 -0
  196. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/__default.scss +0 -0
  197. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_buttons.scss +0 -0
  198. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_components.scss +0 -0
  199. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_forms.scss +0 -0
  200. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_helpers.scss +0 -0
  201. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_images.scss +0 -0
  202. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_nav.scss +0 -0
  203. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_tables.scss +0 -0
  204. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_typography.scss +0 -0
  205. /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_wireframe.scss +0 -0
  206. /data/{lib/generators/cambium/templates/app → app}/models/concerns/idx.rb +0 -0
  207. /data/{lib/generators/cambium/templates/app → app}/models/concerns/image_cropper.rb +0 -0
  208. /data/{lib/generators/cambium/templates/app → app}/models/concerns/publishable.rb +0 -0
  209. /data/{lib/generators/cambium/templates/app → app}/models/concerns/slug.rb +0 -0
  210. /data/{lib/generators/cambium/templates/app → app}/models/concerns/tags.rb +0 -0
  211. /data/lib/generators/{cambium/helpers → helpers}/_autoloader.rb +0 -0
  212. /data/lib/generators/{cambium/templates/app/assets/javascripts/backbone → templates/app/assets/javascripts}/routers/router.js.coffee +0 -0
  213. /data/lib/generators/{cambium/templates/app/assets/javascripts/backbone/models → templates/app/assets/javascripts/templates}/.keep +0 -0
  214. /data/lib/generators/{cambium/templates → templates}/app/assets/stylesheets/application.scss +0 -0
  215. /data/lib/generators/{cambium/templates → templates}/app/views/home/index.html.erb +0 -0
  216. /data/lib/generators/{cambium/templates → templates}/db/seeds.rb +0 -0
  217. /data/{lib/generators/cambium/templates/vendor → vendor}/assets/javascripts/modernizr.js +0 -0
  218. /data/{lib/generators/cambium/templates/vendor → vendor}/assets/stylesheets/normalize.scss +0 -0
@@ -0,0 +1,79 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # ------------------------------------------ Base
4
+
5
+ # rails version
6
+ gem 'rails', '<%= @rails_version %>'
7
+
8
+ # app server
9
+ gem 'unicorn-rails'
10
+
11
+ # database adapter
12
+ gem 'pg'
13
+
14
+ # ------------------------------------------ Assets
15
+
16
+ # stylesheets helpers
17
+ gem 'sass-rails'
18
+ gem 'compass-rails'
19
+ gem 'bourbon'
20
+ gem 'bones-rails'
21
+
22
+ # javascripts helpers
23
+ gem 'uglifier'
24
+ gem 'coffee-rails'
25
+ gem 'jquery-rails'
26
+ gem 'backbone-on-rails'
27
+
28
+ # ------------------------------------------ View Helpers
29
+
30
+ gem 'simple_form'
31
+ gem 'jbuilder'
32
+ gem 'wysihtml5-rails'
33
+ gem 'pickadate-rails'
34
+ gem 'kaminari'
35
+
36
+ # ------------------------------------------ File Uploads
37
+
38
+ gem 'dragonfly'
39
+ gem 'jquery-fileupload-rails'
40
+ gem 'jcrop-rails-v2'
41
+
42
+ # ------------------------------------------ Utilities
43
+
44
+ gem 'devise'
45
+ gem 'cambium'
46
+ gem 'paper_trail'
47
+ gem 'pg_search'
48
+
49
+ # ------------------------------------------ Console Helpers
50
+
51
+ gem 'rails-console-tweaks'
52
+
53
+ group :console do
54
+ gem 'wirb'
55
+ gem 'hirb'
56
+ gem 'awesome_print'
57
+ end
58
+
59
+ # ------------------------------------------ Error Handling
60
+
61
+ group :development do
62
+ gem 'better_errors'
63
+ gem 'binding_of_caller'
64
+ end
65
+
66
+ # ------------------------------------------ Performance
67
+
68
+ group :production do
69
+ gem 'rack-cache', :require => 'rack/cache'
70
+ end
71
+
72
+ # ------------------------------------------ Testing
73
+
74
+ group :development, :test do
75
+ gem 'annotate'
76
+ gem 'factory_girl_rails'
77
+ gem 'faker'
78
+ gem 'rspec-rails'
79
+ end
@@ -1,5 +1,13 @@
1
+ #= require jquery
2
+ #= require jquery_ujs
3
+ #= require underscore
4
+ #= require backbone
5
+ #= require_self
6
+ #= require_tree ./templates
7
+ #= require_tree ./views
8
+ #= require_tree ./routers
9
+
1
10
  window.App =
2
- Models: {}
3
11
  Collections: {}
4
12
  Routers: {}
5
13
  Views: {}
@@ -0,0 +1,16 @@
1
+ class App.Views.DefaultHelpers extends Backbone.View
2
+
3
+ el: 'body'
4
+
5
+ initialize: =>
6
+ @disabledLinks()
7
+ @fadeOutNotices()
8
+
9
+ disabledLinks: =>
10
+ $('a.disabled').click (e) ->
11
+ e.preventDefault()
12
+
13
+ fadeOutNotices: =>
14
+ setTimeout () =>
15
+ $('.notice, .alert').fadeOut()
16
+ , 3500
@@ -0,0 +1,3 @@
1
+ // This is the file you may use to override (or add to)
2
+ // Cambium styles. You may also use this file as a manifest
3
+ // file if you wish to break out your custom styles.
@@ -0,0 +1,2 @@
1
+ class Admin::<%= @model.to_s.pluralize %>Controller < Cambium::AdminController
2
+ end
@@ -2,11 +2,7 @@
2
2
 
3
3
  # redirect to admin dashboard after signing in
4
4
  def after_sign_in_path_for(user)
5
- <% if @admin == true %>if current_user.is_admin?
6
- admin_dashboard_path
7
- else
8
- root_path
9
- end<% else %>root_path<% end %>
5
+ super
10
6
  end
11
7
 
12
8
  # redirect back to sign in form when signed out
@@ -4,11 +4,11 @@ class User < ActiveRecord::Base
4
4
 
5
5
  # Include default devise modules. Others available are:
6
6
  # :lockable, :timeoutable, :omniauthable, :confirmable, :registerable
7
- devise :database_authenticatable, :recoverable, :rememberable, :trackable,
7
+ devise :database_authenticatable, :recoverable, :rememberable, :trackable,
8
8
  :validatable
9
9
 
10
- # ------------------------------------------ Scopes
11
-
12
- scope :admins, -> { where(:is_admin => true) }
10
+ def to_s
11
+ email
12
+ end
13
13
 
14
14
  end
@@ -0,0 +1,3 @@
1
+ <% flash.each do |lvl, msg| %>
2
+ <%= content_tag(:p, msg, :class => lvl) %>
3
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html class="public">
3
3
  <head>
4
- <title><%= @site_title %></title>
4
+ <title><%= @config.app_title %></title>
5
5
  <meta charset="utf-8">
6
6
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
7
  <!-- <meta name="description" content="<%%#= @meta[:description] %>"> -->
@@ -0,0 +1,24 @@
1
+ model: <%= @model.to_s %>
2
+ table:
3
+ title: <%= @model_pl.titleize %>
4
+ scope: all
5
+ columns:<% @columns.each do |col| %>
6
+ <%= "#{col.name}:" %>
7
+ heading: <%= "#{col.name.titleize}" %><% end %>
8
+ buttons:
9
+ new: New <%= @model.to_s %>
10
+ export:
11
+ button: Export <%= @model.to_s.pluralize %>
12
+ columns:<% @columns.each do |col| %>
13
+ <%= "#{col.name}:" %>
14
+ label: <%= "#{col.name.titleize}" %><% end %>
15
+ form:
16
+ new: &new
17
+ title: New <%= @model.to_s %>
18
+ fields:<% @columns.each do |col| %>
19
+ <%= "#{col.name}:" %>
20
+ type: <%= ['integer','decimal','float'].include?(col.type.to_s) ?
21
+ 'string' : col.type.to_s %><% end %>
22
+ edit:
23
+ <<: *new
24
+ title: Edit <%= @model.to_s %>
@@ -0,0 +1,9 @@
1
+ dashboard:
2
+ label: Dashboard
3
+ route: cambium.admin_dashboard
4
+ icon: dashboard
5
+ users:
6
+ label: Users
7
+ route: cambium.admin_users
8
+ icon: users
9
+ controllers: ['users']
@@ -0,0 +1,31 @@
1
+ model: User
2
+ table:
3
+ title: Site Users
4
+ scope: all
5
+ columns:
6
+ email:
7
+ heading: Email
8
+ buttons:
9
+ new: New User
10
+ export:
11
+ button: Export Users
12
+ columns:
13
+ name:
14
+ label: Name
15
+ email:
16
+ label: Email
17
+ form:
18
+ new: &new
19
+ title: New User
20
+ fields:
21
+ name:
22
+ type: string
23
+ email:
24
+ type: string
25
+ password:
26
+ type: password
27
+ password_confirmation:
28
+ type: password
29
+ edit:
30
+ <<: *new
31
+ title: Edit User
@@ -1,15 +1,17 @@
1
1
 
2
2
  config.generators do |g|
3
- # g.fixture true
4
- # g.fixture_replacement "factory_girl"
5
- # g.test_framework :rspec
3
+ g.fixture true
4
+ g.fixture_replacement "factory_girl"
5
+ g.test_framework :rspec
6
6
  g.assets false
7
7
  g.view_specs false
8
+ g.model_specs false
8
9
  g.controller_specs false
9
10
  g.helper_specs false
10
11
  g.routing_specs false
11
12
  g.request_specs false
12
13
  g.stylesheets false
13
14
  g.javascripts false
14
- g.helper false
15
+ g.helpers false
16
+ g.skip_routes true
15
17
  end
@@ -0,0 +1,23 @@
1
+ class Hash
2
+
3
+ def to_ostruct
4
+ convert_to_ostruct_recursive(self)
5
+ end
6
+
7
+ private
8
+
9
+ def convert_to_ostruct_recursive(obj)
10
+ result = obj
11
+ if result.is_a? Hash
12
+ result = result.dup.symbolize_keys
13
+ result.each do |key, val|
14
+ result[key] = convert_to_ostruct_recursive(val)
15
+ end
16
+ result = OpenStruct.new(result)
17
+ elsif result.is_a? Array
18
+ result = result.map { |r| convert_to_ostruct_recursive(r) }
19
+ end
20
+ result
21
+ end
22
+
23
+ end
@@ -0,0 +1,18 @@
1
+ # Load config/settings.yml into Settings OpenStruct
2
+ #
3
+ begin
4
+ config_file = File.join(Rails.root,'config','settings.yml')
5
+ Settings = YAML.load_file(config_file)[Rails.env].to_ostruct
6
+ rescue
7
+ raise "Can't find file: #{config_file}"
8
+ end
9
+
10
+ # Loads config/private.yml (sensitive settings) into Private
11
+ # OpenStruct
12
+ #
13
+ begin
14
+ private_file = File.join(Rails.root,'config','private.yml')
15
+ Private = YAML.load_file(private_file)[Rails.env].to_ostruct
16
+ rescue
17
+ raise "Can't find file: #{private_file}"
18
+ end
@@ -0,0 +1 @@
1
+ Rails.application.config.assets.precompile += %w( modernizr.js )
@@ -0,0 +1,16 @@
1
+ Cambium.configure do |config|
2
+
3
+ # -------------------------------------------------- App Info
4
+
5
+ # Cambium uses these to set your root urls for
6
+ # mailers and other fun stuff.
7
+ #
8
+ config.development_url = 'localhost:3000'
9
+ config.production_url = 'example.com'
10
+
11
+ # The title of your app is what Cambium puts in the
12
+ # browser tab by default.
13
+ #
14
+ config.app_title = 'Cambium'
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # This file is for storing SENSITIVE settings. This file is
2
+ # not tracked.
3
+ #
4
+ # Values here are accessible through a recursive `Private`
5
+ # OpenStruct. For example, you can access "ABC123" using the
6
+ # example below through Private.my_group.my_special_key
7
+ #
8
+ development: &default
9
+ my_group:
10
+ my_special_key: "ABC123"
11
+
12
+ test:
13
+ <<: *default
14
+
15
+ production:
16
+ <<: *default
@@ -0,0 +1,54 @@
1
+ Rails.application.routes.draw do
2
+
3
+ # --- Cambium's Routes ---
4
+ #
5
+ # The following are Cambium's default routes. Feel free to
6
+ # customize (or delete) these to fit your needs.
7
+ #
8
+ # ------------------------------------------ Users (Devise)
9
+ #
10
+ # Learn more about Devise at https://github.com/plataformatec/devise
11
+ #
12
+ devise_for :users, :skip => [:sessions, :registrations]
13
+ devise_scope :user do
14
+ get '/login' => 'devise/sessions#new', :as => :new_user_session
15
+ post '/login' => 'devise/sessions#create', :as => :user_session
16
+ get '/logout' => 'devise/sessions#destroy', :as => :destroy_user_session
17
+ end
18
+ #
19
+ # ------------------------------------------ Admin
20
+ #
21
+ # Cambium already namespaces all its own routes, so it's
22
+ # best to just mount it at the root. This is the base
23
+ # setup if you are using Cambium's CMS
24
+ #
25
+ mount Cambium::Engine => '/'
26
+ #
27
+ # ------------------------------------------ JSON
28
+ #
29
+ # If you plan to use any public json routes, it's good to
30
+ # nest them in their own scope. We use a scope instead of
31
+ # a namespace because a controller action can have routes
32
+ # to it in different formats, so namespacing is
33
+ # unecessary.
34
+ #
35
+ # scope 'json' do
36
+ # 'users' => 'users#index'
37
+ # end
38
+ #
39
+ # ------------------------------------------ Public
40
+ #
41
+ # After we define all namespaced routes, we can move on to
42
+ # those routes that are not namespaced.
43
+ #
44
+ # resources :users
45
+ #
46
+ # ------------------------------------------ Home Page
47
+ #
48
+ # This is your application's home page. Feel free to
49
+ # delete the home controller and change this if you want a
50
+ # different home page.
51
+ #
52
+ root :to => 'home#index'
53
+
54
+ end
@@ -0,0 +1,16 @@
1
+ #
2
+ # This file is for storing NON-SENSITIVE settings.
3
+ #
4
+ # Values here are accessible through a recursive `Settings`
5
+ # OpenStruct. For example, you can access "ABC123" using the
6
+ # example below through Setting.say.hello
7
+ #
8
+ development: &default
9
+ say:
10
+ hello: "Hello"
11
+
12
+ test:
13
+ <<: *default
14
+
15
+ production:
16
+ <<: *default
@@ -19,7 +19,7 @@ esproj
19
19
 
20
20
  # Sensitive Data
21
21
  config/database.yml
22
- config/settings_private.yml
22
+ config/private.yml
23
23
 
24
24
  # Public Uploads
25
25
  public/uploads/
@@ -0,0 +1,13 @@
1
+
2
+ ==================== WARNING! ====================
3
+
4
+ No config file found. Please run:
5
+
6
+ rails g cambium:install
7
+
8
+ Before running this generator. If you wish to
9
+ skip this config check, you can run:
10
+
11
+ rails g cambium:install --no-config-check
12
+
13
+ ==================================================
@@ -0,0 +1,13 @@
1
+
2
+ ==================== PG SEARCH ====================
3
+
4
+ Add the following to each model that you would like
5
+ to be searchable:
6
+
7
+ include PgSearch
8
+ multisearchable :against => [:title, :author]
9
+
10
+ where :title and :author are the attributes you
11
+ wish to be searched
12
+
13
+ ==================================================
@@ -2,14 +2,14 @@ namespace :db do
2
2
 
3
3
  namespace :seed do
4
4
 
5
- desc "Create CSV Files for Models"
5
+ desc "Create CSV files from models"
6
6
  task :create_files => :environment do
7
7
  Dir.glob("#{Rails.root}/app/models/*.rb").each { |file| require file }
8
8
  dir = "#{Rails.root}/db/csv"
9
9
  FileUtils.mkdir(dir) unless File.exists?(dir)
10
10
  ActiveRecord::Base.descendants.each do |model|
11
11
  unless File.exists?("#{dir}/#{model.to_s.tableize}.csv")
12
- File.open("#{dir}/#{model.to_s.tableize}.csv", 'w+') do |f|
12
+ File.open("#{dir}/#{model.to_s.tableize}.csv", 'w+') do |f|
13
13
  f.write(model.columns.collect(&:name).join(','))
14
14
  end
15
15
  puts "CREATED FILE >> #{model.to_s.tableize}.csv"
@@ -18,7 +18,7 @@ namespace :rename do
18
18
  ]
19
19
  filenames.each do |filename|
20
20
  text = File.read(filename)
21
- File.open(filename, "w") do |file|
21
+ File.open(filename, "w") do |file|
22
22
  file << text.gsub(/Roots/, args[:new_name])
23
23
  end
24
24
  puts "CHECKED FILE >> #{filename}"
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module Cambium
4
+ class Admin::DashboardControllerTest < ActionController::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module Cambium
4
+ class Admin::UsersControllerTest < ActionController::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module Cambium
4
+ class AdminControllerTest < ActionController::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end