comfypress 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (289) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.travis.yml +22 -0
  4. data/Gemfile +22 -0
  5. data/Gemfile.lock +175 -0
  6. data/LICENSE +20 -0
  7. data/README.md +79 -0
  8. data/Rakefile +5 -0
  9. data/app/assets/images/comfypress/arrow_bottom.gif +0 -0
  10. data/app/assets/images/comfypress/arrow_right.gif +0 -0
  11. data/app/assets/images/comfypress/bootstrap/glyphicons-halflings-white.png +0 -0
  12. data/app/assets/images/comfypress/bootstrap/glyphicons-halflings.png +0 -0
  13. data/app/assets/images/comfypress/checkerboard.gif +0 -0
  14. data/app/assets/images/comfypress/icon_draft.gif +0 -0
  15. data/app/assets/images/comfypress/icon_file.gif +0 -0
  16. data/app/assets/images/comfypress/icon_layout.gif +0 -0
  17. data/app/assets/images/comfypress/icon_move.gif +0 -0
  18. data/app/assets/images/comfypress/icon_page.gif +0 -0
  19. data/app/assets/images/comfypress/icon_site.gif +0 -0
  20. data/app/assets/images/comfypress/icon_snippet.gif +0 -0
  21. data/app/assets/images/comfypress/nav_arrow.png +0 -0
  22. data/app/assets/javascripts/comfypress/admin/application.js +1 -0
  23. data/app/assets/javascripts/comfypress/application.js.coffee +175 -0
  24. data/app/assets/javascripts/comfypress/lib/bootstrap-datetimepicker.js +21 -0
  25. data/app/assets/javascripts/comfypress/lib/bootstrap-wysihtml5.js +492 -0
  26. data/app/assets/javascripts/comfypress/lib/bootstrap.js +6 -0
  27. data/app/assets/javascripts/comfypress/lib/codemirror.js +10 -0
  28. data/app/assets/javascripts/comfypress/lib/wysihtml5.js +261 -0
  29. data/app/assets/stylesheets/comfypress/admin/application.css +1 -0
  30. data/app/assets/stylesheets/comfypress/application.css.sass +8 -0
  31. data/app/assets/stylesheets/comfypress/base.css.sass +333 -0
  32. data/app/assets/stylesheets/comfypress/bootstrap_overrides.css.sass +45 -0
  33. data/app/assets/stylesheets/comfypress/codemirror_overrides.css.sass +27 -0
  34. data/app/assets/stylesheets/comfypress/lib/bootstrap-datetimepicker.css +9 -0
  35. data/app/assets/stylesheets/comfypress/lib/bootstrap-wysihtml5.css +102 -0
  36. data/app/assets/stylesheets/comfypress/lib/bootstrap.css +9 -0
  37. data/app/assets/stylesheets/comfypress/lib/codemirror.css +240 -0
  38. data/app/assets/stylesheets/comfypress/wysihtml5_overrides.css.sass +5 -0
  39. data/app/controllers/application_controller.rb +5 -0
  40. data/app/controllers/cms_admin/base_controller.rb +51 -0
  41. data/app/controllers/cms_admin/categories_controller.rb +35 -0
  42. data/app/controllers/cms_admin/files_controller.rb +108 -0
  43. data/app/controllers/cms_admin/layouts_controller.rb +67 -0
  44. data/app/controllers/cms_admin/menu_items_controller.rb +65 -0
  45. data/app/controllers/cms_admin/menus_controller.rb +60 -0
  46. data/app/controllers/cms_admin/pages_controller.rb +112 -0
  47. data/app/controllers/cms_admin/revisions_controller.rb +57 -0
  48. data/app/controllers/cms_admin/sites_controller.rb +64 -0
  49. data/app/controllers/cms_admin/snippets_controller.rb +64 -0
  50. data/app/controllers/cms_content_controller.rb +79 -0
  51. data/app/helpers/application_helper.rb +16 -0
  52. data/app/models/cms/block.rb +48 -0
  53. data/app/models/cms/categorization.rb +21 -0
  54. data/app/models/cms/category.rb +30 -0
  55. data/app/models/cms/file.rb +75 -0
  56. data/app/models/cms/layout.rb +99 -0
  57. data/app/models/cms/menu.rb +26 -0
  58. data/app/models/cms/menu_item.rb +14 -0
  59. data/app/models/cms/page.rb +202 -0
  60. data/app/models/cms/revision.rb +17 -0
  61. data/app/models/cms/site.rb +113 -0
  62. data/app/models/cms/snippet.rb +58 -0
  63. data/app/models/cms.rb +5 -0
  64. data/app/views/cms_admin/categories/_categories.html.haml +3 -0
  65. data/app/views/cms_admin/categories/_edit.html.haml +6 -0
  66. data/app/views/cms_admin/categories/_form.html.haml +8 -0
  67. data/app/views/cms_admin/categories/_index.html.haml +24 -0
  68. data/app/views/cms_admin/categories/_show.html.haml +13 -0
  69. data/app/views/cms_admin/categories/create.js.erb +7 -0
  70. data/app/views/cms_admin/categories/destroy.js.erb +3 -0
  71. data/app/views/cms_admin/categories/edit.js.erb +3 -0
  72. data/app/views/cms_admin/categories/update.js.erb +6 -0
  73. data/app/views/cms_admin/files/_file.html.haml +13 -0
  74. data/app/views/cms_admin/files/_form.html.haml +14 -0
  75. data/app/views/cms_admin/files/_index.html.haml +14 -0
  76. data/app/views/cms_admin/files/_page_form.html.haml +9 -0
  77. data/app/views/cms_admin/files/destroy.js.coffee +2 -0
  78. data/app/views/cms_admin/files/edit.html.haml +5 -0
  79. data/app/views/cms_admin/files/index.html.haml +28 -0
  80. data/app/views/cms_admin/files/new.html.haml +5 -0
  81. data/app/views/cms_admin/layouts/_form.html.haml +17 -0
  82. data/app/views/cms_admin/layouts/_index_branch.html.haml +23 -0
  83. data/app/views/cms_admin/layouts/edit.html.haml +9 -0
  84. data/app/views/cms_admin/layouts/index.html.haml +9 -0
  85. data/app/views/cms_admin/layouts/new.html.haml +5 -0
  86. data/app/views/cms_admin/menu_items/_form.html.haml +22 -0
  87. data/app/views/cms_admin/menu_items/edit.html.haml +8 -0
  88. data/app/views/cms_admin/menu_items/index.html.haml +24 -0
  89. data/app/views/cms_admin/menu_items/new.html.haml +5 -0
  90. data/app/views/cms_admin/menus/_form.html.haml +8 -0
  91. data/app/views/cms_admin/menus/edit.html.haml +8 -0
  92. data/app/views/cms_admin/menus/index.html.haml +24 -0
  93. data/app/views/cms_admin/menus/new.html.haml +5 -0
  94. data/app/views/cms_admin/pages/_form.html.haml +38 -0
  95. data/app/views/cms_admin/pages/_form_blocks.html.haml +28 -0
  96. data/app/views/cms_admin/pages/_index_branch.html.haml +35 -0
  97. data/app/views/cms_admin/pages/edit.html.haml +9 -0
  98. data/app/views/cms_admin/pages/form_blocks.js.erb +2 -0
  99. data/app/views/cms_admin/pages/index.html.haml +11 -0
  100. data/app/views/cms_admin/pages/new.html.haml +5 -0
  101. data/app/views/cms_admin/pages/toggle_branch.js.erb +11 -0
  102. data/app/views/cms_admin/revisions/show.html.haml +28 -0
  103. data/app/views/cms_admin/sites/_form.html.haml +14 -0
  104. data/app/views/cms_admin/sites/_mirrors.html.haml +17 -0
  105. data/app/views/cms_admin/sites/edit.html.haml +5 -0
  106. data/app/views/cms_admin/sites/index.html.haml +24 -0
  107. data/app/views/cms_admin/sites/new.html.haml +5 -0
  108. data/app/views/cms_admin/snippets/_form.html.haml +11 -0
  109. data/app/views/cms_admin/snippets/edit.html.haml +9 -0
  110. data/app/views/cms_admin/snippets/index.html.haml +28 -0
  111. data/app/views/cms_admin/snippets/new.html.haml +5 -0
  112. data/app/views/cms_content/_menu.html.haml +5 -0
  113. data/app/views/cms_content/render_sitemap.xml.builder +15 -0
  114. data/app/views/layouts/cms_admin/_body.html.haml +16 -0
  115. data/app/views/layouts/cms_admin/_center.html.haml +7 -0
  116. data/app/views/layouts/cms_admin/_footer.html.haml +3 -0
  117. data/app/views/layouts/cms_admin/_footer_js.html.haml +7 -0
  118. data/app/views/layouts/cms_admin/_head.html.haml +12 -0
  119. data/app/views/layouts/cms_admin/_left.html.haml +11 -0
  120. data/app/views/layouts/cms_admin/_right.html.haml +1 -0
  121. data/app/views/layouts/cms_admin.html.haml +4 -0
  122. data/comfypress.gemspec +28 -0
  123. data/config/application.rb +69 -0
  124. data/config/boot.rb +6 -0
  125. data/config/database.sqlite.yml +47 -0
  126. data/config/database.yml +47 -0
  127. data/config/environment.rb +5 -0
  128. data/config/environments/development.rb +39 -0
  129. data/config/environments/production.rb +67 -0
  130. data/config/environments/test.rb +39 -0
  131. data/config/initializers/comfypress.rb +100 -0
  132. data/config/initializers/paperclip.rb +3 -0
  133. data/config/locales/de.yml +236 -0
  134. data/config/locales/en.yml +285 -0
  135. data/config/locales/es.yml +236 -0
  136. data/config/locales/fr.yml +236 -0
  137. data/config/locales/ja.yml +237 -0
  138. data/config/locales/pl.yml +236 -0
  139. data/config/locales/pt-BR.yml +236 -0
  140. data/config/locales/ru.yml +236 -0
  141. data/config/locales/sv.yml +236 -0
  142. data/config/locales/zh-CN.yml +236 -0
  143. data/config/routes.rb +10 -0
  144. data/config.ru +4 -0
  145. data/db/cms_fixtures/sample-site/layouts/default/_default.yml +1 -0
  146. data/db/cms_fixtures/sample-site/layouts/default/content.html +5 -0
  147. data/db/cms_fixtures/sample-site/layouts/default/css.css +1 -0
  148. data/db/cms_fixtures/sample-site/layouts/default/js.js +1 -0
  149. data/db/cms_fixtures/sample-site/layouts/default/nested/_nested.yml +2 -0
  150. data/db/cms_fixtures/sample-site/layouts/default/nested/content.html +2 -0
  151. data/db/cms_fixtures/sample-site/layouts/default/nested/css.css +1 -0
  152. data/db/cms_fixtures/sample-site/layouts/default/nested/js.js +1 -0
  153. data/db/cms_fixtures/sample-site/pages/index/_index.yml +2 -0
  154. data/db/cms_fixtures/sample-site/pages/index/child/_child.yml +3 -0
  155. data/db/cms_fixtures/sample-site/pages/index/child/left.html +1 -0
  156. data/db/cms_fixtures/sample-site/pages/index/child/right.html +1 -0
  157. data/db/cms_fixtures/sample-site/pages/index/content.html +2 -0
  158. data/db/cms_fixtures/sample-site/snippets/default/_default.yml +1 -0
  159. data/db/cms_fixtures/sample-site/snippets/default/content.html +1 -0
  160. data/db/migrate/01_create_cms.rb +163 -0
  161. data/db/seeds.rb +9 -0
  162. data/db/upgrade_migrations/02_upgrade_to_1_1_0.rb +19 -0
  163. data/db/upgrade_migrations/03_upgrade_to_1_2_0.rb +15 -0
  164. data/db/upgrade_migrations/04_upgrade_to_1_3_0.rb +23 -0
  165. data/db/upgrade_migrations/05_upgrade_to_1_4_0.rb +33 -0
  166. data/db/upgrade_migrations/06_upgrade_to_1_5_0.rb +21 -0
  167. data/db/upgrade_migrations/07_upgrade_to_1_6_0.rb +25 -0
  168. data/doc/preview.png +0 -0
  169. data/doc/sofa.png +0 -0
  170. data/lib/comfypress/authentication/dummy_auth.rb +8 -0
  171. data/lib/comfypress/authentication/http_auth.rb +18 -0
  172. data/lib/comfypress/configuration.rb +99 -0
  173. data/lib/comfypress/engine.rb +18 -0
  174. data/lib/comfypress/error.rb +24 -0
  175. data/lib/comfypress/extensions/acts_as_tree.rb +102 -0
  176. data/lib/comfypress/extensions/has_revisions.rb +64 -0
  177. data/lib/comfypress/extensions/is_categorized.rb +49 -0
  178. data/lib/comfypress/extensions/is_mirrored.rb +85 -0
  179. data/lib/comfypress/extensions/rails.rb +24 -0
  180. data/lib/comfypress/fixtures.rb +289 -0
  181. data/lib/comfypress/form_builder.rb +97 -0
  182. data/lib/comfypress/render_methods.rb +85 -0
  183. data/lib/comfypress/routing.rb +62 -0
  184. data/lib/comfypress/sitemap.rb +27 -0
  185. data/lib/comfypress/tag.rb +154 -0
  186. data/lib/comfypress/tags/asset.rb +25 -0
  187. data/lib/comfypress/tags/collection.rb +64 -0
  188. data/lib/comfypress/tags/field_datetime.rb +17 -0
  189. data/lib/comfypress/tags/field_integer.rb +17 -0
  190. data/lib/comfypress/tags/field_rich_text.rb +17 -0
  191. data/lib/comfypress/tags/field_string.rb +17 -0
  192. data/lib/comfypress/tags/field_text.rb +17 -0
  193. data/lib/comfypress/tags/file.rb +29 -0
  194. data/lib/comfypress/tags/helper.rb +24 -0
  195. data/lib/comfypress/tags/menu.rb +27 -0
  196. data/lib/comfypress/tags/page_datetime.rb +13 -0
  197. data/lib/comfypress/tags/page_file.rb +51 -0
  198. data/lib/comfypress/tags/page_files.rb +52 -0
  199. data/lib/comfypress/tags/page_integer.rb +13 -0
  200. data/lib/comfypress/tags/page_markdown.rb +22 -0
  201. data/lib/comfypress/tags/page_rich_text.rb +13 -0
  202. data/lib/comfypress/tags/page_string.rb +13 -0
  203. data/lib/comfypress/tags/page_text.rb +13 -0
  204. data/lib/comfypress/tags/partial.rb +23 -0
  205. data/lib/comfypress/tags/snippet.rb +19 -0
  206. data/lib/comfypress/version.rb +3 -0
  207. data/lib/comfypress/view_hooks.rb +32 -0
  208. data/lib/comfypress/view_methods.rb +52 -0
  209. data/lib/comfypress.rb +66 -0
  210. data/lib/generators/comfy/cms/README +10 -0
  211. data/lib/generators/comfy/cms/cms_generator.rb +57 -0
  212. data/lib/tasks/comfypress.rake +45 -0
  213. data/script/rails +6 -0
  214. data/test/fixtures/cms/blocks.yml +12 -0
  215. data/test/fixtures/cms/categories.yml +4 -0
  216. data/test/fixtures/cms/categorizations.yml +3 -0
  217. data/test/fixtures/cms/files.yml +9 -0
  218. data/test/fixtures/cms/layouts.yml +40 -0
  219. data/test/fixtures/cms/menu_items.yml +15 -0
  220. data/test/fixtures/cms/menus.yml +9 -0
  221. data/test/fixtures/cms/pages.yml +39 -0
  222. data/test/fixtures/cms/revisions.yml +21 -0
  223. data/test/fixtures/cms/sites.yml +6 -0
  224. data/test/fixtures/cms/snippets.yml +6 -0
  225. data/test/fixtures/files/data.zip +0 -0
  226. data/test/fixtures/files/document.pdf +0 -0
  227. data/test/fixtures/files/image.gif +0 -0
  228. data/test/fixtures/files/image.jpg +0 -0
  229. data/test/fixtures/views/_nav_hook.html.erb +1 -0
  230. data/test/fixtures/views/_nav_hook_2.html.erb +1 -0
  231. data/test/fixtures/views/render_test/_test.html.erb +1 -0
  232. data/test/fixtures/views/render_test/new.html.erb +1 -0
  233. data/test/fixtures/views/render_test/render_layout.html.erb +1 -0
  234. data/test/functional/cms_admin/base_controller_test.rb +18 -0
  235. data/test/functional/cms_admin/categories_controller_test.rb +70 -0
  236. data/test/functional/cms_admin/files_controller_test.rb +216 -0
  237. data/test/functional/cms_admin/layouts_controller_test.rb +123 -0
  238. data/test/functional/cms_admin/pages_controller_test.rb +450 -0
  239. data/test/functional/cms_admin/revisions_controller_test.rb +138 -0
  240. data/test/functional/cms_admin/sites_controller_test.rb +105 -0
  241. data/test/functional/cms_admin/snippets_controller_test.rb +140 -0
  242. data/test/functional/cms_content_controller_test.rb +205 -0
  243. data/test/gemfiles/Gemfile.rails.3.1 +16 -0
  244. data/test/gemfiles/Gemfile.rails.3.2 +16 -0
  245. data/test/gemfiles/Gemfile.rails.4.0 +16 -0
  246. data/test/integration/authentication_test.rb +48 -0
  247. data/test/integration/fixtures_test.rb +61 -0
  248. data/test/integration/mirrors_test.rb +72 -0
  249. data/test/integration/render_cms_test.rb +233 -0
  250. data/test/integration/sites_test.rb +120 -0
  251. data/test/integration/view_hooks_test.rb +43 -0
  252. data/test/test_helper.rb +124 -0
  253. data/test/unit/cms/menu_item_test.rb +7 -0
  254. data/test/unit/cms/menu_test.rb +7 -0
  255. data/test/unit/configuration_test.rb +42 -0
  256. data/test/unit/fixtures_test.rb +357 -0
  257. data/test/unit/mirrors_test.rb +242 -0
  258. data/test/unit/models/block_test.rb +199 -0
  259. data/test/unit/models/categorization_test.rb +76 -0
  260. data/test/unit/models/category_test.rb +39 -0
  261. data/test/unit/models/file_test.rb +89 -0
  262. data/test/unit/models/layout_test.rb +125 -0
  263. data/test/unit/models/page_test.rb +255 -0
  264. data/test/unit/models/site_test.rb +152 -0
  265. data/test/unit/models/snippet_test.rb +49 -0
  266. data/test/unit/revisions_test.rb +185 -0
  267. data/test/unit/sitemap_test.rb +20 -0
  268. data/test/unit/tag_test.rb +308 -0
  269. data/test/unit/tags/asset_test.rb +56 -0
  270. data/test/unit/tags/collection_test.rb +116 -0
  271. data/test/unit/tags/field_datetime_test.rb +50 -0
  272. data/test/unit/tags/field_integer_test.rb +49 -0
  273. data/test/unit/tags/field_rich_text_test.rb +49 -0
  274. data/test/unit/tags/field_string_test.rb +52 -0
  275. data/test/unit/tags/field_text_test.rb +48 -0
  276. data/test/unit/tags/file_test.rb +67 -0
  277. data/test/unit/tags/helper_test.rb +86 -0
  278. data/test/unit/tags/page_datetime_test.rb +50 -0
  279. data/test/unit/tags/page_file_test.rb +119 -0
  280. data/test/unit/tags/page_files_test.rb +113 -0
  281. data/test/unit/tags/page_integer_test.rb +49 -0
  282. data/test/unit/tags/page_markdown_test.rb +48 -0
  283. data/test/unit/tags/page_rich_text_test.rb +49 -0
  284. data/test/unit/tags/page_string_test.rb +49 -0
  285. data/test/unit/tags/page_text_test.rb +52 -0
  286. data/test/unit/tags/partial_test.rb +76 -0
  287. data/test/unit/tags/snippet_test.rb +45 -0
  288. data/test/unit/view_methods_test.rb +80 -0
  289. metadata +457 -0
