From 2fd33c36428ae7684badc43dbe2142152f058b4e Mon Sep 17 00:00:00 2001 From: hukl Date: Thu, 8 Oct 2009 22:24:51 +0200 Subject: enabled shadowbox for headline images on public pages. if js is disabled the regular html version is rendered --- app/helpers/content_helper.rb | 11 ++++------- app/views/content/_headline_image.html.erb | 10 ++++++++++ app/views/layouts/application.html.erb | 7 +------ 3 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 app/views/content/_headline_image.html.erb (limited to 'app') diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index c85fcf5..2eb0c4d 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -31,16 +31,13 @@ module ContentHelper end def headline_image - image = @page.assets.images.first - if image - link_to_path( - image_tag(image.upload.url(:headline)), - ("galleries/" + @page.node.unique_name) - ) + @images = @page.assets.images + + unless @images.empty? + render :partial => 'content/headline_image' end end - # Returns the published_at attribute of a page if it is not nil, otherwise # it returns the auto-filled value of the created_at attribute def date_for_page page diff --git a/app/views/content/_headline_image.html.erb b/app/views/content/_headline_image.html.erb new file mode 100644 index 0000000..ac2e86a --- /dev/null +++ b/app/views/content/_headline_image.html.erb @@ -0,0 +1,10 @@ +<%= link_to_path( + image_tag(@images[0].upload.url(:headline)), + ("galleries/" + @page.node.unique_name) +) %> + + \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index efa8c5d..5be2240 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -9,12 +9,8 @@ <%= stylesheet_link_tag "ccc" %> <%= javascript_include_tag 'jquery-1.3.2.min' %> <%= javascript_include_tag 'shadowbox/shadowbox' %> - <%= javascript_include_tag 'public' %> <%= stylesheet_link_tag "shadowbox" %> - - + <%= javascript_include_tag 'public' %> <%= auto_discovery_link_tag(:rss, {:controller => "rss", :action => "updates"}) %> @@ -45,6 +41,5 @@ <%= featured_articles %> - \ No newline at end of file -- cgit v1.3