Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept --haml option for mercury:install generator #302

Merged
merged 1 commit into from Nov 24, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions 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
});
6 changes: 5 additions & 1 deletion lib/generators/mercury/install/install_generator.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down