hightail 0.0.1
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.
- data/.gitignore +5 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +46 -0
- data/Rakefile +1 -0
- data/USAGE +9 -0
- data/bin/hightail +15 -0
- data/hightail.gemspec +17 -0
- data/lib/hightail.rb +4 -0
- data/lib/hightail/app_builder.rb +40 -0
- data/lib/hightail/generators/app_generator.rb +94 -0
- data/lib/hightail/version.rb +3 -0
- data/templates/Gemfile +26 -0
- data/templates/README.md +2 -0
- data/templates/app_overrides/assets/stylesheets/application.css +7 -0
- data/templates/app_overrides/assets/stylesheets/common.css.sass +40 -0
- data/templates/app_overrides/assets/stylesheets/form_builder.css.sass +112 -0
- data/templates/app_overrides/assets/stylesheets/layout.css.sass +50 -0
- data/templates/app_overrides/assets/stylesheets/reset.css.sass +35 -0
- data/templates/app_overrides/views/layouts/application.html.haml.tt +16 -0
- data/templates/config.ru +3 -0
- data/templates/config/application.rb +40 -0
- data/templates/config/databases/postgresql.yml +19 -0
- data/templates/config/environments/development.rb.tt +28 -0
- data/templates/config/environments/production.rb.tt +60 -0
- data/templates/config/environments/test.rb.tt +38 -0
- data/templates/config/initializers/backtrace_silencers.rb +7 -0
- data/templates/config/initializers/form_builder.rb.tt +3 -0
- data/templates/config/initializers/haml.rb +1 -0
- data/templates/config/initializers/inflections.rb +8 -0
- data/templates/config/initializers/mime_types.rb +3 -0
- data/templates/config/initializers/secret_token.rb.tt +5 -0
- data/templates/config/initializers/session_store.rb.tt +6 -0
- data/templates/config/initializers/wrap_parameters.rb.tt +15 -0
- data/templates/config/locales/en.yml +1 -0
- data/templates/config/locales/form_builder.en.yml +6 -0
- data/templates/config/routes.rb +3 -0
- data/templates/doc/README_FOR_APP.tt +1 -0
- data/templates/gitignore +9 -0
- data/templates/lib/%app_name%/form_builder.rb.tt +171 -0
- data/templates/lib/generators/haml.rb +28 -0
- data/templates/lib/generators/haml/controller/controller_generator.rb +15 -0
- data/templates/lib/generators/haml/controller/templates/view.html.haml +2 -0
- data/templates/lib/generators/haml/scaffold/scaffold_generator.rb +38 -0
- data/templates/lib/generators/haml/scaffold/templates/_form.html.haml +6 -0
- data/templates/lib/generators/haml/scaffold/templates/delete.html.haml +9 -0
- data/templates/lib/generators/haml/scaffold/templates/edit.html.haml +9 -0
- data/templates/lib/generators/haml/scaffold/templates/index.html.haml +23 -0
- data/templates/lib/generators/haml/scaffold/templates/new.html.haml +9 -0
- data/templates/lib/generators/haml/scaffold/templates/show.html.haml +13 -0
- data/templates/rspec +1 -0
- data/templates/rvmrc +40 -0
- data/templates/spec/spec_helper.rb +17 -0
- metadata +121 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
@import 'common'
|
2
|
+
|
3
|
+
body
|
4
|
+
background-color: $background
|
5
|
+
color: $text
|
6
|
+
font-family: 'Helvetica', sans-serif
|
7
|
+
padding: $spacer
|
8
|
+
|
9
|
+
a
|
10
|
+
color: $link
|
11
|
+
|
12
|
+
& > header
|
13
|
+
margin-bottom: $spacer
|
14
|
+
|
15
|
+
h1
|
16
|
+
font-size: $line-height * 2
|
17
|
+
|
18
|
+
a
|
19
|
+
color: $black
|
20
|
+
text-decoration: none
|
21
|
+
|
22
|
+
& > section
|
23
|
+
& > h1
|
24
|
+
font-size: $line-height
|
25
|
+
|
26
|
+
& > nav
|
27
|
+
margin: $spacer 0
|
28
|
+
overflow: auto
|
29
|
+
|
30
|
+
a
|
31
|
+
border: 2px solid $blue
|
32
|
+
display: block
|
33
|
+
float: left
|
34
|
+
font-size: 0.75em
|
35
|
+
font-weight: bold
|
36
|
+
line-height: $line-height / 0.75
|
37
|
+
margin-right: (0.5em / 0.75)
|
38
|
+
padding: 0 (0.5em / 0.75)
|
39
|
+
text-decoration: none
|
40
|
+
text-transform: uppercase
|
41
|
+
|
42
|
+
& > footer
|
43
|
+
border-top: 1px solid $gray
|
44
|
+
color: $gray
|
45
|
+
margin-top: $spacer
|
46
|
+
text-align: right
|
47
|
+
|
48
|
+
small
|
49
|
+
font-size: 0.75em
|
50
|
+
line-height: $line-height / 0.75em
|
@@ -0,0 +1,35 @@
|
|
1
|
+
html, body, div, span,
|
2
|
+
applet, object, iframe,
|
3
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
4
|
+
a, abbr, acronym, address, big, cite, code,
|
5
|
+
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
6
|
+
small, strike, strong, sub, sup, tt, var,
|
7
|
+
dd, dl, dt, li, ol, ul,
|
8
|
+
fieldset, form, label, legend,
|
9
|
+
table, caption, tbody, tfoot, thead, tr, th, td
|
10
|
+
border: 0
|
11
|
+
font-family: inherit
|
12
|
+
font-size: 100%
|
13
|
+
font-style: inherit
|
14
|
+
font-weight: inherit
|
15
|
+
line-height: 1
|
16
|
+
margin: 0
|
17
|
+
padding: 0
|
18
|
+
vertical-align: baseline
|
19
|
+
|
20
|
+
caption, th
|
21
|
+
text-align: left
|
22
|
+
|
23
|
+
a img, :link img, :visited img
|
24
|
+
border: 0
|
25
|
+
|
26
|
+
table
|
27
|
+
border-collapse: collapse
|
28
|
+
border-spacing: 0
|
29
|
+
|
30
|
+
ol, ul
|
31
|
+
list-style: none
|
32
|
+
|
33
|
+
q:before, q:after,
|
34
|
+
blockquote:before, blockquote:after
|
35
|
+
content: ""
|
@@ -0,0 +1,16 @@
|
|
1
|
+
!!!
|
2
|
+
%html{ html_attrs('en_us') }
|
3
|
+
%head
|
4
|
+
%title <%= app_name.humanize.titleize %>
|
5
|
+
= stylesheet_link_tag('application')
|
6
|
+
= javascript_include_tag('application')
|
7
|
+
= csrf_meta_tags
|
8
|
+
|
9
|
+
%body{ class: "#{controller_name} #{action_name}" }
|
10
|
+
%header
|
11
|
+
%h1= link_to '<%= app_name.humanize.titleize %>', root_path
|
12
|
+
|
13
|
+
%section= yield
|
14
|
+
|
15
|
+
%footer
|
16
|
+
%small © #{Time.zone.today.year} <%= app_name.humanize.titleize %>
|
data/templates/config.ru
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
<% if include_all_railties? -%>
|
4
|
+
require 'rails/all'
|
5
|
+
<% else -%>
|
6
|
+
<%= comment_if :skip_active_record %>require 'active_record/railtie'
|
7
|
+
require 'action_controller/railtie'
|
8
|
+
require 'action_mailer/railtie'
|
9
|
+
require 'active_resource/railtie'
|
10
|
+
<%= comment_if :skip_sprockets %>require 'sprockets/railtie'
|
11
|
+
<% unless options[:skip_test_unit] %>require 'rails/test_unit/railtie'
|
12
|
+
<% end -%>
|
13
|
+
<% end -%>
|
14
|
+
|
15
|
+
if defined?(Bundler)
|
16
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
17
|
+
end
|
18
|
+
|
19
|
+
module <%= app_const_base %>
|
20
|
+
class Application < Rails::Application
|
21
|
+
# Defaults
|
22
|
+
config.encoding = 'utf-8'
|
23
|
+
config.filter_parameters += [:password]
|
24
|
+
|
25
|
+
# Load Paths
|
26
|
+
config.autoload_paths << config.root.join('lib')
|
27
|
+
#config.active_record.observers = :cacher
|
28
|
+
<% unless options.skip_sprockets? -%>
|
29
|
+
|
30
|
+
# Assets
|
31
|
+
config.assets.enabled = true
|
32
|
+
config.assets.version = '1.0'
|
33
|
+
<% end -%>
|
34
|
+
|
35
|
+
# Generators
|
36
|
+
config.generators.test_framework :rspec, view_specs: false
|
37
|
+
config.generators.template_engine :haml
|
38
|
+
config.sass.preferred_syntax = :sass
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
adapter: postgresql
|
3
|
+
encoding: unicode
|
4
|
+
pool: 20
|
5
|
+
username: <%= app_name %>
|
6
|
+
password:
|
7
|
+
min_messages: WARNING
|
8
|
+
|
9
|
+
development:
|
10
|
+
<<: *defaults
|
11
|
+
database: <%= app_name %>_development
|
12
|
+
|
13
|
+
test:
|
14
|
+
<<: *defaults
|
15
|
+
database: <%= app_name %>_test
|
16
|
+
|
17
|
+
production:
|
18
|
+
<<: *defaults
|
19
|
+
database: <%= app_name %>_development
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%= app_const %>.configure do
|
2
|
+
# In the development environment your application's code is reloaded on
|
3
|
+
# every request. This slows down response time but is perfect for development
|
4
|
+
# since you don't have to restart the web server when you make code changes.
|
5
|
+
config.cache_classes = false
|
6
|
+
|
7
|
+
# Log error messages when you accidentally call methods on nil.
|
8
|
+
config.whiny_nils = true
|
9
|
+
|
10
|
+
# Show full error reports and disable caching
|
11
|
+
config.consider_all_requests_local = true
|
12
|
+
config.action_controller.perform_caching = false
|
13
|
+
|
14
|
+
# Don't care if the mailer can't send
|
15
|
+
config.action_mailer.raise_delivery_errors = false
|
16
|
+
|
17
|
+
# Print deprecation notices to the Rails logger
|
18
|
+
config.active_support.deprecation = :log
|
19
|
+
|
20
|
+
# Only use best-standards-support built into browsers
|
21
|
+
config.action_dispatch.best_standards_support = :builtin
|
22
|
+
|
23
|
+
# Do not compress assets
|
24
|
+
config.assets.compress = false
|
25
|
+
|
26
|
+
# Expands the lines which load the assets
|
27
|
+
config.assets.debug = true
|
28
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<%= app_const %>.configure do
|
2
|
+
# Code is not reloaded between requests
|
3
|
+
config.cache_classes = true
|
4
|
+
|
5
|
+
# Full error reports are disabled and caching is turned on
|
6
|
+
config.consider_all_requests_local = false
|
7
|
+
config.action_controller.perform_caching = true
|
8
|
+
|
9
|
+
# Disable Rails' static asset server (Apache or nginx will already do this)
|
10
|
+
config.serve_static_assets = false
|
11
|
+
|
12
|
+
# Compress JavaScripts and CSS
|
13
|
+
config.assets.compress = true
|
14
|
+
|
15
|
+
# Don't fallback to assets pipeline if a pre-compiled asset is missed
|
16
|
+
config.assets.compile = false
|
17
|
+
|
18
|
+
# Generate digests for assets URLs
|
19
|
+
config.assets.digest = true
|
20
|
+
|
21
|
+
# Defaults to Rails.root.join('public/assets')
|
22
|
+
#config.assets.manifest = YOUR_PATH
|
23
|
+
|
24
|
+
# Specifies the header that your server uses for sending files
|
25
|
+
#config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
26
|
+
#config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
27
|
+
|
28
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and
|
29
|
+
# use secure cookies.
|
30
|
+
#config.force_ssl = true
|
31
|
+
|
32
|
+
# See everything in the log (default is :info)
|
33
|
+
#config.log_level = :debug
|
34
|
+
|
35
|
+
# Use a different logger for distributed setups
|
36
|
+
#config.logger = SyslogLogger.new
|
37
|
+
|
38
|
+
# Use a different cache store in production
|
39
|
+
#config.cache_store = :mem_cache_store
|
40
|
+
|
41
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
42
|
+
#config.action_controller.asset_host = 'http://assets.example.com'
|
43
|
+
|
44
|
+
# Precompile additional assets (application.js, application.css, and all
|
45
|
+
# non-JS/CSS are already added)
|
46
|
+
#config.assets.precompile += %w( search.js )
|
47
|
+
|
48
|
+
# Disable delivery errors, bad email addresses will be ignored
|
49
|
+
#config.action_mailer.raise_delivery_errors = false
|
50
|
+
|
51
|
+
# Enable threaded mode
|
52
|
+
#config.threadsafe!
|
53
|
+
|
54
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
55
|
+
# the I18n.default_locale when a translation can not be found)
|
56
|
+
config.i18n.fallbacks = true
|
57
|
+
|
58
|
+
# Send deprecation notices to registered listeners
|
59
|
+
config.active_support.deprecation = :notify
|
60
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<%= app_const %>.configure do
|
2
|
+
# The test environment is used exclusively to run your application's test
|
3
|
+
# suite. You never need to work with it otherwise. Remember that your test
|
4
|
+
# database is "scratch space" for the test suite and is wiped and recreated
|
5
|
+
# between test runs. Don't rely on the data there!
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Configure static asset server for tests with Cache-Control for performance
|
9
|
+
config.serve_static_assets = true
|
10
|
+
config.static_cache_control = 'public, max-age=3600'
|
11
|
+
|
12
|
+
# Log error messages when you accidentally call methods on nil
|
13
|
+
config.whiny_nils = true
|
14
|
+
|
15
|
+
# Show full error reports and disable caching
|
16
|
+
config.consider_all_requests_local = true
|
17
|
+
config.action_controller.perform_caching = false
|
18
|
+
|
19
|
+
# Raise exceptions instead of rendering exception templates
|
20
|
+
config.action_dispatch.show_exceptions = false
|
21
|
+
|
22
|
+
# Disable request forgery protection in test environment
|
23
|
+
config.action_controller.allow_forgery_protection = false
|
24
|
+
|
25
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
26
|
+
# The :test delivery method accumulates sent emails in the
|
27
|
+
# ActionMailer::Base.deliveries array.
|
28
|
+
config.action_mailer.delivery_method = :test
|
29
|
+
|
30
|
+
# Use SQL instead of Active Record's schema dumper when creating the test
|
31
|
+
# database. This is necessary if your schema can't be completely dumped by
|
32
|
+
# the schema dumper, like if you have constraints or database-specific column
|
33
|
+
# types
|
34
|
+
#config.active_record.schema_format = :sql
|
35
|
+
|
36
|
+
# Print deprecation notices to the stderr
|
37
|
+
config.active_support.deprecation = :stderr
|
38
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# You can add backtrace silencers for libraries that you're using but don't
|
2
|
+
# wish to see in your backtraces.
|
3
|
+
#Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
4
|
+
|
5
|
+
# You can also remove all the silencers if you're trying to debug a problem
|
6
|
+
# that might stem from framework code.
|
7
|
+
#Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1 @@
|
|
1
|
+
Haml::Template.options[:attr_wrapper] = '"'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Add new inflection rules using the following format (all these examples are
|
2
|
+
# active by default):
|
3
|
+
#ActiveSupport::Inflector.inflections do |inflect|
|
4
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
5
|
+
# inflect.singular /^(ox)en/i, '\1'
|
6
|
+
# inflect.irregular 'person', 'people'
|
7
|
+
# inflect.uncountable %w(fish sheep)
|
8
|
+
#end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# Your secret key for verifying the integrity of signed cookies. If you change
|
2
|
+
# this key, all old signed cookies will become invalid! Make sure the secret is
|
3
|
+
# at least 30 characters and all random, no regular words or you'll be exposed
|
4
|
+
# to dictionary attacks.
|
5
|
+
<%= app_const %>.config.secret_token = '<%= app_secret %>'
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= app_const %>.config.session_store :cookie_store, <%= key_value :key, "'_#{app_name}_session'" %>
|
2
|
+
|
3
|
+
# Use the database for sessions instead of the cookie-based default, which
|
4
|
+
# shouldn't be used to store highly confidential information (create the
|
5
|
+
# session table with "rails generate session_migration")
|
6
|
+
#<%= app_const %>.config.session_store :active_record_store
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
2
|
+
# is enabled by default.
|
3
|
+
|
4
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format
|
5
|
+
# to an empty array.
|
6
|
+
ActiveSupport.on_load(:action_controller) do
|
7
|
+
wrap_parameters <%= key_value :format, '[:json]' %>
|
8
|
+
end
|
9
|
+
<%- unless options.skip_active_record? -%>
|
10
|
+
|
11
|
+
# Disable root element in JSON by default.
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
self.include_root_in_json = false
|
14
|
+
end
|
15
|
+
<%- end -%>
|
@@ -0,0 +1 @@
|
|
1
|
+
en:
|
@@ -0,0 +1 @@
|
|
1
|
+
= <%= app_const_base %>
|
data/templates/gitignore
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module <%= app_const_base %>
|
4
|
+
class FormBuilder < ActionView::Helpers::FormBuilder
|
5
|
+
def error_messages(options={})
|
6
|
+
if object.errors.any?
|
7
|
+
header = I18n.t('errors.template.header', :count => object.errors.count)
|
8
|
+
|
9
|
+
@template.capture_haml do
|
10
|
+
@template.haml_tag(:fieldset, :class => 'errors') do
|
11
|
+
@template.haml_tag(:legend, header)
|
12
|
+
|
13
|
+
@template.haml_tag(:ul) do
|
14
|
+
object.errors.full_messages.each do |message|
|
15
|
+
@template.haml_tag(:li, message)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def fieldset(options={}, &block)
|
24
|
+
legend = options.delete(:legend)
|
25
|
+
|
26
|
+
@template.capture_haml do
|
27
|
+
@template.haml_tag(:fieldset, options) do
|
28
|
+
@template.haml_tag(:legend, legend) if legend
|
29
|
+
yield(self)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def section(options={}, &block)
|
35
|
+
options[:class] = "#{options[:class]} section".strip
|
36
|
+
|
37
|
+
@template.capture_haml do
|
38
|
+
@template.haml_tag(:div, options) { yield(self) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def input(method, options={}, &block)
|
43
|
+
type = options.delete(:type)
|
44
|
+
instructions = options.delete(:instructions)
|
45
|
+
|
46
|
+
style = ['field']
|
47
|
+
style << (options.delete(:required) ? 'required' : 'optional')
|
48
|
+
style << 'checkbox' if type == :check_box
|
49
|
+
style << 'radio' if type == :radio_button
|
50
|
+
style << options.delete(:style) if options[:style]
|
51
|
+
style.uniq!
|
52
|
+
|
53
|
+
input = case type
|
54
|
+
when :check_box
|
55
|
+
checked_value = options.delete(:checked_value)
|
56
|
+
unchecked_value = options.delete(:unchecked_value)
|
57
|
+
checked_value = '1' if unchecked_value && checked_value.blank?
|
58
|
+
arguments = [options, checked_value, unchecked_value].compact
|
59
|
+
send(type, method, *arguments)
|
60
|
+
when :radio_button
|
61
|
+
value = options.delete(:value)
|
62
|
+
object_method = method
|
63
|
+
method = "#{method.to_s.gsub(/\?$/, '')}_#{value.gsub(/\s/, '_')}".downcase
|
64
|
+
send(type, object_method, value, options)
|
65
|
+
when :date_select
|
66
|
+
@template.capture_haml do
|
67
|
+
@template.haml_tag(:div, input, :class => 'group')
|
68
|
+
end
|
69
|
+
when :collection_select
|
70
|
+
collection = options.delete(:collection)
|
71
|
+
value_method = options.delete(:value_method)
|
72
|
+
text_method = options.delete(:text_method)
|
73
|
+
html_options = options.delete(:html) || {}
|
74
|
+
send(type, method, collection, value_method, text_method, options, html_options)
|
75
|
+
when :time_zone_select
|
76
|
+
priority_zones = options.delete(:priority_zones)
|
77
|
+
send(type, method, priority_zones, options)
|
78
|
+
else
|
79
|
+
send(type, method, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
label = label != false ? label(method) : nil
|
83
|
+
markup = [label, input].compact
|
84
|
+
markup.reverse! if [:check_box, :radio_button].include?(type)
|
85
|
+
|
86
|
+
@template.capture_haml do
|
87
|
+
@template.haml_tag(:div, :class => style.join(' ')) do
|
88
|
+
@template.haml_concat(markup.join)
|
89
|
+
yield(self) if block_given?
|
90
|
+
@template.haml_concat(instructions(instructions)) if instructions
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def text(method, options={}, &block)
|
96
|
+
input(method, options.merge(:type => :text_field), &block)
|
97
|
+
end
|
98
|
+
|
99
|
+
def number(method, options={}, &block)
|
100
|
+
input(method, options.merge(:type => :number_field), &block)
|
101
|
+
end
|
102
|
+
|
103
|
+
def password(method, options={}, &block)
|
104
|
+
input(method, options.merge(:type => :password_field), &block)
|
105
|
+
end
|
106
|
+
|
107
|
+
def area(method, options={}, &block)
|
108
|
+
input(method, options.merge(:type => :text_area), &block)
|
109
|
+
end
|
110
|
+
|
111
|
+
def checkbox(method, options={}, &block)
|
112
|
+
input(method, options.merge(:type => :check_box), &block)
|
113
|
+
end
|
114
|
+
|
115
|
+
def radio(method, options={}, &block)
|
116
|
+
input(method, options.merge(:type => :radio_button), &block)
|
117
|
+
end
|
118
|
+
|
119
|
+
def file(method, options={}, &block)
|
120
|
+
input(method, options.merge(:type => :file_field), &block)
|
121
|
+
end
|
122
|
+
|
123
|
+
def select(*args, &block)
|
124
|
+
method = args.shift
|
125
|
+
options = args.extract_options!
|
126
|
+
|
127
|
+
options[:collection] = args[0]
|
128
|
+
options[:value_method] = args[1]
|
129
|
+
options[:text_method] = args[2]
|
130
|
+
input(method, options.merge(:type => :collection_select), &block)
|
131
|
+
end
|
132
|
+
|
133
|
+
def date(method, options={}, &block)
|
134
|
+
input(method, options.merge(:type => :date_select), &block)
|
135
|
+
end
|
136
|
+
|
137
|
+
def time(method, options={}, &block)
|
138
|
+
input(method, options.merge(:type => :time_select), &block)
|
139
|
+
end
|
140
|
+
|
141
|
+
def date_time(method, options={}, &block)
|
142
|
+
input(method, options.merge(:type => :datetime_select), &block)
|
143
|
+
end
|
144
|
+
|
145
|
+
def expiration(method, options={}, &block)
|
146
|
+
options.reverse_merge!(:add_month_numbers => true, :discard_day => true, :order => [:month, :year], :start_year => Date.today.year, :prompt => '')
|
147
|
+
input(method, options.merge(:type => :date_select), &block)
|
148
|
+
end
|
149
|
+
|
150
|
+
def time_zone(method, options, &block)
|
151
|
+
input(method, options.merge(:type => :time_zone_select), &block)
|
152
|
+
end
|
153
|
+
|
154
|
+
def instructions(text_or_nil_with_block=nil, &block)
|
155
|
+
content = text_or_nil_with_block || @template.capture_haml(&block)
|
156
|
+
|
157
|
+
@template.capture_haml do
|
158
|
+
@template.haml_tag(:p, content, :class => 'instructions')
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def submit(value, options={}, &block)
|
163
|
+
@template.capture_haml do
|
164
|
+
@template.haml_tag(:div, :class => 'submit') do
|
165
|
+
@template.haml_concat(super(value, options))
|
166
|
+
yield(self) if block_given?
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|