From 058516aa60d6e98dd3597646aa2c1882140f9e3a Mon Sep 17 00:00:00 2001 From: kfl62 Date: Sun, 1 Feb 2009 23:23:51 +0200 Subject: [PATCH] refactor needed by "image_tag_for_link(src,options ={})" --- .../trst_sys/exe/_db_sys_menu_list.html.erb | 4 +- .../trst_sys/exe/_db_sys_page_list.html.erb | 4 +- .../exe/_db_sys_submenu_list.html.erb | 4 +- .../trst_sys/exe/_db_sys_task_list.html.erb | 4 +- app/views/trst_sys/exe/_db_user_list.html.erb | 4 +- lib/forms/application_helper.rb | 38 ++++++------------ .../images/{db_delete.png => db_remove.png} | Bin public/images/{db_info.png => db_show.png} | Bin 8 files changed, 22 insertions(+), 36 deletions(-) rename public/images/{db_delete.png => db_remove.png} (100%) rename public/images/{db_info.png => db_show.png} (100%) diff --git a/app/views/trst_sys/exe/_db_sys_menu_list.html.erb b/app/views/trst_sys/exe/_db_sys_menu_list.html.erb index 00927e9..23ab6a9 100644 --- a/app/views/trst_sys/exe/_db_sys_menu_list.html.erb +++ b/app/views/trst_sys/exe/_db_sys_menu_list.html.erb @@ -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", diff --git a/app/views/trst_sys/exe/_db_sys_page_list.html.erb b/app/views/trst_sys/exe/_db_sys_page_list.html.erb index bb785d2..e5200ff 100644 --- a/app/views/trst_sys/exe/_db_sys_page_list.html.erb +++ b/app/views/trst_sys/exe/_db_sys_page_list.html.erb @@ -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", diff --git a/app/views/trst_sys/exe/_db_sys_submenu_list.html.erb b/app/views/trst_sys/exe/_db_sys_submenu_list.html.erb index 68a2aab..3ba8f7a 100644 --- a/app/views/trst_sys/exe/_db_sys_submenu_list.html.erb +++ b/app/views/trst_sys/exe/_db_sys_submenu_list.html.erb @@ -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", diff --git a/app/views/trst_sys/exe/_db_sys_task_list.html.erb b/app/views/trst_sys/exe/_db_sys_task_list.html.erb index 117ad4f..635a03d 100644 --- a/app/views/trst_sys/exe/_db_sys_task_list.html.erb +++ b/app/views/trst_sys/exe/_db_sys_task_list.html.erb @@ -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", diff --git a/app/views/trst_sys/exe/_db_user_list.html.erb b/app/views/trst_sys/exe/_db_user_list.html.erb index 95ec917..e536696 100644 --- a/app/views/trst_sys/exe/_db_user_list.html.erb +++ b/app/views/trst_sys/exe/_db_user_list.html.erb @@ -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", diff --git a/lib/forms/application_helper.rb b/lib/forms/application_helper.rb index 49f98b7..d4d34f1 100644 --- a/lib/forms/application_helper.rb +++ b/lib/forms/application_helper.rb @@ -127,12 +127,7 @@ def last_row_for_list(object_name, options) " #{trst_paginate(object_name)} - #{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;" })} " @@ -152,29 +147,20 @@ def last_row_for_row20(object_name, options) def link_to_task_last_column(object_name) " - #{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 })} " 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 diff --git a/public/images/db_delete.png b/public/images/db_remove.png similarity index 100% rename from public/images/db_delete.png rename to public/images/db_remove.png diff --git a/public/images/db_info.png b/public/images/db_show.png similarity index 100% rename from public/images/db_info.png rename to public/images/db_show.png