Skip to content

Commit

Permalink
Display help in the settings listing so that we can find out what set…
Browse files Browse the repository at this point in the history
…tings do without having to go to the edit screen. (ht: rishav)
  • Loading branch information
parndt committed Jan 24, 2011
1 parent d5fd803 commit ea7ac15
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 67 deletions.
Binary file added core/public/images/refinery/icons/information.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 71 additions & 64 deletions core/public/javascripts/refinery/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ $.fn.slideTo = function(response) {
$(this).applyMinimumHeightFromChildren();
$(this).find('.pagination_frame').removeClass('frame_right').addClass('frame_center');
init_modal_dialogs();
init_tooltips();
return $(this);
}

Expand Down Expand Up @@ -144,6 +145,10 @@ init_interface = function() {
$('.form-actions .form-actions-left input:submit#submit_button').click(function(e) {
$("<img src='/images/refinery/icons/ajax-loader.gif' width='16' height='16' class='save-loader' />").appendTo($(this).parent());
});

$('a.suppress').live('click', function(e){
e.preventDefault();
});
};

init_modal_dialogs = function(){
Expand Down Expand Up @@ -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 = $("<div class='tooltip'><div><span></span></div></div>").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 = $("<img src='/images/refinery/"+tooltip_nib_image+"' class='tooltip-nib'/>").appendTo('#tooltip_container');
if (e.type == 'mouseenter' || e.type == 'mouseover') {
$(this).oneTime(350, 'tooltip', $.proxy(function() {
$('.tooltip').remove();
tooltip = $("<div class='tooltip'><div><span></span></div></div>").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 = $("<img src='/images/refinery/"+tooltip_nib_image+"' class='tooltip-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'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
<span class="preview">- <%= truncate(refinery_setting.value.to_s, :length => 40) %></span>
</span>
<span class='actions'>
<%= 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 %>
</span>
</li>

0 comments on commit ea7ac15

Please sign in to comment.