-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed naming of private galleries and added pages.
- Loading branch information
Showing
81 changed files
with
509 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
class ApplicationController < ActionController::Base | ||
protect_from_forgery | ||
|
||
helper_method :photographer | ||
helper_method :photographer, :page_links | ||
|
||
protected #---- | ||
|
||
def photographer | ||
return @photographer if defined?(@photographer) | ||
@photographer = Photographer.cached | ||
end | ||
end | ||
|
||
def page_links | ||
return @pages if defined?(@pages) | ||
@pages = Page.cached | ||
end | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class PagesController < ApplicationController | ||
inherit_resources | ||
respond_to :html | ||
actions :show | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class PrivateGalleriesController < ApplicationController | ||
respond_to :html | ||
|
||
def show | ||
@photographer = Photographer.first | ||
@private_gallery = PrivateGallery.find_by_token(params[:id]) | ||
if @private_gallery | ||
render | ||
else | ||
redirect_to(root_path, :alert => "Unable to find that private gallery.") | ||
end | ||
end | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class PrivateGalleryMailer < ActionMailer::Base | ||
|
||
def invite(from, to, private_gallery) | ||
@private_gallery = private_gallery | ||
@photographer = Photographer.cached | ||
mail( :from => from, :to => to, :subject => 'Your private gallery is ready!') | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
class Page < ActiveRecord::Base | ||
|
||
# **** | ||
# Validations | ||
validates :name, :presence => true, :length => { :within => 2..32 } | ||
validates :body, :presence => true | ||
|
||
# **** | ||
# Mass-assignment protection | ||
attr_accessible :name, :body, :image, :image_cache, :remove_image | ||
|
||
# Image attachment. | ||
mount_uploader :image, ImageUploader | ||
|
||
# **** | ||
# Pagination | ||
paginates_per 16 | ||
|
||
def to_param | ||
"#{id}-#{name}".parameterize | ||
end | ||
|
||
# Caching | ||
# ------- | ||
CACHED = 'pages' | ||
|
||
after_save :clear_cache | ||
|
||
def self.cached | ||
Rails.cache.fetch(CACHED, :expires_in => 1.day) do | ||
Page.order(:name).all | ||
end | ||
end | ||
|
||
def clear_cache | ||
Page.clear_cache | ||
end | ||
|
||
def self.clear_cache | ||
Rails.cache.delete(CACHED) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
app/models/gallery_event.rb → app/models/private_gallery_event.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# encoding: utf-8 | ||
|
||
class PhotoUploader < CarrierWave::Uploader::Base | ||
include CarrierWave::MiniMagick | ||
|
||
# Override the directory where uploaded files will be stored. | ||
# This is a sensible default for uploaders that are meant to be mounted: | ||
def store_dir | ||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" | ||
end | ||
|
||
# Provide a default URL as a default if there hasn't been a file uploaded. | ||
def default_url | ||
"/images/misc/missing.png" | ||
end | ||
|
||
# Resize the original | ||
process :resize_to_limit => [580, 640] | ||
|
||
# Create a thumbnail | ||
version :thumb do | ||
process :resize_to_fill => [150, 100] | ||
end | ||
|
||
# Add a white list of extensions which are allowed to be uploaded. | ||
def extension_white_list | ||
%w(jpg jpeg gif png) | ||
end | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.