From ea7ac1566215c9f8e98a4660e20970ed9e2cb703 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 24 Jan 2011 23:10:43 +1300 Subject: [PATCH] Display help in the settings listing so that we can find out what settings do without having to go to the edit screen. (ht: rishav) --- .../images/refinery/icons/information.png | Bin 0 -> 778 bytes core/public/javascripts/refinery/admin.js | 135 +++++++++--------- .../_refinery_setting.html.erb | 12 +- 3 files changed, 80 insertions(+), 67 deletions(-) create mode 100644 core/public/images/refinery/icons/information.png diff --git a/core/public/images/refinery/icons/information.png b/core/public/images/refinery/icons/information.png new file mode 100644 index 0000000000000000000000000000000000000000..12cd1aef900803abba99b26920337ec01ad5c267 GIT binary patch literal 778 zcmV+l1NHogP)BVme|mWaqy4$_pJm?y9KM{-*hp?1+Ey3e-CEDooTa!B;e(Q>TSF?bj>5At13y1p zriN3w3x~5SfZj{@J4M{kp{?=M_Lh2bV+5LH)Q)5W!-ePA$RgE1@5f1cyHki0Y}JyVEYZF(LD$xXlt$7A5CgE@ zpV-&l%vf;=5kZ2-2gi@Y6J&=cuwt>!vJ^#(&n|LcZyUzi6Duj$$hJ1s*HD-#;k-w@ zpdrwAuoDG_N2bvb07G$Zk*?Hc)JLtW4yqOnic_$zO7NZ#l>Fm){;fE?b$IbOaX2fe z0la4g0Dfw2xk7Wi7NapVD8YMPCZu?A1QCK*67dgsvRKBLFtrM>?$%&_lD1882mzdO zWPdw5KWw6IT`m1b_8=lS5jt8D3=RDa=&jWzR-)S@56WMslZ~mKu1)-wpXB>rNBQ>N zU#K`#1B&v|_AQK;7I~B}OdGiUT9LX>f0xm6<;LeP!=vFjPsUQF*wCJ*dO)4YBypgdiuF!=i@6Zyi7F|q#K zz?tlSZULa@t1D?$e;f@b36&N!V2mjOHw|*").appendTo($(this).parent()); }); + + $('a.suppress').live('click', function(e){ + e.preventDefault(); + }); }; init_modal_dialogs = function(){ @@ -293,83 +298,85 @@ init_tooltips = function(args){ { // create tooltip on hover and destroy it on hoveroff. $(element).hover(function(e) { - $(this).oneTime(350, 'tooltip', $.proxy(function() { - $('.tooltip').remove(); - tooltip = $("
").appendTo('#tooltip_container'); - tooltip.find("span").html($(this).attr('tooltip')); - if(!$.browser.msie) { - tooltip.corner('6px').find('span').corner('6px'); - } - - tooltip_nib_image = $.browser.msie ? 'tooltip-nib.gif' : 'tooltip-nib.png'; - nib = $("").appendTo('#tooltip_container'); + if (e.type == 'mouseenter' || e.type == 'mouseover') { + $(this).oneTime(350, 'tooltip', $.proxy(function() { + $('.tooltip').remove(); + tooltip = $("
").appendTo('#tooltip_container'); + tooltip.find("span").html($(this).attr('tooltip')); + if(!$.browser.msie) { + tooltip.corner('6px').find('span').corner('6px'); + } - tooltip.css({ - 'opacity': 0 - , 'maxWidth': '300px' - }); - required_left_offset = $(this).offset().left - (tooltip.outerWidth() / 2) + ($(this).outerWidth() / 2); - tooltip.css('left', (required_left_offset > 0 ? required_left_offset : 0)); + tooltip_nib_image = $.browser.msie ? 'tooltip-nib.gif' : 'tooltip-nib.png'; + nib = $("").appendTo('#tooltip_container'); - var tooltip_offset = tooltip.offset(); - var tooltip_outer_width = tooltip.outerWidth(); - if (tooltip_offset && (tooltip_offset.left + tooltip_outer_width) > (window_width = $(window).width())) { - tooltip.css('left', window_width - tooltip_outer_width); - } + tooltip.css({ + 'opacity': 0 + , 'maxWidth': '300px' + }); + required_left_offset = $(this).offset().left - (tooltip.outerWidth() / 2) + ($(this).outerWidth() / 2); + tooltip.css('left', (required_left_offset > 0 ? required_left_offset : 0)); - tooltip.css({ - 'top': $(this).offset().top - tooltip.outerHeight() - 2 - }); + var tooltip_offset = tooltip.offset(); + var tooltip_outer_width = tooltip.outerWidth(); + if (tooltip_offset && (tooltip_offset.left + tooltip_outer_width) > (window_width = $(window).width())) { + tooltip.css('left', window_width - tooltip_outer_width); + } - nib.css({ - 'opacity': 0 - }); + tooltip.css({ + 'top': $(this).offset().top - tooltip.outerHeight() - 2 + }); - if (tooltip_offset = tooltip.offset()) { nib.css({ - 'left': $(this).offset().left + ($(this).outerWidth() / 2) - 5 - , 'top': tooltip_offset.top + tooltip.height() + 'opacity': 0 }); - } - try { - tooltip.animate({ - top: tooltip_offset.top - 10 - , opacity: 1 - }, 200, 'swing'); - nib.animate({ - top: nib.offset().top - 10 - , opacity: 1 - }, 200); - } catch(e) { - tooltip.show(); - nib.show(); - } - }, $(this))); + if (tooltip_offset = tooltip.offset()) { + nib.css({ + 'left': $(this).offset().left + ($(this).outerWidth() / 2) - 5 + , 'top': tooltip_offset.top + tooltip.height() + }); + } - }, function(e) { - $(this).stopTime('tooltip'); - if ((tt_offset = (tooltip = $('.tooltip')).css('z-index', '-1').offset()) == null) { - tt_offset = {'top':0,'left':0}; - } - tooltip.animate({ - top: tt_offset.top - 20 - , opacity: 0 - }, 125, 'swing', function(){ - $(this).remove(); - }); - if ((nib_offset = (nib = $('.tooltip-nib')).offset()) == null) { - nib_offset = {'top':0,'left':0}; + try { + tooltip.animate({ + top: tooltip_offset.top - 10 + , opacity: 1 + }, 200, 'swing'); + nib.animate({ + top: nib.offset().top - 10 + , opacity: 1 + }, 200); + } catch(e) { + tooltip.show(); + nib.show(); + } + }, $(this))); + } else if (e.type == 'mouseleave' || e.type == 'mouseout') { + $(this).stopTime('tooltip'); + if ((tt_offset = (tooltip = $('.tooltip')).css('z-index', '-1').offset()) == null) { + tt_offset = {'top':0,'left':0}; + } + tooltip.animate({ + top: tt_offset.top - 20 + , opacity: 0 + }, 125, 'swing', function(){ + $(this).remove(); + }); + if ((nib_offset = (nib = $('.tooltip-nib')).offset()) == null) { + nib_offset = {'top':0,'left':0}; + } + nib.animate({ + top: nib_offset.top - 20 + , opacity: 0 + }, 125, 'swing', function(){ + $(this).remove(); + }); } - nib.animate({ - top: nib_offset.top - 20 - , opacity: 0 - }, 125, 'swing', function(){ - $(this).remove(); - }); }).click(function(e) { $(this).stopTime('tooltip'); }); + if ($(element).attr('tooltip') == null) { $(element).attr('tooltip', $(element).attr('title')); } diff --git a/settings/app/views/admin/refinery_settings/_refinery_setting.html.erb b/settings/app/views/admin/refinery_settings/_refinery_setting.html.erb index f86256721b..6ae69de8f9 100644 --- a/settings/app/views/admin/refinery_settings/_refinery_setting.html.erb +++ b/settings/app/views/admin/refinery_settings/_refinery_setting.html.erb @@ -4,14 +4,20 @@ - <%= truncate(refinery_setting.value.to_s, :length => 40) %> - <%= link_to refinery_icon_tag("application_edit.png"), + <%= link_to refinery_icon_tag('application_edit.png'), edit_admin_refinery_setting_path(refinery_setting, :dialog => true, :width => 725, :height => 525), :title => t('edit', :scope => 'admin.refinery_settings') %> - <%= link_to refinery_icon_tag("delete.png"), + <%= link_to refinery_icon_tag('delete.png'), admin_refinery_setting_path(refinery_setting), - :class => "cancel confirm-delete", + :class => 'cancel confirm-delete', :title => t('delete', :scope => 'admin.refinery_settings'), :confirm => t('message', :scope => 'shared.admin.delete', :title => refinery_setting.title), :method => :delete if refinery_setting.destroyable %> + + <% unless (help = t(refinery_setting.name, :scope => 'admin.refinery_settings.form.help', :default => '')).blank? %> + <%= link_to refinery_icon_tag('information.png'), '#', + :tooltip => help, + :class => 'suppress' %> + <% end %>