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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6881a831904e091c4228d69c086ba4a5622c60be
4
- data.tar.gz: a35bac2b1517e59608167978861ca1a92cb1b94c
3
+ metadata.gz: 99887d04074970f7daa654f9fa7ff4eea5c3f0e7
4
+ data.tar.gz: 3933cd4cb15076a974d220c7331ad161fa563d33
5
5
  SHA512:
6
- metadata.gz: 0fcfddb768d58f562c4243f7b3506d08b37e2e5bb3968c04db8b3ea9a7a6d42b66ad263e53b327aeb8d1443e9ac62cb4782c2c5f4930d5a601f059841c9cb7d0
7
- data.tar.gz: 2ec1f058a8301385f794bb1ae7c623e93ae5eec0d874fbda981c030b27f6b872ff8134cda3ecce8452c52ac72bb108b26bd7d95ee5a2739286394ffd84ca528e
6
+ metadata.gz: db9cf246df9160103a22885bdca5dd61a01619ced628d36902913961190a75030f865b4902eb904b86b86b41b3efc6299a8fed04b711030dce2d8d4455eccb21
7
+ data.tar.gz: 162da5ef45897e73adeaa75e82dbd89076e41c3be2df3ea387dd1b676e6abf9f9fcccbf54f400e7d4fd6efb4c660c4f9389f96154fa8648b8310d92992661248
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Sean C Davis
1
+ Copyright (c) 2014-2015 Sean C Davis, Warren Harrison
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,30 +1,354 @@
1
- # Cambium
1
+ Cambium
2
+ ==========
2
3
 
3
- Cambium speeds up app development to keep you focusing on business logic and not
4
- worrying about repetitive tasks.
4
+ Cambium serves three main purposes in Ruby on Rails applications:
5
5
 
6
- **Initial sprint in progress. Documentation will be provided when the gem is
7
- ready for distribution.**
6
+ 1. Bootstrap Rails' standard installation by performing additional setup
7
+ (things I find myself doing at the beginning of every project).
8
+ 2. Facilitate development throughout the life of any project by abstracting
9
+ repeatable bits of code.
10
+ 3. Provide a simple, but flexible CMS for those applications that require it.
8
11
 
9
- ## Installation
12
+ For now, the documentation will be continued in the README. This will be moved
13
+ out over time.
10
14
 
11
- Add this line to your application's Gemfile:
15
+ App Setup
16
+ ----------
12
17
 
13
- gem 'cambium'
18
+ Cambium lets you get up and running real fast. First, start you rails project
19
+ as you normally would.
14
20
 
15
- And then execute:
21
+ ```text
22
+ $ rails new my_app -d postgresql
23
+ ```
16
24
 
17
- $ bundle
25
+ > Note: Cambium only supports PostgreSQL. If you need to use another database,
26
+ > I suggest you add an option into Cambium and create a pull request. However,
27
+ > I strongly encourage you to give PostgreSQL a try.
18
28
 
19
- Or install it yourself as:
29
+ Add Cambium to your Gemfile.
20
30
 
21
- $ gem install cambium
31
+ ```ruby
32
+ gem 'cambium', '>= 1.0.0'
33
+ ```
22
34
 
23
- ## Usage
35
+ > I would probably commit at this time (so it's easy to rollback if you don't
36
+ > like something Cambium did).
24
37
 
25
- TODO: Write usage instructions here
38
+ Generate Cambium's (simple) configuration file.
26
39
 
