lucy_cms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. data/Gemfile +19 -0
  2. data/Gemfile.lock +88 -0
  3. data/LICENSE +24 -0
  4. data/README.md +161 -0
  5. data/Rakefile +26 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/application_controller.rb +5 -0
  8. data/app/controllers/cms_admin/base_controller.rb +43 -0
  9. data/app/controllers/cms_admin/layouts_controller.rb +66 -0
  10. data/app/controllers/cms_admin/pages_controller.rb +111 -0
  11. data/app/controllers/cms_admin/sessions_controller.rb +25 -0
  12. data/app/controllers/cms_admin/sites_controller.rb +69 -0
  13. data/app/controllers/cms_admin/snippets_controller.rb +62 -0
  14. data/app/controllers/cms_admin/upload_dirs_controller.rb +79 -0
  15. data/app/controllers/cms_admin/users_controller.rb +129 -0
  16. data/app/controllers/cms_content_controller.rb +51 -0
  17. data/app/models/cms_block.rb +28 -0
  18. data/app/models/cms_layout.rb +118 -0
  19. data/app/models/cms_page.rb +163 -0
  20. data/app/models/cms_site.rb +38 -0
  21. data/app/models/cms_snippet.rb +70 -0
  22. data/app/models/cms_upload.rb +19 -0
  23. data/app/models/cms_upload_dir.rb +11 -0
  24. data/app/models/cms_user.rb +93 -0
  25. data/app/views/cms_admin/layouts/_form.html.erb +10 -0
  26. data/app/views/cms_admin/layouts/_index_branch.html.erb +24 -0
  27. data/app/views/cms_admin/layouts/edit.html.erb +6 -0
  28. data/app/views/cms_admin/layouts/index.html.erb +6 -0
  29. data/app/views/cms_admin/layouts/new.html.erb +6 -0
  30. data/app/views/cms_admin/pages/_form.html.erb +37 -0
  31. data/app/views/cms_admin/pages/_form_blocks.html.erb +7 -0
  32. data/app/views/cms_admin/pages/_index_branch.html.erb +40 -0
  33. data/app/views/cms_admin/pages/edit.html.erb +5 -0
  34. data/app/views/cms_admin/pages/form_blocks.js.erb +2 -0
  35. data/app/views/cms_admin/pages/index.html.erb +6 -0
  36. data/app/views/cms_admin/pages/new.html.erb +5 -0
  37. data/app/views/cms_admin/pages/toggle_branch.js.erb +11 -0
  38. data/app/views/cms_admin/sessions/new.html.erb +12 -0
  39. data/app/views/cms_admin/sites/_form.html.erb +16 -0
  40. data/app/views/cms_admin/sites/edit.html.erb +6 -0
  41. data/app/views/cms_admin/sites/new.html.erb +6 -0
  42. data/app/views/cms_admin/sites/setup.html.erb +16 -0
  43. data/app/views/cms_admin/snippets/_form.html.erb +4 -0
  44. data/app/views/cms_admin/snippets/edit.html.erb +6 -0
  45. data/app/views/cms_admin/snippets/index.html.erb +23 -0
  46. data/app/views/cms_admin/snippets/new.html.erb +6 -0
  47. data/app/views/cms_admin/upload_dirs/_file.html.erb +15 -0
  48. data/app/views/cms_admin/upload_dirs/_form.html.erb +2 -0
  49. data/app/views/cms_admin/upload_dirs/conflict.html.erb +12 -0
  50. data/app/views/cms_admin/upload_dirs/index.html.erb +23 -0
  51. data/app/views/cms_admin/upload_dirs/new.html.erb +6 -0
  52. data/app/views/cms_admin/upload_dirs/show.html.erb +26 -0
  53. data/app/views/cms_admin/upload_dirs/uploads_destroy.js.erb +3 -0
  54. data/app/views/cms_admin/users/_form.html.erb +9 -0
  55. data/app/views/cms_admin/users/_index_branch.html.erb +16 -0
  56. data/app/views/cms_admin/users/change_password.html.erb +14 -0
  57. data/app/views/cms_admin/users/edit.html.erb +17 -0
  58. data/app/views/cms_admin/users/index.html.erb +6 -0
  59. data/app/views/cms_admin/users/new.html.erb +14 -0
  60. data/app/views/layouts/cms_admin.html.erb +52 -0
  61. data/config/application.rb +48 -0
  62. data/config/boot.rb +13 -0
  63. data/config/database.yml +22 -0
  64. data/config/environment.rb +5 -0
  65. data/config/environments/development.rb +22 -0
  66. data/config/environments/production.rb +49 -0
  67. data/config/environments/test.rb +35 -0
  68. data/config/initializers/LucyCMS.rb +37 -0
  69. data/config/initializers/mime_types.rb +5 -0
  70. data/config/locales/en.yml +5 -0
  71. data/config/routes.rb +45 -0
  72. data/config.ru +4 -0
  73. data/db/cms_seeds/example.local/layouts/default.yml +8 -0
  74. data/db/cms_seeds/example.local/layouts/nested.yml +6 -0
  75. data/db/cms_seeds/example.local/pages/child/subchild.yml +14 -0
  76. data/db/cms_seeds/example.local/pages/child.yml +10 -0
  77. data/db/cms_seeds/example.local/pages/index.yml +11 -0
  78. data/db/cms_seeds/example.local/snippets/example.yml +4 -0
  79. data/db/migrate/01_create_cms.rb +114 -0
  80. data/db/seeds.rb +7 -0
  81. data/lib/LucyCMS/acts_as_tree.rb +102 -0
  82. data/lib/LucyCMS/cms_tag/field_datetime.rb +26 -0
  83. data/lib/LucyCMS/cms_tag/field_integer.rb +26 -0
  84. data/lib/LucyCMS/cms_tag/field_string.rb +26 -0
  85. data/lib/LucyCMS/cms_tag/field_text.rb +26 -0
  86. data/lib/LucyCMS/cms_tag/helper.rb +20 -0
  87. data/lib/LucyCMS/cms_tag/page_datetime.rb +22 -0
  88. data/lib/LucyCMS/cms_tag/page_integer.rb +22 -0
  89. data/lib/LucyCMS/cms_tag/page_rich_text.rb +22 -0
  90. data/lib/LucyCMS/cms_tag/page_string.rb +22 -0
  91. data/lib/LucyCMS/cms_tag/page_text.rb +22 -0
  92. data/lib/LucyCMS/cms_tag/partial.rb +21 -0
  93. data/lib/LucyCMS/cms_tag/snippet.rb +22 -0
  94. data/lib/LucyCMS/cms_tag.rb +119 -0
  95. data/lib/LucyCMS/configuration.rb +36 -0
  96. data/lib/LucyCMS/controller_methods.rb +42 -0
  97. data/lib/LucyCMS/engine.rb +12 -0
  98. data/lib/LucyCMS/form_builder.rb +129 -0
  99. data/lib/LucyCMS/rails_extensions.rb +22 -0
  100. data/lib/LucyCMS/site_form_builder.rb +129 -0
  101. data/lib/LucyCMS/view_hooks.rb +30 -0
  102. data/lib/LucyCMS/view_methods.rb +68 -0
  103. data/lib/LucyCMS.rb +40 -0
  104. data/lib/generators/README +17 -0
  105. data/lib/generators/cms_generator.rb +44 -0
  106. data/lib/tasks/LucyCMS.rake +283 -0
  107. data/lucy_cms.gemspec +100 -0
  108. data/public/404.html +26 -0
  109. data/public/422.html +26 -0
  110. data/public/500.html +26 -0
  111. data/public/favicon.ico +0 -0
  112. data/public/images/LucyCMS/arrow_bottom.gif +0 -0
  113. data/public/images/LucyCMS/arrow_right.gif +0 -0
  114. data/public/images/LucyCMS/icon_folder.png +0 -0
  115. data/public/images/LucyCMS/icon_layout.gif +0 -0
  116. data/public/images/LucyCMS/icon_move.gif +0 -0
  117. data/public/images/LucyCMS/icon_regular.gif +0 -0
  118. data/public/images/LucyCMS/icon_snippet.gif +0 -0
  119. data/public/images/LucyCMS/icon_upload.png +0 -0
  120. data/public/images/LucyCMS/icon_user.jpg +0 -0
  121. data/public/javascripts/LucyCMS/cms.js +204 -0
  122. data/public/javascripts/LucyCMS/codemirror/codemirror.css +102 -0
  123. data/public/javascripts/LucyCMS/codemirror/codemirror.js +23 -0
  124. data/public/javascripts/LucyCMS/codemirror/codemirror_base.js +88 -0
  125. data/public/javascripts/LucyCMS/codemirror/parse_css.js +4 -0
  126. data/public/javascripts/LucyCMS/codemirror/parse_html_mixed.js +3 -0
  127. data/public/javascripts/LucyCMS/codemirror/parse_js.js +12 -0
  128. data/public/javascripts/LucyCMS/codemirror/parse_xml.js +7 -0
  129. data/public/javascripts/LucyCMS/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  130. data/public/javascripts/LucyCMS/jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  131. data/public/javascripts/LucyCMS/jquery-ui/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  132. data/public/javascripts/LucyCMS/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  133. data/public/javascripts/LucyCMS/jquery-ui/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  134. data/public/javascripts/LucyCMS/jquery-ui/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  135. data/public/javascripts/LucyCMS/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  136. data/public/javascripts/LucyCMS/jquery-ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  137. data/public/javascripts/LucyCMS/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
  138. data/public/javascripts/LucyCMS/jquery-ui/images/ui-icons_2e83ff_256x240.png +0 -0
  139. data/public/javascripts/LucyCMS/jquery-ui/images/ui-icons_454545_256x240.png +0 -0
  140. data/public/javascripts/LucyCMS/jquery-ui/images/ui-icons_888888_256x240.png +0 -0
  141. data/public/javascripts/LucyCMS/jquery-ui/images/ui-icons_cd0a0a_256x240.png +0 -0
  142. data/public/javascripts/LucyCMS/jquery-ui/jquery-ui.css +362 -0
  143. data/public/javascripts/LucyCMS/jquery-ui/jquery-ui.js +190 -0
  144. data/public/javascripts/LucyCMS/jquery.js +154 -0
  145. data/public/javascripts/LucyCMS/plupload/plupload.full.min.js +1 -0
  146. data/public/javascripts/LucyCMS/plupload/plupload.html5.min.js +1 -0
  147. data/public/javascripts/LucyCMS/plupload/plupload.min.js +1 -0
  148. data/public/javascripts/LucyCMS/rails.js +132 -0
  149. data/public/javascripts/LucyCMS/tiny_mce/jquery.tinymce.js +1 -0
  150. data/public/javascripts/LucyCMS/tiny_mce/langs/en.js +170 -0
  151. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/about.htm +54 -0
  152. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/anchor.htm +26 -0
  153. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/charmap.htm +52 -0
  154. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/color_picker.htm +73 -0
  155. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/editor_template.js +1 -0
  156. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/image.htm +80 -0
  157. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  158. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/img/icons.gif +0 -0
  159. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/js/about.js +72 -0
  160. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/js/anchor.js +37 -0
  161. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/js/charmap.js +335 -0
  162. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/js/color_picker.js +253 -0
  163. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/js/image.js +245 -0
  164. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/js/link.js +156 -0
  165. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/js/source_editor.js +56 -0
  166. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/langs/en.js +62 -0
  167. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/langs/en_dlg.js +51 -0
  168. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/link.htm +58 -0
  169. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/skins/default/content.css +36 -0
  170. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/skins/default/dialog.css +117 -0
  171. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  172. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  173. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  174. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  175. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  176. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  177. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/skins/default/ui.css +213 -0
  178. data/public/javascripts/LucyCMS/tiny_mce/themes/advanced/source_editor.htm +25 -0
  179. data/public/javascripts/LucyCMS/tiny_mce/tiny_mce.js +1 -0
  180. data/public/javascripts/LucyCMS/tiny_mce/tiny_mce_popup.js +5 -0
  181. data/public/robots.txt +5 -0
  182. data/public/stylesheets/LucyCMS/content.css +196 -0
  183. data/public/stylesheets/LucyCMS/form.css +125 -0
  184. data/public/stylesheets/LucyCMS/reset.css +1 -0
  185. data/public/stylesheets/LucyCMS/site_form.css +82 -0
  186. data/public/stylesheets/LucyCMS/structure.css +125 -0
  187. data/public/stylesheets/LucyCMS/typography.css +25 -0
  188. data/script/rails +6 -0
  189. data/test/cms_seeds/test.host/layouts/broken.yml +1 -0
  190. data/test/cms_seeds/test.host/layouts/default.yml +3 -0
  191. data/test/cms_seeds/test.host/layouts/nested.yml +4 -0
  192. data/test/cms_seeds/test.host/pages/broken.yml +1 -0
  193. data/test/cms_seeds/test.host/pages/child/subchild.yml +10 -0
  194. data/test/cms_seeds/test.host/pages/child.yml +10 -0
  195. data/test/cms_seeds/test.host/pages/index.yml +10 -0
  196. data/test/cms_seeds/test.host/snippets/broken.yml +1 -0
  197. data/test/cms_seeds/test.host/snippets/default.yml +3 -0
  198. data/test/fixtures/cms_blocks.yml +12 -0
  199. data/test/fixtures/cms_layouts.yml +36 -0
  200. data/test/fixtures/cms_pages.yml +39 -0
  201. data/test/fixtures/cms_sites.yml +3 -0
  202. data/test/fixtures/cms_snippets.yml +5 -0
  203. data/test/fixtures/cms_upload_dirs.yml +9 -0
  204. data/test/fixtures/cms_uploads.yml +4 -0
  205. data/test/fixtures/cms_users.yml +11 -0
  206. data/test/fixtures/files/invalid_file.gif +9 -0
  207. data/test/fixtures/files/valid_image.jpg +0 -0
  208. data/test/fixtures/views/_nav_hook.html.erb +1 -0
  209. data/test/fixtures/views/_nav_hook_2.html.erb +1 -0
  210. data/test/functional/cms_admin/layouts_controller_test.rb +103 -0
  211. data/test/functional/cms_admin/pages_controller_test.rb +334 -0
  212. data/test/functional/cms_admin/sites_controller_test.rb +99 -0
  213. data/test/functional/cms_admin/snippets_controller_test.rb +102 -0
  214. data/test/functional/cms_admin/uploads_controller_test.rb +26 -0
  215. data/test/functional/cms_content_controller_test.rb +134 -0
  216. data/test/integration/rake_tasks_test.rb +65 -0
  217. data/test/integration/render_cms_seed_test.rb +34 -0
  218. data/test/integration/render_cms_test.rb +81 -0
  219. data/test/integration/sites_test.rb +63 -0
  220. data/test/integration/view_hooks_test.rb +33 -0
  221. data/test/test_helper.rb +86 -0
  222. data/test/unit/cms_block_test.rb +43 -0
  223. data/test/unit/cms_configuration_test.rb +17 -0
  224. data/test/unit/cms_layout_test.rb +146 -0
  225. data/test/unit/cms_page_test.rb +257 -0
  226. data/test/unit/cms_site_test.rb +41 -0
  227. data/test/unit/cms_snippet_test.rb +77 -0
  228. data/test/unit/cms_tag_test.rb +206 -0
  229. data/test/unit/cms_tags/field_datetime_test.rb +34 -0
  230. data/test/unit/cms_tags/field_integer_test.rb +33 -0
  231. data/test/unit/cms_tags/field_string_test.rb +34 -0
  232. data/test/unit/cms_tags/field_text_test.rb +32 -0
  233. data/test/unit/cms_tags/helper_test.rb +38 -0
  234. data/test/unit/cms_tags/page_datetime_test.rb +34 -0
  235. data/test/unit/cms_tags/page_integer_test.rb +33 -0
  236. data/test/unit/cms_tags/page_rich_text.rb +33 -0
  237. data/test/unit/cms_tags/page_string_test.rb +33 -0
  238. data/test/unit/cms_tags/page_text_test.rb +34 -0
  239. data/test/unit/cms_tags/partial_test.rb +44 -0
  240. data/test/unit/cms_tags/snippet_test.rb +33 -0
  241. data/test/unit/cms_upload_dir_test.rb +8 -0
  242. data/test/unit/cms_upload_test.rb +26 -0
  243. data/test/unit/cms_user_test.rb +8 -0
  244. data/test/unit/view_methods_test.rb +21 -0
  245. metadata +488 -0
