Skip to content

Commit

Permalink
Added option to image picker to allow a link to toggle the display of…
Browse files Browse the repository at this point in the history
… the image.
  • Loading branch information
parndt committed Dec 4, 2009
1 parent 3c1b097 commit 0087072
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.9.5.19 0.9.5.20
3 changes: 2 additions & 1 deletion vendor/plugins/pages/app/views/admin/pages/_form.html.erb
Expand Up @@ -60,7 +60,8 @@
{ {
:f => f, :f => f,
:field => :custom_title_image_id, :field => :custom_title_image_id,
:image => @page.custom_title_image :image => @page.custom_title_image,
:toggle_image_display => false
} }
%> %>
</div> </div>
Expand Down
@@ -1,5 +1,6 @@
<%= link_to "Show", "", :id => "current_image_toggler" if (toggle_image_display ||= false) %>
<%= f.hidden_field field %> <%= 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'> <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? %> <% unless image.nil? %>
<%= image_fu image, nil, {:class => "brown_border", :id => "current_picked_image"} %> <%= image_fu image, nil, {:class => "brown_border", :id => "current_picked_image"} %>
Expand Down Expand Up @@ -37,6 +38,13 @@
this.hide(); this.hide();
e.stop(); 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> </script>
<% end %> <% end %>

0 comments on commit 0087072

Please sign in to comment.