Sha256: a13bd9df87d861b6e613cd2a649e7a3137ef94a1e1294fc7ffb6e64785709520
Contents?: true
Size: 1.19 KB
Versions: 24
Compression:
Stored size: 1.19 KB
Contents
module Dorsale module FormHelper def form_buttons(opts = {}) back_url = opts[:back_url] back_url = url_for(:back).html_safe if back_url.nil? if opts[:obj].present? if opts[:obj].new_record? submit_action = :create else submit_action = :update end else submit_action = :save end content_tag("div", class: "actions cdiv") do submit = content_tag(:button, type: :submit, class: "btn btn-sm btn-success") do icon(:save) + " " + t("actions.#{submit_action}") end cancel = content_tag("a", href: back_url, class: "btn btn-primary btn-sm") do icon(:times) + " " + t("actions.cancel") end cancel = "" if back_url == false submit + cancel end end def horizontal_form_for(obj, opts={}, &block) opts = { :wrapper => "horizontal_form", :html => { :class => "form-horizontal" } }.deep_merge(opts) simple_form_for(obj, opts, &block) end def search_form(opts = {}) action = opts.delete(:action) || request.fullpath render "dorsale/search/form", action: action end end end
Version data entries
24 entries across 24 versions & 1 rubygems