27
- ## Contributing
40
+ ```text
41
+ $ bundle exec rails g cambium:install
42
+ ```
43
+
44
+ Edit the config (config/initializers/cambium.rb) to your liking.
45
+
46
+ Then, get your PostgreSQL database configured by editing `config/database.yml`
47
+ to your appropriate settings.
48
+
49
+ > **Make sure you do not commit between this step and finishing the setup
50
+ > process.** Cambium will ignore this database.yml file, which is good, as it
51
+ > may contain sensitive data.
52
+
53
+ Then, create your database:
54
+
55
+ ```text
56
+ $ bundle exec rake db:create
57
+ ```
58
+
59
+ Although optional, I suggest you at least start with the default `Gemfile`.
60
+
61
+ ```text
62
+ $ bundle exec rails g cambium:gemfile
63
+ ```
64
+
65
+ Remove the gems you don't want and then bundle.
66
+
67
+ ```text
68
+ $ bundle install
69
+ ```
70
+
71
+ And now you can run Cambium's auto-setup generator.
72
+
73
+ ```text
74
+ $ bundle exec rails g cambium:app
75
+ ```
76
+
77
+ When you're done, you can migrate (and annotate), and be on your way!
78
+
79
+ ```text
80
+ $ bundle exec rake db:migrate
81
+ $ bundle exec annotate
82
+ ```
83
+
84
+ Admin / CMS
85
+ ----------
86
+
87
+ ### Install CMS
88
+
89
+ If you want to also setup a CMS, it's as simple as running the generator.
90
+
91
+ ```text
92
+ $ bundle exec rails g cambium:admin
93
+ ```
94
+
95
+ Run the migrations Cambium created with the admin generator.
96
+
97
+ ```text
98
+ $ bundle exec rake db:migrate
99
+ $ bundle exec annotate
100
+ ```
101
+
102
+ Make sure Cambium's engine is mounted in your `config/routes.rb` file.
103
+
104
+ ```ruby
105
+ mount Cambium::Engine => '/'
106
+ ```
107
+
108
+ It's best to mount it at the root because Cambium automatically namespaces its
109
+ routes.
110
+
111
+ At this point, you should be able to go to `localhost:3000/admin` and be
112
+ redirected to the login page (if you are not signed in). Once you have an admin
113
+ user and sign in successfully, you will be redirected to the admin dashboard.
114
+
115
+ ### Adding Users
116
+
117
+ We have a generator for creating a new user, which takes an `--admin` option if
118
+ you want the user to have admin access.
119
+
120
+ ```text
121
+ $ bundle exec rails g cambium:user [username] [password] [--admin / --no-admin]
122
+ ```
123
+
124
+ ### Generating Admin Controllers
125
+
126
+ A big portion of Cambium's power lies in its ability to spin up feature-full
127
+ CMS controllers and views in a snap.
128
+
129
+ Before you generate an admin controller, you need to make sure you have a
130
+ working data model. It's best if the model already has the columns you know
131
+ you're going to need (it's easy to add or remove later, but quicker if you have
132
+ what you need at the beginning).
133
+
134
+ Then you can run the generator.
135
+
136
+ ```text
137
+ $ bundle exec rails g cambium:controller [model]
138
+ ```
139
+
140
+ **Be sure you are using the proper class name of the data model.**
141
+
142
+ For example, if I have a `Page` model, this would be the command:
143
+
144
+ ```text
145
+ $ bundle exec rails g cambium:controller Page
146
+ ```
147
+
148
+ > Note: I'm working on making Cambium more powerful all the time. At the
149
+ > moment, it works best with simple form-type data.
150
+
151
+ The generator does a few things:
152
+
153
+ * Uses the standard Rails generate to generate a template in the `admin`
154
+ namespace (using the example, your file would be at
155
+ `app/controllers/admin/pages_controller.rb`).
156
+ * Adds a namespaced route to your routes file (`config/routes.rb`).
157
+ * Adds the Cambium config file (at `config/admin/pages.yml` in this example).
158
+ * Adds a generic sidebar item for your controller at
159
+ `config/admin/sidebar.yml`.
160
+
161
+ See below for information on the sidebar and controller settings.
162
+
163
+ ### Sidebar Settings
164
+
165
+ The sidebar in Cambium is driven by your `config/admin/sidebar.yml` settings
166
+ file. It's pretty semantic and simple.
167
+
168
+ The default sidebar is:
169
+
170
+ ```yaml
171
+ dashboard:
172
+ label: Dashboard
173
+ route: cambium.admin_dashboard
174
+ icon: dashboard
175
+ users:
176
+ label: Users
177
+ route: cambium.admin_users
178
+ icon: users
179
+ controllers: ['users']
180
+ ```
181
+
182
+ The important thing to remember is you have to define a unique key for each
183
+ item. For example, if you accidentally named `users` as `dashboard`, then only
184
+ the last `dashboard` item gets rendered.
185
+
186
+ The options are:
187
+
188
+ * `label`: Text within the sidebar link
189
+ * `route`: Route to apply to the link (for custom settings, replace `cambium`
190
+ with `main_app`)
191
+ * `icon`: The name of the icon to use, pulled from [IcoMoon's free
192
+ set](https://icomoon.io/#preview-free)
193
+ * `controllers`: An array of controllers which, if the current page is using
194
+ one of the controllers, the sidebar item will be highlighted (with an
195
+ `active` class)
196
+
197
+ ### Controller Settings
198
+
199
+ The controller settings are what drive the behavior of Cambium. And it's why,
200
+ for simple models, you don't have to add any code to your controller and you
201
+ don't need any views.
202
+
203
+ Each controller's settings file is named for that controller, and can be found
204
+ in `config/admin`. For example, the users controller settings are at
205
+ `config/admin/users.yml`.
206
+
207
+ Here is the default set for the users controller:
208
+
209
+ ```yaml
210
+ model: User
211
+ table:
212
+ title: Site Users
213
+ scope: all
214
+ columns:
215
+ email:
216
+ heading: Email
217
+ buttons:
218
+ new: New User
219
+ export:
220
+ button: Export Users
221
+ columns:
222
+ name:
223
+ label: Name
224
+ email:
225
+ label: Email
226
+ form:
227
+ new: &new
228
+ title: New User
229
+ fields:
230
+ name:
231
+ type: string
232
+ email:
233
+ type: string
234
+ password:
235
+ type: password
236
+ password_confirmation:
237
+ type: password
238
+ edit:
239
+ <<: *new
240
+ title: Edit User
241
+ ```
242
+
243
+ Every setting plays a role. Let's step through each one.
244
+
245
+ * `model`: The name (with class case) of the model to be used for this
246
+ controller
247
+ * `table:title`: The title to show on the controller's index view.
248
+ * `table:scope`: The scope method to run on the model. Most of the time this
249
+ will be `all`, but maybe you need to order, limit, or filter your results.
250
+ You need to do this through an [ActiveRecord
251
+ Scope](http://guides.rubyonrails.org/active_record_querying.html)
252
+ * `table:columns:[column]`: Each column gets its own unique key, which
253
+ distinguishes it from others
254
+ * `table:columns:[column]:heading`: The label for the column in the data table.
255
+ * `table:buttons:new`: Label for the "New" button. If you don't want a
256
+ new button, remove this setting.
257
+ * `export`: This section handles an export option for your data table. Remove
258
+ it if you don't want to offer that.
259
+ * `export:button`: The label for the export button.
260
+ * `export:columns:[column]`: Each column in the exported file gets its own
261
+ unique key, which distinguishes it from others
262
+ * `export:columns:[column]:label`: The heading in the exported file for that
263
+ column.
264
+ * `export:columns:[column]:output`: An optional method you can pass to each
265
+ object to help with display.
266
+ * `form`: Settings for the form.
267
+ * `form:[new/edit]`: New is the defaut, and most of the time Edit will inherit
268
+ from new (the `<<: *new` is what handles that). But you can optionally
269
+ override new values for your edit form.
270
+ * `form:[new/edit]:title`: Title for the form page.
271
+ * `form:[new/edit]:fields:[field]`: Each form field gets its own unique key to
272
+ set it apart from the others.
273
+ * `form:[new/edit]:fields:[field]:type`: The type of the HTML field to render,
274
+ which uses [SimpleForm](https://github.com/plataformatec/simple_form).
275
+
276
+ > Note: Aside from the usual form field types, Cambium uses [Mark It
277
+ > Zero!](https://github.com/seancdavis/mark_it_zero) to render markdown
278
+ > editors. You can pass `markdown` as the `type` option and it will give you a
279
+ > markdown editor.
280
+
281
+ Model Options
282
+ ----------
283
+
284
+ Cambium makes use of many gems, and uses the behavior of those gems to drive
285
+ much of its power. In many cases, this requires added options to your model.
286
+
287
+ ### Searchable Models
288
+
289
+ To make items searchable (in the CMS and in the app), we use
290
+ [pg_search](https://github.com/Casecommons/pg_search). You need to include the
291
+ `PgSearch` module, and then call out the columns you want to search.
292
+
293
+ For example, if you have a `Page` model and you want `title` and `body` to be
294
+ searchable, you're model might look like this:
295
+
296
+ ```ruby
297
+ class Page < ActiveRecord::Base
298
+ include PgSearch
299
+ multisearchable :against => [:title, :body]
300
+ end
301
+ ```
302
+
303
+ ### Activity Log
304
+
305
+ If you want to track the history of a model's records (which also means adding
306
+ it to the activity log in the CMS), you need to add `has_paper_trail` to your
307
+ model.
308
+
309
+ ```ruby
310
+ class Page < ActiveRecord::Base
311
+ has_paper_trail
312
+ end
313
+ ```
314
+
315
+ The activity log in particular makes use of the `to_s` method for the model. In
316
+ this way, we make no assumptions about the default attribute that describes a
317
+ model's record. Usually this is something like `title` or `name`. If it were
318
+ `title`, then your model (from above) is:
319
+
320
+ ```ruby
321
+ class Page < ActiveRecord::Base
322
+ has_paper_trail
323
+
324
+ def to_s
325
+ title
326
+ end
327
+ end
328
+ ```
329
+
330
+ ### Markdown to HTML
331
+
332
+ As mentioned above, Cambium uses [Mark It
333
+ Zero!](https://github.com/seancdavis/mark_it_zero) to render markdown editors.
334
+ You, therefore, also have the option to store a markdown text attribute and
335
+ have it automatically converted to HTML using the `after_save` callback.
336
+
337
+ If, for our `Page` example, you have `body_markdown` and `body_html` fields,
338
+ you can add your `body_markdown` attribute to the form and then the following
339
+ to your model:
340
+
341
+ ```ruby
342
+ class Page < ActiveRecord::Base
343
+ converts_markdown :body_markdown, :body_html
344
+ end
345
+ ```
346
+
347
+ See [this section](https://github.com/seancdavis/mark_it_zero#converting-to-
348
+ html) of the Mark It Zero! docs for more information and options.
349
+
350
+ Contributing
351
+ ----------
28
352
 
29
353
  1. Fork it ( https://github.com/[my-github-username]/cambium/fork )
30
354
  2. Create your feature branch (`git checkout -b my-new-feature`)
@@ -1,29 +1,23 @@
1
1
  #= require jquery
2
2
  #= require jquery_ujs
3
- #= require jquery-fileupload/basic
4
- #= require jquery-fileupload/vendor/tmpl
3
+ #= require mark_it_zero/mark_it_zero
5
4
  #= require pickadate/picker
6
5
  #= require pickadate/picker.date
7
6
  #= require pickadate/picker.time
8
- #= require admin/wysihtml5
9
- #= require admin/parser_rules/custom
10
7
  #= require underscore
11
8
  #= require backbone
12
9
  #= require_self
13
10
  #= require_tree ./templates
14
- #= require_tree ./models
15
- #= require_tree ./collections
16
11
  #= require_tree ./views
17
12
  #= require_tree ./routers
18
13
 
19
- window.Admin =
20
- Models: {}
14
+ window.App =
21
15
  Collections: {}
22
16
  Routers: {}
23
17
  Views: {}
24
18
 
25
- $(document).ready ->
26
- new Admin.Routers.Router
19
+ $ ->
20
+ new App.Routers.Router
27
21
 
28
22
  # Enable pushState for compatible browsers
29
23
  enablePushState = true
@@ -0,0 +1,25 @@
1
+ class App.Routers.Router extends Backbone.Router
2
+
3
+ initialize: =>
4
+ @autoLoadClass()
5
+
6
+ autoLoadClass: =>
7
+ # This is a good place to automatically load classes that may be dependent
8
+ # on a page element, and not necessarily the route.
9
+ #
10
+ # For example:
11
+ #
12
+ # new App.Views.Nav if $('.main-nav').length > 0
13
+ #
14
+ # Or, perhaps you need to load a class on every page. Do that, here, too,
15
+ # like this:
16
+ #
17
+ new App.Views.DefaultHelpers
18
+ new App.Views.DropdownMenu if $('.dropdown-menu').length > 0
19
+ new App.Views.Pickadate
20
+
21
+ routes:
22
+ '': 'initHomePage'
23
+
24
+ initHomePage: ->
25
+ console.log "Welcome to this awesome site, built using Cambium!"
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,24 @@
1
+ class App.Views.DropdownMenu extends Backbone.View
2
+
3
+ el: 'body'
4
+
5
+ events:
6
+ 'click .dropdown-trigger': 'showDropdown'
7
+
8
+ initialize: ->
9
+ $(document).click(@checkHideDropdown)
10
+
11
+ showDropdown: (e) ->
12
+ e.preventDefault()
13
+ $(e.target).closest('.dropdown-container').find('.dropdown-menu')
14
+ .toggleClass('active')
15
+ true
16
+
17
+ checkHideDropdown: (e) ->
18
+ if(
19
+ !$(e.target).is('.dropdown-menu') &&
20
+ !$(e.target).is('.dropdown-container') &&
21
+ $(e.target).parents('.dropdown-container').length == 0
22
+ )
23
+ $('.dropdown-menu').removeClass('active')
24
+ true
@@ -0,0 +1,15 @@
1
+ class App.Views.Pickadate extends Backbone.View
2
+
3
+ el: 'body'
4
+
5
+ initialize: ->
6
+ $('input.pickadate').pickadate()
7
+ $('input.pickatime').pickatime()
8
+ if $('div.pickadatetime').length > 0
9
+ $('input.pickadatetime-date').pickadate()
10
+ $('input.pickadatetime-time').pickatime()
11
+ $('input.pickadatetime-date, input.pickadatetime-time').change (e) ->
12
+ parent = $(e.target).parents('div.pickadatetime').first()
13
+ val = parent.find('input.pickadatetime-date').val()
14
+ val = "#{val} #{parent.find('input.pickadatetime-time').val()}"
15
+ $(e.target).siblings('input.pickadatetime').first().val(val)
@@ -0,0 +1,27 @@
1
+
2
+ // ------------------------------------------ Vendor
3
+
4
+ @import 'bourbon';
5
+ @import 'cambium/admin/bones/bones';
6
+ @import 'pickadate/classic';
7
+ @import 'pickadate/classic.date';
8
+ @import 'pickadate/classic.time';
9
+ @import 'mark_it_zero/mark_it_zero';
10
+
11
+ // ------------------------------------------ Partials
12
+
13
+ @import 'cambium/admin/partials/globals';
14
+ @import 'cambium/admin/partials/typography';
15
+ @import 'cambium/admin/partials/wireframe';
16
+ @import 'cambium/admin/partials/components';
17
+ @import 'cambium/admin/partials/header';
18
+ @import 'cambium/admin/partials/page_title';
19
+ @import 'cambium/admin/partials/sidebar';
20
+ @import 'cambium/admin/partials/activity';
21
+ @import 'cambium/admin/partials/forms';
22
+ @import 'cambium/admin/partials/tables';
23
+ @import 'cambium/admin/partials/dashboard';
24
+
25
+ // ------------------------------------------ Optional Override
26
+
27
+ @import 'admin/admin';
@@ -1,12 +1,12 @@
1
1
  /* Color Palette
2
2
  ============================ */
3
- $color-1: #0065BD; // used most often by default
4
- $color-2: #00A9E0;
5
- $color-3: #D48D2B;
6
- $color-4: #1F7D24;
7
- $color-5: #BDAD1B;
8
- $color-dark: #141819; // designed to be a dark color
9
- $color-light: #fbfcfc; // designed to be a light color
3
+ $color-1: #77D5D3;
4
+ $color-2: #FED96E;
5
+ $color-3: #9DC2DD;
6
+ $color-4: #DB5F7B;
7
+ $color-5: #24A9A7;
8
+ $color-dark: #293541; // designed to be a dark color
9
+ $color-light: #FFFFFF; // designed to be a light color
10
10
 
11
11
  // used primarily for notifications:
12
12
  $color-warning: #CCA300;
@@ -2,50 +2,50 @@
2
2
 
3
3
  /*
4
4
  * Welcome to Bones CSS Framework!
5
- *
6
- * This is the manifest file for Bones' CSS. It brings all files
5
+ *
6
+ * This is the manifest file for Bones' CSS. It brings all files
7
7
  * together.
8
8
  *
9
- * To add or remove modules, simply comment or uncomment and then
9
+ * To add or remove modules, simply comment or uncomment and then
10
10
  * use Compass to recompile and compress.
11
11
  *
12
12
  * Files are noted as recommended and required where applicable.
13
13
  *
14
14
  * Refer to the ../docs/ directory for more detailed instruction.
15
- *
15
+ *
16
16
  */
17
17
 
18
18
  /* Vendor
19
19
  ============================ */
20
20
  @import 'bones/vendor/normalize'; // highly recommended for cross-browser consistency
21
-
21
+
22
22
  /* Config
23
23
  ============================ */
24
24
  /*
25
- * These are your configuration files. You should always
25
+ * These are your configuration files. You should always
26
26
  * load all of these files, as the variable values are
27
27
  * resolved and do not contribute any size to the final
28
28
  * bones.css file.
29
29
  *
30
30
  */
31
- @import 'admin/bones/bones-config/colors';
32
- @import 'admin/bones/bones-config/_default';
33
- @import 'admin/bones/bones-config/wireframe';
34
- @import 'admin/bones/bones-config/typography';
35
- @import 'admin/bones/bones-config/buttons';
36
- @import 'admin/bones/bones-config/forms';
37
- @import 'admin/bones/bones-config/tables';
38
- @import 'admin/bones/bones-config/nav';
39
- @import 'admin/bones/bones-config/images';
40
- @import 'admin/bones/bones-config/components';
41
- @import 'admin/bones/bones-config/helpers';
31
+ @import 'cambium/admin/bones/bones-config/colors';
32
+ @import 'cambium/admin/bones/bones-config/_default';
33
+ @import 'cambium/admin/bones/bones-config/wireframe';
34
+ @import 'cambium/admin/bones/bones-config/typography';
35
+ @import 'cambium/admin/bones/bones-config/buttons';
36
+ @import 'cambium/admin/bones/bones-config/forms';
37
+ @import 'cambium/admin/bones/bones-config/tables';
38
+ @import 'cambium/admin/bones/bones-config/nav';
39
+ @import 'cambium/admin/bones/bones-config/images';
40
+ @import 'cambium/admin/bones/bones-config/components';
41
+ @import 'cambium/admin/bones/bones-config/helpers';
42
42
 
43
43
  /* Main Styles
44
44
  ============================ */
45
45
  @import 'bones/styles/_default'; // required
46
46
  @import 'bones/styles/wireframe';
47
47
  @import 'bones/styles/typography';
48
- @import 'bones/styles/icons'; // icomoon free icon font
48
+ @import 'bones/styles/icons';
49
49
  @import 'bones/styles/buttons';
50
50
  @import 'bones/styles/forms';
51
51
  @import 'bones/styles/tables';
@@ -0,0 +1,21 @@
1
+ * {
2
+ font-family: 'Source Sans Pro', "Helvetica Neue", Helvetica, Arial, sans-serif;
3
+ }
4
+
5
+ @mixin transition-all {
6
+ @include transition(all 0.25s ease-in-out);
7
+ }
8
+
9
+ @mixin clear-list {
10
+ list-style-type: none;
11
+ margin: 0;
12
+ padding: 0;
13
+ li {
14
+ margin: 0;
15
+ padding: 0;
16
+ a {
17
+ margin: 0;
18
+ padding: 0;
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,52 @@
1
+ aside#activity {
2
+ background: $color-light-dark;
3
+ border-left: 1px solid $color-light-darker;
4
+ padding: 25px 10px;
5
+ @include box-sizing(border-box);
6
+ article {
7
+ margin: 0 0 30px 0;
8
+ &:last-child {
9
+ margin-bottom: 0;
10
+ }
11
+ .avatar-container {
12
+ margin: 5px 10px 0 0;
13
+ border-color: $color-light-darker;
14
+ vertical-align: top;
15
+ width: 28px;
16
+ height: 28px;
17
+ }
18
+ .content {
19
+ display: inline-block;
20
+ width: 185px;
21
+ vertical-align: top;
22
+ p {
23
+ margin: 0;
24
+ font-size: 14px;
25
+ line-height: 18px;
26
+ &.action {
27
+ margin-top: 5px;
28
+ }
29
+ &.date {
30
+ color: darken($color-light-darkest, 15%);
31
+ font-weight: 400;
32
+ font-size: 12px;
33
+ line-height: 12px;
34
+ }
35
+ strong {
36
+ font-size: inherit;
37
+ line-height: inherit;
38
+ a {
39
+ font-size: inherit;
40
+ line-height: inherit;
41
+ font-weight: inherit;
42
+ color: inherit;
43
+ @include transition-all;
44
+ &:hover {
45
+ color: $color-dark-lightest;
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }