Skip to content
Browse files

Accept --haml option with mercury:install generator

Copies a .haml version of mercury layout (instead of ERB)
  • Loading branch information...
1 parent d0079a8 commit 3d85b555ec6b3017ed4b15c9c5e4cf04c17823f1 @matthewtoast matthewtoast committed Nov 6, 2012
Showing with 24 additions and 1 deletion.
  1. +19 −0 app/views/layouts/mercury.html.haml
  2. +5 −1 lib/generators/mercury/install/install_generator.rb
View
19 app/views/layouts/mercury.html.haml
@@ -0,0 +1,19 @@
+!!!
+%html
+ %head
+ %meta{:name => "viewport", :content => "width=device-width, maximum-scale=1.0, initial-scale=1.0"}
+ = csrf_meta_tags
+ %title Mercury Editor
+ = stylesheet_link_tag 'mercury'
+ = javascript_include_tag 'jquery-1.7', 'mercury'
+ %body
+ :javascript
+ // Set to the url that you want to save any given page to, leave null for default handling.
+ var saveUrl = null;
+
+ // Instantiate the PageEditor
+ new Mercury.PageEditor(saveUrl, {
+ saveStyle: null, // 'form', or 'json' (default json)
+ saveMethod: null, // 'PUT', or 'POST', (create, vs. update -- default PUT)
+ visible: true // boolean - if the interface should start visible or not
+ });
View
6 lib/generators/mercury/install/install_generator.rb
@@ -8,6 +8,9 @@ class InstallGenerator < Rails::Generators::Base
class_option :full, :type => :boolean, :aliases => '-g',
:desc => 'Full installation will install the layout and css files for easier customization.'
+ class_option :haml, :type => :boolean,
+ :desc => 'Use a Haml layout template (instead of ERB)'
+
def copy_config
copy_file 'app/assets/javascripts/mercury.js'
end
@@ -18,7 +21,8 @@ def add_routes
def copy_layout_and_css_overrides
if options[:full] || yes?("Install the layout file and CSS? [yN]")
- copy_file 'app/views/layouts/mercury.html.erb'
+ layout_ext = (options[:haml]) ? 'haml' : 'erb'
+ copy_file "app/views/layouts/mercury.html.#{layout_ext}"
copy_file 'app/assets/stylesheets/mercury.css'
end
end

0 comments on commit 3d85b55

Please sign in to comment.
Something went wrong with that request. Please try again.