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,63 @@
1
+ module Cmsimple
2
+ class Path < ActiveRecord::Base
3
+ attr_accessible :uri, :page_id, :redirect_uri
4
+
5
+ belongs_to :page
6
+
7
+ validates :uri, presence: true,
8
+ uniqueness: true
9
+
10
+ validate :require_destination
11
+
12
+ before_validation :downcase_uri
13
+
14
+ def self.from_request(request)
15
+ path = request.is_a?(String) ? request : ( request.try(:path) || '' )
16
+ path = "/#{path.gsub(/\/$/,'')}".gsub(/\/+/, '/')
17
+ path.downcase!
18
+ if path == '/'
19
+ with_pages.merge(Cmsimple::Page.root).first!
20
+ else
21
+ with_pages.where(uri: path).first!
22
+ end
23
+ end
24
+
25
+ def self.with_pages
26
+ includes(:page)
27
+ end
28
+
29
+ def destination
30
+ @destination ||= if redirect?
31
+ Redirect.new(self)
32
+ else
33
+ self.page
34
+ end
35
+ end
36
+
37
+ def redirect?
38
+ self.page.blank? || !(self.page.is_root || self.page.uri == self.uri)
39
+ end
40
+
41
+ protected
42
+
43
+ def require_destination
44
+ unless destination.uri.present?
45
+ errors[:destination] << 'can\'t be blank'
46
+ end
47
+ end
48
+
49
+ def downcase_uri
50
+ self.uri.downcase! if self.uri.present?
51
+ end
52
+
53
+ class Redirect
54
+ def initialize(path)
55
+ @path = path
56
+ end
57
+
58
+ def uri
59
+ @path.page.try(:uri).presence || @path.redirect_uri
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,43 @@
1
+ module Cmsimple
2
+ class Region
3
+ attr_reader :snippets
4
+ def initialize(region_hash=nil)
5
+ @region_hash = (region_hash.presence || {}).dup
6
+ @snippets = []
7
+ @html = value
8
+ build_snippets
9
+ end
10
+
11
+ def build_snippets
12
+ return unless @region_hash.key?(:snippets) && @region_hash[:snippets].is_a?(Hash)
13
+ @snippets = @region_hash[:snippets].collect {|id, hash| Snippet.new(id, hash)}
14
+ end
15
+
16
+ def render_snippets
17
+ @html = value
18
+ snippets.each do |snippet|
19
+ snippet_view = yield snippet
20
+ @html.gsub!(snippet.matcher, snippet_view)
21
+ end
22
+ end
23
+
24
+ def value
25
+ begin
26
+ @region_hash[:value]
27
+ rescue => ex
28
+ raise RegionValueError, "Unable to access invalid region hash: #{@region_hash.inspect}"
29
+ end
30
+ end
31
+
32
+ def to_s
33
+ @html.presence || ""
34
+ end
35
+
36
+ def as_json
37
+ @region_hash
38
+ end
39
+ end
40
+
41
+ class RegionValueError < StandardError
42
+ end
43
+ end
@@ -0,0 +1,64 @@
1
+ module Cmsimple
2
+ class Snippet
3
+ extend ActiveModel::Naming
4
+ attr_accessor :name, :options, :id
5
+
6
+ def initialize(id, snippet_hash)
7
+ @id = id
8
+
9
+ @snippet_hash = snippet_hash.dup
10
+ # @snippet_hash.symbolize_keys!
11
+
12
+ @name = @snippet_hash[:name]
13
+
14
+ # the options prefix is to handle legacy snippets mercury
15
+ # changed how it serializes snippets
16
+ @options = flatten_options(@snippet_hash[:options].presence || @snippet_hash)
17
+ end
18
+
19
+ def flatten_options(options)
20
+ return {} unless options.present?
21
+ options = options.dup
22
+ if options.key?(:snippet)
23
+ options.merge(options[:snippet])
24
+ else
25
+ options
26
+ end
27
+ end
28
+
29
+ def method_missing method, *args, &block
30
+ @options[method]
31
+ end
32
+
33
+ def matcher
34
+ /\[#{self.id}(\/\d)?\]/
35
+ end
36
+
37
+ #
38
+ # ActiveModel API
39
+ #
40
+ def persisted?
41
+ false
42
+ end
43
+
44
+ def to_param
45
+ nil
46
+ end
47
+
48
+ def to_key
49
+ nil
50
+ end
51
+
52
+ def to_partial_path
53
+ "cmsimple/snippets/#{name}/display"
54
+ end
55
+
56
+ def errors
57
+ ActiveModel::Errors.new(self)
58
+ end
59
+
60
+ def valid?
61
+ true
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,18 @@
1
+ module Cmsimple
2
+ class Version < ActiveRecord::Base
3
+ serialize :content, Hash
4
+
5
+ attr_accessible :content,
6
+ :template,
7
+ :published_at
8
+
9
+ belongs_to :page, class_name: '::Cmsimple::Page'
10
+
11
+ validates :published_at, presence: true
12
+
13
+ def self.published
14
+ order('published_at DESC')
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ class ImageAttachmentUploader < CarrierWave::Uploader::Base
4
+
5
+ # Include detection for content types
6
+ include CarrierWave::MimeTypes
7
+
8
+ # Include RMagick or MiniMagick support:
9
+ include Cmsimple.configuration.image_processor_mixin
10
+
11
+ # Override the directory where uploaded files will be stored.
12
+ # This is a sensible default for uploaders that are meant to be mounted:
13
+ def store_dir
14
+ eval '"' + Cmsimple.configuration.asset_path + '"'
15
+ end
16
+
17
+ # Provide a default URL as a default if there hasn't been a file uploaded:
18
+ # def default_url
19
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
20
+ # end
21
+
22
+ # Process files as they are uploaded:
23
+ # process :scale => [200, 300]
24
+ #
25
+ # def scale(width, height)
26
+ # # do something
27
+ # end
28
+ process :set_content_type
29
+ process :store_geometry
30
+
31
+ # Create different versions of your uploaded files:
32
+ version :panel do
33
+ process :resize_and_pad => [182, 182]
34
+ end
35
+
36
+ def store_geometry
37
+ if @file
38
+ model.width, model.height = Dimensions.dimensions(@file.file)
39
+ end
40
+ end
41
+ # Add a white list of extensions which are allowed to be uploaded.
42
+ # For images you might use something like this:
43
+ def extension_white_list
44
+ %w(jpg jpeg gif png)
45
+ end
46
+
47
+ # Override the filename of the uploaded files:
48
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
49
+ # def filename
50
+ # "something.jpg" if original_filename
51
+ # end
52
+
53
+ end
@@ -0,0 +1,13 @@
1
+ = form_for @image, :html => { :class => "form-horizontal" } do |f|
2
+ .form-inputs.mercury-display-pane-container
3
+ %fieldset
4
+ .control-group
5
+ = f.label :title, class: 'control-label'
6
+ .controls
7
+ = f.text_field :title
8
+ .control-group
9
+ = f.label :attachment, class: 'control-label'
10
+ .controls
11
+ = f.file_field :attachment
12
+ .form-actions.mercury-display-controls
13
+ = f.submit class: 'btn btn-primary', label: 'Upload'
@@ -0,0 +1,5 @@
1
+ .mercury-framed-panel.embedded
2
+ = render partial: 'form'
3
+
4
+ :javascript
5
+ parent.$('body').trigger('cmsimple:images:uploaded');
@@ -0,0 +1,49 @@
1
+ = form_for @page, :html => { :class => "form-horizontal" } do |f|
2
+ .form-inputs.mercury-display-pane-container
3
+ %fieldset
4
+ %legend Page Info
5
+ .control-group
6
+ = f.label :title, class: 'control-label'
7
+ .controls
8
+ = f.text_field :title
9
+ .control-group
10
+ = f.label :slug, class: 'control-label'
11
+ .controls
12
+ = f.text_field :slug
13
+ %fieldset
14
+ %legend Appearance
15
+ .control-group
16
+ = f.label :template, class: 'control-label'
17
+ .controls
18
+ = f.select :template, Cmsimple::TemplateResolver.all, include_blank: 'None / Inherit'
19
+ %fieldset
20
+ %legend Hierarchy
21
+ .control-group
22
+ = f.label :parent_id, class: 'control-label'
23
+ .controls
24
+ = f.select :parent_id, Cmsimple::Page.for_parent_select(@page).map { |p| [ p.select_label, p.id ] }, include_blank: 'None'
25
+ .control-group
26
+ .controls
27
+ = f.label :is_root, class: 'checkbox' do
28
+ Home Page?
29
+ = f.check_box :is_root
30
+ %fieldset
31
+ %legend SEO Info
32
+ .control-group
33
+ = f.label :browser_title, class: 'control-label'
34
+ .controls
35
+ = f.text_field :browser_title
36
+ .control-group
37
+ = f.label :keywords, class: 'control-label'
38
+ .controls
39
+ = f.text_field :keywords
40
+ .control-group
41
+ = f.label :description, class: 'control-label'
42
+ .controls
43
+ = f.text_field :description, input_html: {rows: 5}
44
+ = render partial: 'form_extras', locals: {f: f}
45
+
46
+ .form-actions.mercury-display-controls
47
+ - unless @page.new_record?
48
+ = link_to 'Delete', page_path(@page), method: :delete, class: 'btn btn-danger', data: { confirm: "Are you sure you would like to permanently delete this page?\n\nIt will delete all versions and associated paths. If you are unsure you can unpublish a page to remove it from public access." }
49
+ = f.submit class: 'btn btn-primary'
@@ -0,0 +1,2 @@
1
+ -# = f.inputs 'Extras' do
2
+ -# = f.inputs :custom_field
@@ -0,0 +1,3 @@
1
+ .mercury-display-pane(style='width: 600px')
2
+ = render partial: 'form'
3
+
@@ -0,0 +1,3 @@
1
+ .mercury-display-pane(style='width: 600px')
2
+ = render partial: 'form'
3
+
@@ -0,0 +1,12 @@
1
+ .mercury-display-pane(style='width: 600px')
2
+ = form_for @page do |f|
3
+ %fieldset
4
+ %legend Publish the current page
5
+ = f.hidden_field :published, value: true
6
+ = f.submit 'Publish Changes', class: 'btn btn-primary'
7
+ - if @page.published?
8
+ = form_for @page do |f|
9
+ %fieldset
10
+ %legend Deactivate the current page by unpublishing
11
+ = f.hidden_field :published, value: false
12
+ = f.submit 'Unpublish', class: 'btn btn-danger'
@@ -0,0 +1,5 @@
1
+ .mercury-snippet-panel
2
+ .filter
3
+ %input.filter(type="text")
4
+ %ul
5
+ = render partial: 'cmsimple/snippet_list'
@@ -0,0 +1,4 @@
1
+ =render_region :header, tag: :header
2
+
3
+ =render_region :content, tag: :content
4
+
@@ -0,0 +1,12 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta(name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0")
5
+ = csrf_meta_tags
6
+ %title Mercury Editor
7
+ = stylesheet_link_tag *Cmsimple.configuration.editor_stylesheets
8
+ = javascript_include_tag *Cmsimple.configuration.editor_javascripts
9
+ %body
10
+ :javascript
11
+ new CMSimple.Editor( new CMSimple.Page(#{current_page.to_json}) )
12
+
@@ -0,0 +1,9 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta(name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0")
5
+ = csrf_meta_tags
6
+ %title Mercury Editor Panel
7
+ = stylesheet_link_tag *Cmsimple.configuration.editor_stylesheets
8
+ %body
9
+ = yield
@@ -0,0 +1,44 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "cmsimple/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "cmsimple"
7
+ s.version = Cmsimple::VERSION
8
+ s.authors = ["Gabe Varela", "Jay Zeschin", "Matt Kitt"]
9
+ s.email = ["info@modeset.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{A simple CMS based on the Mercury editor}
12
+ s.description = %q{A simple CMS based on the Mercury editor}
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_runtime_dependency "rails", "~> 3.2.1"
20
+ s.add_runtime_dependency 'jquery-rails', "~> 2.1.3"
21
+ s.add_runtime_dependency "mercury-rails"
22
+ s.add_runtime_dependency "cells", "~> 3.8"
23
+ s.add_runtime_dependency "carrierwave", "~> 0.5.8"
24
+
25
+ s.add_runtime_dependency "spine-rails", "~> 0.1"
26
+ s.add_runtime_dependency "coffee-script-source", "~> 1.2.0"
27
+ s.add_runtime_dependency "haml", "~> 3.1.6"
28
+ s.add_runtime_dependency "haml-rails", "0.3.4"
29
+ s.add_runtime_dependency "haml_coffee_assets", "~> 0.9.2"
30
+ s.add_runtime_dependency "dimensions"
31
+ s.add_runtime_dependency "mini_magick"
32
+
33
+ # specify any dependencies here; for example:
34
+ s.add_development_dependency "rspec-rails", "~> 2.12.2"
35
+ s.add_development_dependency "cucumber-rails"
36
+ s.add_development_dependency "capybara", "~> 1.1.3"
37
+ s.add_development_dependency "database_cleaner"
38
+ s.add_development_dependency "shoulda-matchers"
39
+ s.add_development_dependency "timecop"
40
+ s.add_development_dependency "teabag"
41
+ s.add_development_dependency "pry"
42
+
43
+ # s.add_runtime_dependency "rest-client"
44
+ end
@@ -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 @@
1
+ require File.expand_path "../../spec/rails_app/config/application", __FILE__
@@ -0,0 +1,8 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "-r features --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %> features
7
+ wip: --tags @wip:3 --wip features
8
+ rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip