-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from shivam091/0.7.0
0.7.0
- Loading branch information
Showing
10 changed files
with
87 additions
and
12 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- encoding: utf-8 -*- | ||
# -*- frozen_string_literal: true -*- | ||
# -*- warn_indent: true -*- | ||
|
||
module RailsBootstrapForm | ||
module Helpers | ||
module Buttons | ||
extend ActiveSupport::Concern | ||
|
||
def self.included(base_class) | ||
def render_button(value = nil, options = {}, &block) | ||
value, options = nil, value if value.is_a?(Hash) | ||
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap_form)) | ||
|
||
if (bootstrap_options.render_as_button? || block) | ||
button(value, options, &block) | ||
else | ||
submit(value, options) | ||
end | ||
end | ||
|
||
def secondary(value = nil, options = {}, &block) | ||
add_css_class!(options, "btn btn-secondary") | ||
render_button(value, options, &block) | ||
end | ||
|
||
def primary(value = nil, options = {}, &block) | ||
add_css_class!(options, "btn btn-primary") | ||
render_button(value, options, &block) | ||
end | ||
|
||
def danger(value = nil, options = {}, &block) | ||
add_css_class!(options, "btn btn-danger") | ||
render_button(value, options, &block) | ||
end | ||
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
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