Permalink
Browse files

Merge branch 'master' of github.com:rapind/grokphoto

  • Loading branch information...
2 parents 487c53b + fc4da4a commit db04f1b1cde9d427eff375f697ffdc283d6d9d68 @rapind committed Mar 28, 2012
View
@@ -52,6 +52,9 @@ gem 'hirefireapp', '~> 0.0.5'
# Factory
gem 'factory_girl_rails', '~> 1.1.0'
+# Used to obsfucate email addresses and phone numbers.
+gem "enkoder_rails", git: "git://github.com/supapuerco/hivelogic-enkoder-rails.git"
+
# Gems used only for assets and not required
# In production environments by default.
group :assets do
View
@@ -14,6 +14,13 @@ GIT
actionpack (~> 3.0)
activemodel (~> 3.0)
+GIT
+ remote: git://github.com/supapuerco/hivelogic-enkoder-rails.git
+ revision: 91824571a69540c2386686edbdd852234f14412c
+ specs:
+ enkoder_rails (0.1)
+ activesupport (>= 3.0)
+
GEM
remote: http://rubygems.org/
specs:
@@ -232,6 +239,7 @@ DEPENDENCIES
delayed_job_active_record (~> 0.3.1)
devise (~> 1.5.3)
dragonfly (~> 0.9.11)
+ enkoder_rails!
factory_girl_rails (~> 1.1.0)
fog (~> 0.10.0)
haml (~> 3.1.4)
@@ -15,4 +15,8 @@ $(document).ready(function() {
}
);
+ $('.carousel').carousel({
+ interval: 5000
+ })
+
});
@@ -10,6 +10,17 @@ body
.page-header
padding-bottom: 10px !important
+#carousel
+ width: 820px
+ height: 400px
+ margin-top: 20px
+ .carousel-control
+ top: 47%
+
+.page-image
+ margin: 0 0 20px 20px
+ float: right
+
.well
h2
margin-bottom: 10px
@@ -38,6 +49,7 @@ div.error
color: #aaa !important
abbr[title='required']
color: #c00
+
.controls
textarea
width: 440px
@@ -113,7 +125,24 @@ ul.image_list
a[rel='lightbox'] img
margin: 6px
-
+
+footer
+ background: #252525
+ border-top: 0
+ margin-top: 20px
+ padding-top: 20px
+ h4
+ line-height: 24px
+ font-size: 16px
+ h3, h4, p, a
+ color: white
+
+ #footer-floor
+ margin-top: 10px
+ padding-top: 10px
+ text-align: right
+ background: #1B1B1B
+
#footer
margin-top: 30px
padding-top: 5px
@@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base
protect_from_forgery
- helper_method :photographer, :page_links
+ helper_method :photographer, :galleries, :pages
before_filter :set_timezone
protected #----
@@ -11,7 +11,12 @@ def photographer
@photographer = Photographer.cached
end
- def page_links
+ def galleries
+ return @galleries if defined?(@galleries)
+ @galleries = Gallery.cached
+ end
+
+ def pages
return @pages if defined?(@pages)
@pages = Page.cached
end
@@ -1,10 +1,12 @@
class HomeController < ApplicationController
-
+ layout 'splash'
+
def timestamp
render :text => Time.zone.now
end
- def index
+ def index
+ @galleries = Gallery.all
end
end
View
@@ -28,11 +28,35 @@ def photos_attrs=(attrs)
# Default ordering
default_scope :order => 'position'
+ # Caching
+ # -------
+ CACHED = 'galleries'
+
+ after_save :clear_cache
+
+ def self.cached
+ Rails.cache.fetch(CACHED, :expires_in => 1.day) do
+ self.all
+ end
+ end
+
+ def clear_cache
+ Gallery.clear_cache
+ end
+
+ def self.clear_cache
+ Rails.cache.delete(CACHED)
+ end
+
# ****
# Logging
after_create :log_create_event
after_update :log_update_event
+ def to_param
+ "#{id}-#{name}".parameterize
+ end
+
private #----
def log_create_event
@@ -0,0 +1,6 @@
+- content_for :title, @gallery.name
+
+%ul.thumbnails
+ - @gallery.photos.each do |photo|
+ %li.span3
+ = link_to(image_tag(photo.photo.thumb('260x180!').url, :size => '260x180'), photo.photo.url, :class => "thumbnail", :rel => 'lightbox')
@@ -1 +1,10 @@
-Nothing to see here...
+.hero-unit
+ %h1= photographer.name
+ %p Maternity, newborn, and family lifestyle photography for the Toronto area.
+ #carousel.carousel
+ .carousel-inner
+ - @galleries.each_with_index do |gallery, idx|
+ %div{ :class => "item#{' active' if idx == 0}" }
+ = link_to( image_tag(gallery.cover.thumb('820x400!').url), gallery_path(gallery) )
+ %a.carousel-control.left{ :href => "#carousel", :'data-slide' => "prev" } &lsaquo;
+ %a.carousel-control.right{ :href => "#carousel", :'data-slide' => "next" } &rsaquo;
@@ -6,37 +6,35 @@
= javascript_include_tag 'application'
= csrf_meta_tags
%body{ :class => "#{yield(:body_class).presence}" }
- .navbar.navbar-fixed-top
- .navbar-inner
- .container
- %ul.nav
- %li{ :class => controller.controller_name == 'home' ? 'active' : '' }= link_to 'Home', root_path
- %li= link_to('Newborns', '#')
- %li= link_to('Kids', '#')
- %li= link_to('Family', '#')
- - page_links.each do |page|
- %li{ :class => (defined?(@page) and @page.id == page.id ? 'active' : '') }= link_to(page.name, page_path(page))
- - if photographer.blog_url
- %li= link_to('Blog', photographer.blog_url)
- %li.divider-vertical
- %li{ :class => controller.controller_name == 'contact_requests' ? 'active' : '' }= link_to('Contact', new_contact_request_path)
- .pull-right= link_to(photographer.name, root_path, :class => 'brand')
- .container
- - if notice
- .alert.alert-block{ :'data-dismiss' => 'alert' }
- %a.close ×
- %p= notice
- .page-header
- %h1= yield(:title).presence || 'Home'
- .row
- - if content_for?(:sidebar)
- .span3
- .well
- = yield(:sidebar)
- %p &nbsp;
- %p &nbsp;
- .span9= yield
- - else
- .span12= yield
- #footer.container
- = "&copy; 2011, #{photographer.name}, All Rights Reserved".html_safe
+ .navbar.navbar-fixed-top
+ .navbar-inner
+ .container
+ %ul.nav
+ - galleries.each do |gallery|
+ %li{ :class => (defined?(@gallery) and @gallery.id == gallery.id ? 'active' : '') }= link_to(gallery.name, gallery_path(gallery))
+ - pages.each do |page|
+ %li{ :class => (defined?(@page) and @page.id == page.id ? 'active' : '') }= link_to(page.name, page_path(page))
+ - if photographer.blog_url
+ %li= link_to('Blog', photographer.blog_url)
+ %li.divider-vertical
+ %li{ :class => controller.controller_name == 'contact_requests' ? 'active' : '' }= link_to('Contact', new_contact_request_path)
+ .pull-right= link_to(photographer.name, root_path, :class => 'brand')
+ .container
+ - if notice
+ .alert.alert-block{ :'data-dismiss' => 'alert' }
+ %a.close ×
+ %p= notice
+ - if content_for?(:title)
+ .page-header
+ %h1= yield(:title)
+ .row
+ - if content_for?(:sidebar)
+ .span3
+ .well
+ = yield(:sidebar)
+ %p &nbsp;
+ %p &nbsp;
+ .span9= yield
+ - else
+ .span12= yield
+ = render :partial => 'shared/footer'
@@ -0,0 +1,12 @@
+!!!
+%html{ 'class' => 'no-js', :lang => 'en' }
+ %head
+ %title= "#{yield(:meta_title).presence || yield(:page_title).presence || 'Home'} | #{photographer.name} Administration"
+ = stylesheet_link_tag 'application'
+ = javascript_include_tag 'application'
+ = csrf_meta_tags
+ %body
+ .container
+ .row
+ .span12= yield
+ = render :partial => 'shared/footer'
@@ -1,2 +1,3 @@
- content_for :title, @page.name
+= image_tag(@page.image.url, :class => 'page-image') if @page.image_uid
= @page.body.to_html.html_safe
@@ -0,0 +1,29 @@
+%footer
+ .container
+ .row
+ .span12
+ .row
+ .span3
+ %h4 Photo Galleries
+ %ul.unstyled
+ - galleries.each do |gallery|
+ %li= link_to(gallery.name, gallery_path(gallery))
+ .span3
+ %h4 Company Information
+ %ul.unstyled
+ - pages.each do |page|
+ %li= link_to(page.name, page_path(page))
+ %li= link_to('Contact', new_contact_request_path)
+ %li= link_to('Blog', new_contact_request_path)
+ .span6
+ %p= photographer.description
+ #footer-floor
+ .container
+ .row
+ .span12
+ %h4
+ - if photographer.phone
+ = enkode(photographer.phone)
+ \/
+ = enkode_mail(photographer.email, photographer.email)
+ %p= "&copy; 2011, #{photographer.name}, All Rights Reserved".html_safe
View
@@ -1,8 +1,9 @@
puts "Creating photographer"
p = Photographer.create(
- :name => 'Dave Rapin Photography',
- :email => 'dave@grokphoto.org',
+ :name => 'Grok Photography',
+ :email => 'grok@grokphoto.org',
:password => 'password',
+ :phone => '416.123.1234',
:description => "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
:blog_url => 'http://rapin.com',
:twitter_url => 'http://twitter.com/#!/rapind',

0 comments on commit db04f1b

Please sign in to comment.