diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index e988aed..0c36596 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -4,10 +4,10 @@ class CategoriesController < ApplicationController # GET /categories.xml def index @categories = Category.paginate :all, :page => params[:page], :per_page => 4 - + @num_categories = @categories.count - - @photos = Photo.all(:limit => 2, :order => 'RANDOM()', :conditions => { :featured => true }) + + @photos = Photo.all(:limit => 2, :order => 'RANDOM()', :conditions => { :featured => true, :enabled => true }) respond_to do |format| format.html # index.html.erb @@ -26,63 +26,4 @@ class CategoriesController < ApplicationController end end - # GET /categories/new - # GET /categories/new.xml - def new - @category = Category.new - - respond_to do |format| - format.html # new.html.erb - format.xml { render :xml => @category } - end - end - - # GET /categories/1/edit - def edit - @category = Category.find(params[:id]) - end - - # POST /categories - # POST /categories.xml - def create - @category = Category.new(params[:category]) - - respond_to do |format| - if @category.save - format.html { redirect_to(@category, :notice => 'Category was successfully created.') } - format.xml { render :xml => @category, :status => :created, :location => @category } - else - format.html { render :action => "new" } - format.xml { render :xml => @category.errors, :status => :unprocessable_entity } - end - end - end - - # PUT /categories/1 - # PUT /categories/1.xml - def update - @category = Category.find(params[:id]) - - respond_to do |format| - if @category.update_attributes(params[:category]) - format.html { redirect_to(@category, :notice => 'Category was successfully updated.') } - format.xml { head :ok } - else - format.html { render :action => "edit" } - format.xml { render :xml => @category.errors, :status => :unprocessable_entity } - end - end - end - - # DELETE /categories/1 - # DELETE /categories/1.xml - def destroy - @category = Category.find(params[:id]) - @category.destroy - - respond_to do |format| - format.html { redirect_to(categories_url) } - format.xml { head :ok } - end - end end diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index c6a30cd..3a7cf31 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -1,10 +1,10 @@ class ContactsController < ApplicationController layout "photos" - + def new @contact = Contact.new(:id => 1) end - + def create @contact = Contact.new(params[:contact]) if @contact.save diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 63cf462..0702ecb 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -2,7 +2,7 @@ class PagesController < ApplicationController layout "photos" def index - @photo = Photo.first(:order => 'RANDOM()', :conditions => { :featured => true }) + @photo = Photo.first(:order => 'RANDOM()', :conditions => { :featured => true, :enabled => true }) end def about diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index ef9fb6e..aace989 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -7,7 +7,7 @@ class PhotosController < ApplicationController def index if params[:category_id] @category = Category.find_by_id(params[:category_id]) - @photos = @category.photos.paginate :page => params[:page], :per_page => 11 + @photos = @category.photos.paginate :page => params[:page], :conditions => { :enabled => true }, :per_page => 11 @num_photos = @photos.count else @photos = Photo.paginate :all, :page => params[:page], :per_page => 11 @@ -17,16 +17,6 @@ class PhotosController < ApplicationController format.html end end - - def create - @photo = Photo.new(params[:photo]) - if @photo.save - flash[:notice] = 'Photo was successfully saved' - redirect_to photo_url(@photo) - else - render :action => :new - end - end def show @photo = Photo.find(params[:id]) diff --git a/app/views/layouts/photos.html.erb b/app/views/layouts/photos.html.erb index c09d31b..4563638 100644 --- a/app/views/layouts/photos.html.erb +++ b/app/views/layouts/photos.html.erb @@ -10,6 +10,7 @@ <%= stylesheet_link_tag "squaregrid", :media => "all" %> <%= stylesheet_link_tag "photos", :media => "all" %> <%= stylesheet_link_tag "fancybox", :media => "all" %> + <%= stylesheet_link_tag "scrollbars", :media => "screen" %> <%= javascript_include_tag 'jquery', 'jquery.validate', 'jrails', 'fancybox', 'photos' %> diff --git a/config/typus/application.yml b/config/typus/application.yml index af99652..f23a93c 100644 --- a/config/typus/application.yml +++ b/config/typus/application.yml @@ -14,8 +14,8 @@ Category: Photo: fields: - default: title, sort, featured - form: photo, title, description, flickr_url, featured, sort + default: title, sort, enabled, featured + form: photo, title, description, flickr_url, enabled, featured, sort order_by: relationships: categories filters: diff --git a/db/migrate/20101202155552_add_enabled_to_photos.rb b/db/migrate/20101202155552_add_enabled_to_photos.rb new file mode 100644 index 0000000..8355e14 --- /dev/null +++ b/db/migrate/20101202155552_add_enabled_to_photos.rb @@ -0,0 +1,9 @@ +class AddEnabledToPhotos < ActiveRecord::Migration + def self.up + add_column :photos, :enabled, :boolean, :default => true + end + + def self.down + remove_column :photos, :enabled + end +end diff --git a/db/schema.rb b/db/schema.rb index 652d8e9..aba3c87 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20101013165208) do +ActiveRecord::Schema.define(:version => 20101202155552) do create_table "admin_users", :force => true do |t| t.string "first_name", :default => "", :null => false @@ -61,6 +61,7 @@ ActiveRecord::Schema.define(:version => 20101013165208) do t.text "description" t.integer "sort" t.boolean "featured", :default => false + t.boolean "enabled", :default => true end end diff --git a/public/stylesheets/photos.css b/public/stylesheets/photos.css index 06f38ef..6a4054f 100644 --- a/public/stylesheets/photos.css +++ b/public/stylesheets/photos.css @@ -183,13 +183,14 @@ img { .about-content { background: #444; color: #ccc; + overflow: auto; } .about-content div { padding: 15px 20px; } .about-content div p { margin-bottom: 0.6em; - line-height: 1.4em; + line-height: 1.35em; } /* FORM */ .contact-form { diff --git a/public/stylesheets/scrollbars.css b/public/stylesheets/scrollbars.css new file mode 100644 index 0000000..47ec5d1 --- /dev/null +++ b/public/stylesheets/scrollbars.css @@ -0,0 +1,71 @@ +/* Shamelessly stolen from elliottkember.com, which in turn was shamelessly stolen from maxvoltar.com, which in turn was shamelessly stolen from chatrboxapp.com. */ + +::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +::-webkit-scrollbar-button:start:decrement, +::-webkit-scrollbar-button:end:increment { + display: block; + height: 4px; +} + +::-webkit-scrollbar-button:vertical:increment { + background-color: #fff; + background: transparent; +} + + +::-webkit-scrollbar-track { + -webkit-border-radius: 3px; +} + + +::-webkit-scrollbar-track-piece { + -webkit-border-radius: 3px; +} + +::-webkit-scrollbar-thumb:vertical { + height: 50px; + background-color: #666; + opacity: 0.5; + -webkit-border-radius: 3px; + position: relative; +} + +::-webkit-scrollbar-thumb:horizontal { + width: 50px; + background-color: #999; + -webkit-border-radius: 3px; +} + +::-webkit-scrollbar-thumb:vertical:hover { + background-color: #999; +} +::-webkit-scrollbar-thumb:vertical:active, ::-webkit-scrollbar-thumb:vertical:focus{ + background-color: #ddd; +} + + +html { + /*overflow-y: scroll;*/ + overflow: auto; + /*width: 100% !important;*/ +} + + +/* @group default */ + +#wrapper { + margin: 0 auto; +} + +html { + overflow-x: hidden; +} + +#turn_wrapper { + left: 10px !important; +} +