Permalink
Browse files

Added option to image picker to allow a link to toggle the display of…

… the image.
  • Loading branch information...
parndt committed Dec 4, 2009
1 parent 3c1b097 commit 0087072411165d347cadd9f68a76406c04286fc5
View
@@ -1 +1 @@
-0.9.5.19
+0.9.5.20
@@ -60,7 +60,8 @@
{
:f => f,
:field => :custom_title_image_id,
- :image => @page.custom_title_image
+ :image => @page.custom_title_image,
+ :toggle_image_display => false
}
%>
</div>
@@ -1,5 +1,6 @@
+<%= link_to "Show", "", :id => "current_image_toggler" if (toggle_image_display ||= false) %>
<%= f.hidden_field field %>
-<div>
+<div id='current_image_container'<%= " style='display: none'" if (toggle_image_display ||= false) %>>
<a id='current_image_link' href="<%= insert_admin_images_url %>?thickbox=true&amp;modal=true&amp;titlebar=true&amp;field=<%= f.object.class.name.underscore.downcase %>_<%= field %>&amp;update_image=current_picked_image&amp;callback=picked_image_changed&amp;thumbnail=&amp;KeepThis=true&amp;TB_iframe=true&amp;width=<%= width ||= 950 %>&amp;height=<%= height ||= 510 %>" style='border: 0px' title='Change <%= (description ||= "image").titleize %>' name='Change <%= (description ||= "image").titleize %>' class='thickbox'>
<% unless image.nil? %>
<%= image_fu image, nil, {:class => "brown_border", :id => "current_picked_image"} %>
@@ -37,6 +38,13 @@
this.hide();
e.stop();
});
+<% if toggle_image_display ||= false -%>
+ jQuery('#current_image_toggler').click(function(e){
+ jQuery(this).html((jQuery(this).html() == 'Show' ? 'Hide' : 'Show'));
+ jQuery("#current_image_container").toggle();
+ e.preventDefault();
+ });
+<% end -%>
});
</script>
<% end %>

0 comments on commit 0087072

Please sign in to comment.