@@ -0,0 +1,17 @@
1
+ <h1> Editing User </h1>
2
+
3
+ <%= cms_form_for @cms_user, :url => {:action => :update} do |form| %>
4
+ <%= form.text_field :login%>
5
+ <%= form.text_field :first_name%>
6
+ <%= form.text_field :last_name%>
7
+ <%= form.check_box :admin%>
8
+ <%= form.check_box :disabled%>
9
+ <%= form.submit 'Update User' %>
10
+ <% end %>
11
+ <% unless @cms_site.authentication == 'LDAP' %>
12
+ <div class='form_element submit_element'>
13
+ <div class='value'>
14
+ <%= button_to 'Change Password', change_password_cms_admin_user_path, :method => 'get', :class => 'big button' %>
15
+ </div>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <%= link_to span_tag('Create New User'), new_cms_admin_user_path, :class => 'big button' %>
2
+ <h1>Users</h1>
3
+
4
+ <ul class='list'>
5
+ <%= render :partial => 'index_branch', :collection => @cms_users %>
6
+ </ul>
@@ -0,0 +1,14 @@
1
+ <h1> Add User </h1>
2
+
3
+ <%= cms_form_for @cms_user, :url => {:action => :create} do |form| %>
4
+ <%= form.text_field :login%>
5
+ <%= form.text_field :first_name%>
6
+ <%= form.text_field :last_name%>
7
+ <% unless @cms_site.authentication == 'LDAP' %>
8
+ <%= form.password_field :password %>
9
+ <%= form.password_field :password_confirmation, :label => 'Repeat Password' %>
10
+ <% end %>
11
+ <%= form.check_box :admin%>
12
+ <%= form.check_box :disabled%>
13
+ <%= form.submit 'Add User' %>
14
+ <% end %>
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5
+ <title>
6
+ <% if CmsSite.count == 0 %>
7
+ LucyCMS
8
+ <% else %>
9
+ <%= @cms_site.label %>
10
+ <% end %>
11
+ </title>
12
+ <%= csrf_meta_tag %>
13
+ <%= stylesheet_link_tag :cms, :cache => ('_cms' if LucyCMS.config.enable_caching) %>
14
+ <%= javascript_include_tag :cms, :cache => ('_cms' if LucyCMS.config.enable_caching) %>
15
+ <%= yield :head %>
16
+ <%= cms_hook :html_head %>
17
+ </head>
18
+ <body class='c_<%= params[:controller].idify %> a_<%= params[:action].idify %>'>
19
+ <div class='body_wrapper'>
20
+ <div class='left_column'>
21
+ <div class='left_column_content'>
22
+ <%= active_link_to 'Setup', edit_cms_admin_site_path %>
23
+ <%= active_link_to 'Users', cms_admin_users_path %>
24
+ <%= active_link_to 'Layouts', cms_admin_layouts_path %>
25
+ <%= active_link_to 'Pages', cms_admin_pages_path %>
26
+ <%= active_link_to 'Snippets', cms_admin_snippets_path %>
27
+ <%= active_link_to 'Uploads', cms_admin_upload_dirs_path %>
28
+ <%= cms_hook :navigation %>
29
+ </div>
30
+ </div>
31
+ <div class='right_column'>
32
+ <div class='right_column_content'>
33
+ <% unless @cms_current_user.nil? %>
34
+ <div id='logout' class='box'>
35
+ <label>Logged in as: <%=@cms_current_user.login%></label>
36
+ <div style="float:right;"><%= button_to 'Logout', cms_admin_session_path, :method => 'delete', :class => 'big button' %></div>
37
+ </div>
38
+ <% end %>
39
+ <%= yield :right_column %>
40
+ </div>
41
+ </div>
42
+ <div class='center_column'>
43
+ <% flash.each do |type, message| %>
44
+ <div class='flash <%= type %>'><%= message %></div>
45
+ <% end %>
46
+ <div class='center_column_content'>
47
+ <%= yield %>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </body>
52
+ </html>
@@ -0,0 +1,48 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module LucyCMS
10
+ class Application < Rails::Application
11
+
12
+ require 'LucyCMS'
13
+
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # JavaScript files you want as :defaults (application.js is always included).
37
+
38
+ # Configure the default encoding used in templates for Ruby 1.9.
39
+ config.encoding = "utf-8"
40
+
41
+ # Configure sensitive parameters which will be filtered from the log file.
42
+ config.filter_parameters += [:password]
43
+
44
+ config.session_store :cookie_store, :key => '_LucyCMS_session'
45
+ config.secret_token = 'e0fef4ab56c1cacd8845864fe2cb2a27f5caad72823419f87b2774785187090a654b83229bf9cef70ce475a83bfa561dbbaa2015788181ea837c456964c1e0f6'
46
+
47
+ end
48
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ LucyCMS::Application.initialize!
@@ -0,0 +1,22 @@
1
+ LucyCMS::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.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 webserver 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_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+ end
@@ -0,0 +1,49 @@
1
+ LucyCMS::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+ end
@@ -0,0 +1,35 @@
1
+ LucyCMS::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.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
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,37 @@
1
+ LucyCMS.configure do |config|
2
+
3
+ # Default url to access admin area is http://yourhost/cms-admin/
4
+ # You can change 'cms-admin' to 'admin', for example.
5
+ # config.admin_route_prefix = 'cms-admin'
6
+
7
+ # Path: /cms-admin redirects to /cms-admin/pages but you can change it
8
+ # You don't need to change it when changing admin_route_prefix
9
+ # config.admin_route_redirect = '/cms-admin/pages'
10
+
11
+ # Location of YAML files that can be used to render pages instead of pulling
12
+ # data from the database. Not active if not specified. Containing folder name
13
+ # should be the hostname of the site. Example: my-app.local
14
+ # config.seed_data_path = File.expand_path('db/cms_seeds', Rails.root)
15
+
16
+ # By default upload directories are placed in a directory called common
17
+ # that is located public directory. You can change the name of that
18
+ # subdirectory. Example: shared
19
+ # config.cms_upload_directory = 'shared'
20
+
21
+ # By default you cannot have irb code inside your layouts/pages/snippets.
22
+ # Generally this is to prevent putting something like this:
23
+ # <% User.delete_all %> but if you really want to allow it...
24
+ # config.disable_irb = true
25
+
26
+ # Asset caching for CSS and JS for admin layout. This setting also controls
27
+ # page caching for CMS Layout CSS and Javascript. Enabled by default. When deploying
28
+ # to an environment with read-only filesystem (like Heroku) turn this setting off.
29
+ # config.enable_caching = true
30
+
31
+ end
32
+
33
+ # If you need to inject some html in cms admin views you can define what partial
34
+ # should be rendered into the following areas:
35
+ # ComfortableMexicanSofa::ViewHooks.add(:navigation, '/layouts/admin/navigation')
36
+ # ComfortableMexicanSofa::ViewHooks.add(:html_head, '/layouts/admin/html_head')
37
+ # ComfortableMexicanSofa::ViewHooks.add(:page_form, '/layouts/admin/page_form')
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
data/config/routes.rb ADDED
@@ -0,0 +1,45 @@
1
+ Rails.application.routes.draw do
2
+
3
+ namespace :cms_admin, :path => LucyCMS.config.admin_route_prefix, :except => :show do
4
+ get '/' => redirect(LucyCMS.config.admin_route_redirect)
5
+ resources :pages do
6
+ member do
7
+ match :form_blocks
8
+ match :toggle_branch
9
+ end
10
+ collection do
11
+ match :reorder
12
+ end
13
+ end
14
+ resource :site do
15
+ collection do
16
+ get :setup
17
+ end
18
+ end
19
+ resource :session
20
+ resources :users do
21
+ member do
22
+ get :change_password
23
+ put :update_password
24
+ end
25
+ end
26
+ resources :layouts
27
+ resources :snippets
28
+ resources :upload_dirs, :except => [:edit, :update] do
29
+ collection do
30
+ get :conflict
31
+ end
32
+ member do
33
+ post :uploads
34
+ delete :uploads_destroy
35
+ end
36
+ end
37
+ end
38
+
39
+ scope :controller => :cms_content do
40
+ get '/cms-css/:id' => :render_css, :as => 'cms_css'
41
+ get '/cms-js/:id' => :render_js, :as => 'cms_js'
42
+ get '/' => :render_html, :as => 'cms_html', :path => '(*cms_path)'
43
+ end
44
+
45
+ end
data/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run LucyCMS::Application
@@ -0,0 +1,8 @@
1
+ label: Default Layout
2
+ slug: default
3
+ content: |-
4
+ <html>
5
+ <body>
6
+ {{ cms:page:content }}
7
+ </body>
8
+ </html>
@@ -0,0 +1,6 @@
1
+ label: Nested Layout
2
+ slug: nested
3
+ parent: default
4
+ content: |-
5
+ <div class='left'> {{ cms:page:left }} </div>
6
+ <div class='left'> {{ cms:page:right }} </div>
@@ -0,0 +1,14 @@
1
+ label: Sub-Child Page
2
+ parent: /child
3
+ cms_layout: nested
4
+ full_path: /child/subchild
5
+ slug: subchild
6
+ cms_blocks_attributes:
7
+ -
8
+ label: left
9
+ content: |-
10
+ Sub Child Page Left Content
11
+ -
12
+ label: right
13
+ content: |-
14
+ Sub Child Page Right Content
@@ -0,0 +1,10 @@
1
+ label: Child Page
2
+ parent: /
3
+ cms_layout: default
4
+ full_path: /child
5
+ slug: child
6
+ cms_blocks_attributes:
7
+ -
8
+ label: content
9
+ content: |-
10
+ Child Page Content
@@ -0,0 +1,11 @@
1
+ label: Home Page
2
+ parent:
3
+ cms_layout: default
4
+ full_path: /
5
+ slug:
6
+ cms_blocks_attributes:
7
+ -
8
+ label: content
9
+ content: |-
10
+ Home Page Content
11
+ {{ cms:snippet:example }}
@@ -0,0 +1,4 @@
1
+ label: Example Snippet
2
+ slug: example
3
+ content: |-
4
+ Content for Example Snippet
@@ -0,0 +1,114 @@
1
+ class CreateCms < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ # -- Sites --------------------------------------------------------------
5
+ create_table :cms_sites do |t|
6
+ t.string :label
7
+ t.string :hostname
8
+ t.string :authentication
9
+ t.string :ldap_hostname
10
+ t.string :ldap_base_DN
11
+ t.string :ldap_uid
12
+ t.string :version
13
+
14
+ end
15
+ add_index :cms_sites, :hostname
16
+
17
+ # -- Layouts ------------------------------------------------------------
18
+ create_table :cms_layouts do |t|
19
+ t.integer :cms_site_id
20
+ t.integer :parent_id
21
+ t.string :app_layout
22
+ t.string :label
23
+ t.string :slug
24
+ t.text :content
25
+ t.text :css
26
+ t.text :js
27
+ t.integer :position, :null => false, :default => 0
28
+ t.integer :cms_user_id
29
+ t.timestamps
30
+ end
31
+ add_index :cms_layouts, [:parent_id, :position]
32
+ add_index :cms_layouts, [:cms_site_id, :slug], :unique => true
33
+
34
+ # -- Pages --------------------------------------------------------------
35
+ create_table :cms_pages do |t|
36
+ t.integer :cms_site_id
37
+ t.integer :cms_layout_id
38
+ t.integer :parent_id
39
+ t.integer :target_page_id
40
+ t.string :label
41
+ t.string :slug
42
+ t.string :full_path
43
+ t.text :content
44
+ t.integer :position, :null => false, :default => 0
45
+ t.integer :children_count, :null => false, :default => 0
46
+ t.boolean :is_published, :null => false, :default => true
47
+ t.integer :cms_user_id
48
+ t.timestamps
49
+ end
50
+ add_index :cms_pages, [:cms_site_id, :full_path]
51
+ add_index :cms_pages, [:parent_id, :position]
52
+
53
+ # -- Page Blocks --------------------------------------------------------
54
+ create_table :cms_blocks do |t|
55
+ t.integer :cms_page_id
56
+ t.string :label
57
+ t.text :content
58
+ t.timestamps
59
+ end
60
+ add_index :cms_blocks, [:cms_page_id, :label]
61
+
62
+ # -- Snippets -----------------------------------------------------------
63
+ create_table :cms_snippets do |t|
64
+ t.integer :cms_site_id
65
+ t.string :label
66
+ t.string :slug
67
+ t.text :content
68
+ t.integer :cms_user_id
69
+ t.timestamps
70
+ end
71
+ add_index :cms_snippets, [:cms_site_id, :slug], :unique => true
72
+
73
+ # -- Users --------------------------------------------------------------
74
+ create_table :cms_users do |t|
75
+ t.string :login
76
+ t.string :first_name
77
+ t.string :last_name
78
+ t.string :hashed_password
79
+ t.string :salt
80
+ t.boolean :admin
81
+ t.boolean :disabled
82
+ end
83
+ # -- Upload Directories -------------------------------------------------
84
+ create_table :cms_upload_dirs do |t|
85
+ t.string :label
86
+ t.integer :cms_site_id
87
+ t.integer :cms_user_id
88
+ t.timestamps
89
+ end
90
+
91
+ # -- Uploads -------------------------------------------------------------
92
+ create_table :cms_uploads do |t|
93
+ t.integer :cms_upload_dir_id
94
+ t.string :cms_upload_dir_label
95
+ t.string :file_file_name
96
+ t.string :file_content_type
97
+ t.integer :file_file_size
98
+ t.integer :cms_user_id
99
+ t.timestamps
100
+ end
101
+ add_index :cms_uploads, [:cms_upload_dir_id, :file_file_name]
102
+ end
103
+
104
+ def self.down
105
+ drop_table :cms_sites
106
+ drop_table :cms_layouts
107
+ drop_table :cms_pages
108
+ drop_table :cms_blocks
109
+ drop_table :cms_snippets
110
+ drop_table :cms_users
111
+ drop_table :cms_upload_dirs
112
+ drop_table :cms_uploads
113
+ end
114
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
+ # Mayor.create(:name => 'Daley', :city => cities.first)