Sha256: cf5a032d233ed06aeacb7f7190ad414ea1b30a7b9cccff3b6cd682c3e735c266
Contents?: true
Size: 1.73 KB
Versions: 18
Compression:
Stored size: 1.73 KB
Contents
module Optimacms module SimpleFormExtensions module ButtonComponents def submit_cancel(*args, &block) template.content_tag :div, :class => "form-group" do template.content_tag :div, :class => "col-sm-offset-1 col-sm-6" do options = args.extract_options! # class options[:class] = [options[:class], 'btn', 'btn-primary', 'btn-lg'].compact # args << options # with cancel link if cancel = options.delete(:cancel) submit(*args, &block) + ' '.html_safe + template.link_to(I18n.t('simple_form.buttons.cancel'), cancel) else submit(*args, &block) end end end end def save_continue_cancel(*args, &block) template.content_tag :div, :class => "form-group" do template.content_tag :div, :class => "col-sm-offset-1 col-sm-6" do options = args.extract_options! # class options[:class] = [options[:class], 'btn', 'btn-primary', 'btn-lg'].compact # args << options buttons = submit(*args, &block) + ' '.html_safe+ template.link_to(I18n.t('simple_form.buttons.save_continue'), '#', {class: options[:class]+['btn-save-continue']}) # with cancel link if cancel = options.delete(:cancel) (buttons+' '.html_safe + template.link_to(I18n.t('simple_form.buttons.cancel'), cancel)).html_safe else buttons.html_safe end end end end end SimpleForm::FormBuilder.send :include, ButtonComponents end end
Version data entries
18 entries across 18 versions & 1 rubygems