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
@@ -1,121 +0,0 @@
1
- module AdminHelper
2
-
3
- # --------------------------------- Inflectors
4
-
5
- def model_plural
6
- @model.to_s.tableize.humanize.titleize
7
- end
8
-
9
- def model_singular
10
- model_plural.singularize
11
- end
12
-
13
- def model_table
14
- @model.to_s.tableize
15
- end
16
-
17
- def model_table_singular
18
- model_table.singularize
19
- end
20
-
21
- # --------------------------------- Routes
22
-
23
- def set_routes
24
- @routes = {
25
- :index => send("admin_#{model_table}_path"),
26
- :new => send("new_admin_#{model_table_singular}_path")
27
- }
28
- unless params[:id].nil?
29
- @item = @model.find_by_id(params[:id])
30
- @item = @model.find_by_slug(params[:id]) if @item.nil?
31
- @routes.merge!(
32
- :show => send("admin_#{model_table_singular}_path", @item),
33
- :edit => send("edit_admin_#{model_table_singular}_path", @item)
34
- )
35
- end
36
- end
37
-
38
- # --------------------------------- Forms
39
-
40
- def form_page(options = {})
41
- render :partial => 'admin/shared/forms/form_page', :locals => options
42
- end
43
-
44
- def form_section(title, options = {}, &block)
45
- state = options[:open].nil? ? true : options[:open]
46
- render :partial => 'admin/shared/forms/form_section', :locals => {
47
- :title => title, :open => state, :content => capture(&block) }
48
- end
49
-
50
- def form_column(title, side = 'left', &block)
51
- side ||= 'left'
52
- render :partial => "admin/shared/forms/form_column_#{side}", :locals => {
53
- :title => title, :content => capture(&block) }
54
- end
55
-
56
- def wysiwyg(form, field = :body, idx = 1)
57
- render :partial => 'admin/shared/forms/editor', :locals => {
58
- :f => form, :field => field, :idx => idx }
59
- end
60
-
61
- def publishable_fields(form)
62
- render :partial => 'admin/shared/forms/publishable', :locals => { :f => form }
63
- end
64
-
65
- def wysihtml5_icon(cmd,icon = cmd,options = {})
66
- options[:cmd] = "data-wysihtml5-command-value='#{options[:cmd]}'" unless options[:cmd] == ''
67
- "<a data-wysihtml5-command='#{cmd}' #{options[:cmd]} id='#{options[:id]}'
68
- class='#{options[:class]}'>
69
- <i class='icon-#{icon}'></i>
70
- </a>".html_safe
71
- end
72
-
73
- def wysihtml5_link(cmd,val=cmd,options={})
74
- options[:cmd] = "data-wysihtml5-command-value='#{options[:cmd]}'" unless options[:cmd] == ''
75
- "<a data-wysihtml5-command='#{cmd}' #{options[:cmd]} id='#{options[:id]}' class='#{options[:class]}'>
76
- #{val}
77
- </a>".html_safe
78
- end
79
-
80
- # --------------------------------- Nav
81
-
82
- def admin_nav_items
83
- items = [
84
- {
85
- :label => 'Users',
86
- :icon => 'user',
87
- :path => admin_users_path,
88
- :controllers => ['users']
89
- },
90
- {
91
- :label => 'Visit Site',
92
- :icon => 'home',
93
- :path => root_path,
94
- :target => :blank
95
- },
96
- {
97
- :label => 'Logout',
98
- :icon => 'exit',
99
- :path => destroy_user_session_path
100
- }
101
- ]
102
- end
103
-
104
- def nav_active?(controllers)
105
- unless controllers.nil?
106
- controllers.each do |controller|
107
- return true if controller_name == controller
108
- end
109
- end
110
- false
111
- end
112
-
113
- # --------------------------------- Misc
114
-
115
- def icon_to(icon, path, options = {})
116
- link_to path, :class => options[:class] do
117
- "<i class='icon-#{icon}'></i>".html_safe
118
- end
119
- end
120
-
121
- end
@@ -1,7 +0,0 @@
1
- module Name
2
-
3
- def name
4
- title
5
- end
6
-
7
- end
@@ -1,7 +0,0 @@
1
- module Title
2
-
3
- def title
4
- name
5
- end
6
-
7
- end
@@ -1,43 +0,0 @@
1
- class Image < ActiveRecord::Base
2
-
3
- # ------------------------------------------ Plugins
4
-
5
- # As you might suspect, this concern (app/models/concerns/image_cropper.rb)
6
- # add all the methods we need to control cropping our images manually. If you
7
- # aren't going to use that feature, just get rid of this line.
8
- #
9
- include ImageCropper
10
-
11
- # ------------------------------------------ Uploaders
12
-
13
- # This is a carrierwave method that uses our ImageUploader
14
- # (app/uploaders/image_uploader.rb) to manage the uploading process and
15
- # creating versions
16
- #
17
- mount_uploader :filename, ImageUploader
18
-
19
- # ------------------------------------------ Validations
20
-
21
- # Require a file to actually be present when we try to create a new record
22
- #
23
- validates :filename, :presence => true
24
-
25
- # ------------------------------------------ Scopes
26
-
27
- # We don't like to use default scopes. But many times we'll reference a
28
- # listing of the images by the date they were creating.
29
- #
30
- scope :recent, -> { order('created_at DESC') }
31
-
32
- # ------------------------------------------ Instance Methods
33
-
34
- # This helps up with jQuery uploading (doing it on the fly vs. reloading a
35
- # page).
36
- #
37
- def to_jq_upload
38
- {
39
- "name" => read_attribute(:filename)
40
- }
41
- end
42
-
43
- end
@@ -1,81 +0,0 @@
1
- require 'yaml'
2
-
3
- class Page < ActiveRecord::Base
4
-
5
- # --------------------------------- plugins
6
-
7
- include Publishable, Slug
8
- # multisearchable :against => [:title, :body, :description], :using => :tsearch
9
- has_ancestry
10
-
11
- # --------------------------------- Associations
12
-
13
- # belongs_to :user, :as => :author
14
-
15
- # --------------------------------- Callbacks
16
-
17
- # --------------------------------- Validations
18
-
19
- validates :title, :presence => true
20
-
21
- # --------------------------------- Scopes
22
-
23
- default_scope { order('ancestry DESC, position ASC') }
24
- scope :for_nav, -> { where(:in_nav => true) }
25
-
26
- # --------------------------------- instance methods
27
-
28
- def parent_options
29
- if id.present?
30
- Page.unscoped.where('id != ?', id).order(:title)
31
- else
32
- Page.all.unscoped.order(:title)
33
- end
34
- end
35
-
36
- def to_s
37
- title
38
- end
39
-
40
- def ancestral_title
41
- ancestors.collect(&:title).push(title).join(' : ')
42
- end
43
-
44
- def template_name
45
- template.humanize
46
- end
47
-
48
- def template_value(field_name)
49
- if template_data.present? && template_data.has_key?(field_name.to_s)
50
- template_data[field_name.to_s]
51
- end
52
- end
53
-
54
- def template_fields
55
- template_file = "#{Rails.application.config.template_directory}/#{self.template}.yml"
56
- if File.exists?(template_file)
57
- template_yaml = YAML.load_file(template_file)
58
- template_yaml['fields']
59
- end
60
- end
61
-
62
- def has_nav_children?
63
- children.for_nav.published.count > 0
64
- end
65
-
66
- # --------------------------------- class methods
67
-
68
- def self.options_for_select
69
- Page.unscoped.published.order(:title).collect do |p|
70
- [p.title, "/#{p.slug}"]
71
- end
72
- end
73
-
74
- def self.template_options
75
- templates = []
76
- Dir["#{Rails.application.config.template_directory}/*.erb"].collect{|f| f.split('/').pop.split('.').shift}.each do |t|
77
- templates << [t.titleize, t]
78
- end
79
- end
80
-
81
- end
@@ -1,45 +0,0 @@
1
- class Post < ActiveRecord::Base
2
-
3
- # --------------------------------- plugins
4
-
5
- include Publishable, Slug, Tags
6
- # include PgSearch
7
- # multisearchable :against => [:title, :body], :using => :tsearch
8
- mount_uploader :main_image, ImageUploader
9
- paginates_per 10
10
-
11
- # --------------------------------- associations
12
-
13
- belongs_to :user
14
-
15
- # --------------------------------- validations
16
-
17
- validates :title, :presence => true
18
-
19
- # --------------------------------- scopes
20
-
21
- default_scope { order(:active_at => :desc) }
22
- scope :featured, -> { where(:is_featured => true) }
23
- scope :during, ->(year, month) { where(
24
- :active_at => "#{year}-#{month}-1".to_date..."#{year}-#{month}-1".to_date+1.month
25
- ) }
26
-
27
- # --------------------------------- instance methods
28
-
29
- def to_s
30
- self.title
31
- end
32
-
33
- def author
34
- self.user
35
- end
36
-
37
- def author_name
38
- author.full_name if author.present?
39
- end
40
-
41
- def summary_text
42
- "#{title} - #{active_at}, #{author.name}"
43
- end
44
-
45
- end
@@ -1,33 +0,0 @@
1
- # == Schema Information
2
- #
3
- # Table name: tags
4
- #
5
- # id :integer not null, primary key
6
- # name :string(255)
7
- # ci_name :string(255)
8
- # slug :string(255)
9
- # created_at :datetime
10
- # updated_at :datetime
11
- #
12
-
13
- class Tag < ActiveRecord::Base
14
-
15
- # ------------------------------------------ Plugins
16
-
17
- include Slug, Title
18
-
19
- # ------------------------------------------ Associations
20
-
21
- has_many :tag_assignments
22
-
23
- # ------------------------------------------ Callbacks
24
-
25
- before_save :downcase_name
26
-
27
- # ------------------------------------------ Instance Methods
28
-
29
- def downcase_name
30
- self.ci_name = self.name.downcase
31
- end
32
-
33
- end
@@ -1,20 +0,0 @@
1
- # == Schema Information
2
- #
3
- # Table name: taggings
4
- #
5
- # id :integer not null, primary key
6
- # tag_id :integer
7
- # taggable_id :integer
8
- # taggable_type :string(255)
9
- # created_at :datetime
10
- # updated_at :datetime
11
- #
12
-
13
- class Tagging < ActiveRecord::Base
14
-
15
- # ------------------------------------------ Associations
16
-
17
- belongs_to :tag
18
- belongs_to :taggable, :polymorphic => true
19
-
20
- end
@@ -1,91 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class ImageUploader < CarrierWave::Uploader::Base
4
-
5
- include CarrierWave::RMagick
6
- include CarrierWave::MimeTypes
7
-
8
- # This is our standard storage method, which stores the files to the file
9
- # system. In some cases, you might need to upload to a remote server. In that
10
- # case, we recommend using CarrierWave Direct:
11
- #
12
- # https://github.com/dwilkie/carrierwave_direct
13
- #
14
- storage :file
15
-
16
- # This is the path at which your images will be stored. This is different than
17
- # the default, but keeps the path to images nice and clean. Feel free to
18
- # change to your liking.
19
- #
20
- def store_dir
21
- "media/images/#{model.id}"
22
- end
23
-
24
- # These are the "versions" created when a new image is uploaded. You can
25
- # change these to meet your preferences, noting the comments below.
26
- #
27
- # For example, if the version is "thumb," you'll be able to get the image by
28
- # calling something like this:
29
- #
30
- # image = Image.find(1)
31
- # image.filename.thumb.url OR image.filename.url(:thumb)
32
- #
33
- version :thumb do
34
- #
35
- # resize_to_fill will automatically crop the image (to the middle),
36
- # resulting in an image of the dimensions you pass.
37
- #
38
- process :resize_to_fill => [150,150]
39
- end
40
-
41
- version :tile do
42
- #
43
- # If you want to override the manual crop (with the cropping tool), you need
44
- # to call this method (process :crop) before you process the resizing.
45
- #
46
- process :crop
47
- process :resize_to_fill => [240,180]
48
- end
49
-
50
- # This is the version we use for cropping. You need to ensure:
51
- #
52
- # 1. the process method is passing ":resize_to_limit" and NOT
53
- # ":resize_to_fill"
54
- #
55
- # 2. the dimensions are taller and wider than your version that calls
56
- # "process :crop"
57
- #
58
- version :to_crop do
59
- process :resize_to_limit => [500,500]
60
- end
61
-
62
- # If you wish to limit the file extensions, edit this list as necessary
63
- #
64
- # If, instead, you don't care about the file extension (although you should,
65
- # since the is an "image" uploader), you can delete this method.
66
- #
67
- def extension_white_list
68
- %w(jpg jpeg gif png)
69
- end
70
-
71
- # This method is physically preparing the method for manual cropping.
72
- #
73
- # MAKE SURE your "resize_to_limit" call here passes the dimensions IDENTICAL
74
- # TO YOUR :crop VERSION
75
- #
76
- # Other than that, you can leave this method alone.
77
- #
78
- def crop
79
- if model.crop_x.present?
80
- resize_to_limit(500,500)
81
- manipulate! do |img|
82
- x = model.crop_x.to_i
83
- y = model.crop_y.to_i
84
- w = model.crop_w.to_i
85
- h = model.crop_h.to_i
86
- img.crop!(x, y, w, h)
87
- end
88
- end
89
- end
90
-
91
- end
@@ -1,5 +0,0 @@
1
- <%= link_to send("new_admin_#{model_table_singular}_path"),
2
- :class => "button-color-1 new float-right" do %>
3
- <i class="icon-plus margin-right-medium"></i>
4
- <span><%= "New #{model_singular}" %></span>
5
- <% end %>
@@ -1,11 +0,0 @@
1
- <%= simple_form_for @item, :url => @url do |f| %>
2
-
3
- <% content = capture do %>
4
- <%= f.input @columns.first.to_sym %>
5
- <% end %>
6
-
7
- <%= form_section :title => 'overview', :content => content %>
8
-
9
- <%= f.button :submit %>
10
-
11
- <% end %>
@@ -1 +0,0 @@
1
- <h1><%= model_plural %></h1>
@@ -1,2 +0,0 @@
1
- <%= form_page :classname => @model.to_s, :index => @routes[:index],
2
- :title => "Edit #{@item.respond_to?(:title) ? @item.title.to_s : @item.send(@columns.first)}" %>
@@ -1 +0,0 @@
1
- <%= image_tag image.filename.url(:thumb), class: "project-preview", data: { id: image.id } %>
@@ -1,7 +0,0 @@
1
- <% if @image.new_record? %>
2
- alert("Failed to upload image: <%= j @image.errors.full_messages.join(', ').html_safe %>");
3
- <% elsif @project %>
4
- $(".images-container").prepend("<div class=\"image\"><a href='<%= edit_admin_project_image_path(@project,@image) %>' class='edit'><i class=\"icon-pencil\"></i></a><a href='#' class='delete' data-id=\"<%= @image.id %>\"><i class=\"icon-remove2\"></i></a><img src=\"<%= @image.filename.thumb.url %>\" class=\"project-preview\" data-id=\"<%= @image.id %>\"></div>");
5
- <% elsif @page or @post %>
6
- $(".images-container").prepend("<div class=\"image\"><img src=\"<%= @image.filename.thumb.url %>\" data-src=\"<%= @image.filename.url %>\" class=\"\" data-id=\"<%= @image.id %>\"></div>");
7
- <% end -%>
@@ -1,4 +0,0 @@
1
- json.array! @images do |image|
2
- json.id image.id
3
- json.filename image.filename
4
- end
@@ -1,50 +0,0 @@
1
- <section id="pages">
2
- <header>
3
- <%= render :partial => 'buttons' %>
4
- <%= render :partial => 'title' %>
5
- </header>
6
-
7
- <div class="table-container">
8
-
9
- <%= render :partial => 'admin/shared/status' %>
10
-
11
- <table>
12
- <thead>
13
- <tr>
14
- <% @columns.each do |col| %>
15
- <th><%= col.titleize %></th>
16
- <% end %>
17
- <% if @actions %>
18
- <th class="actions">Actions</th>
19
- <% end %>
20
- </tr>
21
- </thead>
22
-
23
- <tbody>
24
- <% @items.each do |item| %>
25
- <tr>
26
- <% @columns.each do |col| %>
27
- <td><%= item.send(col) %></td>
28
- <% end %>
29
- <% if @actions %>
30
- <td class="actions">
31
- <% if @actions.include?(:edit) %>
32
- <%= link_to [:edit, :admin, item] do %>
33
- <i class="icon-pencil"></i>&nbsp;Edit
34
- <% end %>
35
- <% end %>
36
- <% if @actions.include?(:delete) %>
37
- <%= link_to [:admin, item], :method => :delete, :data => { :confirm => "Are you sure?" } do %>
38
- <i class="icon-remove"></i>&nbsp;Delete
39
- <% end %>
40
- <% end %>
41
- </td>
42
- <% end %>
43
- </tr>
44
- <% end %>
45
- </tbody>
46
- </table>
47
-
48
- </div>
49
-
50
- </section>
@@ -1,2 +0,0 @@
1
- <%= form_page :classname => @model.to_s, :index => @routes[:index],
2
- :title => "New #{model_singular}" %>
@@ -1,26 +0,0 @@
1
- <%= render :partial => 'admin/shared/insert_image' %>
2
- <%= simple_form_for @item, :url => @url do |f| %>
3
-
4
- <%= form_column 'overview' do %>
5
- <%= f.input :title %>
6
- <%= f.input :description %>
7
- <%= f.input :slug, :label => 'URL' %>
8
- <%= f.input :parent_id,
9
- :label => 'Parent Page',
10
- :collection => @item.parent_options %>
11
- <%= f.input :template, :collection => Page.template_options %>
12
- <% end %>
13
-
14
- <%= form_column 'publish', 'right' do %>
15
- <%= publishable_fields(f) %>
16
- <%= f.input :position, :label => 'Sort order', :collection => (1..@item.siblings.count) %>
17
- <%= f.input :in_nav, :label => 'display in menu' %>
18
- <% end %>
19
-
20
- <%= form_section 'body' do %>
21
- <%= wysiwyg(f) %>
22
- <% end %>
23
-
24
- <%= f.button :submit %>
25
-
26
- <% end %>
@@ -1,40 +0,0 @@
1
- <%= render :partial => 'admin/shared/insert_image' %>
2
- <%= simple_form_for @item, :url => @url do |f| %>
3
-
4
- <%= form_column 'overview' do %>
5
- <%= f.input :title %>
6
- <%= f.input :slug, :label => 'URL' %>
7
- <div class="fields">
8
- <div id="tag-container">
9
- <input type="text" placeholder="add tags" id="new-tag-title" class="new-tag-title">
10
- <div class="tagging-errors"></div>
11
- <ul class="autocomplete"></ul>
12
- <p class="loading">Loading...</p>
13
- <ul id="tag-list"></ul>
14
- </div>
15
- </div>
16
- <div class="image-uploader">
17
- <%= f.input :main_image %>
18
- <% if @item.main_image.to_s.present? %>
19
- <%= content_tag :div, :class => 'control-group' do %>
20
- <%= image_tag(@item.main_image.thumb.url) %>
21
- <br>
22
- <%= f.check_box :remove_main_image %> Remove image
23
- <% end %>
24
- <% end %>
25
- </div>
26
-
27
- <% end %>
28
-
29
- <%= form_column 'publish', 'right' do %>
30
- <%= publishable_fields(f) %>
31
- <%= f.input(:is_featured) %>
32
- <% end %>
33
-
34
- <%= form_section 'body' do %>
35
- <%= wysiwyg(f) %>
36
- <% end %>
37
-
38
- <%= f.button :submit %>
39
-
40
- <% end %>
@@ -1,12 +0,0 @@
1
- <div id="wysihtml5-insert-image-modal">
2
- <div class="modal">
3
- <a href="#" class="close">X</a>
4
- <h1>Insert Image</h1>
5
- <hr>
6
- <%= form_for @image, url: @image_url do |f| %>
7
- <%= f.file_field :filename, multiple: true %>
8
- <% end %>
9
- <hr>
10
- <div class="images-container">Images Loading...</div>
11
- </div>
12
- </div>
@@ -1,12 +0,0 @@
1
- <nav id="sidebar" class="vertical">
2
- <ul>
3
- <% admin_nav_items.each do |item| %>
4
- <li <%= "class=active" if nav_active?(item[:controllers]) %>>
5
- <%= link_to item[:path], :target => item[:target] do %>
6
- <span class="icon"><i class="icon-<%= item[:icon] %>"></i></span>
7
- <span class="title"><%= item[:label] %></span>
8
- <% end %>
9
- </li>
10
- <% end %>
11
- </ul>
12
- </nav>
@@ -1,3 +0,0 @@
1
- <% flash.each do |level,message| %>
2
- <p class="<%= level %>"><%= message %></p>
3
- <% end %>