├── log
└── .gitkeep
├── lib
├── tasks
│ ├── .gitkeep
│ └── sample_data.rake
└── assets
│ └── .gitkeep
├── public
├── favicon.ico
├── robots.txt
├── 422.html
├── 404.html
└── 500.html
├── .rspec
├── app
├── mailers
│ └── .gitkeep
├── models
│ ├── .gitkeep
│ ├── micropost.rb
│ └── user.rb
├── helpers
│ ├── pages_helper.rb
│ ├── microposts_helper.rb
│ ├── application_helper.rb
│ ├── users_helper.rb
│ └── sessions_helper.rb
├── assets
│ ├── images
│ │ ├── logo.png
│ │ └── rails.png
│ ├── stylesheets
│ │ ├── blueprint
│ │ │ ├── src
│ │ │ │ ├── grid.png
│ │ │ │ ├── reset.css
│ │ │ │ ├── print.css
│ │ │ │ ├── ie.css
│ │ │ │ ├── forms.css
│ │ │ │ ├── typography.css
│ │ │ │ └── grid.css
│ │ │ ├── plugins
│ │ │ │ ├── buttons
│ │ │ │ │ ├── icons
│ │ │ │ │ │ ├── key.png
│ │ │ │ │ │ ├── tick.png
│ │ │ │ │ │ └── cross.png
│ │ │ │ │ ├── readme.txt
│ │ │ │ │ └── screen.css
│ │ │ │ ├── link-icons
│ │ │ │ │ ├── icons
│ │ │ │ │ │ ├── doc.png
│ │ │ │ │ │ ├── feed.png
│ │ │ │ │ │ ├── im.png
│ │ │ │ │ │ ├── lock.png
│ │ │ │ │ │ ├── pdf.png
│ │ │ │ │ │ ├── xls.png
│ │ │ │ │ │ ├── email.png
│ │ │ │ │ │ ├── external.png
│ │ │ │ │ │ └── visited.png
│ │ │ │ │ ├── readme.txt
│ │ │ │ │ └── screen.css
│ │ │ │ ├── rtl
│ │ │ │ │ ├── readme.txt
│ │ │ │ │ └── screen.css
│ │ │ │ └── fancy-type
│ │ │ │ │ ├── readme.txt
│ │ │ │ │ └── screen.css
│ │ │ ├── print.css
│ │ │ ├── ie.css
│ │ │ └── screen.css
│ │ ├── pages.css.scss
│ │ ├── users.css.scss
│ │ ├── sessions.css.scss
│ │ ├── microposts.css.scss
│ │ ├── application.css
│ │ └── custom.css
│ └── javascripts
│ │ ├── pages.js.coffee
│ │ ├── sessions.js.coffee
│ │ ├── users.js.coffee
│ │ ├── microposts.js.coffee
│ │ └── application.js
├── views
│ ├── pages
│ │ ├── about.html.erb
│ │ ├── help.html.erb
│ │ ├── contact.html.erb
│ │ └── home.html.erb
│ ├── microposts
│ │ ├── create.html.erb
│ │ ├── destory.html.erb
│ │ └── _micropost.html.erb
│ ├── users
│ │ ├── index.html.erb
│ │ ├── new.html.erb
│ │ ├── _user.html.erb
│ │ ├── edit.html.erb
│ │ ├── _fields.html.erb
│ │ └── show.html.erb
│ ├── layouts
│ │ ├── _footer.html.erb
│ │ ├── _stylesheet.html.erb
│ │ ├── application.html.erb
│ │ └── _header.html.erb
│ ├── shared
│ │ ├── _feed.html.erb
│ │ ├── _micropost_form.html.erb
│ │ ├── _user_info.html.erb
│ │ ├── _error_messages.html.erb
│ │ └── _feed_item.html.erb
│ └── sessions
│ │ └── new.html.erb
└── controllers
│ ├── application_controller.rb
│ ├── pages_controller.rb
│ ├── sessions_controller.rb
│ ├── microposts_controller.rb
│ └── users_controller.rb
├── vendor
├── plugins
│ └── .gitkeep
└── assets
│ └── stylesheets
│ └── .gitkeep
├── README
├── db
├── migrate
│ ├── 20111229134449_add_salt_to_user.rb
│ ├── 20111229131616_add_password_to_users.rb
│ ├── 20111230155106_add_admin_to_users.rb
│ ├── 20111229105019_create_users.rb
│ ├── 20111229121515_add_email_uniq_index.rb
│ └── 20120114084606_create_microposts.rb
├── seeds.rb
├── schema.rb
└── development_structure.sql
├── config.ru_example
├── config
├── environment.rb
├── boot.rb
├── initializers
│ ├── mime_types.rb
│ ├── inflections.rb
│ ├── backtrace_silencers.rb
│ ├── session_store.rb
│ ├── secret_token.rb
│ └── wrap_parameters.rb
├── locales
│ └── en.yml
├── database.yml_example
├── environments
│ ├── development.rb
│ ├── test.rb
│ └── production.rb
├── application.rb
├── deploy.rb
└── routes.rb
├── spec
├── views
│ └── microposts
│ │ ├── create.html.erb_spec.rb
│ │ └── destory.html.erb_spec.rb
├── factories.rb
├── helpers
│ └── microposts_helper_spec.rb
├── requests
│ ├── friendly_forwadings_spec.rb
│ ├── users_spec.rb
│ └── layout_links_spec.rb
├── spec_helper.rb
├── models
│ ├── micropost_spec.rb
│ └── user_spec.rb
└── controllers
│ ├── pages_controller_spec.rb
│ ├── sessions_controller_spec.rb
│ ├── microposts_controller_spec.rb
│ └── users_controller_spec.rb
├── doc
└── README_FOR_APP
├── Rakefile
├── script
└── rails
├── Capfile
├── .gitignore
├── Gemfile
└── Gemfile.lock
/log/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/tasks/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.rspec:
--------------------------------------------------------------------------------
1 | --colour
2 |
--------------------------------------------------------------------------------
/app/mailers/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/plugins/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | Rails 3 demo app
2 |
--------------------------------------------------------------------------------
/vendor/assets/stylesheets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/helpers/pages_helper.rb:
--------------------------------------------------------------------------------
1 | module PagesHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/microposts_helper.rb:
--------------------------------------------------------------------------------
1 | module MicropostsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/assets/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/images/logo.png
--------------------------------------------------------------------------------
/app/assets/images/rails.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/images/rails.png
--------------------------------------------------------------------------------
/app/views/pages/about.html.erb:
--------------------------------------------------------------------------------
1 |
Pages#about
2 | Find me in app/views/pages/about.html.erb
--------------------------------------------------------------------------------
/app/views/pages/help.html.erb:
--------------------------------------------------------------------------------
1 | Pages#help
2 | Find me in app/views/pages/help.html.erb
--------------------------------------------------------------------------------
/app/views/pages/contact.html.erb:
--------------------------------------------------------------------------------
1 | Pages#contact
2 | Find me in app/views/pages/contact.html.erb
--------------------------------------------------------------------------------
/app/views/microposts/create.html.erb:
--------------------------------------------------------------------------------
1 | Microposts#create
2 | Find me in app/views/microposts/create.html.erb
3 |
--------------------------------------------------------------------------------
/app/views/microposts/destory.html.erb:
--------------------------------------------------------------------------------
1 | Microposts#destory
2 | Find me in app/views/microposts/destory.html.erb
3 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/src/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/src/grid.png
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | protect_from_forgery
3 | include SessionsHelper
4 | end
5 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/buttons/icons/key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/buttons/icons/key.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/buttons/icons/tick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/buttons/icons/tick.png
--------------------------------------------------------------------------------
/app/views/users/index.html.erb:
--------------------------------------------------------------------------------
1 | All users:
2 |
3 | <%= will_paginate %>
4 |
5 | <%= render @users %>
6 |
7 |
8 | <%= will_paginate %>
--------------------------------------------------------------------------------
/db/migrate/20111229134449_add_salt_to_user.rb:
--------------------------------------------------------------------------------
1 | class AddSaltToUser < ActiveRecord::Migration
2 | def change
3 | add_column :users, :salt, :string
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/buttons/icons/cross.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/buttons/icons/cross.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/icons/doc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/link-icons/icons/doc.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/icons/feed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/link-icons/icons/feed.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/icons/im.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/link-icons/icons/im.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/icons/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/link-icons/icons/lock.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/icons/pdf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/link-icons/icons/pdf.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/icons/xls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/link-icons/icons/xls.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/icons/email.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/link-icons/icons/email.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/icons/external.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/link-icons/icons/external.png
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/icons/visited.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gs/bango/master/app/assets/stylesheets/blueprint/plugins/link-icons/icons/visited.png
--------------------------------------------------------------------------------
/config.ru_example:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Bango::Application
5 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the rails application
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the rails application
5 | Bango::Application.initialize!
6 |
--------------------------------------------------------------------------------
/spec/views/microposts/create.html.erb_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe "microposts/create.html.erb" do
4 | pending "add some examples to (or delete) #{__FILE__}"
5 | end
6 |
--------------------------------------------------------------------------------
/spec/views/microposts/destory.html.erb_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe "microposts/destory.html.erb" do
4 | pending "add some examples to (or delete) #{__FILE__}"
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20111229131616_add_password_to_users.rb:
--------------------------------------------------------------------------------
1 | class AddPasswordToUsers < ActiveRecord::Migration
2 | def change
3 | add_column :users, :encrypted_password, :string
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20111230155106_add_admin_to_users.rb:
--------------------------------------------------------------------------------
1 | class AddAdminToUsers < ActiveRecord::Migration
2 | def change
3 | add_column :users, :admin, :boolean, :default => false
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/pages.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Pages controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/users.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Users controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/sessions.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Sessions controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 |
3 | # Set up gems listed in the Gemfile.
4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5 |
6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
7 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/microposts.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the microposts controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/views/layouts/_footer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <%= link_to "About", about_path %>
5 | <%= link_to "Contact", contact_path %>
6 |
7 |
8 |
--------------------------------------------------------------------------------
/doc/README_FOR_APP:
--------------------------------------------------------------------------------
1 | Use this README file to introduce your application and point to useful places in the API for learning more.
2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
3 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-Agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 | # Mime::Type.register_alias "text/html", :iphone
6 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Sample localization file for English. Add more files in this directory for other locales.
2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3 |
4 | en:
5 | hello: "Hello world"
6 |
--------------------------------------------------------------------------------
/app/views/shared/_feed.html.erb:
--------------------------------------------------------------------------------
1 | <% if @feed_items.any? %>
2 |
3 | <%= render :partial => "shared/feed_item", :collection => @feed_items %>
4 |
5 | <%= will_paginate @feed_items %>
6 | <% end -%>
--------------------------------------------------------------------------------
/db/migrate/20111229105019_create_users.rb:
--------------------------------------------------------------------------------
1 | class CreateUsers < ActiveRecord::Migration
2 | def change
3 | create_table :users do |t|
4 | t.string :name
5 | t.string :email
6 |
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/db/migrate/20111229121515_add_email_uniq_index.rb:
--------------------------------------------------------------------------------
1 | class AddEmailUniqIndex < ActiveRecord::Migration
2 | def up
3 | add_index :users, :email, :unique => true
4 | end
5 |
6 | def down
7 | remove_index :users, :email
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/app/assets/javascripts/pages.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/sessions.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/users.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/microposts.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
4 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env rake
2 | # Add your own tasks in files placed in lib/tasks ending in .rake,
3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4 |
5 | require File.expand_path('../config/application', __FILE__)
6 |
7 | Bango::Application.load_tasks
8 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 |
3 | def title
4 | base_title = "Bango"
5 | @title.nil? ? base_title : "#{base_title} | #{@title}"
6 | end
7 |
8 | def logo
9 | image_tag("logo.png", :alt => "Bango", :class => "round")
10 | end
11 |
12 | end
13 |
--------------------------------------------------------------------------------
/app/helpers/users_helper.rb:
--------------------------------------------------------------------------------
1 | module UsersHelper
2 | def gravatar_for(user, options = { :size => 50 })
3 | gravatar_image_tag(user.email, :alt => user.name,
4 | :class => "gravatar",
5 | :gravatar => options)
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/app/views/users/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign up
2 |
3 | <%= form_for @user do |f| -%>
4 | <%= render "shared/error_messages", :object => f.object %>
5 | <%= render 'fields', :f => f %>
6 |
7 | <%= f.submit "Submit", :disable_with => 'Submiting...' %>
8 |
9 | <% end -%>
--------------------------------------------------------------------------------
/app/views/users/_user.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= gravatar_for user, :size => 30 %>
3 | <%= link_to user.name, user %>
4 | <% if current_user.admin? %>
5 | | <%= link_to "delete", user_path(user), :method => :delete, :confirm => "Are you sure?", :title => "Delete #{user.name}" %>
6 | <% end -%>
7 |
8 |
--------------------------------------------------------------------------------
/db/migrate/20120114084606_create_microposts.rb:
--------------------------------------------------------------------------------
1 | class CreateMicroposts < ActiveRecord::Migration
2 | def change
3 | create_table :microposts do |t|
4 | t.string :content
5 | t.integer :user_id
6 |
7 | t.timestamps
8 | end
9 | add_index :microposts, :user_id
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/script/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3 |
4 | APP_PATH = File.expand_path('../../config/application', __FILE__)
5 | require File.expand_path('../../config/boot', __FILE__)
6 | require 'rails/commands'
7 |
--------------------------------------------------------------------------------
/Capfile:
--------------------------------------------------------------------------------
1 | load 'deploy' if respond_to?(:namespace) # cap2 differentiator
2 |
3 | # Uncomment if you are using Rails' asset pipeline
4 | load 'deploy/assets'
5 |
6 | Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
7 |
8 | load 'config/deploy' # remove this line to skip loading any of the default tasks
--------------------------------------------------------------------------------
/app/views/shared/_micropost_form.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_for @micropost do |f| -%>
2 | <%= render "shared/error_messages", :object => f.object %>
3 |
4 | <%= f.label :content %>
5 | <%= f.text_area :content %>
6 |
7 |
8 | <%= f.submit "Submit", :disable_with => 'Submiting...' %>
9 |
10 | <% end -%>
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 | # Mayor.create(name: 'Emanuel', city: cities.first)
8 |
--------------------------------------------------------------------------------
/app/views/shared/_user_info.html.erb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/rtl/readme.txt:
--------------------------------------------------------------------------------
1 | RTL
2 | * Mirrors Blueprint, so it can be used with Right-to-Left languages.
3 |
4 | By Ran Yaniv Hartstein, ranh.co.il
5 |
6 | Usage
7 | ----------------------------------------------------------------
8 |
9 | 1) Add this line to your HTML:
10 |
11 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll automatically include all the stylesheets available in this directory
3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4 | * the top of the compiled file, but it's generally better to create a new file per style scope.
5 | *= require_self
6 | *= require_tree ./blueprint
7 | *= require_tree .
8 | */
--------------------------------------------------------------------------------
/app/views/users/edit.html.erb:
--------------------------------------------------------------------------------
1 | Edit user
2 |
3 | <%= form_for @user do |f| %>
4 | <%= render "shared/error_messages", :object => f.object %>
5 | <%= render 'fields', :f => f %>
6 |
7 | <%= f.submit "Update", :disable_with => 'Updating...' %>
8 |
9 | <% end -%>
10 |
11 | <%= gravatar_for @user %>
12 | <%= link_to "Change", 'http://gravatar.com/emails', { :target=>'_blank' } %>
13 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format
4 | # (all these examples are active by default):
5 | # ActiveSupport::Inflector.inflections do |inflect|
6 | # inflect.plural /^(ox)$/i, '\1en'
7 | # inflect.singular /^(ox)en/i, '\1'
8 | # inflect.irregular 'person', 'people'
9 | # inflect.uncountable %w( fish sheep )
10 | # end
11 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/fancy-type/readme.txt:
--------------------------------------------------------------------------------
1 | Fancy Type
2 |
3 | * Gives you classes to use if you'd like some
4 | extra fancy typography.
5 |
6 | Credits and instructions are specified above each class
7 | in the fancy-type.css file in this directory.
8 |
9 |
10 | Usage
11 | ----------------------------------------------------------------
12 |
13 | 1) Add this plugin to lib/settings.yml.
14 | See compress.rb for instructions.
15 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Bango::Application.config.session_store :cookie_store, { :key => '_bango_session'}
4 |
5 | # Use the database for sessions instead of the cookie-based default,
6 | # which shouldn't be used to store highly confidential information
7 | # (create the session table with "rails generate session_migration")
8 | # Bango::Application.config.session_store :active_record_store
9 |
--------------------------------------------------------------------------------
/app/controllers/pages_controller.rb:
--------------------------------------------------------------------------------
1 | class PagesController < ApplicationController
2 |
3 | def home
4 | @title = "Home"
5 | if signed_in?
6 | @micropost = Micropost.new
7 | @feed_items = current_user.feed.paginate(:page => params[:page])
8 | end
9 | end
10 |
11 | def contact
12 | @title = "Contact"
13 | end
14 |
15 | def about
16 | @title = "About"
17 | end
18 |
19 | def help
20 | @title = "Help"
21 | end
22 |
23 | end
24 |
--------------------------------------------------------------------------------
/app/views/layouts/_stylesheet.html.erb:
--------------------------------------------------------------------------------
1 |
4 | <%= stylesheet_link_tag "blueprint/screen", :media => "screen" %>
5 | <%= stylesheet_link_tag "blueprint/print", :media => "print" %>
6 | <%= javascript_include_tag "application" %>
7 |
8 | <%= stylesheet_link_tag 'custom', :media => "screen" %>
9 |
--------------------------------------------------------------------------------
/app/views/microposts/_micropost.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 | <%= micropost.content %>
4 |
5 | Posted <%= time_ago_in_words(micropost.created_at) %> ago.
6 |
7 |
8 | <% if current_user?(micropost.user) %>
9 |
10 | <%= link_to "delete", micropost, :method => :delete, :confirm => "You sure?", :title => micropost.content %>
11 |
12 | <% end -%>
13 |
--------------------------------------------------------------------------------
/app/views/users/_fields.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= f.label :name %>
3 | <%= f.text_field :name %>
4 |
5 |
6 | <%= f.label :email %>
7 | <%= f.text_field :email %>
8 |
9 |
10 | <%= f.label :password %>
11 | <%= f.password_field :password %>
12 |
13 |
14 | <%= f.label :password_confirmation, "Confirmation" %>
15 | <%= f.password_field :password_confirmation %>
16 |
--------------------------------------------------------------------------------
/spec/factories.rb:
--------------------------------------------------------------------------------
1 | Factory.define :user do |user|
2 | user.name "Adam Asny"
3 | user.email "adam@fatbuu.com"
4 | user.password "foobar"
5 | user.password_confirmation "foobar"
6 | user.admin false
7 | end
8 |
9 | Factory.sequence :email do |n|
10 | "person-#{n}@fatbuu.com"
11 | end
12 |
13 | Factory.define :micropost do |micropost|
14 | micropost.content "foobarrrrr"
15 | micropost.association :user
16 | end
--------------------------------------------------------------------------------
/app/views/shared/_error_messages.html.erb:
--------------------------------------------------------------------------------
1 | <% if object.errors.any? %>
2 |
3 |
4 | <%= pluralize(object.errors.count, "error") %> prohibited this <%= object.class.to_s.humanize.downcase %> from being saved:
5 |
6 |
There where problems with the following fields:
7 |
8 | <% object.errors.full_messages.each do |message| %>
9 | <%= message %>
10 | <% end -%>
11 |
12 |
13 | <% end -%>
--------------------------------------------------------------------------------
/app/views/pages/home.html.erb:
--------------------------------------------------------------------------------
1 | <% if signed_in? %>
2 |
3 |
4 |
5 | Whats up?
6 | <%= render "shared/micropost_form" %>
7 | <%= render "shared/feed" %>
8 |
9 |
13 |
14 |
15 | <% else %>
16 |
17 | <%= link_to "Sign up now!", signup_path, :class => "signin_button round" %>
18 | <% end -%>
--------------------------------------------------------------------------------
/spec/helpers/microposts_helper_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | # Specs in this file have access to a helper object that includes
4 | # the MicropostsHelper. For example:
5 | #
6 | # describe MicropostsHelper do
7 | # describe "string concat" do
8 | # it "concats two strings with spaces" do
9 | # helper.concat_strings("this","that").should == "this that"
10 | # end
11 | # end
12 | # end
13 | describe MicropostsHelper do
14 | pending "add some examples to (or delete) #{__FILE__}"
15 | end
16 |
--------------------------------------------------------------------------------
/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into including all the files listed below.
2 | // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3 | // be included in the compiled file accessible from http://example.com/assets/application.js
4 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5 | // the compiled file.
6 | //
7 | //= require jquery
8 | //= require jquery_ujs
9 | //= require_tree .
10 |
--------------------------------------------------------------------------------
/app/views/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign in
2 |
3 | <%= form_for(:session, :url => sessions_path) do |f| %>
4 |
5 | <%= f.label :email %>
6 | <%= f.text_field :email %>
7 |
8 |
9 | <%= f.label :password %>
10 | <%= f.password_field :password %>
11 |
12 |
13 | <%= f.submit "Submit", :disable_with => 'Submiting...' %>
14 |
15 | <% end -%>
16 |
17 | New user? <%= link_to "Sign up now", signup_path %>
--------------------------------------------------------------------------------
/config/initializers/secret_token.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 | # Make sure the secret is at least 30 characters and all random,
6 | # no regular words or you'll be exposed to dictionary attacks.
7 | Bango::Application.config.secret_token = '8a7c87fff4d50b7592e7923d247cee60f0347330c4c5870198e1ed98607a04961d9f5ca212e8ab49114a75548f6d9eb99270815d08d4bf7fdb6a5bb3b53ebfe7'
8 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 | #
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters :format => [:json]
9 | end
10 |
11 | # Disable root element in JSON by default.
12 | ActiveSupport.on_load(:active_record) do
13 | self.include_root_in_json = false
14 | end
15 |
--------------------------------------------------------------------------------
/app/models/micropost.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: microposts
4 | #
5 | # id :integer(4) not null, primary key
6 | # content :string(255)
7 | # user_id :integer(4)
8 | # created_at :datetime
9 | # updated_at :datetime
10 | #
11 |
12 | class Micropost < ActiveRecord::Base
13 | attr_accessible :content
14 | belongs_to :user
15 |
16 | validates :user, :presence => true
17 | validates :content, :presence => true, :length => {:maximum => 140}
18 | default_scope :order => "created_at DESC"
19 |
20 |
21 | end
22 |
23 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/readme.txt:
--------------------------------------------------------------------------------
1 | Link Icons
2 | * Icons for links based on protocol or file type.
3 |
4 | This is not supported in IE versions < 7.
5 |
6 |
7 | Credits
8 | ----------------------------------------------------------------
9 |
10 | * Marc Morgan
11 | * Olav Bjorkoy [bjorkoy.com]
12 |
13 |
14 | Usage
15 | ----------------------------------------------------------------
16 |
17 | 1) Add this line to your HTML:
18 |
19 |
--------------------------------------------------------------------------------
/app/controllers/sessions_controller.rb:
--------------------------------------------------------------------------------
1 | class SessionsController < ApplicationController
2 |
3 | def new
4 | @title = "Sign in"
5 | end
6 |
7 | def create
8 | user = User.authenticate(params[:session][:email],
9 | params[:session][:password])
10 | if user.nil?
11 | @title = "Sign in"
12 | flash.now[:error] = "Invalid email/password"
13 | render :new
14 | else
15 | sign_in(user)
16 | redirect_back_or_to(user)
17 | end
18 | end
19 |
20 | def destroy
21 | sign_out
22 | redirect_to root_path
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile ~/.gitignore_global
6 |
7 | # Ignore bundler config
8 | /.bundle
9 |
10 | .rvmrc
11 | # Ignore the default SQLite database.
12 |
13 |
14 | # Ignore all logfiles and tempfiles.
15 | config.ru
16 | /log/*.log
17 | *.log
18 | /tmp
19 | config/database.yml
20 | Gemfile.lock
21 | doc/api
22 | doc/app
23 | *.swp
24 | *~
25 | .DS_Store
26 | .tags
--------------------------------------------------------------------------------
/app/views/shared/_feed_item.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 | <%= link_to gravatar_for(feed_item.user), feed_item.user %>
4 |
5 |
6 |
7 | <%= link_to feed_item.user.name, feed_item.user %>
8 |
9 | <%= feed_item.content %>
10 | Posted <%= time_ago_in_words(feed_item.created_at) %> ago.
11 |
12 | <% if current_user?(feed_item.user) %>
13 |
14 | <%= link_to "delete", feed_item, :method => :delete, :confirm => "You sure?", :title => feed_item.content %>
15 |
16 | <% end -%>
17 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <%= title %>
5 | <%= csrf_meta_tags %>
6 | <%= render "layouts/stylesheet" %>
7 | <%= javascript_include_tag :default %>
8 |
9 |
10 |
11 | <%= render "layouts/header" %>
12 |
13 | <% flash.each do |key, value| %>
14 | <%= value %>
15 | <% end -%>
16 | <%= yield %>
17 |
18 | <%= render "layouts/footer" %>
19 | <%= debug(params) if Rails.env.development? %>
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/spec/requests/friendly_forwadings_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe "FriendlyForwadings" do
4 | it "should forward the requeste page after signin" do
5 | user = Factory(:user)
6 | visit edit_user_path(user)
7 | fill_in "Email", :with => user.email
8 | fill_in "Password", :with => user.password
9 | click_button
10 | response.should render_template("users/edit")
11 | visit signout_path
12 |
13 | visit signin_path
14 | fill_in "Email", :with => user.email
15 | fill_in "Password", :with => user.password
16 | click_button
17 | response.should render_template("users/show")
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/config/database.yml_example:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | development:
7 | adapter: sqlite3
8 | database: db/development.sqlite3
9 | pool: 5
10 | timeout: 5000
11 |
12 | # Warning: The database defined as "test" will be erased and
13 | # re-generated from your development database when you run "rake".
14 | # Do not set this db to the same as development or production.
15 | test:
16 | adapter: sqlite3
17 | database: db/test.sqlite3
18 | pool: 5
19 | timeout: 5000
20 |
21 | production:
22 | adapter: sqlite3
23 | database: db/production.sqlite3
24 | pool: 5
25 | timeout: 5000
26 |
--------------------------------------------------------------------------------
/app/views/layouts/_header.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= link_to logo, root_path %>
3 |
4 |
5 | <%= link_to "Home", root_path %>
6 | <% if signed_in? %>
7 | <%= link_to "Profile", user_path(current_user) %>
8 | <%= link_to "Users", users_path %>
9 | <%= link_to "Settings", edit_user_path(current_user) %>
10 | <% end -%>
11 | <%= link_to "Help", help_path %>
12 | <% if signed_in? %>
13 | <%= link_to "Sign out", signout_path %>
14 | <% else %>
15 | <%= link_to "Sign in", signin_path %>
16 | <% end -%>
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/views/users/show.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <%= gravatar_for @user %>
6 | <%= @user.name %>
7 |
8 | <% if @user.microposts.any? %>
9 |
10 | <%= render @microposts %>
11 |
12 | <%= will_paginate @microposts %>
13 | <% end -%>
14 |
15 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/controllers/microposts_controller.rb:
--------------------------------------------------------------------------------
1 | class MicropostsController < ApplicationController
2 | before_filter :authenticate
3 | before_filter :authenticate_user, :only => [:destroy]
4 |
5 | def create
6 | @micropost = current_user.microposts.build(params[:micropost])
7 | if @micropost.save
8 | redirect_to root_path, :flash => {:success => "Well done"}
9 | else
10 | @feed_items = []
11 | render 'pages/home'
12 | end
13 | end
14 |
15 | def destroy
16 | @micropost.destroy
17 | redirect_to root_path, :flash => {:success => "Content deleted"}
18 | end
19 |
20 |
21 | private
22 | def authenticate_user
23 | @micropost = Micropost.find(params[:id])
24 | redirect_to root_path unless current_user?(@micropost.user)
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/lib/tasks/sample_data.rake:
--------------------------------------------------------------------------------
1 | namespace :db do
2 | desc "Fill db with sample data"
3 | task :populate => :environment do
4 | require 'faker'
5 | Rake::Task['db:reset'].invoke
6 | admin = User.create!(:name => "Example User", :email => "grechut@gmail.com", :password => "foobar", :password_confirmation => "foobar")
7 | admin.toggle!(:admin)
8 |
9 | 99.times do |n|
10 | name = Faker::Name.name
11 | email = "example_#{n+1}@fatbuu.com"
12 | password = "password"
13 | User.create!(:name => name, :email => email, :password => password, :password_confirmation => password)
14 | end
15 |
16 | User.all(:limit => 6).each do |user|
17 | 50.times do
18 | user.microposts.create!(:content => Faker::Lorem.sentence(5))
19 | end
20 | end
21 | end
22 | end
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
The change you wanted was rejected.
23 |
Maybe you tried to change something you didn't have access to.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
The page you were looking for doesn't exist.
23 |
You may have mistyped the address or the page may have moved.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
We're sorry, but something went wrong.
23 |
We've been notified about this issue and we'll take a look at it shortly.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'http://rubygems.org'
2 |
3 | gem 'rails', '3.1.3'
4 | gem 'therubyracer'
5 | # Bundle edge Rails instead:
6 | # gem 'rails', :git => 'git://github.com/rails/rails.git'
7 |
8 | gem 'capistrano'
9 | gem 'mysql2'
10 | gem 'gravatar_image_tag'
11 | gem 'will_paginate'
12 |
13 |
14 | # Gems used only for assets and not required
15 | # in production environments by default.
16 | group :assets do
17 | gem 'sass-rails', '~> 3.1.5'
18 | gem 'coffee-rails', '~> 3.1.1'
19 | gem 'uglifier', '>= 1.0.3'
20 | end
21 |
22 | gem 'jquery-rails'
23 |
24 |
25 | group :development do
26 | gem 'rspec-rails', '2.6.1'
27 | gem 'spin'
28 | gem 'annotate', :git => 'git://github.com/jeremyolliver/annotate_models.git', :branch => 'rake_compatibility'
29 | gem 'pry'
30 | gem 'faker'
31 | end
32 |
33 | group :test do
34 | gem 'rspec-rails', '2.6.1'
35 | gem 'webrat', '0.7.1'
36 | # Pretty printed test output
37 | gem 'turn', '0.8.2', :require => false
38 | gem 'factory_girl_rails'
39 | end
40 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/buttons/readme.txt:
--------------------------------------------------------------------------------
1 | Buttons
2 |
3 | * Gives you great looking CSS buttons, for both and .
4 | * Demo: particletree.com/features/rediscovering-the-button-element
5 |
6 |
7 | Credits
8 | ----------------------------------------------------------------
9 |
10 | * Created by Kevin Hale [particletree.com]
11 | * Adapted for Blueprint by Olav Bjorkoy [bjorkoy.com]
12 |
13 |
14 | Usage
15 | ----------------------------------------------------------------
16 |
17 | 1) Add this plugin to lib/settings.yml.
18 | See compress.rb for instructions.
19 |
20 | 2) Use the following HTML code to place the buttons on your site:
21 |
22 |
23 | Save
24 |
25 |
26 |
27 | Change Password
28 |
29 |
30 |
31 | Cancel
32 |
33 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # This file is copied to spec/ when you run 'rails generate rspec:install'
2 | ENV["RAILS_ENV"] ||= 'test'
3 | require File.expand_path("../../config/environment", __FILE__)
4 | require 'rspec/rails'
5 |
6 | # Requires supporting ruby files with custom matchers and macros, etc,
7 | # in spec/support/ and its subdirectories.
8 | Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
9 |
10 | RSpec.configure do |config|
11 | # == Mock Framework
12 | #
13 | # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
14 | #
15 | # config.mock_with :mocha
16 | # config.mock_with :flexmock
17 | # config.mock_with :rr
18 | config.mock_with :rspec
19 |
20 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21 | config.fixture_path = "#{::Rails.root}/spec/fixtures"
22 |
23 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
24 | # examples within a transaction, remove the following line or assign false
25 | # instead of true.
26 | config.use_transactional_fixtures = true
27 |
28 | def test_sign_in(user)
29 | controller.current_user = user
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Bango::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Log error messages when you accidentally call methods on nil.
10 | config.whiny_nils = true
11 |
12 | # Show full error reports and disable caching
13 | config.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger
20 | config.active_support.deprecation = :log
21 |
22 | # Only use best-standards-support built into browsers
23 | config.action_dispatch.best_standards_support = :builtin
24 |
25 | # Do not compress assets
26 | config.assets.compress = false
27 |
28 | # Expands the lines which load the assets
29 | config.assets.debug = true
30 | end
31 |
--------------------------------------------------------------------------------
/app/helpers/sessions_helper.rb:
--------------------------------------------------------------------------------
1 | module SessionsHelper
2 |
3 | def sign_in(user)
4 | cookies.permanent.signed[:remember_token] = [user.id, user.salt]
5 | current_user = user
6 | end
7 |
8 | def current_user=(user)
9 | @current_user = user
10 | end
11 |
12 | def current_user
13 | @current_user ||= user_from_remembered_token
14 | end
15 |
16 | def signed_in?
17 | current_user.present?
18 | end
19 |
20 | def sign_out
21 | cookies.delete(:remember_token)
22 | self.current_user = nil
23 | end
24 |
25 | def current_user?(user)
26 | user == current_user
27 | end
28 |
29 | def deny_access
30 | store_location
31 | redirect_to((signin_path), :notice => "Please signup first" )
32 | end
33 |
34 | def store_location
35 | session[:return_to] = request.fullpath
36 | end
37 |
38 | def redirect_back_or_to(default)
39 | redirect_to(session[:return_to] || default)
40 | clear_return_to
41 | end
42 |
43 | def clear_return_to
44 | session[:return_to] = nil
45 | end
46 |
47 | private
48 | def authenticate
49 | deny_access unless signed_in?
50 | end
51 |
52 | def user_from_remembered_token
53 | User.authenticate_with_salt(*remembered_token)
54 | end
55 |
56 | def remembered_token
57 | cookies.signed[:remember_token] || [nil, nil]
58 | end
59 |
60 | end
61 |
--------------------------------------------------------------------------------
/spec/models/micropost_spec.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: microposts
4 | #
5 | # id :integer(4) not null, primary key
6 | # content :string(255)
7 | # user_id :integer(4)
8 | # created_at :datetime
9 | # updated_at :datetime
10 | #
11 |
12 | require 'spec_helper'
13 |
14 | describe Micropost do
15 | before(:each) do
16 | @user = Factory(:user)
17 | @attr = {:content => "lorem ipsum", :user_id => 1}
18 | end
19 |
20 | it "should create a micropost with valid content" do
21 | @user.microposts.create!(@attr)
22 | end
23 |
24 | describe "user associations" do
25 | before(:each) do
26 | @micropost = @user.microposts.create(@attr)
27 | end
28 | it "should have a user attribute" do
29 | @micropost.should respond_to(:user)
30 | end
31 | it "should have the right user" do
32 | @micropost.user_id.should == @user.id
33 | @micropost.user.should == @user
34 | end
35 |
36 | it "should have user" do
37 | Micropost.new(@attr).should_not be_valid
38 | end
39 |
40 | it "should require nonblank content" do
41 | @user.microposts.build(:content => " ").should_not be_valid
42 | end
43 |
44 | it "should reject looong content" do
45 | @user.microposts.build(:content => "a" * 141).should_not be_valid
46 | end
47 | end
48 | end
49 |
50 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/print.css:
--------------------------------------------------------------------------------
1 | /* -----------------------------------------------------------------------
2 |
3 |
4 | Blueprint CSS Framework 1.0.1
5 | http://blueprintcss.org
6 |
7 | * Copyright (c) 2007-Present. See LICENSE for more info.
8 | * See README for instructions on how to use Blueprint.
9 | * For credits and origins, see AUTHORS.
10 | * This is a compressed file. See the sources in the 'src' directory.
11 |
12 | ----------------------------------------------------------------------- */
13 |
14 | /* print.css */
15 | body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;}
16 | .container {background:none;}
17 | hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;}
18 | hr.space {background:#fff;color:#fff;visibility:hidden;}
19 | h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;}
20 | code {font:.9em "Courier New", Monaco, Courier, monospace;}
21 | a img {border:none;}
22 | p img.top {margin-top:0;}
23 | blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
24 | .small {font-size:.9em;}
25 | .large {font-size:1.1em;}
26 | .quiet {color:#999;}
27 | .hide {display:none;}
28 | a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
29 | a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended to check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(:version => 20120114084606) do
15 |
16 | create_table "microposts", :force => true do |t|
17 | t.string "content"
18 | t.integer "user_id"
19 | t.datetime "created_at"
20 | t.datetime "updated_at"
21 | end
22 |
23 | add_index "microposts", ["user_id"], :name => "index_microposts_on_user_id"
24 |
25 | create_table "users", :force => true do |t|
26 | t.string "name"
27 | t.string "email"
28 | t.datetime "created_at"
29 | t.datetime "updated_at"
30 | t.string "encrypted_password"
31 | t.string "salt"
32 | t.boolean "admin", :default => false
33 | end
34 |
35 | add_index "users", ["email"], :name => "index_users_on_email", :unique => true
36 |
37 | end
38 |
--------------------------------------------------------------------------------
/spec/controllers/pages_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe PagesController do
4 | render_views
5 |
6 | before(:each) do
7 | @base_title = "Bango"
8 | end
9 | describe "GET 'home'" do
10 | it "should be successful" do
11 | get 'home'
12 | response.should be_success
13 | end
14 |
15 | it "should have title" do
16 | get 'home'
17 | response.should have_selector("title", :content => "#{@base_title} | Home")
18 | end
19 |
20 | it "should not have non-content" do
21 | get 'home'
22 | response.body.should_not =~ /\s*<\/body>/
23 | end
24 |
25 | end
26 |
27 | describe "GET 'contact'" do
28 | it "should be successful" do
29 | get 'contact'
30 | response.should be_success
31 | end
32 |
33 | it "should have title" do
34 | get 'contact'
35 | response.should have_selector("title", :content => "#{@base_title} | Contact")
36 | end
37 |
38 | end
39 |
40 | describe "GET 'about' " do
41 | it "should be successful" do
42 | get 'about'
43 | response.should be_success
44 | end
45 |
46 | it "should have title" do
47 | get 'about'
48 | response.should have_selector("title", :content => "#{@base_title} | About")
49 | end
50 |
51 | end
52 |
53 | describe "GET 'help' " do
54 | it "should be successful" do
55 | get 'help'
56 | response.should be_success
57 | end
58 |
59 | it "should have title" do
60 | get 'help'
61 | response.should have_selector("title", :content => "#{@base_title} | Help")
62 | end
63 |
64 | end
65 |
66 | end
67 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/link-icons/screen.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | link-icons.css
4 | * Icons for links based on protocol or file type.
5 |
6 | See the Readme file in this folder for additional instructions.
7 |
8 | -------------------------------------------------------------- */
9 |
10 | /* Use this class if a link gets an icon when it shouldn't. */
11 | body a.noicon {
12 | background:transparent none !important;
13 | padding:0 !important;
14 | margin:0 !important;
15 | }
16 |
17 | /* Make sure the icons are not cut */
18 | a[href^="http:"], a[href^="https:"],
19 | a[href^="http:"]:visited, a[href^="https:"]:visited,
20 | a[href^="mailto:"], a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"],
21 | a[href$=".rss"], a[href$=".rdf"], a[href^="aim:"] {
22 | padding:2px 22px 2px 0;
23 | margin:-2px 0;
24 | background-repeat: no-repeat;
25 | background-position: right center;
26 | }
27 |
28 | /* External links */
29 | a[href^="http:"] { background-image: url(icons/external.png); }
30 | a[href^="https:"] { background-image: url(icons/lock.png); }
31 | a[href^="mailto:"] { background-image: url(icons/email.png); }
32 | a[href^="http:"]:visited { background-image: url(icons/visited.png); }
33 |
34 | /* Files */
35 | a[href$=".pdf"] { background-image: url(icons/pdf.png); }
36 | a[href$=".doc"] { background-image: url(icons/doc.png); }
37 | a[href$=".xls"] { background-image: url(icons/xls.png); }
38 |
39 | /* Misc */
40 | a[href$=".rss"],
41 | a[href$=".rdf"] { background-image: url(icons/feed.png); }
42 | a[href^="aim:"] { background-image: url(icons/im.png); }
43 |
--------------------------------------------------------------------------------
/app/controllers/users_controller.rb:
--------------------------------------------------------------------------------
1 | class UsersController < ApplicationController
2 |
3 | before_filter :authenticate, :only => [:index, :edit, :update, :destroy]
4 | before_filter :correct_user, :only => [:edit, :update]
5 | before_filter :admin_user, :only => :destroy
6 |
7 |
8 | def index
9 | @users = User.paginate(:page => params[:page])
10 | @title = "All users"
11 | end
12 |
13 | def new
14 | @user = User.new
15 | @title = "Sign up"
16 | end
17 |
18 | def show
19 | @user = User.find(params[:id])
20 | @microposts = @user.microposts.paginate(:page => params[:page])
21 | @title = @user.name
22 | end
23 |
24 | def create
25 | @user = User.new(params[:user])
26 | if @user.save
27 | sign_in(@user)
28 | redirect_to @user, :flash => { :success => "Welcome to Awesome app!" }
29 | else
30 | @title = "Sign up"
31 | render 'new'
32 | end
33 | end
34 |
35 | def edit
36 | @title = "Edit user"
37 | end
38 |
39 | def update
40 | if @user.update_attributes(params[:user])
41 | redirect_to(user_path(@user), :flash => {:success => "Profile updated."})
42 | else
43 | @title = "Update user"
44 | render 'edit'
45 | end
46 | end
47 |
48 | def destroy
49 | if @user.destroy
50 | redirect_to(users_path, :notice => "#{@user.name} has been deleted")
51 | end
52 | end
53 | private
54 |
55 | def correct_user
56 | @user = User.find(params[:id])
57 | redirect_to(root_path) unless current_user?(@user)
58 | end
59 |
60 | def admin_user
61 | @user = User.find params[:id]
62 | redirect_to(root_path) if !current_user.admin? || current_user?(@user)
63 | end
64 | end
65 |
--------------------------------------------------------------------------------
/db/development_structure.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `microposts` (
2 | `id` int(11) NOT NULL AUTO_INCREMENT,
3 | `content` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
4 | `user_id` int(11) DEFAULT NULL,
5 | `created_at` datetime DEFAULT NULL,
6 | `updated_at` datetime DEFAULT NULL,
7 | PRIMARY KEY (`id`),
8 | KEY `index_microposts_on_user_id` (`user_id`)
9 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
10 |
11 | CREATE TABLE `schema_migrations` (
12 | `version` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
13 | UNIQUE KEY `unique_schema_migrations` (`version`)
14 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
15 |
16 | CREATE TABLE `users` (
17 | `id` int(11) NOT NULL AUTO_INCREMENT,
18 | `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
19 | `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
20 | `created_at` datetime DEFAULT NULL,
21 | `updated_at` datetime DEFAULT NULL,
22 | `encrypted_password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
23 | `salt` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
24 | `admin` tinyint(1) DEFAULT '0',
25 | PRIMARY KEY (`id`),
26 | UNIQUE KEY `index_users_on_email` (`email`)
27 | ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
28 |
29 | INSERT INTO schema_migrations (version) VALUES ('20111229105019');
30 |
31 | INSERT INTO schema_migrations (version) VALUES ('20111229121515');
32 |
33 | INSERT INTO schema_migrations (version) VALUES ('20111229131616');
34 |
35 | INSERT INTO schema_migrations (version) VALUES ('20111229134449');
36 |
37 | INSERT INTO schema_migrations (version) VALUES ('20111230155106');
38 |
39 | INSERT INTO schema_migrations (version) VALUES ('20120114084606');
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Bango::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Configure static asset server for tests with Cache-Control for performance
11 | config.serve_static_assets = true
12 | config.static_cache_control = "public, max-age=3600"
13 |
14 | # Log error messages when you accidentally call methods on nil
15 | config.whiny_nils = true
16 |
17 | # Show full error reports and disable caching
18 | config.consider_all_requests_local = true
19 | config.action_controller.perform_caching = false
20 |
21 | # Raise exceptions instead of rendering exception templates
22 | config.action_dispatch.show_exceptions = false
23 |
24 | # Disable request forgery protection in test environment
25 | config.action_controller.allow_forgery_protection = false
26 |
27 | # Tell Action Mailer not to deliver emails to the real world.
28 | # The :test delivery method accumulates sent emails in the
29 | # ActionMailer::Base.deliveries array.
30 | config.action_mailer.delivery_method = :test
31 |
32 | # Use SQL instead of Active Record's schema dumper when creating the test database.
33 | # This is necessary if your schema can't be completely dumped by the schema dumper,
34 | # like if you have constraints or database-specific column types
35 | # config.active_record.schema_format = :sql
36 |
37 | # Print deprecation notices to the stderr
38 | config.active_support.deprecation = :stderr
39 | end
40 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/src/reset.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | reset.css
4 | * Resets default browser CSS.
5 |
6 | -------------------------------------------------------------- */
7 |
8 | html {
9 | margin:0;
10 | padding:0;
11 | border:0;
12 | }
13 |
14 | body, div, span, object, iframe,
15 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
16 | a, abbr, acronym, address, code,
17 | del, dfn, em, img, q, dl, dt, dd, ol, ul, li,
18 | fieldset, form, label, legend,
19 | table, caption, tbody, tfoot, thead, tr, th, td,
20 | article, aside, dialog, figure, footer, header,
21 | hgroup, nav, section {
22 | margin: 0;
23 | padding: 0;
24 | border: 0;
25 | font-size: 100%;
26 | font: inherit;
27 | vertical-align: baseline;
28 | }
29 |
30 | /* This helps to make newer HTML5 elements behave like DIVs in older browers */
31 | article, aside, details, figcaption, figure, dialog,
32 | footer, header, hgroup, menu, nav, section {
33 | display:block;
34 | }
35 |
36 | /* Line-height should always be unitless! */
37 | body {
38 | line-height: 1.5;
39 | background: white;
40 | }
41 |
42 | /* Tables still need 'cellspacing="0"' in the markup. */
43 | table {
44 | border-collapse: separate;
45 | border-spacing: 0;
46 | }
47 | /* float:none prevents the span-x classes from breaking table-cell display */
48 | caption, th, td {
49 | text-align: left;
50 | font-weight: normal;
51 | float:none !important;
52 | }
53 | table, th, td {
54 | vertical-align: middle;
55 | }
56 |
57 | /* Remove possible quote marks (") from , . */
58 | blockquote:before, blockquote:after, q:before, q:after { content: ''; }
59 | blockquote, q { quotes: "" ""; }
60 |
61 | /* Remove annoying border on linked images. */
62 | a img { border: none; }
63 |
64 | /* Remember to define your own focus styles! */
65 | :focus { outline: 0; }
66 |
--------------------------------------------------------------------------------
/spec/controllers/sessions_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe SessionsController do
4 | render_views
5 |
6 | describe "GET 'new'" do
7 | it "should be successful" do
8 | get :new
9 | response.should be_success
10 | end
11 |
12 | it "should have the right title" do
13 | get :new
14 | response.should have_selector("title", :content => "Sign in")
15 | end
16 | end
17 |
18 | describe "POST 'create'" do
19 |
20 | describe "failure" do
21 |
22 | before(:each) do
23 | @attr = {:email => "", :password => ""}
24 | end
25 |
26 | it "it should re-render new page" do
27 | post :create, :session => @attr
28 | response.should render_template(:new)
29 | end
30 |
31 | it "should have the right title" do
32 | post :create, :session => @attr
33 | response.should have_selector("title", :content => "Sign in")
34 | end
35 |
36 | it "should have an error" do
37 | post :create, :session => @attr
38 | flash.now[:error].should =~ /invalid/i
39 | end
40 | end
41 |
42 | describe "success" do
43 | before(:each) do
44 | @user = Factory(:user)
45 | @attr = { :email => @user.email, :password => @user.password }
46 | end
47 |
48 | it "should sign in user" do
49 | post :create, :session => @attr
50 | controller.current_user.should == @user
51 | controller.should be_signed_in
52 | end
53 |
54 | it "should redirect to user page" do
55 | post :create, :session => @attr
56 | response.should redirect_to(user_path(@user))
57 | end
58 | end
59 | end
60 |
61 | describe "DELETE 'destroy'" do
62 | it "should sign out user" do
63 | test_sign_in(Factory(:user))
64 | delete :destroy
65 | controller.should_not be_signed_in
66 | response.should redirect_to(root_path)
67 | end
68 | end
69 | end
70 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/ie.css:
--------------------------------------------------------------------------------
1 | /* -----------------------------------------------------------------------
2 |
3 |
4 | Blueprint CSS Framework 1.0.1
5 | http://blueprintcss.org
6 |
7 | * Copyright (c) 2007-Present. See LICENSE for more info.
8 | * See README for instructions on how to use Blueprint.
9 | * For credits and origins, see AUTHORS.
10 | * This is a compressed file. See the sources in the 'src' directory.
11 |
12 | ----------------------------------------------------------------------- */
13 |
14 | /* ie.css */
15 | body {text-align:center;}
16 | .container {text-align:left;}
17 | * html .column, * html .span-1, * html .span-2, * html .span-3, * html .span-4, * html .span-5, * html .span-6, * html .span-7, * html .span-8, * html .span-9, * html .span-10, * html .span-11, * html .span-12, * html .span-13, * html .span-14, * html .span-15, * html .span-16, * html .span-17, * html .span-18, * html .span-19, * html .span-20, * html .span-21, * html .span-22, * html .span-23, * html .span-24 {display:inline;overflow-x:hidden;}
18 | * html legend {margin:0px -8px 16px 0;padding:0;}
19 | sup {vertical-align:text-top;}
20 | sub {vertical-align:text-bottom;}
21 | html>body p code {*white-space:normal;}
22 | hr {margin:-8px auto 11px;}
23 | img {-ms-interpolation-mode:bicubic;}
24 | .clearfix, .container {display:inline-block;}
25 | * html .clearfix, * html .container {height:1%;}
26 | fieldset {padding-top:0;}
27 | legend {margin-top:-0.2em;margin-bottom:1em;margin-left:-0.5em;}
28 | textarea {overflow:auto;}
29 | label {vertical-align:middle;position:relative;top:-0.25em;}
30 | input.text, input.title, textarea {background-color:#fff;border:1px solid #bbb;}
31 | input.text:focus, input.title:focus {border-color:#666;}
32 | input.text, input.title, textarea, select {margin:0.5em 0;}
33 | input.checkbox, input.radio {position:relative;top:.25em;}
34 | form.inline div, form.inline p {vertical-align:middle;}
35 | form.inline input.checkbox, form.inline input.radio, form.inline input.button, form.inline button {margin:0.5em 0;}
36 | button, input.button {position:relative;top:0.25em;}
--------------------------------------------------------------------------------
/app/models/user.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: users
4 | #
5 | # id :integer(4) not null, primary key
6 | # name :string(255)
7 | # email :string(255)
8 | # created_at :datetime
9 | # updated_at :datetime
10 | # encrypted_password :string(255)
11 | # salt :string(255)
12 | # admin :boolean(1) default(FALSE)
13 | #
14 |
15 | class User < ActiveRecord::Base
16 | attr_accessor :password
17 | attr_accessible :name, :email, :password, :password_confirmation
18 | has_many :microposts, :dependent => :destroy
19 |
20 | email_regexp = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/
21 | validates :name, :presence => true,
22 | :length => { :maximum => 50 }
23 | validates :email, :presence => true,
24 | :format => { :with => email_regexp, :on => :create },
25 | :uniqueness => true
26 | validates :password, :presence => true,
27 | :confirmation => true,
28 | :length => { :within => 6..40 }
29 |
30 | before_save :encrypt_password
31 |
32 | def has_password?(submitted_password)
33 | encrypted_password == encrypt(submitted_password)
34 | end
35 |
36 | def feed
37 | Micropost.where("user_id = ?", id)
38 | end
39 |
40 | class << self
41 | def authenticate(email, submitted_password)
42 | user = find_by_email email
43 | (user && user.has_password?(submitted_password)) ? user : nil
44 | end
45 |
46 | def authenticate_with_salt(id, cookie_salt)
47 | user = find_by_id(id)
48 | (user && user.salt == cookie_salt) ? user : nil
49 | end
50 | end
51 |
52 | private
53 |
54 | def encrypt_password
55 | self.salt = make_salt if new_record?
56 | self.encrypted_password = encrypt(password)
57 | end
58 |
59 | def encrypt(string)
60 | secure_hash("#{salt}--#{string}")
61 | end
62 |
63 | def make_salt
64 | secure_hash("#{Time.now.utc}--#{password}")
65 | end
66 |
67 | def secure_hash(string)
68 | Digest::SHA2.hexdigest(string)
69 | end
70 | end
71 |
72 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | if defined?(Bundler)
6 | # If you precompile assets before deploying to production, use this line
7 | Bundler.require(*Rails.groups(:assets => %w(development test)))
8 | # If you want your assets lazily compiled in production, use this line
9 | # Bundler.require(:default, :assets, Rails.env)
10 | end
11 |
12 | module Bango
13 | class Application < Rails::Application
14 | # Settings in config/environments/* take precedence over those specified here.
15 | # Application configuration should go into files in config/initializers
16 | # -- all .rb files in that directory are automatically loaded.
17 |
18 | # Custom directories with classes and modules you want to be autoloadable.
19 | # config.autoload_paths += %W(#{config.root}/extras)
20 |
21 | # Only load the plugins named here, in the order given (default is alphabetical).
22 | # :all can be used as a placeholder for all plugins not explicitly named.
23 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24 |
25 | # Activate observers that should always be running.
26 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27 |
28 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30 | # config.time_zone = 'Central Time (US & Canada)'
31 |
32 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34 | # config.i18n.default_locale = :de
35 |
36 | # Configure the default encoding used in templates for Ruby 1.9.
37 | config.encoding = "utf-8"
38 |
39 | # Configure sensitive parameters which will be filtered from the log file.
40 | config.filter_parameters += [:password]
41 |
42 | # Enable the asset pipeline
43 | config.assets.enabled = true
44 |
45 | # Version of your assets, change this if you want to expire all your assets
46 | config.assets.version = '1.0'
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/config/deploy.rb:
--------------------------------------------------------------------------------
1 | require 'bundler/capistrano'
2 |
3 | set :user, 'sfistak'
4 | set :domain, 'miaplacidus.dreamhost.com'
5 | set :project, 'bango'
6 |
7 | set :application, "bango.fatbuu.com"
8 |
9 | set :applicationdir, "/home/#{user}/Sites/#{project}"
10 |
11 | ssh_options[:forward_agent] = true
12 | set :scm, :git
13 | # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
14 | set :repository, "git@github.com:gs/bango.git"
15 | set :branch, 'master'
16 | set :git_shallow_clone, 1
17 | set :scm_verbose, true
18 | set :deploy_via, :remote_cache
19 | set :deploy_to, "#{applicationdir}"
20 | set :copy_exclude, [".git"]
21 | set :rails_env, "production"
22 | #need to send this to have access to bundle
23 | set :default_environment, { 'PATH' => "'/home/sfistak/.rvm/gems/ruby-1.9.2-p290/bin:/home/sfistak/.rvm/gems/ruby-1.9.2-p290@global/bin//bundle:/home/sfistak/.rvm/bin:/home/sfistak/.gems/bin:/usr/lib/ruby/gems/1.8/bin/:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games'" }
24 |
25 | role :web, domain
26 | role :app, domain # This may be the same as your `Web` server
27 | role :db, domain, :primary => true # This is where Rails migrations will run
28 |
29 | # if you're still using the script/reaper helper you will need
30 | # these http://github.com/rails/irs_process_scripts
31 |
32 | # If you are using Passenger mod_rails uncomment this:
33 | namespace :deploy do
34 | task :start do ; end
35 | task :stop do ; end
36 |
37 | task :restart, :roles => :app, :except => { :no_release => true } do
38 | run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
39 | end
40 |
41 | desc "Sync the public/assets directory."
42 | task :assetss do
43 | system "rsync -vr --exclude='.DS_Store' public/assets #{user}@#{application}:#{shared_path}/"
44 | end
45 |
46 | desc "Shared symlinks db, assets, config.ru"
47 | task :share_symlink, :except => { :no_release => true } do
48 | run "ln -nfs #{applicationdir}/shared/config/database.yml #{release_path}/config/database.yml"
49 | run "ln -nfs #{applicationdir}/shared/config.ru #{release_path}/config.ru"
50 | run "ln -nfs #{shared_path}/assets #{release_path}/public/assets"
51 | end
52 |
53 | end
54 |
55 | set :chmod755, "app config db lib public vendor script script/* public/disp*"
56 | set :use_sudo, false
57 |
58 | after "deploy:update_code", "deploy:share_symlink"
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Bango::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # Code is not reloaded between requests
5 | config.cache_classes = true
6 |
7 | # Full error reports are disabled and caching is turned on
8 | config.consider_all_requests_local = false
9 | config.action_controller.perform_caching = true
10 |
11 | # Disable Rails's static asset server (Apache or nginx will already do this)
12 | config.serve_static_assets = false
13 |
14 | # Compress JavaScripts and CSS
15 | config.assets.compress = true
16 |
17 | # Don't fallback to assets pipeline if a precompiled asset is missed
18 | config.assets.compile = true
19 |
20 | # Generate digests for assets URLs
21 | config.assets.digest = true
22 |
23 | # Defaults to Rails.root.join("public/assets")
24 | # config.assets.manifest = YOUR_PATH
25 |
26 | # Specifies the header that your server uses for sending files
27 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29 |
30 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31 | # config.force_ssl = true
32 |
33 | # See everything in the log (default is :info)
34 | # config.log_level = :debug
35 |
36 | # Use a different logger for distributed setups
37 | # config.logger = SyslogLogger.new
38 |
39 | # Use a different cache store in production
40 | # config.cache_store = :mem_cache_store
41 |
42 | # Enable serving of images, stylesheets, and JavaScripts from an asset server
43 | # config.action_controller.asset_host = "http://assets.example.com"
44 |
45 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46 | # config.assets.precompile += %w( *.css *.js )
47 |
48 | # Disable delivery errors, bad email addresses will be ignored
49 | # config.action_mailer.raise_delivery_errors = false
50 |
51 | # Enable threaded mode
52 | # config.threadsafe!
53 |
54 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
55 | # the I18n.default_locale when a translation can not be found)
56 | config.i18n.fallbacks = true
57 |
58 | # Send deprecation notices to registered listeners
59 | config.active_support.deprecation = :notify
60 | end
61 |
--------------------------------------------------------------------------------
/spec/requests/users_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe "Users" do
4 |
5 | describe "signup" do
6 |
7 | describe "failure" do
8 | it "should not make a new user" do
9 | lambda do
10 | visit signup_path
11 | fill_in "Name", :with => ""
12 | fill_in "Email", :with => ""
13 | fill_in "Password", :with => ""
14 | fill_in "Confirmation", :with => ""
15 | click_button
16 | response.should render_template('users/new')
17 | response.should have_selector('div#error_explanation')
18 | response.should_not have_selector('div.flash.success')
19 | end.should_not change(User, :count)
20 | end
21 | end
22 |
23 | describe "success" do
24 | it "should make a new user" do
25 | lambda do
26 | visit signup_path
27 | fill_in "Name", :with => "Michal"
28 | fill_in "Email", :with => "michal@oalskdf.pl"
29 | fill_in "Password", :with => "foobar"
30 | fill_in "Confirmation", :with => "foobar"
31 | click_button
32 | response.should_not have_selector('div#error_explanation')
33 | response.should have_selector('div.flash.success', :content => "Welcome")
34 | response.should render_template('users/show')
35 | end.should change(User, :count).by(1)
36 | end
37 | end
38 |
39 | describe "signin" do
40 | describe "failure" do
41 | it "should not sign in user" do
42 | visit signin_path
43 | fill_in "Email", :with => ""
44 | fill_in "Password", :with => ""
45 | click_button
46 |
47 | response.should have_selector("div.flash.error",
48 | :content => "Invalid")
49 | response.should render_template("sessions/new")
50 |
51 | end
52 | end
53 | describe "success" do
54 | it "should sign in and out user" do
55 | user = Factory(:user)
56 | visit signin_path
57 | fill_in "Email", :with => user.email
58 | fill_in "Password", :with => user.password
59 | click_button
60 |
61 | controller.should be_signed_in
62 | click_link "Sign out"
63 | controller.should_not be_signed_in
64 |
65 | end
66 | end
67 |
68 | end
69 |
70 | end
71 | end
72 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | Bango::Application.routes.draw do
2 |
3 | root :to => "pages#home"
4 | resources :users
5 | resources :sessions, :only => [:new, :create, :destroy]
6 | resources :microposts, :only => [:create, :destroy]
7 |
8 | match "/contact" => "pages#contact"
9 | match "/about" => "pages#about"
10 | match "/help" => "pages#help"
11 | match "/signup" => "users#new"
12 | match "/signin" => "sessions#new"
13 | match "/signout" => "sessions#destroy"
14 |
15 | # The priority is based upon order of creation:
16 | # first created -> highest priority.
17 |
18 | # Sample of regular route:
19 | # match 'products/:id' => 'catalog#view'
20 | # Keep in mind you can assign values other than :controller and :action
21 |
22 | # Sample of named route:
23 | # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
24 | # This route can be invoked with purchase_url(:id => product.id)
25 |
26 | # Sample resource route (maps HTTP verbs to controller actions automatically):
27 | # resources :products
28 |
29 | # Sample resource route with options:
30 | # resources :products do
31 | # member do
32 | # get 'short'
33 | # post 'toggle'
34 | # end
35 | #
36 | # collection do
37 | # get 'sold'
38 | # end
39 | # end
40 |
41 | # Sample resource route with sub-resources:
42 | # resources :products do
43 | # resources :comments, :sales
44 | # resource :seller
45 | # end
46 |
47 | # Sample resource route with more complex sub-resources
48 | # resources :products do
49 | # resources :comments
50 | # resources :sales do
51 | # get 'recent', :on => :collection
52 | # end
53 | # end
54 |
55 | # Sample resource route within a namespace:
56 | # namespace :admin do
57 | # # Directs /admin/products/* to Admin::ProductsController
58 | # # (app/controllers/admin/products_controller.rb)
59 | # resources :products
60 | # end
61 |
62 | # You can have the root of your site routed with "root"
63 | # just remember to delete public/index.html.
64 | # root :to => 'welcome#index'
65 |
66 | # See how all your routes lay out with "rake routes"
67 |
68 | # This is a legacy wild controller route that's not recommended for RESTful applications.
69 | # Note: This route will make all actions in every controller accessible via GET requests.
70 | # match ':controller(/:action(/:id(.:format)))'
71 | end
72 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/buttons/screen.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | buttons.css
4 | * Gives you some great CSS-only buttons.
5 |
6 | Created by Kevin Hale [particletree.com]
7 | * particletree.com/features/rediscovering-the-button-element
8 |
9 | See Readme.txt in this folder for instructions.
10 |
11 | -------------------------------------------------------------- */
12 |
13 | a.button, button {
14 | display:block;
15 | float:left;
16 | margin: 0.7em 0.5em 0.7em 0;
17 | padding:5px 10px 5px 7px; /* Links */
18 |
19 | border:1px solid #dedede;
20 | border-top:1px solid #eee;
21 | border-left:1px solid #eee;
22 |
23 | background-color:#f5f5f5;
24 | font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
25 | font-size:100%;
26 | line-height:130%;
27 | text-decoration:none;
28 | font-weight:bold;
29 | color:#565656;
30 | cursor:pointer;
31 | }
32 | button {
33 | width:auto;
34 | overflow:visible;
35 | padding:4px 10px 3px 7px; /* IE6 */
36 | }
37 | button[type] {
38 | padding:4px 10px 4px 7px; /* Firefox */
39 | line-height:17px; /* Safari */
40 | }
41 | *:first-child+html button[type] {
42 | padding:4px 10px 3px 7px; /* IE7 */
43 | }
44 | button img, a.button img{
45 | margin:0 3px -3px 0 !important;
46 | padding:0;
47 | border:none;
48 | width:16px;
49 | height:16px;
50 | float:none;
51 | }
52 |
53 |
54 | /* Button colors
55 | -------------------------------------------------------------- */
56 |
57 | /* Standard */
58 | button:hover, a.button:hover{
59 | background-color:#dff4ff;
60 | border:1px solid #c2e1ef;
61 | color:#336699;
62 | }
63 | a.button:active{
64 | background-color:#6299c5;
65 | border:1px solid #6299c5;
66 | color:#fff;
67 | }
68 |
69 | /* Positive */
70 | body .positive {
71 | color:#529214;
72 | }
73 | a.positive:hover, button.positive:hover {
74 | background-color:#E6EFC2;
75 | border:1px solid #C6D880;
76 | color:#529214;
77 | }
78 | a.positive:active {
79 | background-color:#529214;
80 | border:1px solid #529214;
81 | color:#fff;
82 | }
83 |
84 | /* Negative */
85 | body .negative {
86 | color:#d12f19;
87 | }
88 | a.negative:hover, button.negative:hover {
89 | background-color:#fbe3e4;
90 | border:1px solid #fbc2c4;
91 | color:#d12f19;
92 | }
93 | a.negative:active {
94 | background-color:#d12f19;
95 | border:1px solid #d12f19;
96 | color:#fff;
97 | }
98 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/fancy-type/screen.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | fancy-type.css
4 | * Lots of pretty advanced classes for manipulating text.
5 |
6 | See the Readme file in this folder for additional instructions.
7 |
8 | -------------------------------------------------------------- */
9 |
10 | /* Indentation instead of line shifts for sibling paragraphs. */
11 | p + p { text-indent:2em; margin-top:-1.5em; }
12 | form p + p { text-indent: 0; } /* Don't want this in forms. */
13 |
14 |
15 | /* For great looking type, use this code instead of asdf:
16 | asdf
17 | Best used on prepositions and ampersands. */
18 |
19 | .alt {
20 | color: #666;
21 | font-family: "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif;
22 | font-style: italic;
23 | font-weight: normal;
24 | }
25 |
26 |
27 | /* For great looking quote marks in titles, replace "asdf" with:
28 | “ asdf”
29 | (That is, when the title starts with a quote mark).
30 | (You may have to change this value depending on your font size). */
31 |
32 | .dquo { margin-left: -.5em; }
33 |
34 |
35 | /* Reduced size type with incremental leading
36 | (http://www.markboulton.co.uk/journal/comments/incremental_leading/)
37 |
38 | This could be used for side notes. For smaller type, you don't necessarily want to
39 | follow the 1.5x vertical rhythm -- the line-height is too much.
40 |
41 | Using this class, it reduces your font size and line-height so that for
42 | every four lines of normal sized type, there is five lines of the sidenote. eg:
43 |
44 | New type size in em's:
45 | 10px (wanted side note size) / 12px (existing base size) = 0.8333 (new type size in ems)
46 |
47 | New line-height value:
48 | 12px x 1.5 = 18px (old line-height)
49 | 18px x 4 = 72px
50 | 72px / 5 = 14.4px (new line height)
51 | 14.4px / 10px = 1.44 (new line height in em's) */
52 |
53 | p.incr, .incr p {
54 | font-size: 10px;
55 | line-height: 1.44em;
56 | margin-bottom: 1.5em;
57 | }
58 |
59 |
60 | /* Surround uppercase words and abbreviations with this class.
61 | Based on work by Jørgen Arnor Gårdsø Lom [http://twistedintellect.com/] */
62 |
63 | .caps {
64 | font-variant: small-caps;
65 | letter-spacing: 1px;
66 | text-transform: lowercase;
67 | font-size:1.2em;
68 | line-height:1%;
69 | font-weight:bold;
70 | padding:0 2px;
71 | }
72 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/src/print.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | print.css
4 | * Gives you some sensible styles for printing pages.
5 | * See Readme file in this directory for further instructions.
6 |
7 | Some additions you'll want to make, customized to your markup:
8 | #header, #footer, #navigation { display:none; }
9 |
10 | -------------------------------------------------------------- */
11 |
12 | body {
13 | line-height: 1.5;
14 | font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
15 | color:#000;
16 | background: none;
17 | font-size: 10pt;
18 | }
19 |
20 |
21 | /* Layout
22 | -------------------------------------------------------------- */
23 |
24 | .container {
25 | background: none;
26 | }
27 |
28 | hr {
29 | background:#ccc;
30 | color:#ccc;
31 | width:100%;
32 | height:2px;
33 | margin:2em 0;
34 | padding:0;
35 | border:none;
36 | }
37 | hr.space {
38 | background: #fff;
39 | color: #fff;
40 | visibility: hidden;
41 | }
42 |
43 |
44 | /* Text
45 | -------------------------------------------------------------- */
46 |
47 | h1,h2,h3,h4,h5,h6 { font-family: "Helvetica Neue", Arial, "Lucida Grande", sans-serif; }
48 | code { font:.9em "Courier New", Monaco, Courier, monospace; }
49 |
50 | a img { border:none; }
51 | p img.top { margin-top: 0; }
52 |
53 | blockquote {
54 | margin:1.5em;
55 | padding:1em;
56 | font-style:italic;
57 | font-size:.9em;
58 | }
59 |
60 | .small { font-size: .9em; }
61 | .large { font-size: 1.1em; }
62 | .quiet { color: #999; }
63 | .hide { display:none; }
64 |
65 |
66 | /* Links
67 | -------------------------------------------------------------- */
68 |
69 | a:link, a:visited {
70 | background: transparent;
71 | font-weight:700;
72 | text-decoration: underline;
73 | }
74 |
75 | /*
76 | This has been the source of many questions in the past. This
77 | snippet of CSS appends the URL of each link within the text.
78 | The idea is that users printing your webpage will want to know
79 | the URLs they go to. If you want to remove this functionality,
80 | comment out this snippet and make sure to re-compress your files.
81 | */
82 | a:link:after, a:visited:after {
83 | content: " (" attr(href) ")";
84 | font-size: 90%;
85 | }
86 |
87 | /* If you're having trouble printing relative links, uncomment and customize this:
88 | (note: This is valid CSS3, but it still won't go through the W3C CSS Validator) */
89 |
90 | /* a[href^="/"]:after {
91 | content: " (http://www.yourdomain.com" attr(href) ") ";
92 | } */
93 |
--------------------------------------------------------------------------------
/spec/controllers/microposts_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe MicropostsController do
4 | render_views
5 |
6 | describe "access control" do
7 | it "should deny access to destroy" do
8 | post :create
9 | response.should redirect_to(signin_path)
10 | end
11 | it "should deny access to create" do
12 | post :destroy, :id => 1
13 | response.should redirect_to(signin_path)
14 | end
15 | end
16 |
17 | describe "POST 'create'" do
18 |
19 | before(:each) do
20 | @user = test_sign_in(Factory(:user))
21 | end
22 |
23 | describe "failure" do
24 | before(:each) do
25 | @attr = {:content => " "}
26 | end
27 |
28 | it "should not create a micropost" do
29 | lambda do
30 | post :create, :micropost => @attr
31 | end.should_not change(Micropost, :count)
32 | end
33 |
34 | it "should rerender the home page" do
35 | post :create, :micropost => @attr
36 | response.should render_template('pages/home')
37 | end
38 | end
39 |
40 | describe "success" do
41 |
42 | before(:each) do
43 | @attr = {:content => "foobar"}
44 | end
45 |
46 | it "should create micropost" do
47 | lambda do
48 | post :create, :micropost => @attr
49 | end.should change(Micropost, :count).by(1)
50 | end
51 |
52 | it "should redirect to root path" do
53 | post :create, :micropost => @attr
54 | response.should redirect_to(root_path)
55 | end
56 |
57 | it "should have flash success message" do
58 | post :create, :micropost => @attr
59 | flash[:success].should =~ /well done/i
60 | end
61 | end
62 | end
63 |
64 | describe "Delete 'destroy'" do
65 |
66 | describe 'for an unathorized user' do
67 |
68 | before(:each) do
69 | @user = Factory(:user)
70 | wrong_user = Factory(:user, :email => Factory.next(:email))
71 | @micropost = Factory(:micropost, :user => @user)
72 | test_sign_in(wrong_user)
73 | end
74 |
75 | it "should deny access" do
76 | delete :destroy, :id => @micropost
77 | response.should redirect_to(root_path)
78 | end
79 | end
80 |
81 | describe "for an authorized user" do
82 | before(:each) do
83 | @user = Factory(:user)
84 | @micropost = Factory(:micropost, :user => @user)
85 | test_sign_in(@user)
86 | end
87 |
88 | it "should delete access" do
89 | lambda do
90 | delete :destroy, :id => @micropost
91 | flash[:success].should =~ /deleted/i
92 | response.should redirect_to(root_path)
93 | end.should change(Micropost, :count).by(-1)
94 | end
95 | end
96 | end
97 |
98 | end
99 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/src/ie.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | ie.css
4 |
5 | Contains every hack for Internet Explorer,
6 | so that our core files stay sweet and nimble.
7 |
8 | -------------------------------------------------------------- */
9 |
10 | /* Make sure the layout is centered in IE5 */
11 | body { text-align: center; }
12 | .container { text-align: left; }
13 |
14 | /* Fixes IE margin bugs */
15 | * html .column, * html .span-1, * html .span-2,
16 | * html .span-3, * html .span-4, * html .span-5,
17 | * html .span-6, * html .span-7, * html .span-8,
18 | * html .span-9, * html .span-10, * html .span-11,
19 | * html .span-12, * html .span-13, * html .span-14,
20 | * html .span-15, * html .span-16, * html .span-17,
21 | * html .span-18, * html .span-19, * html .span-20,
22 | * html .span-21, * html .span-22, * html .span-23,
23 | * html .span-24 { display:inline; overflow-x: hidden; }
24 |
25 |
26 | /* Elements
27 | -------------------------------------------------------------- */
28 |
29 | /* Fixes incorrect styling of legend in IE6. */
30 | * html legend { margin:0px -8px 16px 0; padding:0; }
31 |
32 | /* Fixes wrong line-height on sup/sub in IE. */
33 | sup { vertical-align:text-top; }
34 | sub { vertical-align:text-bottom; }
35 |
36 | /* Fixes IE7 missing wrapping of code elements. */
37 | html>body p code { *white-space: normal; }
38 |
39 | /* IE 6&7 has problems with setting proper margins. */
40 | hr { margin:-8px auto 11px; }
41 |
42 | /* Explicitly set interpolation, allowing dynamically resized images to not look horrible */
43 | img { -ms-interpolation-mode:bicubic; }
44 |
45 | /* Clearing
46 | -------------------------------------------------------------- */
47 |
48 | /* Makes clearfix actually work in IE */
49 | .clearfix, .container { display:inline-block; }
50 | * html .clearfix,
51 | * html .container { height:1%; }
52 |
53 |
54 | /* Forms
55 | -------------------------------------------------------------- */
56 |
57 | /* Fixes padding on fieldset */
58 | fieldset { padding-top:0; }
59 | legend { margin-top:-0.2em; margin-bottom:1em; margin-left:-0.5em; }
60 |
61 | /* Makes classic textareas in IE 6 resemble other browsers */
62 | textarea { overflow:auto; }
63 |
64 | /* Makes labels behave correctly in IE 6 and 7 */
65 | label { vertical-align:middle; position:relative; top:-0.25em; }
66 |
67 | /* Fixes rule that IE 6 ignores */
68 | input.text, input.title, textarea { background-color:#fff; border:1px solid #bbb; }
69 | input.text:focus, input.title:focus { border-color:#666; }
70 | input.text, input.title, textarea, select { margin:0.5em 0; }
71 | input.checkbox, input.radio { position:relative; top:.25em; }
72 |
73 | /* Fixes alignment of inline form elements */
74 | form.inline div, form.inline p { vertical-align:middle; }
75 | form.inline input.checkbox, form.inline input.radio,
76 | form.inline input.button, form.inline button {
77 | margin:0.5em 0;
78 | }
79 | button, input.button { position:relative;top:0.25em; }
80 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/src/forms.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | forms.css
4 | * Sets up some default styling for forms
5 | * Gives you classes to enhance your forms
6 |
7 | Usage:
8 | * For text fields, use class .title or .text
9 | * For inline forms, use .inline (even when using columns)
10 |
11 | -------------------------------------------------------------- */
12 |
13 | /*
14 | A special hack is included for IE8 since it does not apply padding
15 | correctly on fieldsets
16 | */
17 | label { font-weight: bold; }
18 | fieldset { padding:0 1.4em 1.4em 1.4em; margin: 0 0 1.5em 0; border: 1px solid #ccc; }
19 | legend { font-weight: bold; font-size:1.2em; margin-top:-0.2em; margin-bottom:1em; }
20 |
21 | fieldset, #IE8#HACK { padding-top:1.4em; }
22 | legend, #IE8#HACK { margin-top:0; margin-bottom:0; }
23 |
24 | /* Form fields
25 | -------------------------------------------------------------- */
26 |
27 | /*
28 | Attribute selectors are used to differentiate the different types
29 | of input elements, but to support old browsers, you will have to
30 | add classes for each one. ".title" simply creates a large text
31 | field, this is purely for looks.
32 | */
33 | input[type=text], input[type=password], input[type=url], input[type=email],
34 | input.text, input.title,
35 | textarea {
36 | background-color:#fff;
37 | border:1px solid #bbb;
38 | color:#000;
39 | }
40 | input[type=text]:focus, input[type=password]:focus, input[type=url]:focus, input[type=email]:focus,
41 | input.text:focus, input.title:focus,
42 | textarea:focus {
43 | border-color:#666;
44 | }
45 | select { background-color:#fff; border-width:1px; border-style:solid; }
46 |
47 | input[type=text], input[type=password], input[type=url], input[type=email],
48 | input.text, input.title,
49 | textarea, select {
50 | margin:0.5em 0;
51 | }
52 |
53 | input.text,
54 | input.title { width: 300px; padding:5px; }
55 | input.title { font-size:1.5em; }
56 | textarea { width: 390px; height: 250px; padding:5px; }
57 |
58 | /*
59 | This is to be used on forms where a variety of elements are
60 | placed side-by-side. Use the p tag to denote a line.
61 | */
62 | form.inline { line-height:3; }
63 | form.inline p { margin-bottom:0; }
64 |
65 |
66 | /* Success, info, notice and error/alert boxes
67 | -------------------------------------------------------------- */
68 |
69 | .error,
70 | .alert,
71 | .notice,
72 | .success,
73 | .info { padding: 0.8em; margin-bottom: 1em; border: 2px solid #ddd; }
74 |
75 | .error, .alert { background: #fbe3e4; color: #8a1f11; border-color: #fbc2c4; }
76 | .notice { background: #fff6bf; color: #514721; border-color: #ffd324; }
77 | .success { background: #e6efc2; color: #264409; border-color: #c6d880; }
78 | .info { background: #d5edf8; color: #205791; border-color: #92cae4; }
79 | .error a, .alert a { color: #8a1f11; }
80 | .notice a { color: #514721; }
81 | .success a { color: #264409; }
82 | .info a { color: #205791; }
83 |
--------------------------------------------------------------------------------
/spec/requests/layout_links_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe "LayoutLinks" do
4 | it "should have a Home page at /" do
5 | get '/'
6 | response.should have_selector('title', :content => "Home")
7 | end
8 |
9 | it "should have a Contact page at /contact" do
10 | get '/contact'
11 | response.should have_selector('title', :content => "Contact")
12 | end
13 |
14 | it "should have a About page at /about" do
15 | get '/about'
16 | response.should have_selector('title', :content => "About")
17 | end
18 |
19 | it "should have a Help page at /help" do
20 | get '/help'
21 | response.should have_selector('title', :content => "Help")
22 | end
23 |
24 | it "should have a Sign up page at /signup" do
25 | get '/signup'
26 | response.should have_selector('title', :content => "Sign up")
27 | end
28 |
29 | it "should have a Sign in page at /signin" do
30 | get '/signin'
31 | response.should have_selector('title', :content => "Sign in")
32 | end
33 |
34 | it "should have the right links on the layout" do
35 | visit root_path
36 | response.should have_selector('title', :content => "Home")
37 | click_link "About"
38 | response.should have_selector('title', :content => "About")
39 | click_link "Contact"
40 | response.should have_selector('title', :content => "Contact")
41 | click_link "Home"
42 | response.should have_selector('title', :content => "Home")
43 | click_link "Sign up now!"
44 | response.should have_selector('title', :content => "Sign up")
45 | response.should have_selector('a[href="/"]>img')
46 | end
47 |
48 | describe "when user not signin" do
49 | it "should have sign in link" do
50 | visit root_path
51 | response.should have_selector("a", :href => signin_path,
52 | :content => "Sign in")
53 | end
54 | end
55 |
56 | describe "when user signin" do
57 | before(:each) do
58 | @user = Factory(:user)
59 | visit signin_path
60 | fill_in :email, :with => @user.email
61 | fill_in :password, :with => @user.password
62 | click_button
63 | end
64 |
65 | it "should have signout link" do
66 | visit root_path
67 | response.should have_selector("a", :href => signout_path,
68 | :content => "Sign out")
69 |
70 | end
71 | it "should have a profile link" do
72 | visit root_path
73 | response.should have_selector("a", :href => user_path(@user),
74 | :content => "Profile")
75 | end
76 |
77 | it "should have a settings link" do
78 | visit root_path
79 | response.should have_selector("a", :href => edit_user_path(@user),
80 | :content => "Settings")
81 | end
82 |
83 | it "should have a users link" do
84 | visit root_path
85 | response.should have_selector("a", :href => users_path,
86 | :content => "Users")
87 | end
88 | end
89 | end
90 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/src/typography.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | typography.css
4 | * Sets up some sensible default typography.
5 |
6 | -------------------------------------------------------------- */
7 |
8 | /* Default font settings.
9 | The font-size percentage is of 16px. (0.75 * 16px = 12px) */
10 | html { font-size:100.01%; }
11 | body {
12 | font-size: 75%;
13 | color: #222;
14 | background: #fff;
15 | font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
16 | }
17 |
18 |
19 | /* Headings
20 | -------------------------------------------------------------- */
21 |
22 | h1,h2,h3,h4,h5,h6 { font-weight: normal; color: #111; }
23 |
24 | h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; }
25 | h2 { font-size: 2em; margin-bottom: 0.75em; }
26 | h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; }
27 | h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; }
28 | h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.5em; }
29 | h6 { font-size: 1em; font-weight: bold; }
30 |
31 | h1 img, h2 img, h3 img,
32 | h4 img, h5 img, h6 img {
33 | margin: 0;
34 | }
35 |
36 |
37 | /* Text elements
38 | -------------------------------------------------------------- */
39 |
40 | p { margin: 0 0 1.5em; }
41 | /*
42 | These can be used to pull an image at the start of a paragraph, so
43 | that the text flows around it (usage: Text
)
44 | */
45 | .left { float: left !important; }
46 | p .left { margin: 1.5em 1.5em 1.5em 0; padding: 0; }
47 | .right { float: right !important; }
48 | p .right { margin: 1.5em 0 1.5em 1.5em; padding: 0; }
49 |
50 | a:focus,
51 | a:hover { color: #09f; }
52 | a { color: #06c; text-decoration: underline; }
53 |
54 | blockquote { margin: 1.5em; color: #666; font-style: italic; }
55 | strong,dfn { font-weight: bold; }
56 | em,dfn { font-style: italic; }
57 | sup, sub { line-height: 0; }
58 |
59 | abbr,
60 | acronym { border-bottom: 1px dotted #666; }
61 | address { margin: 0 0 1.5em; font-style: italic; }
62 | del { color:#666; }
63 |
64 | pre { margin: 1.5em 0; white-space: pre; }
65 | pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; }
66 |
67 |
68 | /* Lists
69 | -------------------------------------------------------------- */
70 |
71 | li ul,
72 | li ol { margin: 0; }
73 | ul, ol { margin: 0 1.5em 1.5em 0; padding-left: 1.5em; }
74 |
75 | ul { list-style-type: disc; }
76 | ol { list-style-type: decimal; }
77 |
78 | dl { margin: 0 0 1.5em 0; }
79 | dl dt { font-weight: bold; }
80 | dd { margin-left: 1.5em;}
81 |
82 |
83 | /* Tables
84 | -------------------------------------------------------------- */
85 |
86 | /*
87 | Because of the need for padding on TH and TD, the vertical rhythm
88 | on table cells has to be 27px, instead of the standard 18px or 36px
89 | of other elements.
90 | */
91 | table { margin-bottom: 1.4em; width:100%; }
92 | th { font-weight: bold; }
93 | thead th { background: #c3d9ff; }
94 | th,td,caption { padding: 4px 10px 4px 5px; }
95 | /*
96 | You can zebra-stripe your tables in outdated browsers by adding
97 | the class "even" to every other table row.
98 | */
99 | tbody tr:nth-child(even) td,
100 | tbody tr.even td {
101 | background: #e5ecf9;
102 | }
103 | tfoot { font-style: italic; }
104 | caption { background: #eee; }
105 |
106 |
107 | /* Misc classes
108 | -------------------------------------------------------------- */
109 |
110 | .small { font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; }
111 | .large { font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; }
112 | .hide { display: none; }
113 |
114 | .quiet { color: #666; }
115 | .loud { color: #000; }
116 | .highlight { background:#ff0; }
117 | .added { background:#060; color: #fff; }
118 | .removed { background:#900; color: #fff; }
119 |
120 | .first { margin-left:0; padding-left:0; }
121 | .last { margin-right:0; padding-right:0; }
122 | .top { margin-top:0; padding-top:0; }
123 | .bottom { margin-bottom:0; padding-bottom:0; }
124 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/custom.css:
--------------------------------------------------------------------------------
1 | .container {
2 | width: 710px;
3 | }
4 |
5 | body {
6 | background: #cff;
7 | }
8 |
9 | header {
10 | padding-top: 20px;
11 | }
12 |
13 | header img {
14 | padding: 1em;
15 | background: #fff;
16 | }
17 |
18 | section {
19 | margin-top: 1em;
20 | font-size: 120%;
21 | padding: 20px;
22 | background: #fff;
23 | }
24 |
25 | section h1 {
26 | font-size: 250%;
27 | }
28 |
29 | /* links */
30 |
31 | a {
32 | color: #09c;
33 | text-decoration: none;
34 | }
35 |
36 | a:hover{
37 | color: #069;
38 | text-decoration: none;
39 | }
40 |
41 | a:visited {
42 | color: #069;
43 | }
44 |
45 | /* NAV */
46 |
47 | nav {
48 | float: right;
49 | background: white;
50 | padding: 0 0.7em;
51 | white-space: nowrap;
52 | }
53 |
54 | nav ul {
55 | margin: 0;
56 | padding: 0;
57 | }
58 |
59 | nav ul li {
60 | list-style-type: none;
61 | display: inline-block;
62 | padding: 0.2em 0;
63 | }
64 |
65 | nav ul li a {
66 | padding: 0 5px;
67 | font-weight: bold;
68 | }
69 |
70 | nav ul li a:visited {
71 | color: #09c;
72 | }
73 |
74 | nav ul li a:hover {
75 | text-decoration: underline;
76 | }
77 |
78 | /* buttons */
79 |
80 | a.signin_button {
81 | margin-left: auto;
82 | margin-right: auto;
83 | display: block;
84 | text-align: center;
85 | width: 190px;
86 | color: #fff;
87 | background: #006400;
88 | font-size: 150%;
89 | font-weight: bold;
90 | padding: 20px;
91 | }
92 |
93 | /* round */
94 |
95 | .round {
96 | -moz-border-radius: 10px;
97 | -webkit-border-radius: 10px;
98 | border-radius: 10px;
99 | }
100 |
101 |
102 | /*footer*/
103 |
104 | footer {
105 | text-align: center;
106 | margin-top: 10px;
107 | width: 710px;
108 | margin-left: auto;
109 | margin-right: auto;
110 | }
111 |
112 | footer nav {
113 | float: none;
114 | }
115 |
116 |
117 | /*User show page */
118 |
119 | table.profile {
120 | width: 100%;
121 | margin-bottom: 0;
122 | }
123 |
124 | td.main {
125 | width: 70%;
126 | padding: 1em;
127 | }
128 |
129 | td.sidebar {
130 | width: 30%;
131 | padding: 1em;
132 | vertical-align: top;
133 | background: #ffc;
134 | }
135 |
136 | .profile img.gravatar {
137 | border: 1px solid #999;
138 | maring-bottom: -15px;
139 | }
140 |
141 |
142 | /*Sign up form*/
143 |
144 | div.fields, div.actions {
145 | margin-bottom: 10px;
146 | }
147 |
148 | .field_with_errors {
149 | margin-top: 10px;
150 | padding: 2px;
151 | background: red;
152 | display: table;
153 | }
154 |
155 | .field_with_errors label {
156 | color: #fff;
157 | }
158 |
159 | #error_explanation {
160 | width: 400px;
161 | border: 2px solid red;
162 | padding: 7px;
163 | padding-bottom: 12px;
164 | margin-bottom: 20px;
165 | background-color: #f0f0f0;
166 | }
167 |
168 | #error_explanation h2 {
169 | text-align: left;
170 | font-weight: bold;
171 | padding: 5px 5px 5px 15px;
172 | font-size: 12px;
173 | margin: -7px;
174 | background-color: #c00;
175 | color: #fff;
176 | }
177 |
178 | #error_explanation p {
179 | color: #333;
180 | margin-bottom: 0px;
181 | padding: 5px;
182 | }
183 |
184 | #error_explanation ul li {
185 | font-size: 12px;
186 | list-style: square;
187 | }
188 |
189 |
190 |
191 | /*users*/
192 |
193 | ul.users {
194 | margin-top: 1em;
195 | }
196 |
197 | ul.users li {
198 | list-style: none;
199 | }
200 |
201 | /* Micropost styling */
202 |
203 | h1.micropost {
204 | margin-bottom: 0.3em;
205 | }
206 |
207 | table.microposts {
208 | margin-top: 1em;
209 | }
210 |
211 | table.microposts tr {
212 | height: 70px;
213 | }
214 |
215 | table.microposts tr td.gravatar {
216 | border-top: 1px solid #ccc;
217 | vertical-align: top;
218 | width: 50px;
219 | }
220 |
221 | table.microposts tr td.micropost {
222 | border-top: 1px solid #ccc;
223 | vertical-align: top;
224 | padding-top: 10px;
225 | }
226 |
227 | table.microposts tr td.micropost span.timestamp {
228 | display: block;
229 | font-size: 85%;
230 | color: #666;
231 | }
232 |
233 | div.user_info img {
234 | padding-right: 0.1em;
235 | }
236 |
237 | div.user_info a {
238 | text-decoration: none;
239 | }
240 |
241 | div.user_info span.user_name {
242 | position: absolute;
243 | }
244 |
245 | div.user_info span.microposts {
246 | font-size: 80%;
247 | }
248 |
249 | form.new_micropost {
250 | margin-bottom: 2em;
251 | }
252 |
253 | form.new_micropost textarea {
254 | height: 4em;
255 | margin-bottom: 0;
256 | }
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GIT
2 | remote: git://github.com/jeremyolliver/annotate_models.git
3 | revision: 4d57e4fe6360125f17886168120a48091a268e45
4 | branch: rake_compatibility
5 | specs:
6 | annotate (2.4.0)
7 |
8 | GEM
9 | remote: http://rubygems.org/
10 | specs:
11 | actionmailer (3.1.3)
12 | actionpack (= 3.1.3)
13 | mail (~> 2.3.0)
14 | actionpack (3.1.3)
15 | activemodel (= 3.1.3)
16 | activesupport (= 3.1.3)
17 | builder (~> 3.0.0)
18 | erubis (~> 2.7.0)
19 | i18n (~> 0.6)
20 | rack (~> 1.3.5)
21 | rack-cache (~> 1.1)
22 | rack-mount (~> 0.8.2)
23 | rack-test (~> 0.6.1)
24 | sprockets (~> 2.0.3)
25 | activemodel (3.1.3)
26 | activesupport (= 3.1.3)
27 | builder (~> 3.0.0)
28 | i18n (~> 0.6)
29 | activerecord (3.1.3)
30 | activemodel (= 3.1.3)
31 | activesupport (= 3.1.3)
32 | arel (~> 2.2.1)
33 | tzinfo (~> 0.3.29)
34 | activeresource (3.1.3)
35 | activemodel (= 3.1.3)
36 | activesupport (= 3.1.3)
37 | activesupport (3.1.3)
38 | multi_json (~> 1.0)
39 | ansi (1.4.1)
40 | arel (2.2.1)
41 | builder (3.0.0)
42 | capistrano (2.9.0)
43 | highline
44 | net-scp (>= 1.0.0)
45 | net-sftp (>= 2.0.0)
46 | net-ssh (>= 2.0.14)
47 | net-ssh-gateway (>= 1.1.0)
48 | coderay (0.9.8)
49 | coffee-rails (3.1.1)
50 | coffee-script (>= 2.2.0)
51 | railties (~> 3.1.0)
52 | coffee-script (2.2.0)
53 | coffee-script-source
54 | execjs
55 | coffee-script-source (1.2.0)
56 | diff-lcs (1.1.3)
57 | erubis (2.7.0)
58 | execjs (1.2.13)
59 | multi_json (~> 1.0)
60 | factory_girl (1.3.3)
61 | factory_girl_rails (1.0)
62 | factory_girl (~> 1.3)
63 | rails (>= 3.0.0.beta4)
64 | faker (1.0.1)
65 | i18n (~> 0.4)
66 | gravatar_image_tag (1.0.0)
67 | highline (1.6.9)
68 | hike (1.2.1)
69 | i18n (0.6.0)
70 | jquery-rails (1.0.19)
71 | railties (~> 3.0)
72 | thor (~> 0.14)
73 | json (1.6.4)
74 | libv8 (3.3.10.4)
75 | mail (2.3.0)
76 | i18n (>= 0.4.0)
77 | mime-types (~> 1.16)
78 | treetop (~> 1.4.8)
79 | method_source (0.6.7)
80 | ruby_parser (>= 2.3.1)
81 | mime-types (1.17.2)
82 | multi_json (1.0.4)
83 | mysql2 (0.3.11)
84 | net-scp (1.0.4)
85 | net-ssh (>= 1.99.1)
86 | net-sftp (2.0.5)
87 | net-ssh (>= 2.0.9)
88 | net-ssh (2.2.1)
89 | net-ssh-gateway (1.1.0)
90 | net-ssh (>= 1.99.1)
91 | nokogiri (1.5.0)
92 | polyglot (0.3.3)
93 | pry (0.9.7.4)
94 | coderay (~> 0.9.8)
95 | method_source (~> 0.6.7)
96 | ruby_parser (>= 2.3.1)
97 | slop (~> 2.1.0)
98 | rack (1.3.5)
99 | rack-cache (1.1)
100 | rack (>= 0.4)
101 | rack-mount (0.8.3)
102 | rack (>= 1.0.0)
103 | rack-ssl (1.3.2)
104 | rack
105 | rack-test (0.6.1)
106 | rack (>= 1.0)
107 | rails (3.1.3)
108 | actionmailer (= 3.1.3)
109 | actionpack (= 3.1.3)
110 | activerecord (= 3.1.3)
111 | activeresource (= 3.1.3)
112 | activesupport (= 3.1.3)
113 | bundler (~> 1.0)
114 | railties (= 3.1.3)
115 | railties (3.1.3)
116 | actionpack (= 3.1.3)
117 | activesupport (= 3.1.3)
118 | rack-ssl (~> 1.3.2)
119 | rake (>= 0.8.7)
120 | rdoc (~> 3.4)
121 | thor (~> 0.14.6)
122 | rake (0.9.2.2)
123 | rdoc (3.12)
124 | json (~> 1.4)
125 | rspec (2.6.0)
126 | rspec-core (~> 2.6.0)
127 | rspec-expectations (~> 2.6.0)
128 | rspec-mocks (~> 2.6.0)
129 | rspec-core (2.6.4)
130 | rspec-expectations (2.6.0)
131 | diff-lcs (~> 1.1.2)
132 | rspec-mocks (2.6.0)
133 | rspec-rails (2.6.1)
134 | actionpack (~> 3.0)
135 | activesupport (~> 3.0)
136 | railties (~> 3.0)
137 | rspec (~> 2.6.0)
138 | ruby_parser (2.3.1)
139 | sexp_processor (~> 3.0)
140 | sass (3.1.12)
141 | sass-rails (3.1.5)
142 | actionpack (~> 3.1.0)
143 | railties (~> 3.1.0)
144 | sass (~> 3.1.10)
145 | tilt (~> 1.3.2)
146 | sexp_processor (3.0.9)
147 | slop (2.1.0)
148 | spin (0.4.2)
149 | sprockets (2.0.3)
150 | hike (~> 1.2)
151 | rack (~> 1.0)
152 | tilt (~> 1.1, != 1.3.0)
153 | therubyracer (0.9.9)
154 | libv8 (~> 3.3.10)
155 | thor (0.14.6)
156 | tilt (1.3.3)
157 | treetop (1.4.10)
158 | polyglot
159 | polyglot (>= 0.3.1)
160 | turn (0.8.2)
161 | ansi (>= 1.2.2)
162 | tzinfo (0.3.31)
163 | uglifier (1.2.1)
164 | execjs (>= 0.3.0)
165 | multi_json (>= 1.0.2)
166 | webrat (0.7.1)
167 | nokogiri (>= 1.2.0)
168 | rack (>= 1.0)
169 | rack-test (>= 0.5.3)
170 | will_paginate (3.0.2)
171 |
172 | PLATFORMS
173 | ruby
174 |
175 | DEPENDENCIES
176 | annotate!
177 | capistrano
178 | coffee-rails (~> 3.1.1)
179 | factory_girl_rails
180 | faker
181 | gravatar_image_tag
182 | jquery-rails
183 | mysql2
184 | pry
185 | rails (= 3.1.3)
186 | rspec-rails (= 2.6.1)
187 | sass-rails (~> 3.1.5)
188 | spin
189 | therubyracer
190 | turn (= 0.8.2)
191 | uglifier (>= 1.0.3)
192 | webrat (= 0.7.1)
193 | will_paginate
194 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/plugins/rtl/screen.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | rtl.css
4 | * Mirrors Blueprint for left-to-right languages
5 |
6 | By Ran Yaniv Hartstein [ranh.co.il]
7 |
8 | -------------------------------------------------------------- */
9 |
10 | body .container { direction: rtl; }
11 | body .column, body .span-1, body .span-2, body .span-3, body .span-4, body .span-5, body .span-6, body .span-7, body .span-8, body .span-9, body .span-10, body .span-11, body .span-12, body .span-13, body .span-14, body .span-15, body .span-16, body .span-17, body .span-18, body .span-19, body .span-20, body .span-21, body .span-22, body .span-23, body .span-24 {
12 | float: right;
13 | margin-right: 0;
14 | margin-left: 10px;
15 | text-align:right;
16 | }
17 |
18 | body div.last { margin-left: 0; }
19 | body table .last { padding-left: 0; }
20 |
21 | body .append-1 { padding-right: 0; padding-left: 40px; }
22 | body .append-2 { padding-right: 0; padding-left: 80px; }
23 | body .append-3 { padding-right: 0; padding-left: 120px; }
24 | body .append-4 { padding-right: 0; padding-left: 160px; }
25 | body .append-5 { padding-right: 0; padding-left: 200px; }
26 | body .append-6 { padding-right: 0; padding-left: 240px; }
27 | body .append-7 { padding-right: 0; padding-left: 280px; }
28 | body .append-8 { padding-right: 0; padding-left: 320px; }
29 | body .append-9 { padding-right: 0; padding-left: 360px; }
30 | body .append-10 { padding-right: 0; padding-left: 400px; }
31 | body .append-11 { padding-right: 0; padding-left: 440px; }
32 | body .append-12 { padding-right: 0; padding-left: 480px; }
33 | body .append-13 { padding-right: 0; padding-left: 520px; }
34 | body .append-14 { padding-right: 0; padding-left: 560px; }
35 | body .append-15 { padding-right: 0; padding-left: 600px; }
36 | body .append-16 { padding-right: 0; padding-left: 640px; }
37 | body .append-17 { padding-right: 0; padding-left: 680px; }
38 | body .append-18 { padding-right: 0; padding-left: 720px; }
39 | body .append-19 { padding-right: 0; padding-left: 760px; }
40 | body .append-20 { padding-right: 0; padding-left: 800px; }
41 | body .append-21 { padding-right: 0; padding-left: 840px; }
42 | body .append-22 { padding-right: 0; padding-left: 880px; }
43 | body .append-23 { padding-right: 0; padding-left: 920px; }
44 |
45 | body .prepend-1 { padding-left: 0; padding-right: 40px; }
46 | body .prepend-2 { padding-left: 0; padding-right: 80px; }
47 | body .prepend-3 { padding-left: 0; padding-right: 120px; }
48 | body .prepend-4 { padding-left: 0; padding-right: 160px; }
49 | body .prepend-5 { padding-left: 0; padding-right: 200px; }
50 | body .prepend-6 { padding-left: 0; padding-right: 240px; }
51 | body .prepend-7 { padding-left: 0; padding-right: 280px; }
52 | body .prepend-8 { padding-left: 0; padding-right: 320px; }
53 | body .prepend-9 { padding-left: 0; padding-right: 360px; }
54 | body .prepend-10 { padding-left: 0; padding-right: 400px; }
55 | body .prepend-11 { padding-left: 0; padding-right: 440px; }
56 | body .prepend-12 { padding-left: 0; padding-right: 480px; }
57 | body .prepend-13 { padding-left: 0; padding-right: 520px; }
58 | body .prepend-14 { padding-left: 0; padding-right: 560px; }
59 | body .prepend-15 { padding-left: 0; padding-right: 600px; }
60 | body .prepend-16 { padding-left: 0; padding-right: 640px; }
61 | body .prepend-17 { padding-left: 0; padding-right: 680px; }
62 | body .prepend-18 { padding-left: 0; padding-right: 720px; }
63 | body .prepend-19 { padding-left: 0; padding-right: 760px; }
64 | body .prepend-20 { padding-left: 0; padding-right: 800px; }
65 | body .prepend-21 { padding-left: 0; padding-right: 840px; }
66 | body .prepend-22 { padding-left: 0; padding-right: 880px; }
67 | body .prepend-23 { padding-left: 0; padding-right: 920px; }
68 |
69 | body .border {
70 | padding-right: 0;
71 | padding-left: 4px;
72 | margin-right: 0;
73 | margin-left: 5px;
74 | border-right: none;
75 | border-left: 1px solid #eee;
76 | }
77 |
78 | body .colborder {
79 | padding-right: 0;
80 | padding-left: 24px;
81 | margin-right: 0;
82 | margin-left: 25px;
83 | border-right: none;
84 | border-left: 1px solid #eee;
85 | }
86 |
87 | body .pull-1 { margin-left: 0; margin-right: -40px; }
88 | body .pull-2 { margin-left: 0; margin-right: -80px; }
89 | body .pull-3 { margin-left: 0; margin-right: -120px; }
90 | body .pull-4 { margin-left: 0; margin-right: -160px; }
91 |
92 | body .push-0 { margin: 0 18px 0 0; }
93 | body .push-1 { margin: 0 18px 0 -40px; }
94 | body .push-2 { margin: 0 18px 0 -80px; }
95 | body .push-3 { margin: 0 18px 0 -120px; }
96 | body .push-4 { margin: 0 18px 0 -160px; }
97 | body .push-0, body .push-1, body .push-2,
98 | body .push-3, body .push-4 { float: left; }
99 |
100 |
101 | /* Typography with RTL support */
102 | body h1,body h2,body h3,
103 | body h4,body h5,body h6 { font-family: Arial, sans-serif; }
104 | html body { font-family: Arial, sans-serif; }
105 | body pre,body code,body tt { font-family: monospace; }
106 |
107 | /* Mirror floats and margins on typographic elements */
108 | body p img { float: right; margin: 1.5em 0 1.5em 1.5em; }
109 | body dd, body ul, body ol { margin-left: 0; margin-right: 1.5em;}
110 | body td, body th { text-align:right; }
111 |
--------------------------------------------------------------------------------
/spec/models/user_spec.rb:
--------------------------------------------------------------------------------
1 | # == Schema Information
2 | #
3 | # Table name: users
4 | #
5 | # id :integer(4) not null, primary key
6 | # name :string(255)
7 | # email :string(255)
8 | # created_at :datetime
9 | # updated_at :datetime
10 | # encrypted_password :string(255)
11 | # salt :string(255)
12 | # admin :boolean(1) default(FALSE)
13 | #
14 |
15 |
16 |
17 | require 'spec_helper'
18 |
19 | describe User do
20 |
21 | before(:each) do
22 | @attr = { :name => "Adam",
23 | :email => "adam@o2.pl",
24 | :password => "secret",
25 | :password_confirmation => 'secret' }
26 | end
27 | it "should create user with valid data" do
28 | User.create!(@attr)
29 | end
30 |
31 | it "should not create user without name" do
32 | no_name_user = User.new(@attr.merge(:name => ''))
33 | no_name_user.should_not be_valid
34 | end
35 |
36 | it "should required an email address" do
37 | no_email_user = User.new(@attr.merge(:email => ''))
38 | no_email_user.should_not be_valid
39 | end
40 |
41 | it "should reject name if toooo long" do
42 | long_name = 'a' * 51
43 | long_name_user = User.new(@attr.merge(:name => long_name))
44 | long_name_user.should_not be_valid
45 | end
46 |
47 | it "should accept valid email addresses" do
48 | addresses = %w[adam@o2.pl ADAM@kokok.co.uk AdAm2@kkkk.com.pl]
49 | addresses.each do |email|
50 | user = User.new(@attr.merge(:email => email))
51 | user.should be_valid
52 | end
53 | end
54 |
55 | it "should not accept invalid email addresses" do
56 | addresses = %w[adam@o2,pl ADAM_at_kokok.co.uk AdAm2@kkkk.com.]
57 | addresses.each do |email|
58 | user = User.new(@attr.merge(:email => email))
59 | user.should_not be_valid
60 | end
61 | end
62 |
63 | it "should not save duplication email" do
64 | User.create!(@attr)
65 | u = User.new(@attr)
66 | u.should_not be_valid
67 | end
68 |
69 | it "should not save duplicate in upcase" do
70 | User.create!(@attr)
71 | up_email = @attr[:email].upcase
72 | u = User.new(@attr.merge(:email => up_email))
73 | u.should_not be_valid
74 | end
75 |
76 | describe "passwords" do
77 |
78 | before(:each) do
79 | @user = User.new(@attr)
80 | end
81 |
82 | it "should have password attribute" do
83 | @user.should respond_to(:password)
84 | end
85 |
86 | it "should have password confirmation" do
87 | @user.should respond_to(:password_confirmation)
88 | end
89 | end
90 |
91 | describe "password validation" do
92 | it "should require password" do
93 | User.new(@attr.merge(:password => "", :password_confirmation => "")).should_not be_valid
94 | end
95 | it "should require matching password_confirmation" do
96 | User.new(@attr.merge(:password_confirmation => "invalid")).should_not be_valid
97 | end
98 | it "should reject short passwords" do
99 | short = "a" * 5
100 | hash = @attr.merge(:password => short, :password_confirmation => short)
101 | User.new(hash).should_not be_valid
102 | end
103 | it "should reject long passwords" do
104 | long = "a" * 41
105 | hash = @attr.merge(:password => long, :password_confirmation => long)
106 | User.new(hash).should_not be_valid
107 | end
108 | end
109 |
110 | describe "password encryption" do
111 |
112 | before(:each) do
113 | @user = User.create(@attr)
114 | end
115 |
116 | it "should have an encryptied password attribute" do
117 | @user.should respond_to(:encrypted_password)
118 | end
119 |
120 | it "should set encrypted_password" do
121 | @user.encrypted_password.should_not be_blank
122 | end
123 |
124 | it "should have a salt" do
125 | @user.should respond_to(:salt)
126 | end
127 | describe "should have has_password? method" do
128 | it "should exists" do
129 | @user.should respond_to(:has_password?)
130 | end
131 | it "should return true if passwords match" do
132 | @user.has_password?(@attr[:password]).should be_true
133 | end
134 | it "should return false if passwords does not match" do
135 | @user.has_password?("invalid").should be_false
136 | end
137 | end
138 |
139 | describe "authenticate method" do
140 |
141 | it "should exists" do
142 | User.should respond_to(:authenticate)
143 | end
144 |
145 | it "should return nil on email/password mismatch" do
146 | User.authenticate(@attr[:email], "wrong_password").should be_nil
147 | end
148 |
149 | it "should return nil for email without user" do
150 | User.authenticate("kotek@oooo.pl", @attr[:password]).should be_nil
151 | end
152 |
153 | it "should return user match email/password" do
154 | User.authenticate(@attr[:email], @attr[:password]).should == @user
155 |
156 | end
157 | end
158 | end
159 |
160 | describe "admin attribute" do
161 |
162 | before(:each) do
163 | @user = User.create!(@attr)
164 | end
165 |
166 | it "should respond to admin" do
167 | @user.should respond_to(:admin)
168 | end
169 |
170 | it "should not be an admin" do
171 | @user.should_not be_admin
172 | end
173 |
174 | it "should be convertable to an admin" do
175 | @user.toggle!(:admin)
176 | @user.should be_admin
177 | end
178 | end
179 |
180 | describe "micropost associations" do
181 | before(:each) do
182 | @user = User.create!(@attr)
183 | @mp1 = Factory(:micropost, :user => @user, :created_at => 1.day.ago)
184 | @mp2 = Factory(:micropost, :user => @user, :created_at => 1.hour.ago)
185 | end
186 |
187 | it 'should have a micropost attribute' do
188 | @user.should respond_to(:microposts)
189 | end
190 |
191 | it "should return microposts in correct order" do
192 | @user.microposts.should == [@mp2, @mp1]
193 | end
194 | it "should destroy associated microposts" do
195 | @user.destroy
196 | [@mp1, @mp2].each do |micropost|
197 | lambda do
198 | Micropost.find(micropost)
199 | end.should raise_error(ActiveRecord::RecordNotFound)
200 | end
201 | end
202 |
203 | describe "feed" do
204 |
205 | it "should have a feed" do
206 | @user.should respond_to(:feed)
207 | end
208 |
209 | it "should include user's micropost" do
210 | @user.feed.should include(@mp1)
211 | @user.feed.should include(@mp2)
212 | end
213 |
214 | it "should not include others microposts" do
215 | mp3 = Factory(:micropost, :user => Factory(:user, :email => Factory.next(:email)))
216 | @user.feed.should_not include(mp3)
217 | end
218 | end
219 | end
220 | end
221 |
222 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/src/grid.css:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------
2 |
3 | grid.css
4 | * Sets up an easy-to-use grid of 24 columns.
5 |
6 | By default, the grid is 950px wide, with 24 columns
7 | spanning 30px, and a 10px margin between columns.
8 |
9 | If you need fewer or more columns, namespaces or semantic
10 | element names, use the compressor script (lib/compress.rb)
11 |
12 | -------------------------------------------------------------- */
13 |
14 | /* A container should group all your columns. */
15 | .container {
16 | width: 950px;
17 | margin: 0 auto;
18 | }
19 |
20 | /* Use this class on any .span / container to see the grid. */
21 | .showgrid {
22 | background: url(src/grid.png);
23 | }
24 |
25 |
26 | /* Columns
27 | -------------------------------------------------------------- */
28 |
29 | /* Sets up basic grid floating and margin. */
30 | .column, .span-1, .span-2, .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-10, .span-11, .span-12, .span-13, .span-14, .span-15, .span-16, .span-17, .span-18, .span-19, .span-20, .span-21, .span-22, .span-23, .span-24 {
31 | float: left;
32 | margin-right: 10px;
33 | }
34 |
35 | /* The last column in a row needs this class. */
36 | .last { margin-right: 0; }
37 |
38 | /* Use these classes to set the width of a column. */
39 | .span-1 {width: 30px;}
40 |
41 | .span-2 {width: 70px;}
42 | .span-3 {width: 110px;}
43 | .span-4 {width: 150px;}
44 | .span-5 {width: 190px;}
45 | .span-6 {width: 230px;}
46 | .span-7 {width: 270px;}
47 | .span-8 {width: 310px;}
48 | .span-9 {width: 350px;}
49 | .span-10 {width: 390px;}
50 | .span-11 {width: 430px;}
51 | .span-12 {width: 470px;}
52 | .span-13 {width: 510px;}
53 | .span-14 {width: 550px;}
54 | .span-15 {width: 590px;}
55 | .span-16 {width: 630px;}
56 | .span-17 {width: 670px;}
57 | .span-18 {width: 710px;}
58 | .span-19 {width: 750px;}
59 | .span-20 {width: 790px;}
60 | .span-21 {width: 830px;}
61 | .span-22 {width: 870px;}
62 | .span-23 {width: 910px;}
63 | .span-24 {width:950px; margin-right:0;}
64 |
65 | /* Use these classes to set the width of an input. */
66 | input.span-1, textarea.span-1, input.span-2, textarea.span-2, input.span-3, textarea.span-3, input.span-4, textarea.span-4, input.span-5, textarea.span-5, input.span-6, textarea.span-6, input.span-7, textarea.span-7, input.span-8, textarea.span-8, input.span-9, textarea.span-9, input.span-10, textarea.span-10, input.span-11, textarea.span-11, input.span-12, textarea.span-12, input.span-13, textarea.span-13, input.span-14, textarea.span-14, input.span-15, textarea.span-15, input.span-16, textarea.span-16, input.span-17, textarea.span-17, input.span-18, textarea.span-18, input.span-19, textarea.span-19, input.span-20, textarea.span-20, input.span-21, textarea.span-21, input.span-22, textarea.span-22, input.span-23, textarea.span-23, input.span-24, textarea.span-24 {
67 | border-left-width: 1px;
68 | border-right-width: 1px;
69 | padding-left: 5px;
70 | padding-right: 5px;
71 | }
72 |
73 | input.span-1, textarea.span-1 { width: 18px; }
74 | input.span-2, textarea.span-2 { width: 58px; }
75 | input.span-3, textarea.span-3 { width: 98px; }
76 | input.span-4, textarea.span-4 { width: 138px; }
77 | input.span-5, textarea.span-5 { width: 178px; }
78 | input.span-6, textarea.span-6 { width: 218px; }
79 | input.span-7, textarea.span-7 { width: 258px; }
80 | input.span-8, textarea.span-8 { width: 298px; }
81 | input.span-9, textarea.span-9 { width: 338px; }
82 | input.span-10, textarea.span-10 { width: 378px; }
83 | input.span-11, textarea.span-11 { width: 418px; }
84 | input.span-12, textarea.span-12 { width: 458px; }
85 | input.span-13, textarea.span-13 { width: 498px; }
86 | input.span-14, textarea.span-14 { width: 538px; }
87 | input.span-15, textarea.span-15 { width: 578px; }
88 | input.span-16, textarea.span-16 { width: 618px; }
89 | input.span-17, textarea.span-17 { width: 658px; }
90 | input.span-18, textarea.span-18 { width: 698px; }
91 | input.span-19, textarea.span-19 { width: 738px; }
92 | input.span-20, textarea.span-20 { width: 778px; }
93 | input.span-21, textarea.span-21 { width: 818px; }
94 | input.span-22, textarea.span-22 { width: 858px; }
95 | input.span-23, textarea.span-23 { width: 898px; }
96 | input.span-24, textarea.span-24 { width: 938px; }
97 |
98 | /* Add these to a column to append empty cols. */
99 |
100 | .append-1 { padding-right: 40px;}
101 | .append-2 { padding-right: 80px;}
102 | .append-3 { padding-right: 120px;}
103 | .append-4 { padding-right: 160px;}
104 | .append-5 { padding-right: 200px;}
105 | .append-6 { padding-right: 240px;}
106 | .append-7 { padding-right: 280px;}
107 | .append-8 { padding-right: 320px;}
108 | .append-9 { padding-right: 360px;}
109 | .append-10 { padding-right: 400px;}
110 | .append-11 { padding-right: 440px;}
111 | .append-12 { padding-right: 480px;}
112 | .append-13 { padding-right: 520px;}
113 | .append-14 { padding-right: 560px;}
114 | .append-15 { padding-right: 600px;}
115 | .append-16 { padding-right: 640px;}
116 | .append-17 { padding-right: 680px;}
117 | .append-18 { padding-right: 720px;}
118 | .append-19 { padding-right: 760px;}
119 | .append-20 { padding-right: 800px;}
120 | .append-21 { padding-right: 840px;}
121 | .append-22 { padding-right: 880px;}
122 | .append-23 { padding-right: 920px;}
123 |
124 | /* Add these to a column to prepend empty cols. */
125 |
126 | .prepend-1 { padding-left: 40px;}
127 | .prepend-2 { padding-left: 80px;}
128 | .prepend-3 { padding-left: 120px;}
129 | .prepend-4 { padding-left: 160px;}
130 | .prepend-5 { padding-left: 200px;}
131 | .prepend-6 { padding-left: 240px;}
132 | .prepend-7 { padding-left: 280px;}
133 | .prepend-8 { padding-left: 320px;}
134 | .prepend-9 { padding-left: 360px;}
135 | .prepend-10 { padding-left: 400px;}
136 | .prepend-11 { padding-left: 440px;}
137 | .prepend-12 { padding-left: 480px;}
138 | .prepend-13 { padding-left: 520px;}
139 | .prepend-14 { padding-left: 560px;}
140 | .prepend-15 { padding-left: 600px;}
141 | .prepend-16 { padding-left: 640px;}
142 | .prepend-17 { padding-left: 680px;}
143 | .prepend-18 { padding-left: 720px;}
144 | .prepend-19 { padding-left: 760px;}
145 | .prepend-20 { padding-left: 800px;}
146 | .prepend-21 { padding-left: 840px;}
147 | .prepend-22 { padding-left: 880px;}
148 | .prepend-23 { padding-left: 920px;}
149 |
150 |
151 | /* Border on right hand side of a column. */
152 | .border {
153 | padding-right: 4px;
154 | margin-right: 5px;
155 | border-right: 1px solid #ddd;
156 | }
157 |
158 | /* Border with more whitespace, spans one column. */
159 | .colborder {
160 | padding-right: 24px;
161 | margin-right: 25px;
162 | border-right: 1px solid #ddd;
163 | }
164 |
165 |
166 | /* Use these classes on an element to push it into the
167 | next column, or to pull it into the previous column. */
168 |
169 |
170 | .pull-1 { margin-left: -40px; }
171 | .pull-2 { margin-left: -80px; }
172 | .pull-3 { margin-left: -120px; }
173 | .pull-4 { margin-left: -160px; }
174 | .pull-5 { margin-left: -200px; }
175 | .pull-6 { margin-left: -240px; }
176 | .pull-7 { margin-left: -280px; }
177 | .pull-8 { margin-left: -320px; }
178 | .pull-9 { margin-left: -360px; }
179 | .pull-10 { margin-left: -400px; }
180 | .pull-11 { margin-left: -440px; }
181 | .pull-12 { margin-left: -480px; }
182 | .pull-13 { margin-left: -520px; }
183 | .pull-14 { margin-left: -560px; }
184 | .pull-15 { margin-left: -600px; }
185 | .pull-16 { margin-left: -640px; }
186 | .pull-17 { margin-left: -680px; }
187 | .pull-18 { margin-left: -720px; }
188 | .pull-19 { margin-left: -760px; }
189 | .pull-20 { margin-left: -800px; }
190 | .pull-21 { margin-left: -840px; }
191 | .pull-22 { margin-left: -880px; }
192 | .pull-23 { margin-left: -920px; }
193 | .pull-24 { margin-left: -960px; }
194 |
195 | .pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {float: left; position:relative;}
196 |
197 |
198 | .push-1 { margin: 0 -40px 1.5em 40px; }
199 | .push-2 { margin: 0 -80px 1.5em 80px; }
200 | .push-3 { margin: 0 -120px 1.5em 120px; }
201 | .push-4 { margin: 0 -160px 1.5em 160px; }
202 | .push-5 { margin: 0 -200px 1.5em 200px; }
203 | .push-6 { margin: 0 -240px 1.5em 240px; }
204 | .push-7 { margin: 0 -280px 1.5em 280px; }
205 | .push-8 { margin: 0 -320px 1.5em 320px; }
206 | .push-9 { margin: 0 -360px 1.5em 360px; }
207 | .push-10 { margin: 0 -400px 1.5em 400px; }
208 | .push-11 { margin: 0 -440px 1.5em 440px; }
209 | .push-12 { margin: 0 -480px 1.5em 480px; }
210 | .push-13 { margin: 0 -520px 1.5em 520px; }
211 | .push-14 { margin: 0 -560px 1.5em 560px; }
212 | .push-15 { margin: 0 -600px 1.5em 600px; }
213 | .push-16 { margin: 0 -640px 1.5em 640px; }
214 | .push-17 { margin: 0 -680px 1.5em 680px; }
215 | .push-18 { margin: 0 -720px 1.5em 720px; }
216 | .push-19 { margin: 0 -760px 1.5em 760px; }
217 | .push-20 { margin: 0 -800px 1.5em 800px; }
218 | .push-21 { margin: 0 -840px 1.5em 840px; }
219 | .push-22 { margin: 0 -880px 1.5em 880px; }
220 | .push-23 { margin: 0 -920px 1.5em 920px; }
221 | .push-24 { margin: 0 -960px 1.5em 960px; }
222 |
223 | .push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {float: left; position:relative;}
224 |
225 |
226 | /* Misc classes and elements
227 | -------------------------------------------------------------- */
228 |
229 | /* In case you need to add a gutter above/below an element */
230 | div.prepend-top, .prepend-top {
231 | margin-top:1.5em;
232 | }
233 | div.append-bottom, .append-bottom {
234 | margin-bottom:1.5em;
235 | }
236 |
237 | /* Use a .box to create a padded box inside a column. */
238 | .box {
239 | padding: 1.5em;
240 | margin-bottom: 1.5em;
241 | background: #e5eCf9;
242 | }
243 |
244 | /* Use this to create a horizontal ruler across a column. */
245 | hr {
246 | background: #ddd;
247 | color: #ddd;
248 | clear: both;
249 | float: none;
250 | width: 100%;
251 | height: 1px;
252 | margin: 0 0 17px;
253 | border: none;
254 | }
255 |
256 | hr.space {
257 | background: #fff;
258 | color: #fff;
259 | visibility: hidden;
260 | }
261 |
262 |
263 | /* Clearing floats without extra markup
264 | Based on How To Clear Floats Without Structural Markup by PiE
265 | [http://www.positioniseverything.net/easyclearing.html] */
266 |
267 | .clearfix:after, .container:after {
268 | content: "\0020";
269 | display: block;
270 | height: 0;
271 | clear: both;
272 | visibility: hidden;
273 | overflow:hidden;
274 | }
275 | .clearfix, .container {display: block;}
276 |
277 | /* Regular clearing
278 | apply to column that should drop below previous ones. */
279 |
280 | .clear { clear:both; }
281 |
--------------------------------------------------------------------------------
/spec/controllers/users_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe UsersController do
4 | render_views
5 |
6 | describe "Get 'index'" do
7 | describe "for non sign in users" do
8 | it "should deny access" do
9 | get :index
10 | response.should redirect_to(signin_path)
11 | end
12 | end
13 | describe "for sign in users" do
14 | before(:each) do
15 | @user = test_sign_in(Factory(:user))
16 | Factory(:user, :email => "second@fatbuu.com")
17 | Factory(:user, :email => "third@fatbuu.com")
18 | 30.times do
19 | Factory(:user, :email => Factory.next(:email))
20 | end
21 | end
22 |
23 | it "should show 'index'" do
24 | get :index
25 | response.should be_success
26 | end
27 |
28 | it "should have a right title" do
29 | get :index
30 | response.should have_selector("title", :content => 'All users')
31 | end
32 |
33 | it "should have an element for each user" do
34 | get :index
35 | User.paginate(:page => 1).each do |user|
36 | response.should have_selector("li", :content => user.name)
37 | end
38 | end
39 |
40 | it "should paginate users" do
41 | get :index
42 | response.should have_selector("div.pagination")
43 | response.should have_selector("span.disabled", :content => "Previous")
44 | response.should have_selector("a", :href => "/users?page=2", :content => "2")
45 | response.should have_selector("a", :href => "/users?page=2", :content => "Next")
46 | end
47 |
48 | it "should have a delete links for admins" do
49 | @user.toggle!(:admin)
50 | other_user = User.all.second
51 | get :index
52 | response.should have_selector("a", :href => user_path(other_user), :content => "delete")
53 |
54 | end
55 |
56 | it "should not have a delete links for admins" do
57 | other_user = User.all.second
58 | get :index
59 | response.should_not have_selector("a", :href => user_path(other_user), :content => 'delete')
60 | end
61 | end
62 |
63 | end
64 |
65 |
66 | describe "Get 'show'" do
67 |
68 | before(:each) do
69 | @user = Factory(:user)
70 | end
71 |
72 | it "should be success" do
73 | get :show, :id => @user
74 | response.should be_success
75 | end
76 |
77 | it "should assign user" do
78 | get :show, :id => @user
79 | assigns(:user).should == @user
80 | end
81 |
82 | it "should have correct title" do
83 | get :show, :id => @user
84 | response.should have_selector("title", :content => @user.name)
85 | end
86 |
87 | it "should have user's name" do
88 | get :show, :id => @user
89 | response.should have_selector("h1", :content => @user.name)
90 | end
91 |
92 | it "should have an image" do
93 | get :show, :id => @user
94 | response.should have_selector("h1>img", :class => "gravatar")
95 | end
96 |
97 | it "should have correct url" do
98 | get :show, :id => @user
99 | response.should have_selector("td>a", :content => user_path(@user),
100 | :href => user_path(@user))
101 |
102 | end
103 |
104 | it "should show microposts" do
105 | mp1 = Factory(:micropost, :user => @user, :content => "foo bar")
106 | mp2 = Factory(:micropost, :user => @user, :content => "foo bar2")
107 | get :show, :id => @user
108 | response.should have_selector("span.content", :content => mp1.content)
109 | response.should have_selector("span.content", :content => mp2.content)
110 | end
111 |
112 | it "should have pagination" do
113 | 40.times { Factory(:micropost, :user => @user, :content => "foo") }
114 | get :show, :id => @user
115 | response.should have_selector("div.pagination")
116 | end
117 |
118 | it "should have microposts count" do
119 | 10.times { Factory(:micropost, :user => @user, :content => "foo") }
120 | get :show, :id => @user
121 | response.should have_selector("td.sidebar", :content => @user.microposts.count.to_s)
122 | response.should have_selector("td.sidebar", :content => "Microposts")
123 | end
124 | end
125 |
126 |
127 | describe "GET 'new'" do
128 | it "should be successful" do
129 | get :new
130 | response.should be_success
131 | end
132 | it "should have title" do
133 | get :new
134 | response.should have_selector("title", :content => "Sign up")
135 | end
136 | end
137 |
138 | describe "POST 'create'" do
139 |
140 | describe 'failure' do
141 |
142 | before(:each) do
143 | @attr = { :name => "", :email => "", :password => "", :password_confirmation => ""}
144 | end
145 |
146 | it "should have the right title" do
147 | post :create, :user => @attr
148 | response.should have_selector("title", :content => "Sign up")
149 | end
150 |
151 | it "should render the 'new' page" do
152 | post :create, :user => @attr
153 | response.should render_template('new')
154 | end
155 |
156 | it "should not create a user" do
157 | lambda do
158 | post :create, :user => @attr
159 | end.should_not change(User, :count)
160 | end
161 | end
162 |
163 | describe 'success' do
164 |
165 | before(:each) do
166 | @attr = { :name => "New user", :email => "user@foobar.com", :password => "foobar", :password_confirmation => "foobar"}
167 | end
168 |
169 | it "should create a user" do
170 | lambda do
171 | post :create, :user => @attr
172 | end.should change(User, :count).by(1)
173 | end
174 |
175 | it 'should redirect to user show page' do
176 | post :create, :user => @attr
177 | response.should redirect_to(user_path(assigns(:user)))
178 | end
179 |
180 | it "should have a welcome message" do
181 | post :create, :user => @attr
182 | flash[:success].should =~ /welcome to awesome app/i
183 | end
184 |
185 | it "should sign the user in" do
186 | post :create, :user => @attr
187 | controller.should be_signed_in
188 | end
189 | end
190 | end
191 |
192 | describe "GET 'edit'" do
193 | before(:each) do
194 | @user = Factory(:user)
195 | test_sign_in(@user)
196 | end
197 |
198 | it "should be successfull" do
199 | get :edit, :id => @user
200 | response.should be_success
201 | end
202 |
203 | it "should have a right title" do
204 | get :edit, :id => @user
205 | response.should have_selector("title", :content => "Edit")
206 | end
207 |
208 | it "should have a link to change Gravatar" do
209 | get :edit, :id => @user
210 | response.should have_selector("a", :href => 'http://gravatar.com/emails',
211 | :content => "Change")
212 | end
213 | end
214 |
215 | describe "PUT 'update'" do
216 | before(:each) do
217 | @user = Factory(:user)
218 | test_sign_in(@user)
219 | end
220 |
221 | describe "failure" do
222 | before(:each) do
223 | @attr = {:email => "", :name => "", :password_confirmation => ""}
224 | end
225 |
226 | it "should re-render the page" do
227 | put :update, :id => @user, :user => @attr
228 | response.should render_template('edit')
229 | end
230 | end
231 |
232 | it "should have the right title" do
233 | put :update, :id => @user, :user => @attr
234 | response.should have_selector("title", :content => "Update")
235 | end
236 |
237 | describe "success" do
238 |
239 | before(:each) do
240 | @attr = { :name => "New name", :email => "john@fatbuu.com", :password => "fuubarr", :password_confirmation => "fuubarr" }
241 | end
242 |
243 | it "should change user attributes" do
244 | put :update, :id => @user, :user => @attr
245 | user = assigns(:user)
246 | @user.reload
247 | @user.name.should == user.name
248 | @user.email.should == user.email
249 | @user.encrypted_password.should == user.encrypted_password
250 | response.should redirect_to(user_path(@user))
251 | end
252 |
253 | it "should have flash msg" do
254 | put :update, :id => @user, :user => @attr
255 | flash[:success].should =~ /updated/i
256 | end
257 | end
258 | end
259 |
260 | describe "anauthorized access to edit/update" do
261 |
262 | before(:each) do
263 | @user = Factory(:user)
264 | end
265 |
266 | describe 'for non signed users' do
267 |
268 | it "should deny to 'edit' action" do
269 | get :edit, :id => @user
270 | response.should redirect_to(signin_path)
271 | flash[:notice].should =~ /please/i
272 | end
273 |
274 | it "should deny to 'update' action" do
275 | put :update, :id => @user.id, :user => {}
276 | response.should redirect_to(signin_path)
277 | flash[:notice].should =~ /please/i
278 | end
279 | end
280 |
281 | describe 'for sign in users' do
282 | before(:each) do
283 | wrong_user = Factory(:user, :email => 'wrong_user@fatbuu.com')
284 | test_sign_in(wrong_user)
285 | end
286 |
287 | it "should require matching users for edit" do
288 | get :edit, :id => @user.id
289 | response.should redirect_to(root_path)
290 | end
291 |
292 | it "should require matching users for edit" do
293 | put :update, :id => @user.id, :user => {}
294 | response.should redirect_to(root_path)
295 | end
296 | end
297 | end
298 |
299 | describe "DELETE 'destroy'" do
300 | before(:each) do
301 | @user = Factory(:user)
302 | end
303 |
304 |
305 | describe "as a non signed in user" do
306 | it "should deny access" do
307 | delete :destroy, :id => @user.id
308 | response.should redirect_to(signin_path)
309 | end
310 | end
311 |
312 | describe "as non-admin user" do
313 | it "should protect the action" do
314 | test_sign_in(@user)
315 | delete :destroy, :id => @user.id
316 | response.should redirect_to(root_path)
317 | end
318 | end
319 |
320 | describe "as admin user" do
321 | before(:each) do
322 | @admin = Factory(:user, :email => 'admin@fatbuu.com', :admin => true)
323 | test_sign_in(@admin)
324 | end
325 |
326 | it "should destroy user" do
327 | lambda do
328 | delete :destroy, :id => @user.id
329 | end.should change(User, :count).by(-1)
330 | flash[:notice].should =~ /deleted/i
331 | end
332 |
333 | it "should to redirect users page" do
334 | delete :destroy, :id => @user.id
335 | response.should redirect_to(users_path)
336 | end
337 |
338 | it "should not allow destroy itself" do
339 | lambda do
340 | delete :destroy, :id => @admin
341 | end.should_not change(User, :count)
342 | end
343 |
344 | end
345 | end
346 | end
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/blueprint/screen.css:
--------------------------------------------------------------------------------
1 | /* -----------------------------------------------------------------------
2 |
3 |
4 | Blueprint CSS Framework 1.0.1
5 | http://blueprintcss.org
6 |
7 | * Copyright (c) 2007-Present. See LICENSE for more info.
8 | * See README for instructions on how to use Blueprint.
9 | * For credits and origins, see AUTHORS.
10 | * This is a compressed file. See the sources in the 'src' directory.
11 |
12 | ----------------------------------------------------------------------- */
13 |
14 | /* reset.css */
15 | html {margin:0;padding:0;border:0;}
16 | body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;}
17 | article, aside, details, figcaption, figure, dialog, footer, header, hgroup, menu, nav, section {display:block;}
18 | body {line-height:1.5;background:white;}
19 | table {border-collapse:separate;border-spacing:0;}
20 | caption, th, td {text-align:left;font-weight:normal;float:none !important;}
21 | table, th, td {vertical-align:middle;}
22 | blockquote:before, blockquote:after, q:before, q:after {content:'';}
23 | blockquote, q {quotes:"" "";}
24 | a img {border:none;}
25 | :focus {outline:0;}
26 |
27 | /* typography.css */
28 | html {font-size:100.01%;}
29 | body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
30 | h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
31 | h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
32 | h2 {font-size:2em;margin-bottom:0.75em;}
33 | h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
34 | h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
35 | h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
36 | h6 {font-size:1em;font-weight:bold;}
37 | h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
38 | p {margin:0 0 1.5em;}
39 | .left {float:left !important;}
40 | p .left {margin:1.5em 1.5em 1.5em 0;padding:0;}
41 | .right {float:right !important;}
42 | p .right {margin:1.5em 0 1.5em 1.5em;padding:0;}
43 | a:focus, a:hover {color:#09f;}
44 | a {color:#06c;text-decoration:underline;}
45 | blockquote {margin:1.5em;color:#666;font-style:italic;}
46 | strong, dfn {font-weight:bold;}
47 | em, dfn {font-style:italic;}
48 | sup, sub {line-height:0;}
49 | abbr, acronym {border-bottom:1px dotted #666;}
50 | address {margin:0 0 1.5em;font-style:italic;}
51 | del {color:#666;}
52 | pre {margin:1.5em 0;white-space:pre;}
53 | pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
54 | li ul, li ol {margin:0;}
55 | ul, ol {margin:0 1.5em 1.5em 0;padding-left:1.5em;}
56 | ul {list-style-type:disc;}
57 | ol {list-style-type:decimal;}
58 | dl {margin:0 0 1.5em 0;}
59 | dl dt {font-weight:bold;}
60 | dd {margin-left:1.5em;}
61 | table {margin-bottom:1.4em;width:100%;}
62 | th {font-weight:bold;}
63 | thead th {background:#c3d9ff;}
64 | th, td, caption {padding:4px 10px 4px 5px;}
65 | tbody tr:nth-child(even) td, tbody tr.even td {background:#e5ecf9;}
66 | tfoot {font-style:italic;}
67 | caption {background:#eee;}
68 | .small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
69 | .large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
70 | .hide {display:none;}
71 | .quiet {color:#666;}
72 | .loud {color:#000;}
73 | .highlight {background:#ff0;}
74 | .added {background:#060;color:#fff;}
75 | .removed {background:#900;color:#fff;}
76 | .first {margin-left:0;padding-left:0;}
77 | .last {margin-right:0;padding-right:0;}
78 | .top {margin-top:0;padding-top:0;}
79 | .bottom {margin-bottom:0;padding-bottom:0;}
80 |
81 | /* forms.css */
82 | label {font-weight:bold;}
83 | fieldset {padding:0 1.4em 1.4em 1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;}
84 | legend {font-weight:bold;font-size:1.2em;margin-top:-0.2em;margin-bottom:1em;}
85 | fieldset, #IE8#HACK {padding-top:1.4em;}
86 | legend, #IE8#HACK {margin-top:0;margin-bottom:0;}
87 | input[type=text], input[type=password], input[type=url], input[type=email], input.text, input.title, textarea {background-color:#fff;border:1px solid #bbb;color:#000;}
88 | input[type=text]:focus, input[type=password]:focus, input[type=url]:focus, input[type=email]:focus, input.text:focus, input.title:focus, textarea:focus {border-color:#666;}
89 | select {background-color:#fff;border-width:1px;border-style:solid;}
90 | input[type=text], input[type=password], input[type=url], input[type=email], input.text, input.title, textarea, select {margin:0.5em 0;}
91 | input.text, input.title {width:300px;padding:5px;}
92 | input.title {font-size:1.5em;}
93 | textarea {width:390px;height:250px;padding:5px;}
94 | form.inline {line-height:3;}
95 | form.inline p {margin-bottom:0;}
96 | .error, .alert, .notice, .success, .info {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
97 | .error, .alert {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}
98 | .notice {background:#fff6bf;color:#514721;border-color:#ffd324;}
99 | .success {background:#e6efc2;color:#264409;border-color:#c6d880;}
100 | .info {background:#d5edf8;color:#205791;border-color:#92cae4;}
101 | .error a, .alert a {color:#8a1f11;}
102 | .notice a {color:#514721;}
103 | .success a {color:#264409;}
104 | .info a {color:#205791;}
105 |
106 | /* grid.css */
107 | .container {width:950px;margin:0 auto;}
108 | .showgrid {background:url(src/grid.png);}
109 | .column, .span-1, .span-2, .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-10, .span-11, .span-12, .span-13, .span-14, .span-15, .span-16, .span-17, .span-18, .span-19, .span-20, .span-21, .span-22, .span-23, .span-24 {float:left;margin-right:10px;}
110 | .last {margin-right:0;}
111 | .span-1 {width:30px;}
112 | .span-2 {width:70px;}
113 | .span-3 {width:110px;}
114 | .span-4 {width:150px;}
115 | .span-5 {width:190px;}
116 | .span-6 {width:230px;}
117 | .span-7 {width:270px;}
118 | .span-8 {width:310px;}
119 | .span-9 {width:350px;}
120 | .span-10 {width:390px;}
121 | .span-11 {width:430px;}
122 | .span-12 {width:470px;}
123 | .span-13 {width:510px;}
124 | .span-14 {width:550px;}
125 | .span-15 {width:590px;}
126 | .span-16 {width:630px;}
127 | .span-17 {width:670px;}
128 | .span-18 {width:710px;}
129 | .span-19 {width:750px;}
130 | .span-20 {width:790px;}
131 | .span-21 {width:830px;}
132 | .span-22 {width:870px;}
133 | .span-23 {width:910px;}
134 | .span-24 {width:950px;margin-right:0;}
135 | input.span-1, textarea.span-1, input.span-2, textarea.span-2, input.span-3, textarea.span-3, input.span-4, textarea.span-4, input.span-5, textarea.span-5, input.span-6, textarea.span-6, input.span-7, textarea.span-7, input.span-8, textarea.span-8, input.span-9, textarea.span-9, input.span-10, textarea.span-10, input.span-11, textarea.span-11, input.span-12, textarea.span-12, input.span-13, textarea.span-13, input.span-14, textarea.span-14, input.span-15, textarea.span-15, input.span-16, textarea.span-16, input.span-17, textarea.span-17, input.span-18, textarea.span-18, input.span-19, textarea.span-19, input.span-20, textarea.span-20, input.span-21, textarea.span-21, input.span-22, textarea.span-22, input.span-23, textarea.span-23, input.span-24, textarea.span-24 {border-left-width:1px;border-right-width:1px;padding-left:5px;padding-right:5px;}
136 | input.span-1, textarea.span-1 {width:18px;}
137 | input.span-2, textarea.span-2 {width:58px;}
138 | input.span-3, textarea.span-3 {width:98px;}
139 | input.span-4, textarea.span-4 {width:138px;}
140 | input.span-5, textarea.span-5 {width:178px;}
141 | input.span-6, textarea.span-6 {width:218px;}
142 | input.span-7, textarea.span-7 {width:258px;}
143 | input.span-8, textarea.span-8 {width:298px;}
144 | input.span-9, textarea.span-9 {width:338px;}
145 | input.span-10, textarea.span-10 {width:378px;}
146 | input.span-11, textarea.span-11 {width:418px;}
147 | input.span-12, textarea.span-12 {width:458px;}
148 | input.span-13, textarea.span-13 {width:498px;}
149 | input.span-14, textarea.span-14 {width:538px;}
150 | input.span-15, textarea.span-15 {width:578px;}
151 | input.span-16, textarea.span-16 {width:618px;}
152 | input.span-17, textarea.span-17 {width:658px;}
153 | input.span-18, textarea.span-18 {width:698px;}
154 | input.span-19, textarea.span-19 {width:738px;}
155 | input.span-20, textarea.span-20 {width:778px;}
156 | input.span-21, textarea.span-21 {width:818px;}
157 | input.span-22, textarea.span-22 {width:858px;}
158 | input.span-23, textarea.span-23 {width:898px;}
159 | input.span-24, textarea.span-24 {width:938px;}
160 | .append-1 {padding-right:40px;}
161 | .append-2 {padding-right:80px;}
162 | .append-3 {padding-right:120px;}
163 | .append-4 {padding-right:160px;}
164 | .append-5 {padding-right:200px;}
165 | .append-6 {padding-right:240px;}
166 | .append-7 {padding-right:280px;}
167 | .append-8 {padding-right:320px;}
168 | .append-9 {padding-right:360px;}
169 | .append-10 {padding-right:400px;}
170 | .append-11 {padding-right:440px;}
171 | .append-12 {padding-right:480px;}
172 | .append-13 {padding-right:520px;}
173 | .append-14 {padding-right:560px;}
174 | .append-15 {padding-right:600px;}
175 | .append-16 {padding-right:640px;}
176 | .append-17 {padding-right:680px;}
177 | .append-18 {padding-right:720px;}
178 | .append-19 {padding-right:760px;}
179 | .append-20 {padding-right:800px;}
180 | .append-21 {padding-right:840px;}
181 | .append-22 {padding-right:880px;}
182 | .append-23 {padding-right:920px;}
183 | .prepend-1 {padding-left:40px;}
184 | .prepend-2 {padding-left:80px;}
185 | .prepend-3 {padding-left:120px;}
186 | .prepend-4 {padding-left:160px;}
187 | .prepend-5 {padding-left:200px;}
188 | .prepend-6 {padding-left:240px;}
189 | .prepend-7 {padding-left:280px;}
190 | .prepend-8 {padding-left:320px;}
191 | .prepend-9 {padding-left:360px;}
192 | .prepend-10 {padding-left:400px;}
193 | .prepend-11 {padding-left:440px;}
194 | .prepend-12 {padding-left:480px;}
195 | .prepend-13 {padding-left:520px;}
196 | .prepend-14 {padding-left:560px;}
197 | .prepend-15 {padding-left:600px;}
198 | .prepend-16 {padding-left:640px;}
199 | .prepend-17 {padding-left:680px;}
200 | .prepend-18 {padding-left:720px;}
201 | .prepend-19 {padding-left:760px;}
202 | .prepend-20 {padding-left:800px;}
203 | .prepend-21 {padding-left:840px;}
204 | .prepend-22 {padding-left:880px;}
205 | .prepend-23 {padding-left:920px;}
206 | .border {padding-right:4px;margin-right:5px;border-right:1px solid #ddd;}
207 | .colborder {padding-right:24px;margin-right:25px;border-right:1px solid #ddd;}
208 | .pull-1 {margin-left:-40px;}
209 | .pull-2 {margin-left:-80px;}
210 | .pull-3 {margin-left:-120px;}
211 | .pull-4 {margin-left:-160px;}
212 | .pull-5 {margin-left:-200px;}
213 | .pull-6 {margin-left:-240px;}
214 | .pull-7 {margin-left:-280px;}
215 | .pull-8 {margin-left:-320px;}
216 | .pull-9 {margin-left:-360px;}
217 | .pull-10 {margin-left:-400px;}
218 | .pull-11 {margin-left:-440px;}
219 | .pull-12 {margin-left:-480px;}
220 | .pull-13 {margin-left:-520px;}
221 | .pull-14 {margin-left:-560px;}
222 | .pull-15 {margin-left:-600px;}
223 | .pull-16 {margin-left:-640px;}
224 | .pull-17 {margin-left:-680px;}
225 | .pull-18 {margin-left:-720px;}
226 | .pull-19 {margin-left:-760px;}
227 | .pull-20 {margin-left:-800px;}
228 | .pull-21 {margin-left:-840px;}
229 | .pull-22 {margin-left:-880px;}
230 | .pull-23 {margin-left:-920px;}
231 | .pull-24 {margin-left:-960px;}
232 | .pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {float:left;position:relative;}
233 | .push-1 {margin:0 -40px 1.5em 40px;}
234 | .push-2 {margin:0 -80px 1.5em 80px;}
235 | .push-3 {margin:0 -120px 1.5em 120px;}
236 | .push-4 {margin:0 -160px 1.5em 160px;}
237 | .push-5 {margin:0 -200px 1.5em 200px;}
238 | .push-6 {margin:0 -240px 1.5em 240px;}
239 | .push-7 {margin:0 -280px 1.5em 280px;}
240 | .push-8 {margin:0 -320px 1.5em 320px;}
241 | .push-9 {margin:0 -360px 1.5em 360px;}
242 | .push-10 {margin:0 -400px 1.5em 400px;}
243 | .push-11 {margin:0 -440px 1.5em 440px;}
244 | .push-12 {margin:0 -480px 1.5em 480px;}
245 | .push-13 {margin:0 -520px 1.5em 520px;}
246 | .push-14 {margin:0 -560px 1.5em 560px;}
247 | .push-15 {margin:0 -600px 1.5em 600px;}
248 | .push-16 {margin:0 -640px 1.5em 640px;}
249 | .push-17 {margin:0 -680px 1.5em 680px;}
250 | .push-18 {margin:0 -720px 1.5em 720px;}
251 | .push-19 {margin:0 -760px 1.5em 760px;}
252 | .push-20 {margin:0 -800px 1.5em 800px;}
253 | .push-21 {margin:0 -840px 1.5em 840px;}
254 | .push-22 {margin:0 -880px 1.5em 880px;}
255 | .push-23 {margin:0 -920px 1.5em 920px;}
256 | .push-24 {margin:0 -960px 1.5em 960px;}
257 | .push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {float:left;position:relative;}
258 | div.prepend-top, .prepend-top {margin-top:1.5em;}
259 | div.append-bottom, .append-bottom {margin-bottom:1.5em;}
260 | .box {padding:1.5em;margin-bottom:1.5em;background:#e5eCf9;}
261 | hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:1px;margin:0 0 17px;border:none;}
262 | hr.space {background:#fff;color:#fff;visibility:hidden;}
263 | .clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
264 | .clearfix, .container {display:block;}
265 | .clear {clear:both;}
--------------------------------------------------------------------------------