From 954e3b68aed311f1538771c0768aff2fb6ba5dce Mon Sep 17 00:00:00 2001 From: Alexander Negoda Date: Sun, 29 Jul 2012 02:33:03 +0400 Subject: [PATCH] upd --- Gemfile | 4 +- Gemfile.lock | 17 +++- app/assets/javascripts/application.js | 29 +++++- app/assets/javascripts/home.js | 2 + .../{application.css => application.css.scss} | 98 ++++++++++++++----- app/assets/stylesheets/home.css.less | 3 + app/controllers/albums_controller.rb | 10 +- app/controllers/application_controller.rb | 19 +++- app/controllers/collections_controller.rb | 21 +++- app/controllers/home_controller.rb | 16 +++ app/controllers/locale_controller.rb | 2 + app/controllers/photos_controller.rb | 8 +- app/helpers/application_helper.rb | 18 +++- app/helpers/home_helper.rb | 2 + app/models/album.rb | 73 +++++++------- app/models/collection.rb | 6 ++ app/models/photo.rb | 4 +- app/uploaders/file_uploader.rb | 9 +- app/views/albums/_row_collections.html.erb | 28 ++++++ app/views/albums/index.html.erb | 24 ++--- app/views/albums/show.html.erb | 71 ++++++-------- app/views/collections/_form.html.erb | 72 +++++++------- .../collections/_row_collections.html.erb | 29 ++++++ app/views/collections/index.html.erb | 38 +------ app/views/collections/new.html.erb | 9 +- app/views/collections/show.html.erb | 26 ++--- app/views/home/index.html.erb | 5 + app/views/kaminari/_first_page.html.erb | 13 +++ app/views/kaminari/_gap.html.erb | 8 ++ app/views/kaminari/_last_page.html.erb | 13 +++ app/views/kaminari/_next_page.html.erb | 13 +++ app/views/kaminari/_page.html.erb | 12 +++ app/views/kaminari/_paginator.html.erb | 25 +++++ app/views/kaminari/_prev_page.html.erb | 13 +++ app/views/layouts/bootstrap.html.erb | 3 +- app/views/photos/_row_collections.html.erb | 22 +++++ app/views/photos/_thumb.html.erb | 2 +- app/views/photos/index.html.erb | 5 +- app/views/shared/_head.html.erb | 4 +- app/views/shared/_home_slider.html.erb | 31 +++--- app/views/shared/_nav_bar.html.erb | 11 +-- app/views/shared/_notifications.html.erb | 13 +++ app/views/shared/_user_links.html.erb | 15 ++- config/application.rb | 2 +- config/initializers/{hack.rb => hacks.rb} | 0 config/initializers/kaminari_config.rb | 9 ++ config/locales/en.yml | 31 +++++- config/locales/ru.yml | 40 ++++++++ config/routes.rb | 2 +- db/seeds.rb | 15 +-- test/blueprints.rb | 12 +-- test/functional/home_controller_test.rb | 7 ++ test/unit/helpers/home_helper_test.rb | 4 + .../assets/javascripts/jquery.mousewheel.js | 84 ++++++++++++++++ 54 files changed, 769 insertions(+), 283 deletions(-) create mode 100644 app/assets/javascripts/home.js rename app/assets/stylesheets/{application.css => application.css.scss} (67%) create mode 100644 app/assets/stylesheets/home.css.less create mode 100644 app/controllers/home_controller.rb create mode 100644 app/helpers/home_helper.rb create mode 100644 app/views/albums/_row_collections.html.erb create mode 100644 app/views/collections/_row_collections.html.erb create mode 100644 app/views/home/index.html.erb create mode 100644 app/views/kaminari/_first_page.html.erb create mode 100644 app/views/kaminari/_gap.html.erb create mode 100644 app/views/kaminari/_last_page.html.erb create mode 100644 app/views/kaminari/_next_page.html.erb create mode 100644 app/views/kaminari/_page.html.erb create mode 100644 app/views/kaminari/_paginator.html.erb create mode 100644 app/views/kaminari/_prev_page.html.erb create mode 100644 app/views/photos/_row_collections.html.erb create mode 100644 app/views/shared/_notifications.html.erb rename config/initializers/{hack.rb => hacks.rb} (100%) create mode 100644 config/initializers/kaminari_config.rb create mode 100644 config/locales/ru.yml create mode 100644 test/functional/home_controller_test.rb create mode 100644 test/unit/helpers/home_helper_test.rb create mode 100644 vendor/assets/javascripts/jquery.mousewheel.js diff --git a/Gemfile b/Gemfile index a0b3297..88e8da7 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ gem 'rails', '3.2.6' gem 'mime-types', :require => 'mime/types' gem 'carrierwave', '0.6.2' gem 'dynamic_form' +gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git' gem 'princely' gem 'jquery-rails' gem 'jquery-ui-rails' @@ -12,7 +13,8 @@ gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootst gem 'ajaxful_rating_jquery', :git => 'git://github.com/baxang/ajaxful_rating_jquery.git'#, :branch => 'rails3' gem 'configatron', :git => 'git://github.com/markbates/configatron.git' gem 'plupload-rails', :git => 'git://github.com/bryanmig/plupload-rails.git' -gem 'sequel', :git => 'git://github.com/jeremyevans/sequel.git' +#gem 'sequel', :git => 'git://github.com/jeremyevans/sequel.git' +gem 'breadcrumbs_on_rails', :git => 'git://github.com/lloydk/breadcrumbs_on_rails.git' gem 'russian', :git => 'git://github.com/yaroslav/russian.git' gem "devise_omniauth_engine", :git=>"git://github.com/greendog/devise_omniauth_engine.git" diff --git a/Gemfile.lock b/Gemfile.lock index c5f6b62..5837354 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,11 @@ +GIT + remote: git://github.com/amatsuda/kaminari.git + revision: 82a38e07db1ca1598c8daf073a8f6be22ae714d6 + specs: + kaminari (0.13.0) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) + GIT remote: git://github.com/baxang/ajaxful_rating_jquery.git revision: b4a2c760cdbad9cd865fb18667d14045018287ed @@ -21,10 +29,10 @@ GIT yettings GIT - remote: git://github.com/jeremyevans/sequel.git - revision: 4b3396b47fdec748a4ed8fae8f6745d2fb5f1f71 + remote: git://github.com/lloydk/breadcrumbs_on_rails.git + revision: 310c40186b97dc816e22e9be7aac3b43dcef040b specs: - sequel (3.37.0) + breadcrumbs_on_rails (2.2.0) GIT remote: git://github.com/mamantoha/omniauth-vkontakte.git @@ -258,6 +266,7 @@ PLATFORMS DEPENDENCIES ajaxful_rating_jquery! + breadcrumbs_on_rails! cancan carrierwave (= 0.6.2) coffee-rails @@ -268,6 +277,7 @@ DEPENDENCIES fog jquery-rails jquery-ui-rails + kaminari! machinist mime-types mini_exiftool @@ -282,7 +292,6 @@ DEPENDENCIES rails (= 3.2.6) russian! sass-rails - sequel! sqlite3 twitter-bootstrap-rails! uglifier diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 14c55c9..21d9896 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -8,6 +8,11 @@ //= require jquery_ujs //= require jquery.easing.1.3 //= require jquery.noisy.min +//= require jquery.mousewheel +//= require fancybox/jquery.fancybox.pack +//= require fancybox/helpers/jquery.fancybox-buttons +//= require fancybox/helpers/jquery.fancybox-media +//= require fancybox/helpers/jquery.fancybox-thumbs //= require twitter/bootstrap //= require plupload //= require jquery.plupload.queue @@ -24,9 +29,31 @@ $(document).ready(function () { $('body').noisy({ 'intensity':10, 'size':200, - 'opacity':0.320, + 'opacity':0.120, 'fallback':'', 'monochrome':false }).css('background-color', '#fefefe'); + + $('.icon-popover').popover() + + $(".fancybox-thumb").fancybox({ + prevEffect : 'none', + nextEffect : 'none', + helpers : { + title : { + type: 'outside' + }, + overlay : { + opacity : 0.8, + css : { + 'background-color' : '#000' + } + }, + thumbs : { + width : 50, + height : 50 + } + } + }); }); diff --git a/app/assets/javascripts/home.js b/app/assets/javascripts/home.js new file mode 100644 index 0000000..dee720f --- /dev/null +++ b/app/assets/javascripts/home.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css.scss similarity index 67% rename from app/assets/stylesheets/application.css rename to app/assets/stylesheets/application.css.scss index 5aee594..3fd0ea8 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css.scss @@ -1,51 +1,55 @@ /* - *= require_self *= require_tree . *= require jquery.plupload.queue *= require bootstrap_and_overrides + *= require fancybox/jquery.fancybox + *= require fancybox/helpers/jquery.fancybox-buttons + *= require fancybox/helpers/jquery.fancybox-thumbs + *= require_self */ -*{ - text-shadow: 1px 1px 1px #fff; +* { + text-shadow: 1px 1px 1px #999; /*text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 30px rgba(255, 255, 255, 0.125);*/ font-family: 'Nunito', 'Istok Web', sans-serif; - color: #959494; + color: #333; } body { padding-top: 90px; padding-bottom: 40px; } + h1, h2, h3, h4, h5, h6 { color: #666; } - .navbar-inner { - background-color: #FAFAFA; - background-image: -moz-linear-gradient(center top, #FAFAFA, #EAEAEA); - background-image: -ms-linear-gradient(center top, #FAFAFA, #EAEAEA); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#FAFAFA), to(#EAEAEA)); - background-image: -webkit-linear-gradient(center top, #FAFAFA, #EAEAEA); - background-image: -o-linear-gradient(center top, #FAFAFA, #EAEAEA); - background-image: linear-gradient(top, #FAFAFA, #EAEAEA); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#FAFAFA', endColorstr = '#EAEAEA', GradientType = 0); + background-color: #FAFAFA !important; + background-image: -moz-linear-gradient(center top, #FAFAFA, #EAEAEA) !important; + background-image: -ms-linear-gradient(center top, #FAFAFA, #EAEAEA) !important; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#FAFAFA), to(#EAEAEA)) !important; + background-image: -webkit-linear-gradient(center top, #FAFAFA, #EAEAEA) !important; + background-image: -o-linear-gradient(center top, #FAFAFA, #EAEAEA) !important; + background-image: linear-gradient(top, #FAFAFA, #EAEAEA) !important; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#FAFAFA', endColorstr = '#EAEAEA', GradientType = 0) !important; } - .navbar .brand { - color: #000; - font-weight: bold; - padding-bottom: 5px; + color: #000 !important; + font-weight: bold !important; + padding-bottom: 5px !important; + padding: 10px 20px 12px; /*text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 30px rgba(255, 255, 255, 0.125);*/ } -navbar .nav .dropdown-toggle .caret, .navbar .nav .open.dropdown .caret { +.navbar .nav .dropdown-toggle .caret, .navbar .nav .open.dropdown .caret { border-top-color: #000000; } .navbar .nav { - margin-top: 15px; + margin-top: 5px; + margin-bottom: 10px; } .navbar .nav > li { @@ -54,7 +58,6 @@ navbar .nav .dropdown-toggle .caret, .navbar .nav .open.dropdown .caret { .navbar .nav .divider-vertical { padding: 0; - height: 61px; } .navbar .nav > li > a { @@ -107,17 +110,21 @@ navbar .nav .dropdown-toggle .caret, .navbar .nav .open.dropdown .caret { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 0px rgba(255, 255, 255, 0.75); transition: none; } + .navbar-search .search-query :-moz-placeholder { color: #666; } + .navbar-search .search-query::-webkit-input-placeholder { color: #666; } + .navbar-search .search-query:hover { color: #333; background-color: #999999; background-color: rgba(255, 255, 255, 0.5); } + .navbar-search .search-query:focus, .navbar-search .search-query.focused { padding: 5px 10px; color: #333333; @@ -128,10 +135,57 @@ navbar .nav .dropdown-toggle .caret, .navbar .nav .open.dropdown .caret { outline: 0; } -.ajaxful-rating-wrapper{ +.ajaxful-rating-wrapper { float: right; } -.view-btn{ +.view-btn { display: inline; + padding: 5px; + float: left; +} + +.anythingSlider { + padding: 0 0 28px 0; +} + +.thumbnail { + background: none repeat scroll 0 0 #FFFFFF; + border: 0 none; + border-radius: 7px 7px 7px 7px; + box-shadow: 1px 1px 3px #D9D9D9; + display: block; + height: 340px; +} + +.caption { + position: relative; + bottom: 0px; + height: 150px; +} + +.caption .title { + padding: 5px 0 5px 0; + font-size: 13px; + text-align: center; +} + +.caption .descr { + display: block; + padding: 10px 0 0 0; +} + +.caption .controls { + position: absolute; + bottom: 5px; + width: 250px; +} + +.caption .controls .tooltips{ + float: left; + width: 15px; + padding: 5px; +} +.icon-popover{ + cursor: pointer; } \ No newline at end of file diff --git a/app/assets/stylesheets/home.css.less b/app/assets/stylesheets/home.css.less new file mode 100644 index 0000000..ee403b8 --- /dev/null +++ b/app/assets/stylesheets/home.css.less @@ -0,0 +1,3 @@ +// Place all the styles related to the home controller here. +// They will automatically be included in application.css. +// You can use Less here: http://lesscss.org/ diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 831c8c8..7455d6e 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -20,7 +20,7 @@ class AlbumsController < ApplicationController end } else - @albums = Album.order('albums.title') + @albums = Album.popular.page(@page).per(@per_page) end respond_to do |format| format.html @@ -40,6 +40,8 @@ class AlbumsController < ApplicationController def show @album = Album.find( params[:id]) + @photos = @album.photos.popular + respond_to do |format| format.html format.json { render :json => @album } @@ -98,5 +100,11 @@ class AlbumsController < ApplicationController redirect_to @album end end + + def rate + @album = Album.find(params[:id]) + @album.rate(params[:stars], current_user, params[:dimension]) + render :json => {:id => @album.wrapper_dom_id(params), :width => 125} + end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fd82122..f40969a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,8 +6,9 @@ class ApplicationController < ActionController::Base helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryProtection for details + before_filter :set_locale before_filter :authenticate_user!, :set_current_user - before_filter :setup + before_filter :setup, :set_pagination_params private # This hack is needed to access the current user in models. See http://rails-bestpractices.com/posts/47-fetch-current-user-in-models @@ -31,4 +32,20 @@ class ApplicationController < ActionController::Base redirect_to(session[:return_to] || default) session[:return_to] = nil end + + private + + def set_pagination_params + @page = params[:page] + @per_page = params[:per_page] + end + + def set_locale + I18n.locale = session[:locale] + + if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym) + session[:locale] = I18n.locale = params[:locale].to_sym + end + end + end diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index 0878ad1..18f3a58 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -1,11 +1,13 @@ class CollectionsController < ApplicationController before_filter :check_public_access skip_before_filter :authenticate_user!, :only => [:index, :show] - + add_breadcrumb I18n.t('home_page'), :root_path, :title => I18n.t('home_page') def index - @collections = Collection.includes(:albums => :photos).where("photos.id NOT NULL").group_for.order('collections.title') - @popular_photos = Photo.visible.order('rating_average asc').limit(10) + add_breadcrumb t('activerecord.models.collection.popular'), collections_path, :title => t('activerecord.models.collection.popular') + add_breadcrumb t('activerecord.actions.create', :model => I18n.t('activerecord.models.collection.single')), new_collection_path, + :title => t('activerecord.actions.create'), :li_icon => 'icon-plus-sign' + @collections = Collection.popular.page(@page).per(@per_page) respond_to do |format| format.html @@ -16,7 +18,14 @@ class CollectionsController < ApplicationController def show @collection = Collection.find( params[:id] ) - @albums = @collection.albums.order('title') + add_breadcrumb t('activerecord.models.collection.popular'), collections_path, :title => t('activerecord.models.collection.popular') + add_breadcrumb @collection.title, collection_path(@collection), :title => @collection.title + add_breadcrumb t('activerecord.actions.update', :model => I18n.t('activerecord.models.collection.single')), edit_collection_path, + :title => t('activerecord.actions.update', :model => I18n.t('activerecord.models.collection.single')) + add_breadcrumb t('activerecord.actions.destroy', :model => I18n.t('activerecord.models.collection.single')),collection_path(@collection), + :title => t('activerecord.actions.destroy', :model => I18n.t('activerecord.models.collection.single')) + + @albums = @collection.albums.includes(:photos).where("photos.id NOT NULL").order('albums.rating_average desc').page(@page).per(@per_page) respond_to do |format| format.html format.json { render :json => @collection } @@ -27,6 +36,8 @@ class CollectionsController < ApplicationController def new @collection = Collection.new + add_breadcrumb t('activerecord.models.collection.other').mb_chars.capitalize.to_s, collections_path, :title => t('activerecord.models.collection.other') + add_breadcrumb t('activerecord.actions.new', :model => I18n.t('activerecord.models.collection.one')), new_collection_path, :title => t('activerecord.actions.new') end def create @@ -45,6 +56,8 @@ class CollectionsController < ApplicationController def update @collection = Collection.find( params[:id]) + add_breadcrumb t('activerecord.models.collection.popular'), collections_path, :title => t('activerecord.models.collection.popular') + add_breadcrumb t('activerecord.actions.create', :model => I18n.t('activerecord.models.collection.single')), new_collection_path, :title => t('activerecord.actions.create') if @collection.update_attributes(params[:collection]) flash[:notice] = "Collection updated!" redirect_to @collection diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000..deda1be --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,16 @@ +class HomeController < ApplicationController + skip_before_filter :authenticate_user!, :only => [:index] + + add_breadcrumb t('home_page'), :root_path + + def index + @collections = Collection.popular.limit(12) + @popular_photos = Photo.popular.limit(10) + + respond_to do |format| + format.html + format.json { render :json => @collections } + format.xml { render :xml => @collections } + end + end +end diff --git a/app/controllers/locale_controller.rb b/app/controllers/locale_controller.rb index 60bfc78..6a41733 100644 --- a/app/controllers/locale_controller.rb +++ b/app/controllers/locale_controller.rb @@ -1,4 +1,6 @@ class LocaleController < ApplicationController + skip_before_filter :authenticate_user!, :only => [:set] + def set if request.referer && request.referer.starts_with?('http://' + request.host) session['return_to'] = request.referer diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index ad698d7..863380d 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -25,7 +25,7 @@ class PhotosController < ApplicationController end } else - @photos = Photo.order("photos.id ASC") + @photos = Photo.popular.page(@page).per(@per_page) end respond_to do |format| format.html @@ -148,4 +148,10 @@ class PhotosController < ApplicationController redirect_to @photo end end + + def rate + @photo = Photo.find(params[:id]) + @photo.rate(params[:stars], current_user, params[:dimension]) + render :json => {:id => @photo.wrapper_dom_id(params), :width => 125} + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c807bbe..c17be66 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,12 +1,13 @@ # Methods added to this helper will be available to all templates in the application. module ApplicationHelper +=begin def breadcrumbs(sep = "/", include_home = true) levels = request.path.split('?')[0].split('/') levels.delete_at(0) #links = "You are here: " - links = content_tag('a', "HOME", :href => root_path ) if include_home + links = content_tag('li', (content_tag('a', t(:home_page), :href => root_path ) if include_home)) nocrumb = ["collections", "albums", "photos", "tags", "new", "edit", "tags"] @@ -15,12 +16,19 @@ module ApplicationHelper level = level.gsub("-", " ") if index+1 == levels.length #links += " #{sep} #{level.upcase}" unless nocrumb.include?(level) - elsif !nocrumb.include?(level) + #elsif !nocrumb.include?(level) links += " " + sep + " " - links += content_tag('a', level.upcase, :href => '/'+levels[0..index].join('/')) + links += content_tag('li', content_tag('a', level, :href => '/'+levels[0..index].join('/'))) end end - content_tag("div", links, :id => "breadcrumb") - end + content_tag("ul", links, :class => "breadcrumb") + end +=end + + def pluralize(string, count=nil, variants=nil) + # example variants for russian: # Russian.pluralize(3.14, "вещь", "вещи", "вещей", "вещи") + a,b,c,d=*variants + I18n.locale.eql?(:ru) ? Russian.pluralize(count, a,b,c,d) : string.pluralize + end end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb new file mode 100644 index 0000000..23de56a --- /dev/null +++ b/app/helpers/home_helper.rb @@ -0,0 +1,2 @@ +module HomeHelper +end diff --git a/app/models/album.rb b/app/models/album.rb index 583b7c0..fa54a41 100644 --- a/app/models/album.rb +++ b/app/models/album.rb @@ -9,95 +9,96 @@ class Album < ActiveRecord::Base validates :path, :presence => true, :uniqueness => true #, :message => "Album already exsists on disc" validates :title, :presence => true #, :message => "can't be blank" - + before_validation :ensure_path, :set_title after_create :create_folders after_destroy :destroy_folders attr_accessor :tags - #attr_protected :path - scope :untouched, where("albums.id IN ( SELECT DISTINCT photos.album_id FROM photos WHERE photos.description IS NULL AND photos.id NOT IN ( SELECT photo_id FROM photo_tags) )").order('title') - scope :unused, where("albums.id NOT IN (SELECT album_id FROM collection_albums)") - scope :used, where("albums.id IN (SELECT album_id FROM collection_albums)") + scope :visible, lambda { where(:public => true) } + scope :popular, lambda{visible.includes(:photos).where("photos.id NOT NULL").order('albums.rating_average desc')} + scope :untouched, lambda{where("albums.id IN ( SELECT DISTINCT photos.album_id FROM photos WHERE photos.description IS NULL AND photos.id NOT IN ( SELECT photo_id FROM photo_tags) )").order('title')} + scope :unused, lambda{where("albums.id NOT IN (SELECT album_id FROM collection_albums)")} + scope :used, lambda{where("albums.id IN (SELECT album_id FROM collection_albums)")} def to_param "#{id}-#{title.parameterize}" end - + def ensure_path self.path = self.title.parameterize unless self.path end - + def set_title self.title = File.basename(self.path).titleize unless self.title || !self.path end - + def tags # should maybe cache this to database? # should maybe return array instead? - + tags = Array.new - self.photos.map{ |photo| - if photo.tags.empty? - # photo has no tags => no unversial tags for this album - return - else - photo.tags - end - }.each_with_index{ |photo_tags,i| - # returns tag collection for each photo - if i == 0 - tags = photo_tags - else - # combine arrays if they have identical tags. - # Will remove tags that are only tagged to one photo - #tags = tags & photo_tags - tags = tags & photo_tags - end + self.photos.map { |photo| + if photo.tags.empty? + # photo has no tags => no unversial tags for this album + return + else + photo.tags + end + }.each_with_index { |photo_tags, i| + # returns tag collection for each photo + if i == 0 + tags = photo_tags + else + # combine arrays if they have identical tags. + # Will remove tags that are only tagged to one photo + #tags = tags & photo_tags + tags = tags & photo_tags + end } return tags end - + def tags=(tags) tags = tags.split(" ").sort - current_tags = ( self.tags.nil? ? [] : self.tags.map{|tag|tag.title} ) + current_tags = (self.tags.nil? ? [] : self.tags.map { |tag| tag.title }) return if tags == self.tags - + # find tags that should be removed from this album - thus remove from all photos in album # i.e. tags listed in self.tag_list but no in parameter tags #current_tags.map {|tag|tag if !tags.include?(tag) }.compact (current_tags - tags).each { |tag| - self.photos.each {|photo| - photo.untag( tag ) + self.photos.each { |photo| + photo.untag(tag) } } # add universial tags to all photos in album (tags - current_tags).each do |tag| self.photos.each { |photo| - photo.tag( tag ) + photo.tag(tag) } end end def photo_tags tags = Array.new - self.photos.each{ |photo| + self.photos.each { |photo| tags = tags | photo.tags } return tags - end + end protected private - + def create_folders #Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) unless File.exists?( APP_CONFIG[:photos_path] + self.path ) #Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) unless File.exists?( APP_CONFIG[:thumbs_path] + self.path ) end - + def destroy_folders #puts "DELETE DIRECTORY " + APP_CONFIG[:photos_path] + self.path #Dir.delete( APP_CONFIG[:photos_path] + self.path ) if File.exists?( APP_CONFIG[:photos_path] + self.path ) diff --git a/app/models/collection.rb b/app/models/collection.rb index cc728e7..6895726 100644 --- a/app/models/collection.rb +++ b/app/models/collection.rb @@ -9,6 +9,12 @@ class Collection < ActiveRecord::Base validates :title, :presence => true + scope :visible, where(:public => true) + scope :popular, lambda{visible.includes(:albums => :photos).where("photos.id NOT NULL").order('collections.rating_average desc')} + + def photos_count + self.albums.includes(:photos).size + end def to_param "#{id}-#{title.parameterize}" diff --git a/app/models/photo.rb b/app/models/photo.rb index 755de96..c9ceff7 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -16,6 +16,7 @@ class Photo < ActiveRecord::Base attr_accessor :tag_list scope :visible, where(:public => true) + scope :popular, visible.order('rating_average desc') scope :untouched, :conditions => "photos.description IS NULL AND photos.id NOT IN ( SELECT photo_id FROM photo_tags)", :include => :album scope :previous, lambda { |p,a| { :conditions => ["id < :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id DESC"} } scope :next, lambda { |p,a| { :conditions => ["id > :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id ASC"} } @@ -59,8 +60,7 @@ class Photo < ActiveRecord::Base private def set_title - a=self.attachment.file.basename - update_attribute(:title, a.titleize) + update_attribute(:title, self.attachment.file.basename.titleize) self.title = self.attachment.file.basename.titleize unless self.title end diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index e18da47..d6f3315 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -49,7 +49,7 @@ class FileUploader < CarrierWave::Uploader::Base # end # Create different versions of your uploaded files - version :collection do + version :thumb do process :resize_to_fill => [260, 180] def store_dir @@ -57,13 +57,6 @@ class FileUploader < CarrierWave::Uploader::Base end end - version :album do - process :resize_to_fill => [100, 100] - - def store_dir - ENV['STORAGE_PATH'] + "/thumbs/#{model.album.path}/#{model.id}" - end - end ###################################################################################################################### # Note diff --git a/app/views/albums/_row_collections.html.erb b/app/views/albums/_row_collections.html.erb new file mode 100644 index 0000000..7d0efe8 --- /dev/null +++ b/app/views/albums/_row_collections.html.erb @@ -0,0 +1,28 @@ +
+
+ <% @albums.in_groups_of(4).each do |group| %> + <% unless group.empty? %> +
    + <% group.compact.each_with_index do |album, index| %> +
  • +
    + <%= image_tag album.photos.first.attachment.thumb.url %> +
    +
    <%= album.title %>
    + <%= album.description %> +
    +

    <%= link_to 'View', (album_path(album) unless album.photos.empty?), {:class => 'btn btn-primary'} %>

    +
    + +
    + <%= ratings_for album %> +
    +
    +
    +
  • + <% end %> +
