Commit 1dfa54dc authored by Martin Markech's avatar Martin Markech
Browse files

refactoring

parent 3a813cc8
......@@ -57,12 +57,14 @@ module Refinery
# end
# Create different versions of your uploaded files
=begin
version :collection do
process :resize_to_fill => Refinery::PhotoGallery.collection_dimensions
def store_dir
"thumbs/#{model.album.path}"
end
end
=end
version :album do
process :resize_to_fill => Refinery::PhotoGallery.album_dimensions
def store_dir
......
<div id="photo-<%= photo.id %>" class="form-photo-field">
<%= fields_for "photos[photo]", photo, :index => photo.id do |p|%>
<div class="form_photo_left">
<%= link_to (image_tag photo.file.collection.url), photo.file.single.url, {:target=> "_blank"} %>
<%= link_to (image_tag photo.file.preview.url), photo.file.single.url, {:target=> "_blank"} %>
</div>
<div class="form_photo_right">
......
......@@ -3,9 +3,7 @@
<%= javascript_include_tag "/assets/refinery/photo_gallery/admin/plupload/plupload.full.js" -%>
<%= javascript_include_tag "/assets/refinery/photo_gallery/admin/plupload/jquery.plupload.queue.js" -%>
<% if Refinery::PhotoGallery.plupload_locale.present? %>
<%= javascript_include_tag "/assets/refinery/photo_gallery/admin/plupload/i18n/" + Refinery::PhotoGallery.plupload_locale + ".js" -%>
<% end %>
<%= javascript_include_tag "/assets/refinery/photo_gallery/admin/plupload/i18n/" + Refinery::PhotoGallery.plupload_locale.to_s + ".js" -%>
<script type="text/javascript">
<% session_key = Rails.application.config.session_options[:key] %>
......@@ -31,12 +29,6 @@
quality : <%= Refinery::PhotoGallery.client_side_resize_params[:quality] %>},
<% end %>
// Flash settings
flash_swf_url : '/assets/refinery/photo_gallery/admin/plupload/plupload.flash.swf',
// Silverlight settings
silverlight_xap_url : '/assets/refinery/photo_gallery/admin/plupload/plupload.silverlight.xap',
// Post init events, bound after the internal events
init : {
FileUploaded: function(up, file, info) {
......@@ -81,7 +73,4 @@
</div>
<% end %>
<br><%#= link_to "Edit uploaded photos", untouched_album_photos_path( @album ) %>
<br><%#= link_to "Back to #{@album.title}", @album %>
\ No newline at end of file
<br><br>
\ No newline at end of file
<% cache "refinery/photo_gallery/albums/#{params[:id]}/page_#{params[:page]}" do %>
<%= will_paginate @page.album.photos.page(params[:page]) %>
<div style="clear:both;"></div>
<%# cache "refinery/photo_gallery/albums/#{params[:id]}/page_#{params[:page]}" do %>
<%= will_paginate @page.photos.page(params[:page]) %>
<% @page.album.photos.each_with_index do |photo, index| %>
<div class="column portfolio-item">
<div class="portfolio-thumbnail-image">
<%# :width => Refinery::PhotoGallery.album_dimensions[0], :height => Refinery::PhotoGallery.album_dimensions[1] %>
<%= link_to (image_tag photo.file.album.url ), photo.file.single.url, {
<ul id="gallery" class="clearfix">
<% @page.photos.each_with_index do |photo, index| %>
<li>
<%= link_to (image_tag photo.file.album.url, :width => Refinery::PhotoGallery.album_dimensions[0], :height => Refinery::PhotoGallery.album_dimensions[1] ), photo.file.single.url, {
:target=> "_blank",
:class=>"fancybox",
:data =>{:title=> t('.image') + ' ' + (index + 1 ).to_s + '/' + @page.album.photos.length.to_s + ' ' + photo.title + '<br/><br/>' + photo.description},
:data =>{:title=> t('.image') + ' ' + (index + 1 ).to_s + '/' + @page.photos.length.to_s + ' ' + photo.title + '<br/><br/>' + photo.description},
:rel=>"group",
:title=> photo.title } %>
</div>
</div>
<% end %>
</li>
<% end %>
</ul>
<div style="clear:both;"></div>
<%= will_paginate @page.album.photos.page(params[:page]) %>
<% end %>
<%= will_paginate @page.photos.page(params[:page]) %>
<%# end %>
<% cache "refinery/photo_gallery/albums/#{params[:id]}" do %>
<h2 >
<%= @page.album.title %>
</h2>
<div>
<%= raw @page.album.description %>
</div>
<% end %>
<% if @page.album.present? %>
<% cache "refinery/photo_gallery/albums/#{params[:id]}" do %>
<h2 >
<%= @page.album.title %>
</h2>
<div>
<%= raw @page.album.description %>
</div>
<% end %>
<div id="photo_gallery">
<%= render :partial => "/refinery/photo_gallery/albums/photos" %>
</div>
<%= render :partial => "/refinery/photo_gallery/albums/photos" %>
<% end %>
Refinery::PhotoGallery.configure do |config|
# At least one or more comma-separated values from list: html5,flash,browserplus,silverlight,gears
# config.runtimes = <%= Refinery::PhotoGallery.runtimes.inspect %>
# Max file size of uploaded image
# config.max_file_size = <%= Refinery::PhotoGallery.max_file_size.inspect %>
......@@ -14,8 +11,7 @@ Refinery::PhotoGallery.configure do |config|
# config.client_side_resize_params = <%= Refinery::PhotoGallery.client_side_resize_params.inspect %>
# Locale name for Plupload. Put your locale file in /app/assets/javascripts/refinery/photo_gallery/admin/plupload/i18n/ and write here filename WITHOUT file extension. E.g: cs
# To leave english, put ''
# config.locale = <%= Refinery::PhotoGallery.plupload_locale.inspect %>
# config.plupload_locale = <%= Refinery::PhotoGallery.plupload_locale.inspect %>
# Case insensitive extension white list for carrierwave
# config.extension_white_list = <%= Refinery::PhotoGallery.extension_white_list.inspect %>
......@@ -27,7 +23,6 @@ Refinery::PhotoGallery.configure do |config|
# config.delete_uploaded_file = <%= Refinery::PhotoGallery.delete_uploaded_file.inspect %>
# Thumbs dimensions in pixels. E.g: [950,950] for width:950, height: 950
# config.collection_dimensions = <%= Refinery::PhotoGallery.collection_dimensions.inspect %>
# config.album_dimensions = <%= Refinery::PhotoGallery.album_dimensions.inspect %>
# config.preview_dimensions = <%= Refinery::PhotoGallery.preview_dimensions.inspect %>
# config.single_dimensions = <%= Refinery::PhotoGallery.single_dimensions.inspect %>
......
......@@ -8,23 +8,21 @@ module Refinery
self.runtimes = 'html5,flash,browserplus,silverlight,gears'
#self.runtimes = 'html5,flash,browserplus,silverlight,gears'
self.runtimes = 'html5'
self.max_file_size = '10mb'
#TODO or per album?
#TODO by default false!
self.client_side_resize = true
self.client_side_resize_params = {:width => 950, :height=> 950, :quality=> 100}
#TODO leave blank before publishing this gem!
self.plupload_locale = ''
self.plupload_locale = Refinery::I18n.default_locale.to_s
self.extension_white_list = %w(jpg jpeg gif png bmp tiff)
self.photo_gallery_dir = "/system/refinery/photo_gallery"
self.photo_gallery_dir_relative_to_root = '/public' + self.photo_gallery_dir
#TODO or per album?
self.delete_uploaded_file = true
self.collection_dimensions = [200, 200]
self.album_dimensions = [150, 150]
#self.collection_dimensions = [200, 200]
self.album_dimensions = [140, 140]
self.preview_dimensions = [210, 210]
self.single_dimensions = [950, 950]
self.single_dimensions = [900, 900]
self.albums_per_page = 10
self.collections_per_page = 10
......
......@@ -5,6 +5,7 @@ module Refinery
def has_one_page_album
has_one :album_page, :as => :page
has_one :album, :through => :album_page
has_many :photos, :class_name => Refinery::PhotoGallery::Photo, :through => :album
accepts_nested_attributes_for :album_page
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment