Sha256: cb9ef394e75186b7dd531c1a6532afcee41fd21d1a7372af95b565a5883cf666
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module GuaraViewsHelper def format_boolean(value) value ? t("commons.yes"):t("commons.no") end def link_to_add_fields(name, f, association) new_object = f.object.send(association).klass.new id = new_object.object_id fields = f.semantic_fields_for(association, new_object, child_index: id) do |builder| #render(association.to_s + "/" + association.to_s.singularize + "_fields", f: builder) yield builder end link_to(t("helpers.forms.#{name}"), '#', class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")}) end def nbsp(value) if value.nil? || ((value.kind_of? String) && value.empty?) raw " " else value end end def show_label_tag(label) label_tag label, label+":", :class => "strong" end def inline_namedlist(list) list.all.collect {|item| "#{item.name}" }.join ", " end def inline_list(list, field=nil) field = "name" if field.nil? list.all.collect {|item| (item.send field.to_sym).to_s }.join ", " end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
guara-0.0.3 | app/helpers/guara_views_helper.rb |
guara-0.0.1.rc | app/helpers/guara_views_helper.rb |