Module: ApplicationHelper
- Defined in:
- lib/generators/squeezer/templates/app/helpers/application_helper.rb
Overview
Methods added to this helper will be available to all templates in the application.
Instance Method Summary collapse
- #action_bar ⇒ Object
- #destroy_bar ⇒ Object
- #edit_bar ⇒ Object
- #historics_bar ⇒ Object
- #index_bar ⇒ Object
- #link_permitted(*args) ⇒ Object
- #list_bar(a) ⇒ Object
- #new_bar ⇒ Object
- #show_bar ⇒ Object
Instance Method Details
#action_bar ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/generators/squeezer/templates/app/helpers/application_helper.rb', line 51 def h={ :show => [:index,:new,:edit,:historics,:destroy], :index =>[:new], :new => [:index], :edit => [:index,:show,:new,:historics,:destroy], :historics =>[:index,:show,:new,:edit,:destroy], :old => [:index,:show,:new,:historics] } =(h[action_name.to_sym]) content_for :action_bar do end end |
#destroy_bar ⇒ Object
27 28 29 |
# File 'lib/generators/squeezer/templates/app/helpers/application_helper.rb', line 27 def "#{link_permitted "Borrar",:destroy,controller_name.to_sym,{:action=>:show,:id=>params[:id]}} " end |
#edit_bar ⇒ Object
35 36 37 |
# File 'lib/generators/squeezer/templates/app/helpers/application_helper.rb', line 35 def "#{link_permitted "Editar",:edit,controller_name.to_sym,{:action=>:edit,:id=>params[:id]}} " end |
#historics_bar ⇒ Object
31 32 33 |
# File 'lib/generators/squeezer/templates/app/helpers/application_helper.rb', line 31 def "#{link_permitted "Historico",:historics,controller_name.to_sym,{:action=>:historics,:id=>params[:id]}} " end |
#index_bar ⇒ Object
23 24 25 |
# File 'lib/generators/squeezer/templates/app/helpers/application_helper.rb', line 23 def "#{link_permitted "Ver Todos",:index,controller_name.to_sym,{:action=>:index}} " end |
#link_permitted(*args) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/generators/squeezer/templates/app/helpers/application_helper.rb', line 3 def link_permitted(*args) name = args.first action = args.second obj = args.third = args.fourth if permitted_to? action,obj if action == :destroy link_to name,,:confirm => 'Are you sure?', :method => :delete else link_to name, end end end |
#list_bar(a) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/generators/squeezer/templates/app/helpers/application_helper.rb', line 43 def (a) ="" a.each {|x| +=eval(x.to_s+'_bar') } return end |
#new_bar ⇒ Object
39 40 41 |
# File 'lib/generators/squeezer/templates/app/helpers/application_helper.rb', line 39 def "#{link_permitted "Nuevo",:new,controller_name.to_sym,{:action=>:new}} " end |
#show_bar ⇒ Object
19 20 21 |
# File 'lib/generators/squeezer/templates/app/helpers/application_helper.rb', line 19 def "#{link_permitted "Mostrar",:show,controller_name.to_sym,{:action=>:show,:id=>params[:id]}} " end |