@@ -0,0 +1,14 @@
1
+ = form.text_field :label, :data => {:slugify => @site.new_record?}
2
+ = form.text_field :identifier, :data => {:slug => true}
3
+ = form.text_field :hostname
4
+ = form.text_field :path
5
+ = form.select :locale, ComfyPress.config.locales.to_a.collect{|l| [l[1], l[0]]}
6
+ = form.check_box :is_mirrored, :label => t('.is_mirrored')
7
+
8
+ - if (options = Cms::Menu.options_for_select(@site)).present?
9
+ = form.select :menu_id, options, {:prompt => "Select menu"}
10
+
11
+
12
+ .form-actions
13
+ = form.submit t(@site.new_record?? '.create' : '.update'), :class => 'btn btn-primary'
14
+
@@ -0,0 +1,17 @@
1
+ - object ||= mirrors
2
+ - return unless @site.is_mirrored?
3
+
4
+ - options = case object
5
+ - when Cms::Layout
6
+ - object.mirrors.collect{|m| [m.site.label, edit_cms_admin_site_layout_path(m.site, m)]}
7
+ - when Cms::Page
8
+ - object.mirrors.collect{|m| [m.site.label, edit_cms_admin_site_page_path(m.site, m)]}
9
+ - when Cms::Snippet
10
+ - object.mirrors.collect{|m| [m.site.label, edit_cms_admin_site_snippet_path(m.site, m)]}
11
+ - else
12
+ - (Cms::Site.mirrored - [@site]).collect{|s| [s.label, url_for(params.merge(:site_id => s))]}
13
+
14
+ - options = [[@site.label, request.fullpath]] + options
15
+
16
+ #mirrors.box
17
+ = select_tag :mirror, options_for_select(options)
@@ -0,0 +1,5 @@
1
+ .page-header
2
+ %h2= t('.title')
3
+
4
+ = comfy_form_for @site, :as => :site, :url => {:action => :update} do |form|
5
+ = render form
@@ -0,0 +1,24 @@
1
+ .page-header
2
+ = link_to t('.new_link'), new_cms_admin_site_path, :class => 'btn pull-right'
3
+ %h2= t('.title')
4
+
5
+ %table.table.table-hover.table-bordered
6
+ - @sites.each do |site|
7
+ %tr
8
+ %td
9
+ .icon
10
+ %td.main
11
+ .item-title
12
+ = link_to site.label, cms_admin_site_pages_path(site)
13
+ .item-meta
14
+ .identifier
15
+ = site.identifier
16
+ = "(#{site.locale})"
17
+ .host
18
+ - host = "http://#{site.hostname}/#{site.path}"
19
+ = link_to host, host, :target => '_blank'
20
+ %td
21
+ .btn-group
22
+ = link_to t('.select'), cms_admin_site_pages_path(site), :class => 'btn btn-small'
23
+ = link_to t('.edit'), edit_cms_admin_site_path(site), :class => 'btn btn-small'
24
+ = link_to t('.delete'), cms_admin_site_path(site), :method => :delete, :data => {:confirm => t('.are_you_sure')}, :class => 'btn btn-small btn-danger'
@@ -0,0 +1,5 @@
1
+ .page-header
2
+ %h2= t('.title')
3
+
4
+ = comfy_form_for @site, :as => :site, :url => {:action => :create} do |form|
5
+ = render form
@@ -0,0 +1,11 @@
1
+ - content_for :right_column do
2
+ = render :partial => 'cms_admin/files/index'
3
+
4
+ = form.text_field :label, :data => {:slugify => @snippet.new_record?}
5
+ = form.text_field :identifier, :data => {:slug => true}
6
+ = form.text_area :content, :data => {:cm_mode => 'text/html'}
7
+
8
+ = render :partial => 'cms_admin/categories/form', :object => form
9
+
10
+ .form-actions
11
+ = form.submit t(@snippet.new_record?? '.create' : '.update'), :class => 'btn btn-primary'
@@ -0,0 +1,9 @@
1
+ .page-header
2
+ = link_to pluralize(@snippet.revisions.count, t('.revision')), cms_admin_site_snippet_revisions_path(@site, @snippet), :class => 'btn pull-right'
3
+ %h2= t('.title')
4
+
5
+ - content_for :right_column do
6
+ = render :partial => 'cms_admin/sites/mirrors', :object => @snippet
7
+
8
+ = comfy_form_for @snippet, :as => :snippet, :url => {:action => :update} do |form|
9
+ = render form
@@ -0,0 +1,28 @@
1
+ .page-header
2
+ = link_to t('.new_link'), new_cms_admin_site_snippet_path(@site), :class => 'btn pull-right'
3
+ %h2= t('.title')
4
+
5
+ - content_for :right_column do
6
+ = render :partial => 'cms_admin/sites/mirrors'
7
+
8
+ = render :partial => 'cms_admin/categories/index', :object => 'Cms::Snippet'
9
+
10
+ %table.table.table-hover.table-bordered
11
+ %tbody.sortable
12
+ - @snippets.each do |snippet|
13
+ %tr{:id => dom_id(snippet)}
14
+ %td
15
+ .icon
16
+ - if !params[:category].present? && @site.snippets.count > 1
17
+ .dragger
18
+ %span ⇅
19
+ %td.main
20
+ .item-title
21
+ = link_to snippet.label, edit_cms_admin_site_snippet_path(@site, snippet)
22
+ = render :partial => '/cms_admin/categories/categories', :object => snippet
23
+ .item-meta
24
+ = snippet.identifier
25
+ %td
26
+ .btn-group
27
+ = link_to t('.edit'), edit_cms_admin_site_snippet_path(@site, snippet), :class => 'btn btn-small'
28
+ = link_to t('.delete'), cms_admin_site_snippet_path(@site, snippet), :method => :delete, :data => {:confirm => t('.are_you_sure')}, :class => 'btn btn-small btn-danger'
@@ -0,0 +1,5 @@
1
+ .page-header
2
+ %h2= t('.title')
3
+
4
+ = comfy_form_for @snippet, :as => :snippet, :url => {:action => :create} do |form|
5
+ = render form
@@ -0,0 +1,5 @@
1
+ - menu_items = Cms::Menu.find(menu_id).menu_items
2
+
3
+ %ul.menu
4
+ - menu_items.each do |menu_item|
5
+ %li= link_to_menu_item(menu_item)
@@ -0,0 +1,15 @@
1
+ xml.instruct! :xml, :version => '1.0', :encoding => 'UTF-8'
2
+
3
+ xml.urlset :xmlns => 'http://www.sitemaps.org/schemas/sitemap/0.9' do
4
+ @cms_site.pages.published.each do |page|
5
+ xml.url do
6
+ xml.loc "http://#{@cms_site.hostname}#{"/" + @cms_site.path unless @cms_site.path.blank? }#{page.full_path}"
7
+ # just take some guesses the closer to the root means higher priority
8
+ # start subtracting 0.1 for every additional child page, max out at 0.1
9
+ # "/" splits to 0, "/child_page" splits to 2, hence weird max -1
10
+ xml.priority [1 - (0.1 * ( ( [page.full_path.split("/").count, 1].max - 1 ) ) ), 0.1].max
11
+ xml.lastmod page.updated_at.strftime('%Y-%m-%d')
12
+ end
13
+ end
14
+ ComfyPress::Sitemap.process(@cms_site, self, xml)
15
+ end
@@ -0,0 +1,16 @@
1
+ %body#comfy{:class => "c-#{params[:controller].slugify} a-#{params[:action].slugify}"}
2
+ = cms_hook :header
3
+
4
+ .body-wrapper
5
+ .left-column
6
+ .left-column-content
7
+ = render :partial => 'layouts/cms_admin/left'
8
+ .right-column
9
+ .right-column-content
10
+ = render :partial => 'layouts/cms_admin/right'
11
+ .center-column
12
+ = render :partial => 'layouts/cms_admin/center'
13
+
14
+ = render :partial => 'layouts/cms_admin/footer'
15
+
16
+ = render :partial => 'layouts/cms_admin/footer_js'
@@ -0,0 +1,7 @@
1
+ - flash.each do |type, message|
2
+ .alert{:class => "alert-#{type}"}
3
+ %button.close{:type => 'button', :class => "close", :data => {:dismiss => 'alert'}} ×
4
+ = message
5
+
6
+ .center-column-content
7
+ = yield
@@ -0,0 +1,3 @@
1
+ .body-footer
2
+ = link_to 'ComfyPress', 'https://github.com/comfy', :target => '_blank'
3
+ %span.version= ComfyPress::VERSION
@@ -0,0 +1,7 @@
1
+ - if content_for(:javascript)
2
+ :javascript
3
+ #{yield :javascript}
4
+
5
+ - if @site && !@site.new_record?
6
+ :javascript
7
+ CMS.file_upload_path = "#{cms_admin_site_files_path(@site)}"
@@ -0,0 +1,12 @@
1
+ %head
2
+ %meta{'http-equiv' => "Content-type", :content => "text/html; charset=utf-8"}
3
+ %title= ComfyPress.config.cms_title
4
+ = csrf_meta_tag
5
+
6
+ = stylesheet_link_tag 'comfypress/application'
7
+ = stylesheet_link_tag 'comfypress/admin/application'
8
+ = javascript_include_tag 'comfypress/application'
9
+ = javascript_include_tag 'comfypress/admin/application'
10
+
11
+ = yield :head
12
+ = cms_hook :html_head
@@ -0,0 +1,11 @@
1
+ %ul.navigation
2
+ %li= active_link_to t('cms_admin.base.sites'), cms_admin_sites_path, :active => ['cms_admin/sites']
3
+
4
+ - if @site && !@site.new_record?
5
+ %li= active_link_to t('cms_admin.base.layouts'), cms_admin_site_layouts_path(@site)
6
+ %li= active_link_to t('cms_admin.base.pages'), cms_admin_site_pages_path(@site)
7
+ %li= active_link_to t('cms_admin.base.snippets'), cms_admin_site_snippets_path(@site)
8
+ %li= active_link_to t('cms_admin.base.files'), cms_admin_site_files_path(@site)
9
+ %li= active_link_to t('cms_admin.base.menus'), cms_admin_site_menus_path(@site)
10
+
11
+ = cms_hook :navigation
@@ -0,0 +1 @@
1
+ = yield :right_column
@@ -0,0 +1,4 @@
1
+ !!!
2
+ %html{:lang => I18n.locale}
3
+ = render :partial => 'layouts/cms_admin/head'
4
+ = render :partial => 'layouts/cms_admin/body'
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ $:.unshift File.expand_path('../lib', __FILE__)
4
+ require 'comfypress/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "comfypress"
8
+ s.version = ComfyPress::VERSION
9
+ s.authors = ["Nayeem Syed", "Omega Interactive Ltd"]
10
+ s.email = ["developerinlondon@gmail.com"]
11
+ s.homepage = "http://github.com/omegainteractive/comfypress"
12
+ s.summary = "CMS Engine for Rails 3 apps (Based on ComfortableMexicanSofa)"
13
+ s.description = "ComfyPress is a powerful CMS Engine for Ruby on Rails 3 applications"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.platform = Gem::Platform::RUBY
17
+ s.require_paths = ['lib']
18
+
19
+ s.add_dependency 'rails', '>= 3.1.0'
20
+ s.add_dependency 'formatted_form', '>= 2.1.0'
21
+ s.add_dependency 'active_link_to', '>= 1.0.0'
22
+ s.add_dependency 'paperclip', '>= 3.4.0'
23
+ s.add_dependency 'redcarpet', '>= 2.2.0'
24
+ s.add_dependency 'jquery-rails', '>= 2.1.4'
25
+ s.add_dependency 'haml-rails', '>= 0.3.0'
26
+ s.add_dependency 'sass-rails', '>= 3.1.0'
27
+ s.add_dependency 'coffee-rails', '>= 3.1.0'
28
+ end
@@ -0,0 +1,69 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
+
12
+ module ComfyPress
13
+ class Application < Rails::Application
14
+
15
+ require 'comfypress'
16
+
17
+ # Settings in config/environments/* take precedence over those specified here.
18
+ # Application configuration should go into files in config/initializers
19
+ # -- all .rb files in that directory are automatically loaded.
20
+
21
+ # Custom directories with classes and modules you want to be autoloadable.
22
+ # config.autoload_paths += %W(#{config.root}/extras)
23
+
24
+ # Only load the plugins named here, in the order given (default is alphabetical).
25
+ # :all can be used as a placeholder for all plugins not explicitly named.
26
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
27
+
28
+ # Activate observers that should always be running.
29
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
30
+
31
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
32
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
33
+ # config.time_zone = 'Central Time (US & Canada)'
34
+
35
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
36
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
37
+ # config.i18n.default_locale = :de
38
+
39
+ # Configure the default encoding used in templates for Ruby 1.9.
40
+ config.encoding = "utf-8"
41
+
42
+ # Configure sensitive parameters which will be filtered from the log file.
43
+ config.filter_parameters += [:password]
44
+
45
+ # Enable escaping HTML in JSON.
46
+ config.active_support.escape_html_entities_in_json = true
47
+
48
+ # Use SQL instead of Active Record's schema dumper when creating the database.
49
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
50
+ # like if you have constraints or database-specific column types
51
+ # config.active_record.schema_format = :sql
52
+
53
+ # Enforce whitelist mode for mass assignment.
54
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
55
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
56
+ # parameters by using an attr_accessible or attr_protected declaration.
57
+ config.active_record.whitelist_attributes = true
58
+
59
+ # Enable the asset pipeline
60
+ config.assets.enabled = true
61
+
62
+ # Version of your assets, change this if you want to expire all your assets
63
+ config.assets.version = '1.0'
64
+
65
+ config.session_store :cookie_store, :key => '_comfy_session'
66
+ config.secret_token = 'e0fef4ab56c1cacd8845864fe2cb2a27f5caad72823419f87b2774785187090a654b83229bf9cef70ce475a83bfa561dbbaa2015788181ea837c456964c1e0f6'
67
+
68
+ end
69
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,47 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 10000
8
+ # adapter: mysql2
9
+ # encoding: utf8
10
+ # database: cms
11
+ # pool: 5
12
+ # username: root
13
+ # password:
14
+ # socket: /tmp/mysql.sock
15
+ # host: 127.0.0.1
16
+
17
+ # config.database_config = 'cms_'
18
+ cms_development:
19
+ # adapter: mysql2
20
+ # encoding: utf8
21
+ # database: cms_dev
22
+ # pool: 5
23
+ # username: root
24
+ # password:
25
+ # socket: /tmp/mysql.sock
26
+ # host: 127.0.0.1
27
+ adapter: sqlite3
28
+ database: db/cms_development.sqlite3
29
+ pool: 5
30
+ timeout: 10000
31
+
32
+ # Warning: The database defined as "test" will be erased and
33
+ # re-generated from your development database when you run "rake".
34
+ # Do not set this db to the same as development or production.
35
+ test:
36
+ # adapter: mysql2
37
+ # encoding: utf8
38
+ # database: cms_test
39
+ # pool: 5
40
+ # username: root
41
+ # password:
42
+ # socket: /tmp/mysql.sock
43
+ # host: 127.0.0.1
44
+ adapter: sqlite3
45
+ database: db/test.sqlite3
46
+ pool: 5
47
+ timeout: 10000
@@ -0,0 +1,47 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ # adapter: sqlite3
5
+ # database: db/development.sqlite3
6
+ # pool: 5
7
+ # timeout: 10000
8
+ adapter: mysql2
9
+ encoding: utf8
10
+ database: cms
11
+ pool: 5
12
+ username: root
13
+ password:
14
+ socket: /tmp/mysql.sock
15
+ host: 127.0.0.1
16
+
17
+ # config.database_config = 'cms_'
18
+ cms_development:
19
+ adapter: mysql2
20
+ encoding: utf8
21
+ database: cms_dev
22
+ pool: 5
23
+ username: root
24
+ password:
25
+ socket: /tmp/mysql.sock
26
+ host: 127.0.0.1
27
+ # adapter: sqlite3
28
+ # database: db/cms_development.sqlite3
29
+ # pool: 5
30
+ # timeout: 10000
31
+
32
+ # Warning: The database defined as "test" will be erased and
33
+ # re-generated from your development database when you run "rake".
34
+ # Do not set this db to the same as development or production.
35
+ test:
36
+ adapter: mysql2
37
+ encoding: utf8
38
+ database: cms_test
39
+ pool: 5
40
+ username: root
41
+ password:
42
+ socket: /tmp/mysql.sock
43
+ host: 127.0.0.1
44
+ # adapter: sqlite3
45
+ # database: db/test.sqlite3
46
+ # pool: 5
47
+ # timeout: 10000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ ComfyPress::Application.initialize!
@@ -0,0 +1,39 @@
1
+ defined?(ComfyPress::Application) && ComfyPress::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ unless Rails.version <= '3.2.0'
26
+ # Raise exception on mass assignment protection for Active Record models
27
+ config.active_record.mass_assignment_sanitizer = :strict
28
+
29
+ # Log the query plan for queries taking more than this (works
30
+ # with SQLite, MySQL, and PostgreSQL)
31
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
32
+ end
33
+
34
+ # Do not compress assets
35
+ config.assets.compress = false
36
+
37
+ # Expands the lines which load the assets
38
+ config.assets.debug = true
39
+ end
@@ -0,0 +1,67 @@
1
+ defined?(ComfyPress::Application) && ComfyPress::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to nil and saved in location specified by config.assets.prefix
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end
@@ -0,0 +1,39 @@
1
+ defined?(ComfyPress::Application) && ComfyPress::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ unless Rails.version <= '3.2.0'
33
+ # Raise exception on mass assignment protection for Active Record models
34
+ config.active_record.mass_assignment_sanitizer = :strict
35
+ end
36
+
37
+ # Print deprecation notices to the stderr
38
+ config.active_support.deprecation = :stderr
39
+ end