-
Notifications
You must be signed in to change notification settings - Fork 630
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shifted Formtastic::LayoutHelper to Formtastic::Helpers::LayoutHelper
- Loading branch information
1 parent
899ce96
commit 56d6558
Showing
7 changed files
with
73 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# encoding: utf-8 | ||
require 'formtastic' | ||
require 'formtastic/layout_helper' | ||
require 'formtastic/helpers/layout_helper' | ||
ActionView::Base.send :include, Formtastic::SemanticFormHelper | ||
ActionView::Base.send :include, Formtastic::LayoutHelper | ||
ActionView::Base.send :include, Formtastic::Helpers::LayoutHelper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# encoding: utf-8 | ||
|
||
module Formtastic | ||
module Helpers | ||
module LayoutHelper | ||
|
||
def formtastic_stylesheet_link_tag | ||
stylesheet_link_tag("formtastic") + | ||
stylesheet_link_tag("formtastic_changes") | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
module Formtastic | ||
module Helpers | ||
module Support | ||
module FieldsetWrapper | ||
|
||
protected | ||
|
||
# Generates a fieldset and wraps the content in an ordered list. When working | ||
# with nested attributes, it allows %i as interpolation option in :name. So you can do: | ||
# | ||
# f.inputs :name => 'Task #%i', :for => :tasks | ||
# | ||
# or the shorter equivalent: | ||
# | ||
# f.inputs 'Task #%i', :for => :tasks | ||
# | ||
# And it will generate a fieldset for each task with legend 'Task #1', 'Task #2', | ||
# 'Task #3' and so on. | ||
# | ||
# Note: Special case for the inline inputs (non-block): | ||
# f.inputs "My little legend", :title, :body, :author # Explicit legend string => "My little legend" | ||
# f.inputs :my_little_legend, :title, :body, :author # Localized (118n) legend with I18n key => I18n.t(:my_little_legend, ...) | ||
# f.inputs :title, :body, :author # First argument is a column => (no legend) | ||
def field_set_and_list_wrapping(*args, &block) #:nodoc: | ||
contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten | ||
html_options = args.extract_options! | ||
|
||
legend = html_options.dup.delete(:name).to_s | ||
legend %= parent_child_index(html_options[:parent]) if html_options[:parent] | ||
legend = template.content_tag(:legend, template.content_tag(:span, Formtastic::Util.html_safe(legend))) unless legend.blank? | ||
|
||
if block_given? | ||
contents = if template.respond_to?(:is_haml?) && template.is_haml? | ||
template.capture_haml(&block) | ||
else | ||
template.capture(&block) | ||
end | ||
end | ||
|
||
# Ruby 1.9: String#to_s behavior changed, need to make an explicit join. | ||
contents = contents.join if contents.respond_to?(:join) | ||
fieldset = template.content_tag(:fieldset, | ||
Formtastic::Util.html_safe(legend) << template.content_tag(:ol, Formtastic::Util.html_safe(contents)), | ||
html_options.except(:builder, :parent) | ||
) | ||
|
||
fieldset | ||
end | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# encoding: utf-8 | ||
|
||
require 'formtastic' | ||
require 'formtastic/layout_helper' | ||
require 'formtastic/helpers/layout_helper' | ||
require 'rails' | ||
|
||
module Formtastic | ||
class Railtie < Rails::Railtie | ||
initializer 'formtastic.initialize', :after => :after_initialize do | ||
ActionView::Base.send :include, Formtastic::SemanticFormHelper | ||
ActionView::Base.send(:include, Formtastic::LayoutHelper) | ||
ActionView::Base.send(:include, Formtastic::Helpers::LayoutHelper) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters