Skip to content

Commit

Permalink
refactor needed by "image_tag_for_link(src,options ={})"
Browse files Browse the repository at this point in the history
  • Loading branch information
kfl62 committed Feb 1, 2009
1 parent fb5466c commit 058516a
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 36 deletions.
4 changes: 2 additions & 2 deletions app/views/trst_sys/exe/_db_sys_menu_list.html.erb
Expand Up @@ -37,13 +37,13 @@
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.edit(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_info.png',
<%= image_tag 'db_show.png',
:alt => t('activerecord.attributes.crud.show'),
:title => t('activerecord.attributes.crud.show'),
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.show(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_delete.png',
<%= image_tag 'db_remove.png',
:alt => t('activerecord.attributes.crud.remove'),
:title => t('activerecord.attributes.crud.remove'),
:size => "13x13",
Expand Down
4 changes: 2 additions & 2 deletions app/views/trst_sys/exe/_db_sys_page_list.html.erb
Expand Up @@ -41,13 +41,13 @@
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.edit(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_info.png',
<%= image_tag 'db_show.png',
:alt => t('activerecord.attributes.crud.show'),
:title => t('activerecord.attributes.crud.show'),
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.show(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_delete.png',
<%= image_tag 'db_remove.png',
:alt => t('activerecord.attributes.crud.remove'),
:title => t('activerecord.attributes.crud.remove'),
:size => "13x13",
Expand Down
4 changes: 2 additions & 2 deletions app/views/trst_sys/exe/_db_sys_submenu_list.html.erb
Expand Up @@ -37,13 +37,13 @@
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.edit(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_info.png',
<%= image_tag 'db_show.png',
:alt => t('activerecord.attributes.crud.show'),
:title => t('activerecord.attributes.crud.show'),
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.show(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_delete.png',
<%= image_tag 'db_remove.png',
:alt => t('activerecord.attributes.crud.remove'),
:title => t('activerecord.attributes.crud.remove'),
:size => "13x13",
Expand Down
4 changes: 2 additions & 2 deletions app/views/trst_sys/exe/_db_sys_task_list.html.erb
Expand Up @@ -39,13 +39,13 @@
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.edit(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_info.png',
<%= image_tag 'db_show.png',
:alt => t('activerecord.attributes.crud.show'),
:title => t('activerecord.attributes.crud.show'),
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.show(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_delete.png',
<%= image_tag 'db_remove.png',
:alt => t('activerecord.attributes.crud.remove'),
:title => t('activerecord.attributes.crud.remove'),
:size => "13x13",
Expand Down
4 changes: 2 additions & 2 deletions app/views/trst_sys/exe/_db_user_list.html.erb
Expand Up @@ -52,13 +52,13 @@
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.edit(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_info.png',
<%= image_tag 'db_show.png',
:alt => t('activerecord.attributes.crud.show'),
:title => t('activerecord.attributes.crud.show'),
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.show(#{params[:id]}, #{o.id}); return false;" %>
<%= image_tag 'db_delete.png',
<%= image_tag 'db_remove.png',
:alt => t('activerecord.attributes.crud.remove'),
:title => t('activerecord.attributes.crud.remove'),
:size => "13x13",
Expand Down
38 changes: 12 additions & 26 deletions lib/forms/application_helper.rb
Expand Up @@ -127,12 +127,7 @@ def last_row_for_list(object_name, options)
"<tr class='even'>
<td colspan='#{options[:colspan]}' align='center' style='padding-top:10px'>#{trst_paginate(object_name)}</td>
<td style='border-left : 1px ridge #ffffff; width : 50px'>
#{image_tag 'db_new.png',
:alt => t('activerecord.attributes.crud.new'),
:title => t('activerecord.attributes.crud.new'),
:size => "18x18",
:style => "padding : 0 0 0 10px; cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.edit(#{params[:id]},'new'); return false;"}
#{image_tag_for_link("new", {:arg1 => params[:id], :arg2 => "new", :size => "18x18", :style => "padding : 0 0 0 10px; cursor : pointer; vertical-align : middle;" })}
</td>
</tr>
"
Expand All @@ -152,29 +147,20 @@ def last_row_for_row20(object_name, options)

def link_to_task_last_column(object_name)
"<td align='center' style='border-left : 1px ridge #ffffff; width : 50px'>
#{image_tag 'db_edit.png',
:alt => t('activerecord.attributes.crud.edit'),
:title => t('activerecord.attributes.crud.edit'),
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.edit(#{params[:id]}, #{object_name.id}); return false;"}
#{image_tag 'db_info.png',
:alt => t('activerecord.attributes.crud.show'),
:title => t('activerecord.attributes.crud.show'),
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.show(#{params[:id]}, #{object_name.id}); return false;"}
#{image_tag 'db_delete.png',
:alt => t('activerecord.attributes.crud.remove'),
:title => t('activerecord.attributes.crud.remove'),
:size => "13x13",
:style => "cursor : pointer; vertical-align : middle;",
:onclick => "TrstWindow.remove(#{params[:id]}, #{object_name.id}); return false;"}
#{image_tag_for_link("edit,show,remove", {:arg1 => params[:id], :arg2 => object_name.id })}
</td>"
end

def image_for_link_to_task

def image_tag_for_link(src,options ={})
html = ""
src.split(",").each { |s|
options[:alt] = options[:title] = t('activerecord.attributes.crud.' + s)
options[:size] = "13x13" unless options[:size]
options[:style] = "cursor : pointer; vertical-align : middle;" unless options[:style]
options[:onclick] = "TrstWindow.#{s}(#{options.delete(:arg1)}, #{options.delete(:arg2)}); return false;"
html += image_tag("db_#{s}.png", options)
}
html
end

end
File renamed without changes
File renamed without changes

0 comments on commit 058516a

Please sign in to comment.