Module: QUI::CommonHelpers::MainHelper

Defined in:
lib/qui-common-helpers.rb

Instance Method Summary collapse

Instance Method Details

#delete_image_tagObject



12
13
14
# File 'lib/qui-common-helpers.rb', line 12

def delete_image_tag
  image_tag("icons/16x16/delete.png", :alt => t(:deleteAsAction))
end

#edit_image_tagObject



4
5
6
# File 'lib/qui-common-helpers.rb', line 4

def edit_image_tag
  image_tag("icons/16x16/edit.png", :alt => t(:editAsAction))
end


16
17
18
# File 'lib/qui-common-helpers.rb', line 16

def link_to_delete(object)
  link_to(delete_image_tag, [ section, object ], :title => t(:deleteAsAction), :method => :delete, :confirm => t(:deleteConfirmation))
end


8
9
10
# File 'lib/qui-common-helpers.rb', line 8

def link_to_edit(object)
  link_to(edit_image_tag, send("edit_#{section}_#{object.class.to_s.tableize.singularize}_path", object), :title => t(:editAsAction))
end


20
21
22
23
24
25
26
27
28
# File 'lib/qui-common-helpers.rb', line 20

def link_to_object(object, description = nil)
  description = object.link_default_description if description.nil?
  
  if defined?(section)
    link_to description, [ section, object ]
  else
    link_to description, object
  end
end