app/helpers/crud_helper.rb in templus_models-1.2.7 vs app/helpers/crud_helper.rb in templus_models-1.2.8

- old
+ new

@@ -15,10 +15,18 @@ @@cruds = Dir[Rails.root.join("app","raro_crud","*.rb")].map{|f| f.split(/\//).last.gsub(/_crud\.rb/,'')} #end return @@cruds.include?(attribute.to_s) end + def lista_menus_crud(raro_models) + menus = [] + raro_models.each do |modelo| + menus << ['crud', "#{modelo.name.underscore}"] + end + menus + end + def menu_helper_crud(modelo, url, nome, classe, icon='') if can?(:read, classe) buffer = "" buffer << "<li class='childreen #{controller.controller_name == 'crud' and params[:model] == modelo ? 'active' : '' }'>" buffer << link_to("<i class='#{icon}'></i><span>#{nome}</span>".html_safe, url, data: {push: true, crumb: 'wielka'}) @@ -40,10 +48,18 @@ end def is_action_new? params[:action] == "new" end + + def is_action_index? + params[:action] == "index" + end + + def is_action_query? + params[:action] == "query" + end def render_link(link) "<a href='#{link[:link]}' class='#{link[:class]}' #{data(link)}>#{gen_icon(link[:icon])} #{link[:text]}</a>".html_safe end @@ -144,7 +160,11 @@ end end def render_crud(&block) render "/crud/shared", block: block + end + + def render_default_actions_crud + render "default_actions_crud" end end \ No newline at end of file