cmsimple 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. data/.gitignore +31 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +16 -0
  4. data/Gemfile +20 -0
  5. data/Gemfile.ci +5 -0
  6. data/LICENSE +19 -0
  7. data/README.md +118 -0
  8. data/Rakefile +47 -0
  9. data/app/assets/javascripts/cmsimple.js +61 -0
  10. data/app/assets/javascripts/cmsimple/controllers/editor.coffee +102 -0
  11. data/app/assets/javascripts/cmsimple/lib/namespaces.coffee +3 -0
  12. data/app/assets/javascripts/cmsimple/lib/support.coffee +4 -0
  13. data/app/assets/javascripts/cmsimple/mercury/config.js +462 -0
  14. data/app/assets/javascripts/cmsimple/mercury/handlers.coffee +9 -0
  15. data/app/assets/javascripts/cmsimple/models/image.coffee +49 -0
  16. data/app/assets/javascripts/cmsimple/models/page.coffee +106 -0
  17. data/app/assets/javascripts/cmsimple/models/path.coffee +31 -0
  18. data/app/assets/javascripts/cmsimple/models/version.coffee +29 -0
  19. data/app/assets/javascripts/cmsimple/panels/images/index.coffee +2 -0
  20. data/app/assets/javascripts/cmsimple/panels/images/list.coffee +48 -0
  21. data/app/assets/javascripts/cmsimple/panels/images/panel.coffee +69 -0
  22. data/app/assets/javascripts/cmsimple/panels/images/selection.coffee +52 -0
  23. data/app/assets/javascripts/cmsimple/panels/page_metadata.coffee +42 -0
  24. data/app/assets/javascripts/cmsimple/panels/publish.coffee +32 -0
  25. data/app/assets/javascripts/cmsimple/panels/redirects/form.coffee +51 -0
  26. data/app/assets/javascripts/cmsimple/panels/redirects/index.coffee +2 -0
  27. data/app/assets/javascripts/cmsimple/panels/redirects/list.coffee +34 -0
  28. data/app/assets/javascripts/cmsimple/panels/redirects/panel.coffee +39 -0
  29. data/app/assets/javascripts/cmsimple/panels/sitemap/index.coffee +2 -0
  30. data/app/assets/javascripts/cmsimple/panels/sitemap/panel.coffee +40 -0
  31. data/app/assets/javascripts/cmsimple/panels/sitemap/sortable.coffee +55 -0
  32. data/app/assets/javascripts/cmsimple/panels/sitemap/tree.coffee +61 -0
  33. data/app/assets/javascripts/cmsimple/panels/versions/index.coffee +2 -0
  34. data/app/assets/javascripts/cmsimple/panels/versions/list.coffee +51 -0
  35. data/app/assets/javascripts/cmsimple/panels/versions/panel.coffee +53 -0
  36. data/app/assets/javascripts/cmsimple/views/image_library/_item.jst.hamlc +24 -0
  37. data/app/assets/javascripts/cmsimple/views/image_library/list.jst.hamlc +8 -0
  38. data/app/assets/javascripts/cmsimple/views/redirects/_path.jst.hamlc +6 -0
  39. data/app/assets/javascripts/cmsimple/views/redirects/list.jst.hamlc +19 -0
  40. data/app/assets/javascripts/cmsimple/views/sitemap/_page.jst.hamlc +9 -0
  41. data/app/assets/javascripts/cmsimple/views/sitemap/tree.jst.hamlc +5 -0
  42. data/app/assets/javascripts/cmsimple/views/versions/_item.jst.hamlc +6 -0
  43. data/app/assets/javascripts/cmsimple/views/versions/list.jst.hamlc +4 -0
  44. data/app/assets/stylesheets/cmsimple.css +15 -0
  45. data/app/assets/stylesheets/cmsimple/forms.css +10 -0
  46. data/app/assets/stylesheets/cmsimple/panels.css +399 -0
  47. data/app/assets/stylesheets/cmsimple/toolbar-images.css +27 -0
  48. data/app/assets/stylesheets/mercury_overrides.css +2 -0
  49. data/app/controllers/cmsimple/front_controller.rb +38 -0
  50. data/app/controllers/cmsimple/images_controller.rb +28 -0
  51. data/app/controllers/cmsimple/mercury_controller.rb +7 -0
  52. data/app/controllers/cmsimple/pages_controller.rb +89 -0
  53. data/app/controllers/cmsimple/paths_controller.rb +23 -0
  54. data/app/controllers/cmsimple/snippets_controller.rb +23 -0
  55. data/app/controllers/cmsimple/versions_controller.rb +17 -0
  56. data/app/helpers/cmsimple/regions_helper.rb +38 -0
  57. data/app/models/cmsimple/image.rb +19 -0
  58. data/app/models/cmsimple/page.rb +203 -0
  59. data/app/models/cmsimple/path.rb +63 -0
  60. data/app/models/cmsimple/region.rb +43 -0
  61. data/app/models/cmsimple/snippet.rb +64 -0
  62. data/app/models/cmsimple/version.rb +18 -0
  63. data/app/uploaders/image_attachment_uploader.rb +53 -0
  64. data/app/views/cmsimple/images/_form.html.haml +13 -0
  65. data/app/views/cmsimple/images/new.html.haml +5 -0
  66. data/app/views/cmsimple/pages/_form.html.haml +49 -0
  67. data/app/views/cmsimple/pages/_form_extras.html.haml +2 -0
  68. data/app/views/cmsimple/pages/edit.html.haml +3 -0
  69. data/app/views/cmsimple/pages/new.html.haml +3 -0
  70. data/app/views/cmsimple/pages/publish.html.haml +12 -0
  71. data/app/views/cmsimple/snippets/index.html.haml +5 -0
  72. data/app/views/cmsimple/templates/default.html.haml +4 -0
  73. data/app/views/layouts/editor.html.haml +12 -0
  74. data/app/views/layouts/panel.html.haml +9 -0
  75. data/cmsimple.gemspec +44 -0
  76. data/config.ru +4 -0
  77. data/config/application.rb +1 -0
  78. data/config/cucumber.yml +8 -0
  79. data/config/environment.rb +2 -0
  80. data/config/routes.rb +34 -0
  81. data/db/migrate/20120201221410_create_cmsimple_pages.rb +10 -0
  82. data/db/migrate/20120222185901_add_title_parent_id_and_position_to_pages.rb +10 -0
  83. data/db/migrate/20120229185214_add_slug_to_pages.rb +7 -0
  84. data/db/migrate/20120323200439_add_is_root_to_page.rb +5 -0
  85. data/db/migrate/20120328174339_add_meta_info_to_cmsimple_pages.rb +9 -0
  86. data/db/migrate/20120329172857_create_cmsimple_path.rb +11 -0
  87. data/db/migrate/20120407024752_create_cmsimple_images.rb +13 -0
  88. data/db/migrate/20120410041105_add_timestamps_to_cmsimple_pages.rb +7 -0
  89. data/db/migrate/20120425211937_add_published_at_to_cmsimple_pages.rb +6 -0
  90. data/db/migrate/20120430175047_create_cmsimple_versions.rb +13 -0
  91. data/db/migrate/20120831233927_rename_path_to_current_uri_on_paths.rb +5 -0
  92. data/features/create.feature +18 -0
  93. data/features/delete.feature +12 -0
  94. data/features/edit.feature +54 -0
  95. data/features/publishing.feature +31 -0
  96. data/features/redirects.feature +27 -0
  97. data/features/step_definitions/mercury_steps.rb +440 -0
  98. data/features/step_definitions/page_steps.rb +269 -0
  99. data/features/step_definitions/web_steps.rb +254 -0
  100. data/features/support/env.rb +77 -0
  101. data/features/support/mercury_content.rb +25 -0
  102. data/features/support/mercury_selectors.rb +148 -0
  103. data/features/support/paths.rb +16 -0
  104. data/features/support/selectors.rb +26 -0
  105. data/features/support/utils.rb +18 -0
  106. data/features/versioning.feature +27 -0
  107. data/features/visit.feature +7 -0
  108. data/lib/cmsimple.rb +22 -0
  109. data/lib/cmsimple/configuration.rb +65 -0
  110. data/lib/cmsimple/exts/to_bool.rb +25 -0
  111. data/lib/cmsimple/page_responder.rb +46 -0
  112. data/lib/cmsimple/rails.rb +5 -0
  113. data/lib/cmsimple/regions_proxy.rb +32 -0
  114. data/lib/cmsimple/template_resolver.rb +14 -0
  115. data/lib/cmsimple/template_responder.rb +12 -0
  116. data/lib/cmsimple/version.rb +3 -0
  117. data/lib/generators/cmsimple/install/install_generator.rb +46 -0
  118. data/lib/generators/cmsimple/install/templates/default.html.erb +10 -0
  119. data/lib/generators/cmsimple/install/templates/default.html.haml +6 -0
  120. data/lib/generators/cmsimple/install/templates/initializer.rb +22 -0
  121. data/lib/generators/cmsimple/snippet/snippet_generator.rb +56 -0
  122. data/lib/generators/cmsimple/snippet/templates/cell.rb +18 -0
  123. data/lib/generators/cmsimple/snippet/templates/display.html.erb +14 -0
  124. data/lib/generators/cmsimple/snippet/templates/display.html.haml +11 -0
  125. data/lib/generators/cmsimple/snippet/templates/options.html.erb +18 -0
  126. data/lib/generators/cmsimple/snippet/templates/options.html.haml +12 -0
  127. data/script/app +2 -0
  128. data/script/migrate +2 -0
  129. data/script/rails +8 -0
  130. data/spec/fixtures/rails.png +0 -0
  131. data/spec/helpers/regions_helper_spec.rb +62 -0
  132. data/spec/javascripts/controllers/editor_spec.coffee +57 -0
  133. data/spec/javascripts/models/image_geometry_spec.coffee +64 -0
  134. data/spec/javascripts/models/image_spec.coffee +4 -0
  135. data/spec/javascripts/models/page_spec.coffee +121 -0
  136. data/spec/javascripts/models/path_spec.coffee +39 -0
  137. data/spec/javascripts/models/version_spec.coffee +31 -0
  138. data/spec/javascripts/panels/images/selection_spec.coffee +104 -0
  139. data/spec/javascripts/panels/sitemap/panel_spec.coffee +10 -0
  140. data/spec/javascripts/panels/sitemap/sortable_spec.coffee +63 -0
  141. data/spec/javascripts/panels/sitemap/tree_spec.coffee +62 -0
  142. data/spec/javascripts/spec_helper.coffee +25 -0
  143. data/spec/javascripts/support/stubs.coffee +16 -0
  144. data/spec/lib/page_responder_spec.rb +58 -0
  145. data/spec/lib/regions_proxy_spec.rb +47 -0
  146. data/spec/models/image_spec.rb +46 -0
  147. data/spec/models/page_spec.rb +237 -0
  148. data/spec/models/path_spec.rb +71 -0
  149. data/spec/models/region_spec.rb +14 -0
  150. data/spec/models/snippet_spec.rb +57 -0
  151. data/spec/models/version_spec.rb +7 -0
  152. data/spec/rails_app/.gitignore +33 -0
  153. data/spec/rails_app/Rakefile +7 -0
  154. data/spec/rails_app/app/assets/images/rails.png +0 -0
  155. data/spec/rails_app/app/assets/javascripts/application.js +9 -0
  156. data/spec/rails_app/app/assets/stylesheets/application.css +7 -0
  157. data/spec/rails_app/app/cells/example/display.html.haml +2 -0
  158. data/spec/rails_app/app/cells/example/options.html.haml +15 -0
  159. data/spec/rails_app/app/cells/example_cell.rb +19 -0
  160. data/spec/rails_app/app/cells/image_example/display.html.haml +4 -0
  161. data/spec/rails_app/app/cells/image_example/options.html.haml +15 -0
  162. data/spec/rails_app/app/cells/image_example_cell.rb +18 -0
  163. data/spec/rails_app/app/controllers/application_controller.rb +3 -0
  164. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  165. data/spec/rails_app/app/mailers/.gitkeep +0 -0
  166. data/spec/rails_app/app/models/.gitkeep +0 -0
  167. data/spec/rails_app/app/views/cmsimple/_snippet_list.html.haml +8 -0
  168. data/spec/rails_app/app/views/cmsimple/templates/default.html.haml +19 -0
  169. data/spec/rails_app/app/views/cmsimple/templates/test.html.haml +2 -0
  170. data/spec/rails_app/app/views/layouts/application.html.haml +13 -0
  171. data/spec/rails_app/config.ru +4 -0
  172. data/spec/rails_app/config/application.rb +65 -0
  173. data/spec/rails_app/config/boot.rb +9 -0
  174. data/spec/rails_app/config/database.example.yml +22 -0
  175. data/spec/rails_app/config/database.travis.yml +8 -0
  176. data/spec/rails_app/config/environment.rb +5 -0
  177. data/spec/rails_app/config/environments/development.rb +30 -0
  178. data/spec/rails_app/config/environments/test.rb +39 -0
  179. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  180. data/spec/rails_app/config/initializers/cells.rb +1 -0
  181. data/spec/rails_app/config/initializers/cmsimple.rb +3 -0
  182. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  183. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  184. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  185. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  186. data/spec/rails_app/config/initializers/teabag.rb +58 -0
  187. data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
  188. data/spec/rails_app/config/locales/en.yml +5 -0
  189. data/spec/rails_app/config/routes.rb +61 -0
  190. data/spec/rails_app/db/seeds.rb +11 -0
  191. data/spec/rails_app/lib/assets/.gitkeep +0 -0
  192. data/spec/rails_app/lib/tasks/.gitkeep +0 -0
  193. data/spec/rails_app/public/404.html +26 -0
  194. data/spec/rails_app/public/422.html +26 -0
  195. data/spec/rails_app/public/500.html +26 -0
  196. data/spec/rails_app/public/robots.txt +5 -0
  197. data/spec/rails_app/script/rails +6 -0
  198. data/spec/rails_app/vendor/assets/stylesheets/.gitkeep +0 -0
  199. data/spec/rails_app/vendor/plugins/.gitkeep +0 -0
  200. data/spec/spec_helper.rb +31 -0
  201. data/spec/support/active_model_lint_example.rb +14 -0
  202. data/spec/teabag_env.rb +28 -0
  203. data/vendor/assets/images/sitemap/has-changes.png +0 -0
  204. data/vendor/assets/images/sitemap/published.png +0 -0
  205. data/vendor/assets/images/sitemap/unpublished.png +0 -0
  206. data/vendor/assets/images/toolbar/metadata.png +0 -0
  207. data/vendor/assets/images/toolbar/publish.png +0 -0
  208. data/vendor/assets/images/toolbar/redirect.png +0 -0
  209. data/vendor/assets/images/toolbar/sitemap.png +0 -0
  210. data/vendor/assets/images/toolbar/snippets.png +0 -0
  211. data/vendor/assets/images/toolbar/unpublished.png +0 -0
  212. data/vendor/assets/images/tree-line-horizontal-last.png +0 -0
  213. data/vendor/assets/images/tree-line-horizontal.png +0 -0
  214. data/vendor/assets/images/tree-line-vertical.png +0 -0
  215. data/vendor/assets/javascripts/jquery-serializeObject.js +107 -0
  216. data/vendor/assets/javascripts/jquery.to-json.js +74 -0
  217. data/vendor/assets/javascripts/jquery.ui.nestedSortable-1.3.4.js +391 -0
  218. data/vendor/assets/javascripts/moment-1.6.2.js +918 -0
  219. data/vendor/assets/javascripts/underscore-1.3.1.js +31 -0
  220. data/vendor/assets/stylesheets/jasmine-modified.css +216 -0
  221. metadata +686 -0
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+ describe Cmsimple::Region do
3
+
4
+ it 'returns the value on to_s' do
5
+ region = Cmsimple::Region.new value: 'hello'
6
+ region.to_s.should == 'hello'
7
+ end
8
+
9
+ it 'returns an empty string for a non-existent region' do
10
+ region = Cmsimple::Region.new nil
11
+ region.to_s.should == ''
12
+ end
13
+
14
+ end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cmsimple::Snippet do
4
+ subject { Cmsimple::Snippet.new 'name', {} }
5
+
6
+ it_should_behave_like 'ActiveModel'
7
+
8
+ describe 'options' do
9
+ let(:snippet) { Cmsimple::Snippet.new 'snippet_0', { name: 'example', snippet: {first_name: 'Fred', last_name: 'Flintstone'} } }
10
+
11
+ it "sets values for name" do
12
+ snippet.name.should == 'example'
13
+ end
14
+
15
+ it "sets values for options" do
16
+ snippet.options.should be_a(Hash)
17
+ snippet.options[:first_name].should == 'Fred'
18
+ end
19
+
20
+ it 'can access options with via method calls' do
21
+ snippet.first_name.should == 'Fred'
22
+ snippet.last_name.should == 'Flintstone'
23
+ end
24
+
25
+ it "returns a string to match against the html for interpolations" do
26
+ snippet.matcher.should =~ '[snippet_0/0]'
27
+ end
28
+ end
29
+
30
+ describe 'created via a region' do
31
+ before do
32
+ @region = Cmsimple::Region.new(value: "<div>some content</div><div>[snippet_0/0]</div>",
33
+ snippets: {snippet_0: {name: 'example',
34
+ first_name: 'Fred',
35
+ last_name: 'Flinstone'
36
+ }})
37
+ end
38
+
39
+ it "has an array of snippets" do
40
+ @region.snippets.should be_a(Array)
41
+ @region.snippets.first.should be_a(Cmsimple::Snippet)
42
+ end
43
+
44
+ it "sets values for options when not nested under the snippet key" do
45
+ @region.snippets.first.first_name.should == 'Fred'
46
+ end
47
+
48
+ describe '#render_snippets' do
49
+ it 'interpolates the result of the block into the region html' do
50
+ @region.render_snippets do |snippet|
51
+ "<span>#{snippet.options[:first_name]} #{snippet.options[:last_name]}</span>"
52
+ end
53
+ @region.to_s.should == '<div>some content</div><div><span>Fred Flinstone</span></div>'
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cmsimple::Version do
4
+ subject { Cmsimple::Version.new }
5
+ it { should belong_to :page }
6
+ it { should validate_presence_of(:published_at) }
7
+ end
@@ -0,0 +1,33 @@
1
+ # System stuff
2
+ .DS_Store
3
+ .bundle
4
+ .idea
5
+ .rake_tasks
6
+ REVISION
7
+ vendor/bundle
8
+ .rake_tasks~
9
+ mkmf.log
10
+
11
+ # Local config files
12
+ config/database.yml
13
+ config/*.sphinx.conf
14
+ config/mongoid.yml
15
+
16
+ # Local DBs
17
+ db/sphinx
18
+ db/*.sqlite3
19
+
20
+ # Logs
21
+ log/*.log
22
+ log/*.pid
23
+
24
+ # Tempfiles
25
+ tmp/**/*
26
+ coverage
27
+ capybara*
28
+
29
+ # Assets
30
+ public/system
31
+ public/static
32
+ /assets
33
+ packages
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ RailsTestApp::Application.load_tasks
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -0,0 +1,2 @@
1
+ %h1
2
+ = [@first_name, @last_name].compact.join(' ')
@@ -0,0 +1,15 @@
1
+ .mercury-display-pane(style='width: 500px')
2
+ = form_for @snippet, :url => '#', html: { class: 'form-horizontal'} do |f|
3
+ %fieldset
4
+ %legend Full Name Snippet
5
+ .control-group
6
+ = f.label :first_name, class: 'control-label'
7
+ .controls
8
+ = f.text_field :first_name
9
+ .control-group
10
+ = f.label :last_name, class: 'control-label'
11
+ .controls
12
+ = f.text_field :last_name
13
+ .form-actions.mercury-display-controls
14
+ = f.submit class: 'btn btn-primary'
15
+
@@ -0,0 +1,19 @@
1
+ require 'ostruct'
2
+ class ExampleCell < Cell::Rails
3
+
4
+ def display(snippet)
5
+ @first_name = snippet.first_name
6
+ @last_name = snippet.last_name
7
+ render view: :display
8
+ end
9
+
10
+ def preview(snippet)
11
+ display(snippet)
12
+ end
13
+
14
+ def options(snippet)
15
+ @snippet = snippet
16
+ render
17
+ end
18
+
19
+ end
@@ -0,0 +1,4 @@
1
+ .item
2
+ %img(src="#{ @image_1.presence || 'http://placehold.it/60x80/'}" data-snippet-image='image_1' data-image-geometry='<100x<100' style='float: left; padding-right: 5px;')
3
+ %h3= @title
4
+ %p= @summary
@@ -0,0 +1,15 @@
1
+ .mercury-display-pane(style='width: 500px')
2
+ = form_for @snippet, :url => '#', html: { class: 'form-horizontal'} do |f|
3
+ %fieldset
4
+ %legend Image Example Snippet
5
+ .control-group
6
+ = f.label :title, class: 'control-label'
7
+ .controls
8
+ = f.text_field :title
9
+ .control-group
10
+ = f.label :summary, class: 'control-label'
11
+ .controls
12
+ = f.text_field :summary
13
+ = f.hidden_field :image_1
14
+ .form-actions.mercury-display-controls
15
+ = f.submit class: 'btn btn-primary'
@@ -0,0 +1,18 @@
1
+ class ImageExampleCell < Cell::Rails
2
+
3
+ def display(snippet)
4
+ @title = snippet.title
5
+ @summary = snippet.summary
6
+ @image_1 = snippet.image_1
7
+ render view: :display
8
+ end
9
+
10
+ def preview(snippet)
11
+ display(snippet)
12
+ end
13
+
14
+ def options(snippet)
15
+ @snippet = snippet
16
+ render
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,8 @@
1
+ %li(data-filter="example, snippet, name")
2
+ %img(alt="Example Snippet" data-snippet="example" src="/assets/toolbar/snippets.png")
3
+ %h4>Snippet Name
4
+ .description A one or two line long description of what this snippet does.
5
+ %li(data-filter="image_example, snippet, name")
6
+ %img(alt="Image Example Snippet" data-snippet="image_example" src="/assets/toolbar/snippets.png")
7
+ %h4>Image Example
8
+ .description A one or two line long description of what this snippet does.
@@ -0,0 +1,19 @@
1
+ = content_for :title do
2
+ = @page.browser_title
3
+ = content_for :keywords do
4
+ = @page.keywords
5
+ = content_for :description do
6
+ = @page.description
7
+
8
+ %h2 Editable
9
+ %section#editable1(data-mercury='full')
10
+ =region_content @page.regions.editable1
11
+
12
+ %h2 Snippetable
13
+ %section#snippetable1(data-mercury='snippets')
14
+ =region_content @page.regions.snippetable1
15
+
16
+ %h2 Markupable
17
+ %section#markupable1(data-mercury='markdown')
18
+ =region_content @page.regions.markupable1
19
+
@@ -0,0 +1,2 @@
1
+ %h2 Test template with content
2
+ =render_region :content, tag: :section
@@ -0,0 +1,13 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title= content_for :title || 'Cmsimple'
5
+ - if content_for(:keywords).present?
6
+ %meta(name="keywords" content="#{content_for(:keywords)}")
7
+ - if content_for(:description).present?
8
+ %meta(name="description" content="#{content_for(:description)}")
9
+ = stylesheet_link_tag :application
10
+ = javascript_include_tag :application
11
+ = csrf_meta_tag
12
+ %body
13
+ = yield
@@ -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 RailsTestApp::Application
@@ -0,0 +1,65 @@
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
+ require 'cmsimple'
13
+ require 'teabag'
14
+
15
+ module RailsTestApp
16
+ class Application < Rails::Application
17
+ config.generators do |g|
18
+ g.template_engine :haml
19
+ g.stylesheets false
20
+ g.javascripts false
21
+ g.helpers false
22
+ g.test_framework :rspec, :fixture => false
23
+ g.helper_specs false
24
+ g.view_specs false
25
+ g.integration_tool :cucumber
26
+ end
27
+
28
+ # Settings in config/environments/* take precedence over those specified here.
29
+ # Application configuration should go into files in config/initializers
30
+ # -- all .rb files in that directory are automatically loaded.
31
+
32
+ # Custom directories with classes and modules you want to be autoloadable.
33
+ # config.autoload_paths += %W(#{config.root}/extras)
34
+
35
+ # Only load the plugins named here, in the order given (default is alphabetical).
36
+ # :all can be used as a placeholder for all plugins not explicitly named.
37
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
38
+
39
+ # Activate observers that should always be running.
40
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
41
+
42
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
43
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
44
+ # config.time_zone = 'Central Time (US & Canada)'
45
+
46
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
47
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
48
+ # config.i18n.default_locale = :de
49
+
50
+ # Configure the default encoding used in templates for Ruby 1.9.
51
+ config.encoding = "utf-8"
52
+
53
+ # Configure sensitive parameters which will be filtered from the log file.
54
+ config.filter_parameters += [:password]
55
+
56
+ # Enable the asset pipeline
57
+ config.assets.enabled = true
58
+
59
+ # asset paths for jasminerice
60
+ config.assets.paths << File.join(Rails.root, "..", "javascripts")
61
+
62
+ # Version of your assets, change this if you want to expire all your assets
63
+ config.assets.version = '1.0'
64
+ end
65
+ end
@@ -0,0 +1,9 @@
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'])
7
+
8
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
9
+
@@ -0,0 +1,22 @@
1
+ development:
2
+ adapter: mysql2
3
+ encoding: utf8
4
+ reconnect: false
5
+ database: cmsimple_development
6
+ pool: 5
7
+ username: root
8
+ password:
9
+ socket: /tmp/mysql.sock
10
+
11
+ test: &test
12
+ adapter: mysql2
13
+ encoding: utf8
14
+ reconnect: true
15
+ database: cmsimple_test
16
+ pool: 5
17
+ username: root
18
+ password:
19
+ socket: /tmp/mysql.sock
20
+
21
+ cucumber:
22
+ <<: *test
@@ -0,0 +1,8 @@
1
+ test: &test
2
+ adapter: mysql2
3
+ encoding: utf8
4
+ database: cmsimple_test
5
+ username: root
6
+
7
+ cucumber:
8
+ <<: *test
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ RailsTestApp::Application.initialize!
@@ -0,0 +1,30 @@
1
+ RailsTestApp::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
+ # Do not compress assets
26
+ config.assets.compress = false
27
+
28
+ # Expands the lines which load the assets
29
+ config.assets.debug = true
30
+ end