# coding: utf-8 module AdminHelper def act_menu(cond) cond ? 'active' : nil end def sortable(url) html = %Q{ }.gsub(/[\n ]+/, ' ').strip.html_safe return content_for(:js,html) end def show_tree(c) link = link_to c.name, [:edit, :admin, c] edit = link_to "Удал",[:admin, c], data: { confirm: 'Точно удалить?' }, :method => :delete, class: "del" html = content_tag(:div, link + content_tag(:p, edit)) if c.children.any? html << content_tag(:ol) do raw c.children.map{|ch| show_tree(ch)}.join() end end content_tag :li, raw(html), id: "list_#{c.id}" end def sort_tree(url, maxLevels = 2) %Q{ }.gsub(/[\n ]+/, ' ').strip.html_safe end def tsingular model model.model_name.human end def taccusative model_name t("activerecord.models.#{model_name}.acc") end def tplural model model.model_name.human(:count => 'other') end end