+ <% end %> + <% end %> +
+
\ No newline at end of file diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index 5c1e490..dc56228 100644 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -1,19 +1,11 @@ -<% for album in @albums %> -
-
- <%= render :partial => "photos/thumb", :locals => {:photo => album.photos.first } unless album.photos.empty? %> -

<%= link_to album.title, album %>

-
-
- <%= render :partial => "photos/thumb", :collection => album.photos.find(:all, :limit => 5, :offset => 1), :as => :photo %> -
-
-<% end %> +<%= paginate @albums %> +<%= render 'row_collections' %> +<%= paginate @albums %> <%= content_for :action_links do %> -<%= link_to "Show just the photos tagged with #{params[:q]}", photos_path(:q => params[:q]) if params[:q] %> -<% if has_role?("admin") %> -<%= " | " if params[:q] %> -<%= link_to "New album", new_album_path() %> -<% end %> + <%= link_to "Show just the photos tagged with #{params[:q]}", photos_path(:q => params[:q]) if params[:q] %> + <% if current_user and current_user.has_role?("admin") %> + <%= " | " if params[:q] %> + <%= link_to "New album", new_album_path() %> + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index 8fb9819..3d5b7f3 100644 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -1,60 +1,47 @@

<%= @album.title %>

- -
- - <% count = 0.0 %> - <% for photo in @album.photos.find(:all, :order => "Id ASC") %> - <% count += 1%> - <% if count == 1 || ( (count-1) / 4.0 == ( (count-1) / 4.0).to_i ) %><% end %> - - <% if count / 4.0 == (count / 4.0).to_i %><% end %> - <% end %> -
<%= link_to image_tag( photo.attachment.preview.url ), [@album.collections.first, @album, photo] %>
-
+<%= render :partial => 'photos/row_collections' %>

