Permalink
Browse files

nova fotogalerie

  • Loading branch information...
1 parent 8fe4660 commit 05671f6276683d9a05b6e9bb934035a968667445 @rubydev rubydev committed Mar 8, 2011
View
@@ -10,4 +10,4 @@ config/database.yml
config/deploy.rb
config/*sphinx*
public/assets
-noviny.tmproj
+noviny.tmproj
@@ -68,7 +68,11 @@ def detail
@article = Article.find_by_id(params[:id],:include=>[:sections,:themes,:relarticles,:inverse_relarticles, :author, :pictures, :article_comments, :info_boxes])
redirect_to home_path and return unless @article
cookies[:last_article_id] = @article.id
-
+
+ # gallery
+ @pictures = Picture.paginate_from_article(@article.id,params[:page])
+ @article_image = @pictures.first
+
set_detail_variables
@article_image = @article.pictures.first
@@ -84,7 +88,16 @@ def detail
render :action=>"detail_noimg" if (!@article_image && !@article.content_type.video?)
end
-
+
+ def detail_gallery
+ @page = 1
+ @article = Article.find_by_id(params[:id],:include=>[:sections,:themes,:relarticles,:inverse_relarticles, :author, :pictures, :article_comments, :info_boxes])
+ set_detail_variables
+ @pictures = Picture.paginate_from_article(@article.id,params[:page])
+ @article_image = @pictures.first
+ redirect_to :action=>"detail",:id=>params[:id] and return if @pictures.blank?
+ end
+
def vote
if request.xhr?
remote_ip = request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip
@@ -216,14 +229,6 @@ def change_main_image
end
end
- def detail_gallery
- @page = 1
- @article = Article.find_by_id(params[:id],:include=>[:sections,:themes,:relarticles,:inverse_relarticles, :author, :pictures, :article_comments, :info_boxes])
- set_detail_variables
- @pictures = Picture.paginate_from_article(@article.id,params[:page])
- @article_image = @pictures.first
- redirect_to :action=>"detail",:id=>params[:id] and return if @pictures.blank?
- end
protected
def set_detail_variables
@@ -23,20 +23,26 @@ def index
def detail
@section = Section.find(:first,:conditions=>["name LIKE ?",unpretty_name(params[:name])],:select=>"id,name")
- cookies[:section_id] = @section.id
- @html_title = @section.name
- set_default_variables
- add_breadcrumb @section.name, section_path(pretty_name(@section))
- render :action=>"holidays" and return if Web::Calendar.holidays?
- if @section.name == "Váš Hlas"
- redirect_to home_path and return unless set_question_variables
- render :action=>"vas-hlas", :layout=>"web/gallery" and return
- elsif @section.name == "Fórum"
- set_forum_variables
- render :action=>"forum", :layout=>"web/gallery" and return
+ if params[:name] =~ /^homepage$/
+ redirect_to home_url
+ elsif @section
+ cookies[:section_id] = @section.id
+ @html_title = @section.name
+ set_default_variables
+ add_breadcrumb @section.name, section_path(pretty_name(@section))
+ render :action=>"holidays" and return if Web::Calendar.holidays?
+ if @section.name == "Váš Hlas"
+ redirect_to home_path and return unless set_question_variables
+ render :action=>"vas-hlas", :layout=>"web/gallery" and return
+ elsif @section.name == "Fórum"
+ set_forum_variables
+ render :action=>"forum", :layout=>"web/gallery" and return
+ else
+ render :action=>"#{@section.id}" and return
+ render :action=>"detail" and return
+ end
else
- render :action=>"#{@section.id}" and return
- render :action=>"detail" and return
+ render :template => 'web/text_pages/error', :layout => 'web/part/text_page'
end
end
View
@@ -40,9 +40,11 @@ class Picture < ActiveRecord::Base
:articles_preview => "140x",
:article_profile => "178x",
:gallery_big => "440x440",
+ :gallery_very_big => "800x",
:author_image => "178x178#"
},
- :convert_options => { :hp_main_crop => " -gravity Center -extent 440x270",
+ :convert_options => { :all => '-quality 80',
+ :hp_main_crop => " -gravity Center -extent 440x270",
:hp_sidebar => " -gravity Center -extent 140x130",
:author_little => ' -gravity Center -extent 65x60',
:preview_bottom => ' -gravity Center -extent 140x90',
@@ -9,8 +9,9 @@
<meta name="keywords" content="<%= @meta_keywords -%>" />
<title><%= "#{@html_title} - " if @html_title -%>Deník Referendum</title>
<%#= javascript_include_tag :defaults %>
- <%= javascript_include_tag "prototype", "effects", "dragdrop", "controls", "jquery-1.3.2.min", "jquery.scrollTo-1.4.0-min", "jquery.serialScroll-1.2.1-min", "web/cufon-yui", "web/cufon-arial", "web/fontCharger", "init", :cache => 'js_gal_files' %>
- <%= stylesheet_link_tag 'web/css/default' %>
+ <%= javascript_include_tag "prototype", "effects", "scriptaculous", "lightbox" %>
+ <%= javascript_include_tag "dragdrop", "controls", "jquery-1.4.2.min", "jquery.scrollTo-1.4.0-min", "jquery.serialScroll-1.2.1-min", "web/cufon-yui", "web/cufon-arial", "web/fontCharger", "init", :cache => "js_gal_files" %>
+ <%= stylesheet_link_tag 'web/css/default', 'lightbox' %>
<!--[if IE]><link rel="stylesheet" type="text/css" href="/stylesheets/web/css/msie.css" media="screen" /><![endif]-->
<link rel="icon" href="favicon-dr.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/images/web/favicon-dr.ico" type="image/x-icon" />
@@ -13,8 +13,8 @@
<%= javascript_include_tag "prototype", "effects", "dragdrop", "controls", "jquery-1.3.2.min", "jquery.scrollTo-1.4.0-min", "jquery.serialScroll-1.2.1-min", "web/cufon-yui", "web/cufon-arial", "web/fontCharger", "init", "calendar","jqModal", :cache => 'js_files' %>
<%= stylesheet_link_tag 'web/css/default',"calendar", "jqModal", :cache => 'css_files' %>
<!--[if IE]><link rel="stylesheet" type="text/css" href="/stylesheets/web/css/msie.css" media="screen" /><![endif]-->
- <link rel="icon" href="favicon-dr.ico" type="image/x-icon" />
- <link rel="shortcut icon" href="/images/web/favicon-dr.ico" type="image/x-icon" />
+ <link rel="icon" href="/images/web/favicon-dr.ico" type="image/x-icon" />
+ <link rel="shortcut icon" href="/images/web/favicon-dr.ico" type="image/x-icon" />
<script>
jQuery.noConflict();
</script>
@@ -1,2 +1,4 @@
-<%= (main_image_tag(@article_image.data.url(:gallery_big),:title=>@article_image.info(@article.first_image_title))) %>
-<p class="info"><%= @article_image.info(@article.first_image_title) %></p>
+<% @article_image.data.exists?(:gallery_very_big) ? im_url = @article_image.data.url(:gallery_very_big) : im_url = @article_image.data.url(:gallery_big) %>
+<%= link_to (main_image_tag(@article_image.data.url(:gallery_big)), im_url,
+ :title=>@article_image.info(@article.first_image_title),:rel => 'lightbox[roadtrip]') %>
+<p class="info"><%= @article_image.info(@article.first_image_title) %></p>
@@ -1,3 +1,3 @@
<li>
-<%= link_to(main_image_tag(thumb.data.url(:author_little)),thumb.data.url(:gallery_big),:title=>thumb.info) %>
-</li>
+<%= link_to(main_image_tag(thumb.data.url(:author_little)), ( thumb.data.exists?(:gallery_very_big) ? thumb.data.url(:gallery_very_big) : thumb.data.url(:gallery_big) ) ,:title=>thumb.info, :rel => "lightbox[roadtrip]") %>
+</li>
@@ -1,41 +1,58 @@
<div class="box boxDetail">
<h2 class="head"><%= @article.name %></h2>
<p class="perex"><%=th @article.perex %></p>
-
- <% cond = !ContentType.author_nick_types.include?(@article.content_type_id)%>
<div class="cols detailImage line">
+ <% cond = !ContentType.author_nick_types.include?(@article.content_type_id)%>
<div class="col1 item itemSmallImage itemSmall<%= ' noImg' unless (@author_image && cond && !@printable) -%>">
<%= render :partial=>"web/articles/author_box" %>
</div> <!-- /.col1 -->
-
- <div class="col2 mainImage">
- <% if @article.content_type.video? %>
- <%= @article.new_videodata %>
- <% else %>
- <% im = main_image_tag(@article_image.data.url(:hp_main)) %>
- <%= (@article.pictures.count > 1) ? link_to(im, gallery_article_path(pretty_id(@article))) : im %>
- <p class="info">
- <%= link_to("Galerie", gallery_article_path(pretty_id(@article))) if @article.pictures.count > 1 %>
- <%= @article_image.info(@article.first_image_title) %>
- </p>
- <% end %>
+
+ <% if @article.pictures.count > 1 %>
+ <div class="col2 gallery">
+ <% if @pictures.length > 6 %>
+ <div class="paging">
+ <ul class="pages">
+ <li class="nav prev"><a href="">predchozi</a></li>
+ <li><span class="actual">1</span> / <%= (@pictures.length / 6) + 1 %></li>
+ <li class="nav next"><a href="">nasledujici</a></li>
+ </ul>
+ </div> <!-- /.paging -->
+ <% end %>
+ <div class="thumbs">
+ <ul>
+ <%= render :partial=>"web/articles/thumb", :collection=>@pictures %>
+ </ul>
+ </div> <!-- /.thumbs -->
+ <div class="main">
+ <%= render :partial=>"web/articles/main_image" %>
+ </div> <!-- /.main -->
</div> <!-- /.col2 -->
-
+ <% else %>
+ <div class="col2 mainImage">
+ <% if @article.content_type.video? %>
+ <%= @article.new_videodata %>
+ <% else %>
+ <%= main_image_tag(@article_image.data.url(:hp_main)) %>
+ <p class="info"><%= @article_image.info(@article.first_image_title) %></p>
+ <% end %>
+ </div> <!-- /.col2 -->
+ <% end %>
+
</div> <!-- /.cols -->
-
+
<div class="cols detailContent">
<div class="col1">
<div class="box boxLine">
<%= render :partial=>"web/articles/left_box" %>
</div> <!-- /.box -->
-
+
<%= render :partial=>"web/articles/profil" %>
-
+
<div class="box">
<%= render :partial=>"web/articles/rel_articles" %>
</div> <!-- /.box -->
</div> <!-- /.col1 -->
-
+
<div class="col2">
<div class="text">
<p><%=th @article.text %></p>
@@ -2,7 +2,7 @@
<h2 class="head"><%= @article.name %></h2>
<p class="perex"><%=th @article.perex %></p>
<div class="cols detailImage line">
- <% cond = !ContentType.author_nick_types.include?(@article.content_type_id)%>
+ <% cond = !ContentType.author_nick_types.include?(@article.content_type_id)%>
<div class="col1 item itemSmallImage itemSmall<%= ' noImg' unless (@author_image && cond) -%>">
<%= render :partial=>"web/articles/author_box" %>
</div> <!-- /.col1 -->
@@ -52,4 +52,4 @@
</div> <!-- /.col2 -->
</div> <!-- /.cols -->
- </div> <!-- /.box -->
+ </div> <!-- /.box -->
View
@@ -32,7 +32,7 @@
map.edit_really_fond "/nadacni-fond/edit_really_fond/:id", :controller => "web/fonds", :action => "edit_really_fond"
map.detail_article "/clanek/:id",:controller => 'web/articles',:action=>"detail"
- map.gallery_article "/clanek-galerie/:id",:controller => 'web/articles',:action=>"detail_gallery"
+ #map.gallery_article "/clanek-galerie/:id",:controller => 'web/articles',:action=>"detail_gallery"
map.delete_comment "/clanek/smazat_komentar/:id",:controller => 'web/articles',:action=>"delete_comment"
map.section_succ "/rubrika/:name/zobrazit-dalsi/:succ_date",:controller => 'web/sections',:action=>"detail"
map.section_prev "/rubrika/:name/zobrazit-predchozi/:prev_date",:controller => 'web/sections',:action=>"detail"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,136 @@
+// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+var Builder = {
+ NODEMAP: {
+ AREA: 'map',
+ CAPTION: 'table',
+ COL: 'table',
+ COLGROUP: 'table',
+ LEGEND: 'fieldset',
+ OPTGROUP: 'select',
+ OPTION: 'select',
+ PARAM: 'object',
+ TBODY: 'table',
+ TD: 'table',
+ TFOOT: 'table',
+ TH: 'table',
+ THEAD: 'table',
+ TR: 'table'
+ },
+ // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
+ // due to a Firefox bug
+ node: function(elementName) {
+ elementName = elementName.toUpperCase();
+
+ // try innerHTML approach
+ var parentTag = this.NODEMAP[elementName] || 'div';
+ var parentElement = document.createElement(parentTag);
+ try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
+ parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
+ } catch(e) {}
+ var element = parentElement.firstChild || null;
+
+ // see if browser added wrapping tags
+ if(element && (element.tagName.toUpperCase() != elementName))
+ element = element.getElementsByTagName(elementName)[0];
+
+ // fallback to createElement approach
+ if(!element) element = document.createElement(elementName);
+
+ // abort if nothing could be created
+ if(!element) return;
+
+ // attributes (or text)
+ if(arguments[1])
+ if(this._isStringOrNumber(arguments[1]) ||
+ (arguments[1] instanceof Array) ||
+ arguments[1].tagName) {
+ this._children(element, arguments[1]);
+ } else {
+ var attrs = this._attributes(arguments[1]);
+ if(attrs.length) {
+ try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
+ parentElement.innerHTML = "<" +elementName + " " +
+ attrs + "></" + elementName + ">";
+ } catch(e) {}
+ element = parentElement.firstChild || null;
+ // workaround firefox 1.0.X bug
+ if(!element) {
+ element = document.createElement(elementName);
+ for(attr in arguments[1])
+ element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
+ }
+ if(element.tagName.toUpperCase() != elementName)
+ element = parentElement.getElementsByTagName(elementName)[0];
+ }
+ }
+
+ // text, or array of children
+ if(arguments[2])
+ this._children(element, arguments[2]);
+
+ return element;
+ },
+ _text: function(text) {
+ return document.createTextNode(text);
+ },
+
+ ATTR_MAP: {
+ 'className': 'class',
+ 'htmlFor': 'for'
+ },
+
+ _attributes: function(attributes) {
+ var attrs = [];
+ for(attribute in attributes)
+ attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
+ '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
+ return attrs.join(" ");
+ },
+ _children: function(element, children) {
+ if(children.tagName) {
+ element.appendChild(children);
+ return;
+ }
+ if(typeof children=='object') { // array can hold nodes and text
+ children.flatten().each( function(e) {
+ if(typeof e=='object')
+ element.appendChild(e)
+ else
+ if(Builder._isStringOrNumber(e))
+ element.appendChild(Builder._text(e));
+ });
+ } else
+ if(Builder._isStringOrNumber(children))
+ element.appendChild(Builder._text(children));
+ },
+ _isStringOrNumber: function(param) {
+ return(typeof param=='string' || typeof param=='number');
+ },
+ build: function(html) {
+ var element = this.node('div');
+ $(element).update(html.strip());
+ return element.down();
+ },
+ dump: function(scope) {
+ if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
+
+ var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
+ "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
+ "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
+ "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
+ "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
+ "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
+
+ tags.each( function(tag){
+ scope[tag] = function() {
+ return Builder.node.apply(Builder, [tag].concat($A(arguments)));
+ }
+ });
+ }
+}
Oops, something went wrong.

0 comments on commit 05671f6

Please sign in to comment.