summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-10-08 22:24:51 +0200
committerhukl <contact@smyck.org>2009-10-08 22:24:51 +0200
commit2fd33c36428ae7684badc43dbe2142152f058b4e (patch)
treec1025efc497973e268baa1b531120e726478d992
parent0db008d0bfb0803e5b000fcf08058e7d01f588eb (diff)
enabled shadowbox for headline images on public pages. if js is disabled the regular html version is rendered
-rw-r--r--app/helpers/content_helper.rb11
-rw-r--r--app/views/content/_headline_image.html.erb10
-rw-r--r--app/views/layouts/application.html.erb7
-rw-r--r--public/javascripts/public.js16
-rw-r--r--public/stylesheets/resources/close.png (renamed from public/javascripts/shadowbox/resources/close.png)bin255 -> 255 bytes
-rw-r--r--public/stylesheets/resources/next.png (renamed from public/javascripts/shadowbox/resources/next.png)bin248 -> 248 bytes
-rw-r--r--public/stylesheets/resources/pause.png (renamed from public/javascripts/shadowbox/resources/pause.png)bin155 -> 155 bytes
-rw-r--r--public/stylesheets/resources/play.png (renamed from public/javascripts/shadowbox/resources/play.png)bin211 -> 211 bytes
-rw-r--r--public/stylesheets/resources/previous.png (renamed from public/javascripts/shadowbox/resources/previous.png)bin237 -> 237 bytes
9 files changed, 31 insertions, 13 deletions
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
31 end 31 end
32 32
33 def headline_image 33 def headline_image
34 image = @page.assets.images.first 34 @images = @page.assets.images
35 if image 35
36 link_to_path( 36 unless @images.empty?
37 image_tag(image.upload.url(:headline)), 37 render :partial => 'content/headline_image'
38 ("galleries/" + @page.node.unique_name)
39 )
40 end 38 end
41 end 39 end
42 40
43
44 # Returns the published_at attribute of a page if it is not nil, otherwise 41 # Returns the published_at attribute of a page if it is not nil, otherwise
45 # it returns the auto-filled value of the created_at attribute 42 # it returns the auto-filled value of the created_at attribute
46 def date_for_page page 43 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 @@
1<%= link_to_path(
2 image_tag(@images[0].upload.url(:headline)),
3 ("galleries/" + @page.node.unique_name)
4) %>
5
6<div class="shadowbox_images" style="display: none">
7 <% @images.each do |image| %>
8 <%= link_to "hallo", image.upload.url, :class => "shadowbox_image" %>
9 <% end %>
10</div> \ 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 @@
9 <%= stylesheet_link_tag "ccc" %> 9 <%= stylesheet_link_tag "ccc" %>
10 <%= javascript_include_tag 'jquery-1.3.2.min' %> 10 <%= javascript_include_tag 'jquery-1.3.2.min' %>
11 <%= javascript_include_tag 'shadowbox/shadowbox' %> 11 <%= javascript_include_tag 'shadowbox/shadowbox' %>
12 <%= javascript_include_tag 'public' %>
13 <%= stylesheet_link_tag "shadowbox" %> 12 <%= stylesheet_link_tag "shadowbox" %>
14 13 <%= javascript_include_tag 'public' %>
15 <script type="text/javascript" charset="utf-8">
16 Shadowbox.init();
17 </script>
18 14
19 <%= auto_discovery_link_tag(:rss, {:controller => "rss", :action => "updates"}) %> 15 <%= auto_discovery_link_tag(:rss, {:controller => "rss", :action => "updates"}) %>
20 </head> 16 </head>
@@ -45,6 +41,5 @@
45 <%= featured_articles %> 41 <%= featured_articles %>
46 </div> 42 </div>
47 </div> 43 </div>
48
49 </body> 44 </body>
50</html> \ No newline at end of file 45</html> \ No newline at end of file
diff --git a/public/javascripts/public.js b/public/javascripts/public.js
index f4619e7..0919360 100644
--- a/public/javascripts/public.js
+++ b/public/javascripts/public.js
@@ -1,7 +1,23 @@
1Shadowbox.init({
2 skipSetup : true
3});
4
5
1$(document).ready(function(){ 6$(document).ready(function(){
7
8 Shadowbox.setup(".shadowbox_image", {gallery : "fofo"})
9
2 if ($("#headline_image img").length != 0) { 10 if ($("#headline_image img").length != 0) {
3 image_handler.initialize(); 11 image_handler.initialize();
4 } 12 }
13
14 $("div#headline_image a").bind("click", function() {
15 return false;
16 });
17
18 $("div#headline_image a img").bind("click", function(){
19 $(".shadowbox_image:first").trigger("click");
20 });
5}); 21});
6 22
7 23
diff --git a/public/javascripts/shadowbox/resources/close.png b/public/stylesheets/resources/close.png
index 33c1aab..33c1aab 100644
--- a/public/javascripts/shadowbox/resources/close.png
+++ b/public/stylesheets/resources/close.png
Binary files differ
diff --git a/public/javascripts/shadowbox/resources/next.png b/public/stylesheets/resources/next.png
index 0c950d6..0c950d6 100644
--- a/public/javascripts/shadowbox/resources/next.png
+++ b/public/stylesheets/resources/next.png
Binary files differ
diff --git a/public/javascripts/shadowbox/resources/pause.png b/public/stylesheets/resources/pause.png
index 0b5f804..0b5f804 100644
--- a/public/javascripts/shadowbox/resources/pause.png
+++ b/public/stylesheets/resources/pause.png
Binary files differ
diff --git a/public/javascripts/shadowbox/resources/play.png b/public/stylesheets/resources/play.png
index d26c933..d26c933 100644
--- a/public/javascripts/shadowbox/resources/play.png
+++ b/public/stylesheets/resources/play.png
Binary files differ
diff --git a/public/javascripts/shadowbox/resources/previous.png b/public/stylesheets/resources/previous.png
index f39220d..f39220d 100644
--- a/public/javascripts/shadowbox/resources/previous.png
+++ b/public/stylesheets/resources/previous.png
Binary files differ