<%= @album.description %>

<% unless @album.photo_tags.empty? %> -

Tagged with: -<% for tag in @album.photo_tags.map{|tag|tag.title}.sort %> -<%= link_to tag, album_tag_photos_path(@album, tag) %> -<% end %> -

+

Tagged with: + <% for tag in @album.photo_tags.map { |tag| tag.title }.sort %> + <%= link_to tag, album_tag_photos_path(@album, tag) %> + <% end %> +

<% end %> <% unless @album.collections.empty? %> -

Part of: -<% for collection in @album.collections.find(:all, :order => 'title') %> -<%= link_to collection.title, collection_path(collection) %> -<% end %> -

+

Part of: + <% for collection in @album.collections.order('title') %> + <%= link_to collection.title, collection_path(collection) %> + <% end %> +

<% end %> -<% if has_role?("admin") %> -

<%= @album.address %>

-<% end %> -<% if has_role?("admin") %> -

<%= @album.note %>

+<% if current_user and current_user.has_role?("admin") %> +

<%= @album.address %>

+

<%= @album.note %>

<% end %> <%= content_for :action_links do %> -<% if has_role?("admin") %> -<% if params[:collection_id] %> -<%= link_to "PDF", collection_album_path(params[:collection_id],@album, :format => 'pdf') %> |  -<%= link_to "Edit album", edit_collection_album_path(params[:collection_id],@album) %> |  -<%= link_to "Edit all photos", edit_multiple_collection_album_photos_path(params[:collection_id],@album) %> |  -<%= link_to "Edit untouched photos", untouched_collection_album_photos_path(params[:collection_id], @album) %> |  -<%= link_to "Add photos", upload_collection_album_photos_path(params[:collection_id], @album) %> -<% else %> -<%= link_to "PDF", album_path(@album, :format => 'pdf') %> |  -<%= link_to "Edit album", edit_album_path(@album) %> |  -<%= link_to "Edit all photos", edit_multiple_album_photos_path(@album) %> |  -<%= link_to "Edit untouched photos", untouched_album_photos_path(@album) %> |  -<%= link_to "Add photos", upload_album_photos_path(@album) %> -<% end %> + <% if current_user and current_user.has_role?("admin") %> + <% if params[:collection_id] %> +
  • <%= link_to "PDF", collection_album_path(params[:collection_id], @album, :format => 'pdf') %>
  • +
  • <%= link_to "Edit album", edit_collection_album_path(params[:collection_id], @album) %>
  • +
  • <%= link_to "Edit all photos", edit_multiple_collection_album_photos_path(params[:collection_id], @album) %>
  • +
  • <%= link_to "Edit untouched photos", untouched_collection_album_photos_path(params[:collection_id], @album) %>
  • +
  • <%= link_to "Add photos", upload_collection_album_photos_path(params[:collection_id], @album) %>
  • + <% else %> +
  • <%= link_to "PDF", album_path(@album, :format => 'pdf') %>
  • +
  • <%= link_to "Edit album", edit_album_path(@album) %>
  • +
  • <%= link_to "Edit all photos", edit_multiple_album_photos_path(@album) %>
  • +
  • <%= link_to "Edit untouched photos", untouched_album_photos_path(@album) %>
  • +
  • <%= link_to "Add photos", upload_album_photos_path(@album) %>
  • + <% end %> -<% end %> + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/collections/_form.html.erb b/app/views/collections/_form.html.erb index 39cd6c5..f1eaeb1 100644 --- a/app/views/collections/_form.html.erb +++ b/app/views/collections/_form.html.erb @@ -1,38 +1,40 @@ -<%= form.label :title, :Title, {:class => 'big'} %>
    -<%= form.text_field :title, {:class => 'big'} %>
    +
    +
    + <%= form.label :title, t('activerecord.models.collection.attributes.title'), {:class => 'control-label'} %> +
    + <%= form.text_field :title, {:class => 'input-xlarge'} %> +
    +
    -<%= form.label :description %>
    -<%= form.text_area :description %>
    +
    + <%= form.label :description, t('activerecord.models.collection.attributes.description'), {:class => 'control-label'} %> +
    + <%= form.text_area :description, {:class => 'input-xlarge', :rows => 5} %> +
    +
    -<% unless @collection.albums.empty? %> -<%= form.label :albums %>
    -
    -<% for album in @collection.albums %> -<%= form.fields_for :album_list do |album_fields| %> - -<%= image_tag "delete-24x24.png", :class => "delete", :alt => "Delete" -%> + <% unless @collection.albums.empty? %> + <%= form.label :albums %> + <% @collection.albums.each do |album| %> + <%= form.fields_for :album_list do |album_fields| %> + <%= image_tag "delete-24x24.png", :class => "delete", :alt => "Delete" -%> + <% if album.photos.empty? %> + <%= album.title %> + <% else %> + <%= image_tag album.photos.first.attachment.thumb.url, :alt => album.title %> + <% end %> + <%= album_fields.hidden_field album.id %> + <% end %> + <% end %> -<% if album.photos.empty? %> - <%= album.title %> -<% else %> -<%= image_tag album.photos.first.attachment.album.url, :alt => album.title %> -<% end %> -<%= album_fields.hidden_field album.id %> - -<% end %> -<% end %> -
    - -

    -<% -grouped_options = [ - ['Available albums',[['Choose album to add','']]], - ['Not used', Album.unused.map{|album|[album.title, album.id]} ], - ['In use', Album.used.map{|album|[album.title, album.id]} ] -] -grouped_options_for_select(grouped_options) -%> -<%= select_tag 'available_albums', grouped_options_for_select(grouped_options) %> -

    - -<% end %> + <% + grouped_options = [ + ['Available albums', [['Choose album to add', '']]], + ['Not used', Album.unused.map { |album| [album.title, album.id] }], + ['In use', Album.used.map { |album| [album.title, album.id] }] + ] + grouped_options_for_select(grouped_options) + %> + <%= select_tag 'available_albums', grouped_options_for_select(grouped_options) %> + <% end %> +
    \ No newline at end of file diff --git a/app/views/collections/_row_collections.html.erb b/app/views/collections/_row_collections.html.erb new file mode 100644 index 0000000..2b2224b --- /dev/null +++ b/app/views/collections/_row_collections.html.erb @@ -0,0 +1,29 @@ +
    +
    + <% @collections.in_groups_of(4).each do |group| %> + <% unless group.empty? %> +
      + <% group.compact.each_with_index do |collection, index| %> +
    • +
      + <%= image_tag collection.albums.first.photos.first.attachment.thumb.url %> +
      +
      <%= collection.title %>
      + <%= collection.description %> +
      +

      <%= link_to 'View', (collection_path(collection) unless collection.albums.empty? || collection.albums.first.photos.empty?), {:class => 'btn btn-primary'} %>

      +
      + + +
      + <%= ratings_for collection %> +
      +
      +
      +
    • + <% end %> +
    + <% end %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/collections/index.html.erb b/app/views/collections/index.html.erb index 478fa3a..615087e 100644 --- a/app/views/collections/index.html.erb +++ b/app/views/collections/index.html.erb @@ -1,36 +1,6 @@ -
    - <%= render 'shared/home_slider' %> -
    -
    -
    -
    - <% @collections.in_groups_of(4).each do |group| %> - <% unless group.empty? %> -
      - <% group.compact.each_with_index do |collection, index| %> -
    • -
      - <%= image_tag collection.albums.first.photos.first.attachment.collection.url %> -
      -
      <%= collection.title %>
      -

      <%= collection.description %>

      -

      <%= link_to 'View', (collection_path(collection) unless collection.albums.empty? || collection.albums.first.photos.empty?), {:class => 'btn btn-primary'} %>

      - <%= ratings_for collection %> -
      -
      -
    • - <% end %> -
    - <% end %> - <% end %> -
    -
    +

    <%= t('activerecord.models.collection.pluralize') %>

    +<%= paginate @collections %> +<%= render 'row_collections' %> +<%= paginate @collections %> - -<%= content_for :action_links do %> - <% if current_user and current_user.has_role?("admin") %> - <%= link_to "New collection", new_collection_path %> - <% end %> -<% end %> - diff --git a/app/views/collections/new.html.erb b/app/views/collections/new.html.erb index 6145682..6b577ee 100644 --- a/app/views/collections/new.html.erb +++ b/app/views/collections/new.html.erb @@ -1,7 +1,8 @@ -

    New collection

    - -<%= form_for @collection do |f| %> +<%= form_for @collection, :html => {:class => 'form-horizontal'} do |f| %> + <%= t('activerecord.actions.new', :model => I18n.t('activerecord.models.collection.one')) %> <%= f.error_messages %> <%= render :partial => "form", :object => f %> - <%= f.submit "Create" %> +
    + <%= f.button "Create", :class => 'btn btn-primary btn-large' %> +
    <% end %> \ No newline at end of file diff --git a/app/views/collections/show.html.erb b/app/views/collections/show.html.erb index 6ec99b4..45db1be 100644 --- a/app/views/collections/show.html.erb +++ b/app/views/collections/show.html.erb @@ -1,22 +1,12 @@ -

    <%= h @collection.title %>

    -

    <%= h @collection.description %>

    +

    <%= @collection.title %>

    +

    <%= @collection.description %>

    -<% for album in @albums %> -
    -
    - <%= render :partial => "photos/thumb", :locals => {:photo => album.photos.first } unless album.photos.empty? %> -

    <%= link_to album.title, collection_album_path(@collection, album) %>

    -
    -
    - <%= render :partial => "photos/thumb", :collection => album.photos.find(:all, :limit => 5, :offset => 1), :as => :photo %> -
    -
    -<% end %> +<%= render :partial => 'albums/row_collections' %> <%= content_for :action_links do %> -<% if current_user and current_user.has_role?("admin") %> -<%= link_to "PDF", collection_path(@collection, :format => 'pdf') %> |  -<%= link_to "Edit collection", edit_collection_path(@collection) %> | -<%= link_to "New album", new_collection_album_path(@collection) %> -<% end %> + <% if current_user and current_user.has_role?("admin") %> +
  • <%= link_to "PDF", collection_path(@collection, :format => 'pdf') %>
  • +
  • <%= link_to "Edit collection", edit_collection_path(@collection) %>
  • +
  • <%= link_to "New album", new_collection_album_path(@collection) %>
  • + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 0000000..cf865c6 --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,5 @@ +
    + <%= render 'shared/home_slider' %> +
    +

    <%= t('activerecord.models.collection.popular') %>

    +<%= render :partial => 'collections/row_collections' %> \ No newline at end of file diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb new file mode 100644 index 0000000..f7e9846 --- /dev/null +++ b/app/views/kaminari/_first_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "First" page + - available local variables + url: url to the first page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.first? %> +
  • + <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> +
  • +<% end %> \ No newline at end of file diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb new file mode 100644 index 0000000..2bcc522 --- /dev/null +++ b/app/views/kaminari/_gap.html.erb @@ -0,0 +1,8 @@ +<%# Non-link tag that stands for skipped pages... + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • <%= raw(t 'views.pagination.truncate') %>
  • \ No newline at end of file diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb new file mode 100644 index 0000000..e27c2a7 --- /dev/null +++ b/app/views/kaminari/_last_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "Last" page + - available local variables + url: url to the last page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.last? %> + +<% end %> diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb new file mode 100644 index 0000000..7bccfdc --- /dev/null +++ b/app/views/kaminari/_next_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "Next" page + - available local variables + url: url to the next page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.last? %> +
  • + <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> +
  • +<% end %> diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb new file mode 100644 index 0000000..3cf4a8e --- /dev/null +++ b/app/views/kaminari/_page.html.erb @@ -0,0 +1,12 @@ +<%# Link showing page number + - available local variables + page: a page object for "this" page + url: url to this page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +
  • + <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> +
  • diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb new file mode 100644 index 0000000..92a916d --- /dev/null +++ b/app/views/kaminari/_paginator.html.erb @@ -0,0 +1,25 @@ +<%# The container tag + - available local variables + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote + paginator: the paginator that renders the pagination tags inside +-%> +<%= paginator.render do -%> + +<% end -%> diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb new file mode 100644 index 0000000..336073b --- /dev/null +++ b/app/views/kaminari/_prev_page.html.erb @@ -0,0 +1,13 @@ +<%# Link to the "Previous" page + - available local variables + url: url to the previous page + current_page: a page object for the currently displayed page + num_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> +<% unless current_page.first? %> + +<% end %> diff --git a/app/views/layouts/bootstrap.html.erb b/app/views/layouts/bootstrap.html.erb index defdafc..69852ac 100644 --- a/app/views/layouts/bootstrap.html.erb +++ b/app/views/layouts/bootstrap.html.erb @@ -7,8 +7,9 @@ <%= render :partial => 'shared/nav_bar' %>
    -
    <%= flash[:notice] %>
    + <%= render :partial => 'shared/notifications' %> + <%= render_breadcrumbs %> <%= yield %>
    diff --git a/app/views/photos/_row_collections.html.erb b/app/views/photos/_row_collections.html.erb new file mode 100644 index 0000000..9bc4b80 --- /dev/null +++ b/app/views/photos/_row_collections.html.erb @@ -0,0 +1,22 @@ +
    +
    + <% @photos.in_groups_of(4).each do |group| %> + <% unless group.empty? %> +
      + <% group.compact.each_with_index do |photo, index| %> +
    • +
      + <%= link_to image_tag(photo.attachment.thumb.url), photo.attachment.largest.url, :class => 'fancybox-thumb', :rel => "fancybox-thumb" %> +
      +
      <%= photo.title %>
      + <%= photo.description %> + <%= ratings_for photo %> +
      +
      +
    • + <% end %> +
    + <% end %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/photos/_thumb.html.erb b/app/views/photos/_thumb.html.erb index d8eff19..c3c4a9f 100644 --- a/app/views/photos/_thumb.html.erb +++ b/app/views/photos/_thumb.html.erb @@ -1 +1 @@ -<%= link_to (image_tag eval('photo.attachment.' + (defined?(photosize) ? photosize : "album") + '.url')), [photo.album.collections.first, photo.album, photo] %> \ No newline at end of file +<%= link_to image_tag(eval('photo.attachment.' + (defined?(photosize) ? photosize : "thumb") + '.url')), [photo.album.collections.first, photo.album, photo] %> \ No newline at end of file diff --git a/app/views/photos/index.html.erb b/app/views/photos/index.html.erb index 4721360..678cf40 100644 --- a/app/views/photos/index.html.erb +++ b/app/views/photos/index.html.erb @@ -1,4 +1,7 @@ - +<%#= render :partial => 'photos/thumb', :collection => @photos, :as => :photo %> +<%= paginate @photos %> +<%= render :partial => 'photos/row_collections' %> +<%= paginate @photos %> <%= content_for :action_links do %> <%= link_to "Show albums containing photos tagged with #{params[:q]}", albums_path(:q => params[:q]) if params[:q] %> diff --git a/app/views/shared/_head.html.erb b/app/views/shared/_head.html.erb index 0e4f891..ce72c81 100644 --- a/app/views/shared/_head.html.erb +++ b/app/views/shared/_head.html.erb @@ -10,8 +10,11 @@ +<%= yield :styles %> <%= stylesheet_link_tag "application", :media => "all" %> + <%= javascript_include_tag "application" %> +<%= yield :head %> <%= favicon_link_tag 'images/apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %> @@ -32,7 +35,6 @@ <%= favicon_link_tag 'images/favicon.ico', :rel => 'shortcut icon' %> -<%= yield :head %> <%= yield :javascript %> <%= raw ajaxful_rating_style %> <%= raw ajaxful_rating_script %> \ No newline at end of file diff --git a/app/views/shared/_home_slider.html.erb b/app/views/shared/_home_slider.html.erb index 4c8e343..f93342b 100644 --- a/app/views/shared/_home_slider.html.erb +++ b/app/views/shared/_home_slider.html.erb @@ -1,11 +1,26 @@ +<%= content_for :styles do %> + <%= stylesheet_link_tag "anythingslider/anythingslider" %> + + +<% end %> <%= content_for :head do %> - <%= stylesheet_link_tag "anythingslider/anythingslider", "anythingslider/theme-metallic", "anythingslider/animate" %> + <%#= stylesheet_link_tag "anythingslider/anythingslider", "anythingslider/theme-metallic", "anythingslider/animate" %> + <%= javascript_include_tag "anythingslider/jquery.anythingslider.min" %> - - <% end %>
    diff --git a/app/views/shared/_nav_bar.html.erb b/app/views/shared/_nav_bar.html.erb index 498673c..88080b4 100644 --- a/app/views/shared/_nav_bar.html.erb +++ b/app/views/shared/_nav_bar.html.erb @@ -6,15 +6,14 @@ - Photomix - + Photomix