├── lib ├── tasks │ ├── .gitkeep │ └── cucumber.rake ├── assets │ └── .gitkeep └── tweet │ ├── retweet.rb │ ├── favorite.rb │ └── base.rb ├── public ├── favicon.ico ├── robots.txt ├── humans.txt ├── 500.html ├── 422.html └── 404.html ├── app ├── mailers │ └── .gitkeep ├── models │ ├── .gitkeep │ └── user.rb ├── helpers │ ├── home_helper.rb │ └── application_helper.rb ├── views │ ├── boxes │ │ ├── twitter │ │ │ ├── _retweet.html.erb │ │ │ └── _favorite.html.erb │ │ └── index.html.erb │ ├── layouts │ │ ├── _messages.html.erb │ │ ├── _navigation.html.erb │ │ └── application.html.erb │ └── home │ │ └── index.html.erb ├── controllers │ ├── home_controller.rb │ ├── boxes_controller.rb │ ├── sessions_controller.rb │ └── application_controller.rb └── assets │ ├── javascripts │ ├── bootstrap.js.coffee │ ├── home.js.coffee │ ├── box.js.coffee │ ├── application.js │ └── lib │ │ └── jquery.isotope.min.js │ └── stylesheets │ ├── application.css │ ├── bootstrap_and_overrides.css.less │ └── isotope.css ├── vendor └── assets │ ├── javascripts │ └── .gitkeep │ └── stylesheets │ └── .gitkeep ├── .rvmrc ├── config ├── initializers │ ├── 0_dotenv.rb │ ├── generators.rb │ ├── extensions.rb │ ├── tweeter.rb │ ├── omniauth.rb │ ├── mime_types.rb │ ├── wrap_parameters.rb │ ├── backtrace_silencers.rb │ ├── session_store.rb │ ├── secret_token.rb │ └── inflections.rb ├── environment.rb ├── boot.rb ├── locales │ └── en.yml ├── routes.rb ├── cucumber.yml ├── environments │ ├── development.rb │ ├── test.rb │ └── production.rb ├── mongoid.yml └── application.rb ├── spec ├── support │ └── mongoid.rb ├── models │ └── user_spec.rb ├── factories │ └── users.rb ├── controllers │ ├── home_controller_spec.rb │ └── sessions_controller_spec.rb └── spec_helper.rb ├── .env ├── Procfile.development ├── config.ru ├── Rakefile ├── script ├── rails └── cucumber ├── db └── seeds.rb ├── README ├── Gemfile ├── .gitignore ├── README.textile ├── features └── support │ └── env.rb ├── tweet_structure.txt └── Gemfile.lock /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/mailers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rvmrc: -------------------------------------------------------------------------------- 1 | rvm use --create ruby-1.9.3@favoriter 2 | -------------------------------------------------------------------------------- /app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | module HomeHelper 2 | end 3 | -------------------------------------------------------------------------------- /config/initializers/0_dotenv.rb: -------------------------------------------------------------------------------- 1 | Dotenv.load if defined? Dotenv -------------------------------------------------------------------------------- /app/views/boxes/twitter/_retweet.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | retwit 3 |
  • -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /config/initializers/generators.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.generators do |g| 2 | end 3 | -------------------------------------------------------------------------------- /app/views/boxes/index.html.erb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/support/mongoid.rb: -------------------------------------------------------------------------------- 1 | RSpec.configure do |config| 2 | config.include Mongoid::Matchers 3 | end 4 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | OMNIAUTH_PROVIDER_KEY=kyELwlHieRbmlVhKq0xRGA 2 | OMNIAUTH_PROVIDER_SECRET=R0uiH7TINYxIGdSIlS8rnSypdL7U857cGuWOtuw -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def index 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /spec/models/user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe User do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /app/assets/javascripts/bootstrap.js.coffee: -------------------------------------------------------------------------------- 1 | jQuery -> 2 | $("a[rel=popover]").popover() 3 | $(".tooltip").tooltip() 4 | $("a[rel=tooltip]").tooltip() -------------------------------------------------------------------------------- /lib/tweet/retweet.rb: -------------------------------------------------------------------------------- 1 | module Tweet 2 | class Retweet < Base 3 | def to_partial_path 4 | 'boxes/twitter/retweet' 5 | end 6 | end 7 | end -------------------------------------------------------------------------------- /lib/tweet/favorite.rb: -------------------------------------------------------------------------------- 1 | module Tweet 2 | class Favorite < Base 3 | def to_partial_path 4 | 'boxes/twitter/favorite' 5 | end 6 | end 7 | end -------------------------------------------------------------------------------- /app/views/layouts/_messages.html.erb: -------------------------------------------------------------------------------- 1 | <% flash.each do |name, msg| %> 2 | <%= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String) %> 3 | <% end %> -------------------------------------------------------------------------------- /config/initializers/extensions.rb: -------------------------------------------------------------------------------- 1 | # Require recursively all files in the lib/extensions 2 | Dir[Rails.root.join('lib/**/extensions/**/*.rb')].each {|f| require f} -------------------------------------------------------------------------------- /Procfile.development: -------------------------------------------------------------------------------- 1 | web: bundle exec thin start -p $PORT 2 | mongo: mongod run --config /usr/local/etc/mongod.conf 3 | memcached: /usr/local/bin/memcached 4 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Favoriter::Application 5 | -------------------------------------------------------------------------------- /config/initializers/tweeter.rb: -------------------------------------------------------------------------------- 1 | Twitter.configure do |config| 2 | config.consumer_key = ENV['OMNIAUTH_PROVIDER_KEY'] 3 | config.consumer_secret = ENV['OMNIAUTH_PROVIDER_SECRET'] 4 | end -------------------------------------------------------------------------------- /config/initializers/omniauth.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.middleware.use OmniAuth::Builder do 2 | provider :twitter, ENV['OMNIAUTH_PROVIDER_KEY'], ENV['OMNIAUTH_PROVIDER_SECRET'] 3 | end 4 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Favoriter::Application.initialize! 6 | -------------------------------------------------------------------------------- /app/controllers/boxes_controller.rb: -------------------------------------------------------------------------------- 1 | class BoxesController < ApplicationController 2 | before_filter :authenticate_user! 3 | 4 | def index 5 | @twitter_stream = current_user.cached_twitter_stream 6 | end 7 | end -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/factories/users.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :user do 5 | provider "twitter" 6 | uid "12345" 7 | name "Bob" 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /spec/controllers/home_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe HomeController do 4 | describe "GET 'index'" do 5 | it "returns http success" do 6 | get 'index' 7 | response.should be_success 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/assets/javascripts/home.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/views/layouts/_navigation.html.erb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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 | Favoriter::Application.load_tasks 8 | -------------------------------------------------------------------------------- /app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |
    2 | <%= link_to signin_path, :class => "btn btn-large btn-primary" do %> 3 |
    4 | Sign With Twitter 5 |
    6 | <% end %> 7 |
    -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/assets/javascripts/box.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 | 5 | $('ul').isotope { 6 | itemSelector : 'li', 7 | layoutMode : 'masonry' 8 | } 9 | -------------------------------------------------------------------------------- /script/cucumber: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first 4 | if vendored_cucumber_bin 5 | load File.expand_path(vendored_cucumber_bin) 6 | else 7 | require 'rubygems' unless ENV['NO_RUBYGEMS'] 8 | require 'cucumber' 9 | load Cucumber::BINARY 10 | end 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Favoriter::Application.routes.draw do 2 | match '/auth/:provider/callback' => 'sessions#create' 3 | 4 | match '/signin' => 'sessions#new', :as => :signin 5 | match '/signout' => 'sessions#destroy', :as => :signout 6 | match '/auth/failure' => 'sessions#failure' 7 | 8 | resources :boxes, :only => [:index] 9 | 10 | root :to => 'home#index' 11 | end 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | 6 | *= require 'font-awesome' 7 | *= require_self 8 | *= require_tree . 9 | */ 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /public/humans.txt: -------------------------------------------------------------------------------- 1 | /* the humans responsible & colophon */ 2 | /* humanstxt.org */ 3 | 4 | 5 | /* TEAM */ 6 | : 7 | Site: 8 | Twitter: 9 | Location: 10 | 11 | /* THANKS */ 12 | Daniel Kehoe (@rails_apps) for the RailsApps project 13 | 14 | /* SITE */ 15 | Standards: HTML5, CSS3 16 | Components: jQuery 17 | Software: Ruby on Rails 18 | 19 | /* GENERATED BY */ 20 | RailsApps application template: http://railsapps.github.com/ -------------------------------------------------------------------------------- /app/views/boxes/twitter/_favorite.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | 3 | <%= favorite.producer_names %> 4 | 5 | 6 | adds to favorite: 7 |

    8 | 9 |
    10 | <%=raw favorite.text_with_links %> 11 | 12 | 13 | 14 | <%= favorite.user_name %> 15 | <%= link_to("@#{favorite.user_screen_name}", favorite.user_url) %> 16 | 17 | 18 |
    19 |
  • -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Favoriter::Application.config.session_store :cookie_store, key: '_avatar_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 | # Favoriter::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /config/cucumber.yml: -------------------------------------------------------------------------------- 1 | <% 2 | rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" 3 | rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" 4 | std_opts = "-r features/support/ -r features/step_definitions --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" 5 | %> 6 | default: <%= std_opts %> features 7 | wip: --tags @wip:3 --wip features 8 | rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip 9 | -------------------------------------------------------------------------------- /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 | Favoriter::Application.config.secret_token = '1ba186ff57a5795968911d0616d3e6eb9541664f0ca7afa310538d6a82f0a4b133291c3032a569935e4285de2ab50ba65689815abf1fb1f4d82262a681bdbc68' 8 | -------------------------------------------------------------------------------- /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 | # 12 | # These inflection rules are supported but not enabled by default: 13 | # ActiveSupport::Inflector.inflections do |inflect| 14 | # inflect.acronym 'RESTful' 15 | # end 16 | -------------------------------------------------------------------------------- /app/controllers/sessions_controller.rb: -------------------------------------------------------------------------------- 1 | class SessionsController < ApplicationController 2 | 3 | def new 4 | redirect_to '/auth/twitter' 5 | end 6 | 7 | def create 8 | auth = request.env['omniauth.auth'] 9 | user = User.from_omniauth(env['omniauth.auth']) 10 | session[:user_id] = user.id 11 | 12 | redirect_to boxes_url, :notice => 'Signed in!' 13 | end 14 | 15 | def destroy 16 | reset_session 17 | redirect_to root_url, :notice => 'Signed out!' 18 | end 19 | 20 | def failure 21 | redirect_to root_url, :alert => "Authentication error: #{params[:message].humanize}" 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /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 |
    24 | 25 | 26 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // the compiled file. 9 | // 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 11 | // GO AFTER THE REQUIRES BELOW. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require twitter/bootstrap 16 | //= require lib/jquery.isotope.min 17 | //= require_tree . 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | 4 | helper_method :current_user 5 | helper_method :user_signed_in? 6 | helper_method :correct_user? 7 | 8 | private 9 | def current_user 10 | begin 11 | @current_user ||= User.find(session[:user_id]) if session[:user_id] 12 | rescue Mongoid::Errors::DocumentNotFound 13 | nil 14 | end 15 | end 16 | 17 | def user_signed_in? 18 | return true if current_user 19 | end 20 | 21 | def correct_user? 22 | @user = User.find(params[:id]) 23 | unless current_user == @user 24 | redirect_to root_url, :alert => 'Access denied.' 25 | end 26 | end 27 | 28 | def authenticate_user! 29 | if !current_user 30 | redirect_to root_url, :alert => 'You need to sign in for access to this page.' 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Favoriter 2 | ======================== 3 | 4 | This application was generated with the rails_apps_composer gem: 5 | https://github.com/RailsApps/rails_apps_composer 6 | provided by the RailsApps Project: 7 | http://railsapps.github.com/ 8 | 9 | ________________________ 10 | 11 | Recipes: 12 | ["auth", "controllers", "core", "email", "extras", "frontend", "gems", "git", "init", "models", "railsapps", "readme", "routes", "setup", "testing", "views"] 13 | 14 | Preferences: 15 | {:git=>true, :railsapps=>"rails3-mongoid-omniauth", :database=>"mongodb", :orm=>"mongoid", :templates=>"erb", :unit_test=>"rspec", :integration=>"cucumber", :fixtures=>"factory_girl", :frontend=>"none", :email=>"none", :authentication=>"omniauth", :omniauth_provider=>"twitter", :authorization=>"none", :starter_app=>"users_app", :form_builder=>"none", :dev_webserver=>"webrick", :prod_webserver=>"unicorn", :jsruntime=>true, :rvmrc=>true} 16 | 17 | ________________________ 18 | 19 | License -------------------------------------------------------------------------------- /spec/controllers/sessions_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe SessionsController do 4 | let(:current_user) { create :user } 5 | 6 | before(:each) do 7 | OmniAuth.config.test_mode = true 8 | OmniAuth.config.mock_auth[:twitter] = { 9 | 'uid' => current_user.uid, 10 | 'provider' => current_user.provider, 11 | 'info' => { 12 | 'name' => current_user.name 13 | }, 14 | 'credentials' => { 15 | 'token' => 'token', 16 | 'secret' => 'secret' 17 | } 18 | } 19 | end 20 | 21 | describe 'GET #new' do 22 | it 'redirectes users to authentication' do 23 | get 'new' 24 | assert_redirected_to '/auth/twitter' 25 | end 26 | end 27 | 28 | describe 'creates new user' do 29 | it 'redirects users back to root_url' do 30 | visit '/signin' 31 | page.should have_content('Signed in!') 32 | current_path.should == '/' 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/tweet/base.rb: -------------------------------------------------------------------------------- 1 | require 'rinku' 2 | 3 | module Tweet 4 | class Base 5 | attr_reader :target, :sources 6 | 7 | def initialize(target, sources) 8 | @target, @sources = target, sources 9 | end 10 | 11 | def text 12 | target.text 13 | end 14 | 15 | def text_with_links 16 | @text_with_links ||= Rinku.auto_link(target.text) 17 | end 18 | 19 | def user_name 20 | target.user.name 21 | end 22 | 23 | def user_screen_name 24 | target.user.screen_name 25 | end 26 | 27 | def user_image_url 28 | target.user.profile_image_url 29 | end 30 | 31 | def user_url 32 | twitter_url(user_screen_name) 33 | end 34 | 35 | def producer_names 36 | @producer_names ||= sources.map { |s| s.name }.join(', ') 37 | end 38 | 39 | def producer_screen_names 40 | @producer_screen_names ||= sources.map { |s| s.screen_name }.join(', ') 41 | end 42 | 43 | private 44 | 45 | def twitter_url(name) 46 | "https://twitter.com/#{name}" 47 | end 48 | end 49 | end -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | ruby '1.9.3' 3 | 4 | gem 'rails', '3.2.8' 5 | gem 'jquery-rails' 6 | gem 'mongoid', '>= 3.0.3' 7 | gem 'omniauth', '>= 1.1.0' 8 | gem 'omniauth-twitter' 9 | gem 'twitter' 10 | gem 'memcache-client' 11 | gem 'rinku' 12 | 13 | 14 | group :assets do 15 | gem 'less-rails', '~> 2.2.3' 16 | gem 'coffee-rails', '~> 3.2.1' 17 | gem 'uglifier', '>= 1.0.3' 18 | gem 'twitter-bootstrap-rails', '~> 2.1.0' 19 | gem 'jquery-rails' 20 | gem 'font-awesome-rails' 21 | end 22 | 23 | group :development do 24 | gem 'foreman' 25 | gem 'heroku' 26 | end 27 | 28 | group :test do 29 | gem 'database_cleaner', '>= 0.8.0' 30 | gem 'mongoid-rspec', '>= 1.4.6' 31 | gem 'cucumber-rails', '>= 1.3.0', :require => false 32 | gem 'launchy', '>= 2.1.2' 33 | gem 'capybara', '>= 1.1.2' 34 | end 35 | 36 | group :development, :test do 37 | gem 'rspec-rails', '>= 2.11.0' 38 | gem 'factory_girl_rails', '>= 4.0.0' 39 | gem 'dotenv' 40 | end 41 | 42 | group :development, :production do 43 | gem 'thin' 44 | gem 'awesome_print' 45 | end 46 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Favoriter::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 | # Use a different cache store in production 26 | config.cache_store = :mem_cache_store 27 | 28 | # Do not compress assets 29 | config.assets.compress = false 30 | 31 | # Expands the lines which load the assets 32 | config.assets.debug = true 33 | end 34 | -------------------------------------------------------------------------------- /app/assets/stylesheets/bootstrap_and_overrides.css.less: -------------------------------------------------------------------------------- 1 | @import "twitter/bootstrap/bootstrap"; 2 | body { 3 | padding-top: 60px; 4 | } 5 | 6 | @import "twitter/bootstrap/responsive"; 7 | 8 | // Set the correct sprite paths 9 | @iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png'); 10 | @iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png'); 11 | 12 | // Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines) 13 | // Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not 14 | // have the proper paths. So for now we use the absolute path. 15 | @fontAwesomeEotPath: '/assets/fontawesome-webfont.eot'; 16 | @fontAwesomeWoffPath: '/assets/fontawesome-webfont.woff'; 17 | @fontAwesomeTtfPath: '/assets/fontawesome-webfont.ttf'; 18 | @fontAwesomeSvgPath: '/assets/fontawesome-webfont.svg'; 19 | 20 | // Font Awesome 21 | @import "fontawesome"; 22 | 23 | // Your custom LESS stylesheets goes here 24 | // 25 | // Since bootstrap was imported above you have access to its mixins which 26 | // you may use and inherit here 27 | // 28 | // If you'd like to override bootstrap's own variables, you can do so here as well 29 | // See http://twitter.github.com/bootstrap/less.html for their names and documentation 30 | // 31 | // Example: 32 | // @linkColor: #ff0000; 33 | -------------------------------------------------------------------------------- /app/assets/stylesheets/isotope.css: -------------------------------------------------------------------------------- 1 | /**** Isotope Filtering ****/ 2 | 3 | .isotope-item { 4 | z-index: 2; 5 | } 6 | 7 | .isotope-hidden.isotope-item { 8 | pointer-events: none; 9 | z-index: 1; 10 | } 11 | 12 | /**** Isotope CSS3 transitions ****/ 13 | 14 | .isotope, 15 | .isotope .isotope-item { 16 | -webkit-transition-duration: 0.8s; 17 | -moz-transition-duration: 0.8s; 18 | -ms-transition-duration: 0.8s; 19 | -o-transition-duration: 0.8s; 20 | transition-duration: 0.8s; 21 | } 22 | 23 | .isotope { 24 | -webkit-transition-property: height, width; 25 | -moz-transition-property: height, width; 26 | -ms-transition-property: height, width; 27 | -o-transition-property: height, width; 28 | transition-property: height, width; 29 | } 30 | 31 | .isotope .isotope-item { 32 | -webkit-transition-property: -webkit-transform, opacity; 33 | -moz-transition-property: -moz-transform, opacity; 34 | -ms-transition-property: -ms-transform, opacity; 35 | -o-transition-property: top, left, opacity; 36 | transition-property: transform, opacity; 37 | } 38 | 39 | /**** disabling Isotope CSS3 transitions ****/ 40 | 41 | .isotope.no-transition, 42 | .isotope.no-transition .isotope-item, 43 | .isotope .isotope-item.no-transition { 44 | -webkit-transition-duration: 0s; 45 | -moz-transition-duration: 0s; 46 | -ms-transition-duration: 0s; 47 | -o-transition-duration: 0s; 48 | transition-duration: 0s; 49 | } -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Favoriter::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 | 33 | # Print deprecation notices to the stderr 34 | config.active_support.deprecation = :stderr 35 | end 36 | -------------------------------------------------------------------------------- /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 | require 'rspec/autorun' 6 | require 'factory_girl' 7 | 8 | # Requires supporting ruby files with custom matchers and macros, etc, 9 | # in spec/support/ and its subdirectories. 10 | Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} 11 | 12 | RSpec.configure do |config| 13 | config.include FactoryGirl::Syntax::Methods 14 | # ## Mock Framework 15 | # 16 | # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: 17 | # 18 | # config.mock_with :mocha 19 | # config.mock_with :flexmock 20 | # config.mock_with :rr 21 | 22 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 23 | # config.fixture_path = "#{::Rails.root}/spec/fixtures" 24 | 25 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 26 | # examples within a transaction, remove the following line or assign false 27 | # instead of true. 28 | # config.use_transactional_fixtures = true 29 | 30 | # If true, the base class of anonymous controllers will be inferred 31 | # automatically. This will be the default behavior in future versions of 32 | # rspec-rails. 33 | config.infer_base_class_for_anonymous_controllers = false 34 | 35 | # Clean up the database 36 | require 'database_cleaner' 37 | config.before(:suite) do 38 | DatabaseCleaner.strategy = :truncation 39 | DatabaseCleaner.orm = "mongoid" 40 | end 41 | 42 | config.before(:each) do 43 | DatabaseCleaner.clean 44 | end 45 | 46 | end 47 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | require 'tweet/favorite' 2 | require 'tweet/retweet' 3 | 4 | class User 5 | include Mongoid::Document 6 | 7 | field :provider, type: String 8 | field :uid, type: String 9 | field :twitter_oauth_token, type: String 10 | field :twitter_oauth_token_secret, type: String 11 | field :name, type: String 12 | 13 | attr_accessible :provider, :uid, :name 14 | 15 | def self.from_omniauth(auth) 16 | user = where(auth.slice('provider', 'uid')).first || create_with_omniauth(auth) 17 | user.refresh_tokens!(auth) 18 | user 19 | end 20 | 21 | def self.create_with_omniauth(auth) 22 | create! do |user| 23 | user.provider = auth['provider'] 24 | user.uid = auth['uid'] 25 | user.name = auth['info']['name'] || '' if auth['info'] 26 | end 27 | end 28 | 29 | def refresh_tokens!(auth) 30 | self.twitter_oauth_token = auth['credentials']['token'] 31 | self.twitter_oauth_token_secret = auth['credentials']['secret'] 32 | save! 33 | end 34 | 35 | def twitter 36 | @twitter ||= Twitter::Client.new( 37 | :oauth_token => twitter_oauth_token, 38 | :oauth_token_secret => twitter_oauth_token_secret 39 | ) 40 | end 41 | 42 | def twitter_stream 43 | result = [] 44 | 45 | twitter.activity_by_friends.each do |tweet| 46 | case tweet.class.name 47 | when 'Twitter::Action::Retweet' 48 | tweet.target_objects.each {|target| result << Tweet::Retweet.new(target, tweet.targets) } 49 | when 'Twitter::Action::Favorite' 50 | tweet.targets.each {|target| result << Tweet::Favorite.new(target, tweet.sources) } 51 | end 52 | end 53 | 54 | result 55 | end 56 | 57 | def cached_twitter_stream 58 | Rails.cache.fetch("twitter_stream/#{uid}", :expires_in => 1.hour) do 59 | twitter_stream 60 | end 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Ignore these files when commiting to a git repository. 3 | # 4 | # See http://help.github.com/ignore-files/ for more about ignoring files. 5 | # 6 | # The original version of this file is found here: 7 | # https://github.com/RailsApps/rails3-application-templates/raw/master/files/gitignore.txt 8 | # 9 | # Corrections? Improvements? Create a GitHub issue: 10 | # http://github.com/RailsApps/rails3-application-templates/issues 11 | #---------------------------------------------------------------------------- 12 | 13 | # bundler state 14 | /.bundle 15 | /vendor/bundle/ 16 | 17 | # minimal Rails specific artifacts 18 | db/*.sqlite3 19 | /log/* 20 | /tmp/* 21 | 22 | # various artifacts 23 | **.war 24 | *.rbc 25 | *.sassc 26 | .rspec 27 | .redcar/ 28 | .sass-cache 29 | /config/config.yml 30 | /config/database.yml 31 | /coverage.data 32 | /coverage/ 33 | /db/*.javadb/ 34 | /db/*.sqlite3 35 | /doc/api/ 36 | /doc/app/ 37 | /doc/features.html 38 | /doc/specs.html 39 | /public/cache 40 | /public/stylesheets/compiled 41 | /public/system/* 42 | /spec/tmp/* 43 | /cache 44 | /capybara* 45 | /capybara-*.html 46 | /gems 47 | /spec/requests 48 | /spec/routing 49 | /spec/views 50 | /specifications 51 | rerun.txt 52 | pickle-email-*.html 53 | 54 | # If you find yourself ignoring temporary files generated by your text editor 55 | # or operating system, you probably want to add a global ignore instead: 56 | # git config --global core.excludesfile ~/.gitignore_global 57 | # 58 | # Here are some files you may want to ignore globally: 59 | 60 | # scm revert files 61 | **.orig 62 | 63 | # Mac finder artifacts 64 | .DS_Store 65 | 66 | # Netbeans project directory 67 | /nbproject/ 68 | 69 | # RubyMine project files 70 | .idea 71 | 72 | # Textmate project files 73 | /*.tmproj 74 | 75 | # vim artifacts 76 | **.swp 77 | 78 | Procfile 79 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Favoriter::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 = false 19 | 20 | # Generate digests for assets URLs 21 | config.assets.digest = true 22 | 23 | # Defaults to nil and saved in location specified by config.assets.prefix 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 | # Prepend all log lines with the following tags 37 | # config.log_tags = [ :subdomain, :uuid ] 38 | 39 | # Use a different logger for distributed setups 40 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 41 | 42 | # Use a different cache store in production 43 | config.cache_store = :mem_cache_store 44 | 45 | # Enable serving of images, stylesheets, and JavaScripts from an asset server 46 | # config.action_controller.asset_host = "http://assets.example.com" 47 | 48 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) 49 | # config.assets.precompile += %w( search.js ) 50 | 51 | # Disable delivery errors, bad email addresses will be ignored 52 | # config.action_mailer.raise_delivery_errors = false 53 | 54 | # Enable threaded mode 55 | # config.threadsafe! 56 | 57 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 58 | # the I18n.default_locale when a translation can not be found) 59 | config.i18n.fallbacks = true 60 | 61 | # Send deprecation notices to registered listeners 62 | config.active_support.deprecation = :notify 63 | 64 | end 65 | -------------------------------------------------------------------------------- /lib/tasks/cucumber.rake: -------------------------------------------------------------------------------- 1 | # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. 2 | # It is recommended to regenerate this file in the future when you upgrade to a 3 | # newer version of cucumber-rails. Consider adding your own code to a new file 4 | # instead of editing this one. Cucumber will automatically load all features/**/*.rb 5 | # files. 6 | 7 | 8 | unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks 9 | 10 | vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first 11 | $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil? 12 | 13 | begin 14 | require 'cucumber/rake/task' 15 | 16 | namespace :cucumber do 17 | Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| 18 | t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. 19 | t.fork = true # You may get faster startup if you set this to false 20 | t.profile = 'default' 21 | end 22 | 23 | Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t| 24 | t.binary = vendored_cucumber_bin 25 | t.fork = true # You may get faster startup if you set this to false 26 | t.profile = 'wip' 27 | end 28 | 29 | Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t| 30 | t.binary = vendored_cucumber_bin 31 | t.fork = true # You may get faster startup if you set this to false 32 | t.profile = 'rerun' 33 | end 34 | 35 | desc 'Run all features' 36 | task :all => [:ok, :wip] 37 | 38 | task :statsetup do 39 | require 'rails/code_statistics' 40 | ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features') 41 | ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features') 42 | end 43 | end 44 | desc 'Alias for cucumber:ok' 45 | task :cucumber => 'cucumber:ok' 46 | 47 | task :default => :cucumber 48 | 49 | task :features => :cucumber do 50 | STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" 51 | end 52 | 53 | # In case we don't have ActiveRecord, append a no-op task that we can depend upon. 54 | task 'db:test:prepare' do 55 | end 56 | 57 | task :stats => 'cucumber:statsetup' 58 | rescue LoadError 59 | desc 'cucumber rake task not available (cucumber not installed)' 60 | task :cucumber do 61 | abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' 62 | end 63 | end 64 | 65 | end 66 | -------------------------------------------------------------------------------- /config/mongoid.yml: -------------------------------------------------------------------------------- 1 | development: 2 | # Configure available database sessions. (required) 3 | sessions: 4 | # Defines the default session. (required) 5 | default: 6 | # Defines the name of the default database that Mongoid can connect to. 7 | # (required). 8 | database: avatar_development 9 | # Provides the hosts the default session can connect to. Must be an array 10 | # of host:port pairs. (required) 11 | hosts: 12 | - localhost:27017 13 | options: 14 | # Change whether the session persists in safe mode by default. 15 | # (default: false) 16 | # safe: false 17 | 18 | # Change the default consistency model to :eventual or :strong. 19 | # :eventual will send reads to secondaries, :strong sends everything 20 | # to master. (default: :eventual) 21 | consistency: :strong 22 | # Configure Mongoid specific options. (optional) 23 | options: 24 | # Configuration for whether or not to allow access to fields that do 25 | # not have a field definition on the model. (default: true) 26 | # allow_dynamic_fields: true 27 | 28 | # Enable the identity map, needed for eager loading. (default: false) 29 | # identity_map_enabled: false 30 | 31 | # Includes the root model name in json serialization. (default: false) 32 | # include_root_in_json: false 33 | 34 | # Include the _type field in serializaion. (default: false) 35 | # include_type_for_serialization: false 36 | 37 | # Preload all models in development, needed when models use 38 | # inheritance. (default: false) 39 | # preload_models: false 40 | 41 | # Protect id and type from mass assignment. (default: true) 42 | # protect_sensitive_fields: true 43 | 44 | # Raise an error when performing a #find and the document is not found. 45 | # (default: true) 46 | # raise_not_found_error: true 47 | 48 | # Raise an error when defining a scope with the same name as an 49 | # existing method. (default: false) 50 | # scope_overwrite_exception: false 51 | 52 | # Skip the database version check, used when connecting to a db without 53 | # admin access. (default: false) 54 | # skip_version_check: false 55 | 56 | # User Active Support's time zone in conversions. (default: true) 57 | # use_activesupport_time_zone: true 58 | 59 | # Ensure all times are UTC in the app side. (default: false) 60 | # use_utc: false 61 | test: 62 | sessions: 63 | default: 64 | database: avatar_test 65 | hosts: 66 | - localhost:27017 67 | options: 68 | consistency: :strong 69 | 70 | production: 71 | sessions: 72 | default: 73 | uri: <%= ENV['MONGOHQ_URL'] %> -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h1. Favoriter 2 | 3 | This application was generated with the "rails_apps_composer":https://github.com/RailsApps/rails_apps_composer gem provided by the "RailsApps Project":http://railsapps.github.com/. 4 | 5 | h2. Diagnostics 6 | 7 | This application was built with recipes that are NOT known to work together. 8 | 9 | This application was built with preferences that are known to work together. 10 | 11 | If the application doesn't work as expected, please "report an issue":https://github.com/RailsApps/rails_apps_composer/issues and include these diagnostics: 12 | 13 | We'd also like to know if you've found combinations of recipes or preferences that do work together. 14 | 15 | Recipes: 16 | ["auth", "controllers", "core", "email", "extras", "frontend", "gems", "git", "init", "models", "railsapps", "readme", "routes", "setup", "testing", "views"] 17 | 18 | Preferences: 19 | {:git=>true, :railsapps=>"rails3-mongoid-omniauth", :database=>"mongodb", :orm=>"mongoid", :templates=>"erb", :unit_test=>"rspec", :integration=>"cucumber", :fixtures=>"factory_girl", :frontend=>"none", :email=>"none", :authentication=>"omniauth", :omniauth_provider=>"twitter", :authorization=>"none", :starter_app=>"users_app", :form_builder=>"none", :dev_webserver=>"webrick", :prod_webserver=>"unicorn", :jsruntime=>true, :rvmrc=>true} 20 | 21 | h2. Ruby on Rails 22 | 23 | This application requires: 24 | 25 | * Ruby version 1.9.3 26 | * Rails version 3.2.8 27 | 28 | Learn more about "Installing Rails":http://railsapps.github.com/installing-rails.html. 29 | 30 | h2. Database 31 | 32 | This application uses MongoDB with the Mongoid ORM. 33 | 34 | h2. Development 35 | 36 | * Template Engine: ERB 37 | * Testing Framework: RSpec and Factory Girl and Cucumber 38 | * Front-end Framework: None 39 | * Form Builder: None 40 | * Authentication: OmniAuth 41 | * Authorization: None 42 | 43 | 44 | 45 | 46 | 47 | h2. Getting Started 48 | 49 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 50 | 51 | h2. Documentation and Support 52 | 53 | This is the only documentation. 54 | 55 | h4. Issues 56 | 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 58 | 59 | h2. Similar Projects 60 | 61 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 62 | 63 | h2. Contributing 64 | 65 | If you make improvements to this application, please share with others. 66 | 67 | * Fork the project on GitHub. 68 | * Make your feature addition or bug fix. 69 | * Commit with Git. 70 | * Send the author a pull request. 71 | 72 | If you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I'll add a note to the README so that others can find your work. 73 | 74 | h2. Credits 75 | 76 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 77 | 78 | h2. License 79 | 80 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. -------------------------------------------------------------------------------- /features/support/env.rb: -------------------------------------------------------------------------------- 1 | # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. 2 | # It is recommended to regenerate this file in the future when you upgrade to a 3 | # newer version of cucumber-rails. Consider adding your own code to a new file 4 | # instead of editing this one. Cucumber will automatically load all features/**/*.rb 5 | # files. 6 | 7 | require 'cucumber/rails' 8 | 9 | # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In 10 | # order to ease the transition to Capybara we set the default here. If you'd 11 | # prefer to use XPath just remove this line and adjust any selectors in your 12 | # steps to use the XPath syntax. 13 | Capybara.default_selector = :css 14 | 15 | # By default, any exception happening in your Rails application will bubble up 16 | # to Cucumber so that your scenario will fail. This is a different from how 17 | # your application behaves in the production environment, where an error page will 18 | # be rendered instead. 19 | # 20 | # Sometimes we want to override this default behaviour and allow Rails to rescue 21 | # exceptions and display an error page (just like when the app is running in production). 22 | # Typical scenarios where you want to do this is when you test your error pages. 23 | # There are two ways to allow Rails to rescue exceptions: 24 | # 25 | # 1) Tag your scenario (or feature) with @allow-rescue 26 | # 27 | # 2) Set the value below to true. Beware that doing this globally is not 28 | # recommended as it will mask a lot of errors for you! 29 | # 30 | ActionController::Base.allow_rescue = false 31 | 32 | # Remove/comment out the lines below if your app doesn't have a database. 33 | # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. 34 | begin 35 | DatabaseCleaner.orm = 'mongoid' 36 | DatabaseCleaner.strategy = :truncation 37 | rescue NameError 38 | raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." 39 | end 40 | 41 | # You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. 42 | # See the DatabaseCleaner documentation for details. Example: 43 | # 44 | # Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do 45 | # # { :except => [:widgets] } may not do what you expect here 46 | # # as tCucumber::Rails::Database.javascript_strategy overrides 47 | # # this setting. 48 | # DatabaseCleaner.strategy = :truncation 49 | # end 50 | # 51 | # Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do 52 | # DatabaseCleaner.strategy = :truncation 53 | # end 54 | # 55 | 56 | # Possible values are :truncation and :truncation 57 | # The :truncation strategy is faster, but might give you threading problems. 58 | # See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature 59 | Cucumber::Rails::Database.javascript_strategy = :truncation 60 | 61 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <%= content_for?(:title) ? yield(:title) : "Favoriter" %> 8 | <%= csrf_meta_tags %> 9 | 10 | 11 | 14 | 15 | <%= stylesheet_link_tag "application", :media => "all" %> 16 | 17 | 18 | 19 | <%= favicon_link_tag '/images/apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %> 20 | 21 | 22 | 23 | <%= favicon_link_tag '/images/apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %> 24 | 25 | 26 | 27 | <%= favicon_link_tag '/images/apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %> 28 | 29 | 30 | 31 | <%= favicon_link_tag '/images/apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %> 32 | 33 | 34 | 35 | <%= favicon_link_tag '/images/favicon.ico', :rel => 'shortcut icon' %> 36 | 37 | 38 | 39 | 55 | 56 |
    57 |
    58 |
    59 |
    60 | <%= render 'layouts/messages' %> 61 | <%= yield %> 62 |
    63 |
    64 |
    65 | 66 |
    67 |

    © FlatStack 2012

    68 |
    69 | 70 |
    71 | 72 | 74 | 75 | <%= javascript_include_tag "application" %> 76 | 77 | 78 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | # Pick the frameworks you want: 4 | # require "active_record/railtie" 5 | require "action_controller/railtie" 6 | require "action_mailer/railtie" 7 | require "active_resource/railtie" 8 | require "sprockets/railtie" 9 | # # require "rails/test_unit/railtie" 10 | 11 | if defined?(Bundler) 12 | # If you precompile assets before deploying to production, use this line 13 | Bundler.require(*Rails.groups(:assets => %w(development test))) 14 | # If you want your assets lazily compiled in production, use this line 15 | # Bundler.require(:default, :assets, Rails.env) 16 | end 17 | 18 | module Favoriter 19 | class Application < Rails::Application 20 | 21 | # don't generate RSpec tests for views and helpers 22 | config.generators do |g| 23 | g.view_specs false 24 | g.helper_specs false 25 | 26 | end 27 | 28 | # Settings in config/environments/* take precedence over those specified here. 29 | # Application configuration should go into files in config/initializers 30 | # -- all .rb files in that directory are automatically loaded. 31 | 32 | # Custom directories with classes and modules you want to be autoloadable. 33 | # config.autoload_paths += %W(#{config.root}/extras) 34 | config.autoload_paths += %W(#{config.root}/lib) 35 | 36 | 37 | # Only load the plugins named here, in the order given (default is alphabetical). 38 | # :all can be used as a placeholder for all plugins not explicitly named. 39 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 40 | 41 | # Activate observers that should always be running. 42 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 43 | 44 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 45 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 46 | # config.time_zone = 'Central Time (US & Canada)' 47 | 48 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 49 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 50 | # config.i18n.default_locale = :de 51 | 52 | # Configure the default encoding used in templates for Ruby 1.9. 53 | config.encoding = "utf-8" 54 | 55 | # Configure sensitive parameters which will be filtered from the log file. 56 | config.filter_parameters += [:password] 57 | 58 | # Enable escaping HTML in JSON. 59 | config.active_support.escape_html_entities_in_json = true 60 | 61 | # Use SQL instead of Active Record's schema dumper when creating the database. 62 | # This is necessary if your schema can't be completely dumped by the schema dumper, 63 | # like if you have constraints or database-specific column types 64 | # config.active_record.schema_format = :sql 65 | 66 | # Enforce whitelist mode for mass assignment. 67 | # This will create an empty whitelist of attributes available for mass-assignment for all models 68 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible 69 | # parameters by using an attr_accessible or attr_protected declaration. 70 | # config.active_record.whitelist_attributes = true 71 | 72 | # Enable the asset pipeline 73 | config.assets.enabled = true 74 | 75 | # Version of your assets, change this if you want to expire all your assets 76 | config.assets.version = '1.0' 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /tweet_structure.txt: -------------------------------------------------------------------------------- 1 | { 2 | :max_position=>"1347791089000", :min_position=>"1347791089000", :created_at=>"Sun Sep 16 10:24:49 +0000 2012", :target_objects=>[], 3 | :target_objects_size=>0, 4 | :targets=>[ 5 | { 6 | :coordinates=>nil, :place=>nil, :retweet_count=>0, :in_reply_to_user_id=>nil, :truncated=>false, 7 | :created_at=>"Sun Sep 16 09:31:47 +0000 2012", :id_str=>"247266523411001344", 8 | :user=>{ 9 | :profile_sidebar_border_color=>"000000", :id=>199638286, :screen_name=>"_genry", 10 | :profile_image_url=>"http://a0.twimg.com/profile_images/1149380325/Count_normal.jpg", 11 | :friends_count=>115, :default_profile_image=>false, :profile_background_tile=>false, :location=>"Kazan", 12 | :profile_sidebar_fill_color=>"FFFFFF", :utc_offset=>nil, :favourites_count=>113, :name=>"генри", 13 | :contributors_enabled=>false, :lang=>"en", :time_zone=>nil, :protected=>false, :profile_background_color=>"FFFFFF", 14 | :geo_enabled=>false, :is_translator=>false, :default_profile=>false, :notifications=>false, :description=>"отправился на поиски водяного чипа", 15 | :profile_background_image_url=>"http://a0.twimg.com/profile_background_images/163628182/Industrial_Area.jpg", 16 | :profile_link_color=>"8DAFB8", :following=>false, :statuses_count=>5242, 17 | :follow_request_sent=>false, :id_str=>"199638286", 18 | :profile_background_image_url_https=>"https://si0.twimg.com/profile_background_images/163628182/Industrial_Area.jpg", 19 | :listed_count=>19, :verified=>false, :profile_use_background_image=>true, :url=>nil, :followers_count=>247, 20 | :profile_text_color=>"000000", 21 | :created_at=>"Thu Oct 07 11:30:43 +0000 2010", :profile_image_url_https=>"https://si0.twimg.com/profile_images/1149380325/Count_normal.jpg" 22 | }, 23 | :retweeted=>false, :in_reply_to_screen_name=>nil, :possibly_sensitive=>false, :in_reply_to_status_id=>nil, :in_reply_to_status_id_str=>nil, 24 | :source=>"web", :contributors=>nil, :geo=>nil, :id=>247266523411001344, :in_reply_to_user_id_str=>nil, :favorited=>false, 25 | :text=>"во, после просмотра думаю че с бородой своей сделать http://t.co/wwASMD5x" 26 | } 27 | ], 28 | :targets_size=>1, 29 | :sources=>[ 30 | { 31 | :profile_sidebar_border_color=>"AEF5FA", :id=>145165580, 32 | :screen_name=>"Alerticus", :profile_image_url=>"http://a0.twimg.com/profile_images/2343692252/pu880ameb52vxa2aefoh_normal.png", 33 | :friends_count=>181, :default_profile_image=>false, :profile_background_tile=>false, :location=>"Russia, Moscow", 34 | :profile_sidebar_fill_color=>"3B615D", :utc_offset=>14400, :favourites_count=>64, :name=>"Alexander Pavlenko", 35 | :contributors_enabled=>false, :lang=>"en", :time_zone=>"Moscow", :protected=>false, :profile_background_color=>"214542", 36 | :geo_enabled=>true, :is_translator=>false, :default_profile=>false, :notifications=>false, 37 | :description=>"Ruby on Rails powered web-developer", 38 | :profile_background_image_url=>"http://a0.twimg.com/profile_background_images/268567679/x78fca1330e9da6bcfc1b6c350a82523.jpg", 39 | :profile_link_color=>"B4D9AD", :following=>true, :statuses_count=>1001, 40 | :follow_request_sent=>false, :id_str=>"145165580", 41 | :profile_background_image_url_https=>"https://si0.twimg.com/profile_background_images/268567679/x78fca1330e9da6bcfc1b6c350a82523.jpg", 42 | :listed_count=>3, :verified=>false, :profile_use_background_image=>true, :url=>"http://www.alerticus.ru/", 43 | :followers_count=>99, :profile_text_color=>"739E9F", 44 | :created_at=>"Tue May 18 08:13:57 +0000 2010", 45 | :profile_image_url_https=>"https://si0.twimg.com/profile_images/2343692252/pu880ameb52vxa2aefoh_normal.png" 46 | } 47 | ], 48 | :sources_size=>1 49 | } -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionmailer (3.2.8) 5 | actionpack (= 3.2.8) 6 | mail (~> 2.4.4) 7 | actionpack (3.2.8) 8 | activemodel (= 3.2.8) 9 | activesupport (= 3.2.8) 10 | builder (~> 3.0.0) 11 | erubis (~> 2.7.0) 12 | journey (~> 1.0.4) 13 | rack (~> 1.4.0) 14 | rack-cache (~> 1.2) 15 | rack-test (~> 0.6.1) 16 | sprockets (~> 2.1.3) 17 | activemodel (3.2.8) 18 | activesupport (= 3.2.8) 19 | builder (~> 3.0.0) 20 | activerecord (3.2.8) 21 | activemodel (= 3.2.8) 22 | activesupport (= 3.2.8) 23 | arel (~> 3.0.2) 24 | tzinfo (~> 0.3.29) 25 | activeresource (3.2.8) 26 | activemodel (= 3.2.8) 27 | activesupport (= 3.2.8) 28 | activesupport (3.2.8) 29 | i18n (~> 0.6) 30 | multi_json (~> 1.0) 31 | addressable (2.3.2) 32 | arel (3.0.2) 33 | awesome_print (1.1.0) 34 | builder (3.0.3) 35 | capybara (1.1.2) 36 | mime-types (>= 1.16) 37 | nokogiri (>= 1.3.3) 38 | rack (>= 1.0.0) 39 | rack-test (>= 0.5.4) 40 | selenium-webdriver (~> 2.0) 41 | xpath (~> 0.1.4) 42 | childprocess (0.3.5) 43 | ffi (~> 1.0, >= 1.0.6) 44 | coffee-rails (3.2.2) 45 | coffee-script (>= 2.2.0) 46 | railties (~> 3.2.0) 47 | coffee-script (2.2.0) 48 | coffee-script-source 49 | execjs 50 | coffee-script-source (1.3.3) 51 | commonjs (0.2.6) 52 | cucumber (1.2.1) 53 | builder (>= 2.1.2) 54 | diff-lcs (>= 1.1.3) 55 | gherkin (~> 2.11.0) 56 | json (>= 1.4.6) 57 | cucumber-rails (1.3.0) 58 | capybara (>= 1.1.2) 59 | cucumber (>= 1.1.8) 60 | nokogiri (>= 1.5.0) 61 | daemons (1.1.9) 62 | database_cleaner (0.8.0) 63 | diff-lcs (1.1.3) 64 | dotenv (0.2.0) 65 | erubis (2.7.0) 66 | eventmachine (0.12.10) 67 | excon (0.16.2) 68 | execjs (1.4.0) 69 | multi_json (~> 1.0) 70 | factory_girl (4.0.0) 71 | activesupport (>= 3.0.0) 72 | factory_girl_rails (4.0.0) 73 | factory_girl (~> 4.0.0) 74 | railties (>= 3.0.0) 75 | faraday (0.8.4) 76 | multipart-post (~> 1.1) 77 | ffi (1.1.5) 78 | font-awesome-rails (0.4.1) 79 | railties (~> 3.1) 80 | foreman (0.56.0) 81 | thor (>= 0.13.6) 82 | gherkin (2.11.2) 83 | json (>= 1.4.6) 84 | hashie (1.2.0) 85 | heroku (2.31.2) 86 | heroku-api (~> 0.3.4) 87 | launchy (>= 0.3.2) 88 | netrc (~> 0.7.7) 89 | rest-client (~> 1.6.1) 90 | rubyzip 91 | heroku-api (0.3.5) 92 | excon (~> 0.16.1) 93 | hike (1.2.1) 94 | i18n (0.6.1) 95 | journey (1.0.4) 96 | jquery-rails (2.1.1) 97 | railties (>= 3.1.0, < 5.0) 98 | thor (~> 0.14) 99 | json (1.7.5) 100 | launchy (2.1.2) 101 | addressable (~> 2.3) 102 | less (2.2.2) 103 | commonjs (~> 0.2.6) 104 | less-rails (2.2.3) 105 | actionpack (>= 3.1) 106 | less (~> 2.2.0) 107 | libv8 (3.3.10.4) 108 | libwebsocket (0.1.5) 109 | addressable 110 | mail (2.4.4) 111 | i18n (>= 0.4.0) 112 | mime-types (~> 1.16) 113 | treetop (~> 1.4.8) 114 | memcache-client (1.8.5) 115 | mime-types (1.19) 116 | mongoid (3.0.6) 117 | activemodel (~> 3.1) 118 | moped (~> 1.1) 119 | origin (~> 1.0) 120 | tzinfo (~> 0.3.22) 121 | mongoid-rspec (1.5.1) 122 | mongoid (>= 3.0.1) 123 | rake 124 | rspec (>= 2.9) 125 | moped (1.2.2) 126 | multi_json (1.3.6) 127 | multipart-post (1.1.5) 128 | netrc (0.7.7) 129 | nokogiri (1.5.5) 130 | oauth (0.4.6) 131 | omniauth (1.1.0) 132 | hashie (~> 1.2) 133 | rack 134 | omniauth-oauth (1.0.1) 135 | oauth 136 | omniauth (~> 1.0) 137 | omniauth-twitter (0.0.12) 138 | multi_json (~> 1.3) 139 | omniauth-oauth (~> 1.0) 140 | origin (1.0.8) 141 | polyglot (0.3.3) 142 | rack (1.4.1) 143 | rack-cache (1.2) 144 | rack (>= 0.4) 145 | rack-ssl (1.3.2) 146 | rack 147 | rack-test (0.6.1) 148 | rack (>= 1.0) 149 | rails (3.2.8) 150 | actionmailer (= 3.2.8) 151 | actionpack (= 3.2.8) 152 | activerecord (= 3.2.8) 153 | activeresource (= 3.2.8) 154 | activesupport (= 3.2.8) 155 | bundler (~> 1.0) 156 | railties (= 3.2.8) 157 | railties (3.2.8) 158 | actionpack (= 3.2.8) 159 | activesupport (= 3.2.8) 160 | rack-ssl (~> 1.3.2) 161 | rake (>= 0.8.7) 162 | rdoc (~> 3.4) 163 | thor (>= 0.14.6, < 2.0) 164 | rake (0.9.2.2) 165 | rdoc (3.12) 166 | json (~> 1.4) 167 | rest-client (1.6.7) 168 | mime-types (>= 1.16) 169 | rinku (1.7.0) 170 | rspec (2.11.0) 171 | rspec-core (~> 2.11.0) 172 | rspec-expectations (~> 2.11.0) 173 | rspec-mocks (~> 2.11.0) 174 | rspec-core (2.11.1) 175 | rspec-expectations (2.11.2) 176 | diff-lcs (~> 1.1.3) 177 | rspec-mocks (2.11.2) 178 | rspec-rails (2.11.0) 179 | actionpack (>= 3.0) 180 | activesupport (>= 3.0) 181 | railties (>= 3.0) 182 | rspec (~> 2.11.0) 183 | rubyzip (0.9.9) 184 | selenium-webdriver (2.25.0) 185 | childprocess (>= 0.2.5) 186 | libwebsocket (~> 0.1.3) 187 | multi_json (~> 1.0) 188 | rubyzip 189 | simple_oauth (0.1.9) 190 | sprockets (2.1.3) 191 | hike (~> 1.2) 192 | rack (~> 1.0) 193 | tilt (~> 1.1, != 1.3.0) 194 | therubyracer (0.10.2) 195 | libv8 (~> 3.3.10) 196 | thin (1.4.1) 197 | daemons (>= 1.0.9) 198 | eventmachine (>= 0.12.6) 199 | rack (>= 1.0.0) 200 | thor (0.16.0) 201 | tilt (1.3.3) 202 | treetop (1.4.10) 203 | polyglot 204 | polyglot (>= 0.3.1) 205 | twitter (3.7.0) 206 | faraday (~> 0.8) 207 | multi_json (~> 1.3) 208 | simple_oauth (~> 0.1.6) 209 | twitter-bootstrap-rails (2.1.3) 210 | actionpack (>= 3.1) 211 | less-rails (~> 2.2.3) 212 | railties (>= 3.1) 213 | therubyracer (~> 0.10.2) 214 | tzinfo (0.3.33) 215 | uglifier (1.2.7) 216 | execjs (>= 0.3.0) 217 | multi_json (~> 1.3) 218 | xpath (0.1.4) 219 | nokogiri (~> 1.3) 220 | 221 | PLATFORMS 222 | ruby 223 | 224 | DEPENDENCIES 225 | awesome_print 226 | capybara (>= 1.1.2) 227 | coffee-rails (~> 3.2.1) 228 | cucumber-rails (>= 1.3.0) 229 | database_cleaner (>= 0.8.0) 230 | dotenv 231 | factory_girl_rails (>= 4.0.0) 232 | font-awesome-rails 233 | foreman 234 | heroku 235 | jquery-rails 236 | launchy (>= 2.1.2) 237 | less-rails (~> 2.2.3) 238 | memcache-client 239 | mongoid (>= 3.0.3) 240 | mongoid-rspec (>= 1.4.6) 241 | omniauth (>= 1.1.0) 242 | omniauth-twitter 243 | rails (= 3.2.8) 244 | rinku 245 | rspec-rails (>= 2.11.0) 246 | thin 247 | twitter 248 | twitter-bootstrap-rails (~> 2.1.0) 249 | uglifier (>= 1.0.3) 250 | -------------------------------------------------------------------------------- /app/assets/javascripts/lib/jquery.isotope.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Isotope v1.5.19 3 | * An exquisite jQuery plugin for magical layouts 4 | * http://isotope.metafizzy.co 5 | * 6 | * Commercial use requires one-time license fee 7 | * http://metafizzy.co/#licenses 8 | * 9 | * Copyright 2012 David DeSandro / Metafizzy 10 | */ 11 | (function(a,b,c){"use strict";var d=a.document,e=a.Modernizr,f=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},g="Moz Webkit O Ms".split(" "),h=function(a){var b=d.documentElement.style,c;if(typeof b[a]=="string")return a;a=f(a);for(var e=0,h=g.length;e"+d+"{#modernizr{height:3px}}"+"").appendTo("head"),f=b('
    ').appendTo("html");a=f.height()===3,f.remove(),e.remove()}return a},csstransitions:function(){return!!j}},l;if(e)for(l in k)e.hasOwnProperty(l)||e.addTest(l,k[l]);else{e=a.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var m=" ",n;for(l in k)n=k[l](),e[l]=n,m+=" "+(n?"":"no-")+l;b("html").addClass(m)}if(e.csstransforms){var o=e.csstransforms3d?{translate:function(a){return"translate3d("+a[0]+"px, "+a[1]+"px, 0) "},scale:function(a){return"scale3d("+a+", "+a+", 1) "}}:{translate:function(a){return"translate("+a[0]+"px, "+a[1]+"px) "},scale:function(a){return"scale("+a+") "}},p=function(a,c,d){var e=b.data(a,"isoTransform")||{},f={},g,h={},j;f[c]=d,b.extend(e,f);for(g in e)j=e[g],h[g]=o[g](j);var k=h.translate||"",l=h.scale||"",m=k+l;b.data(a,"isoTransform",e),a.style[i]=m};b.cssNumber.scale=!0,b.cssHooks.scale={set:function(a,b){p(a,"scale",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.scale?d.scale:1}},b.fx.step.scale=function(a){b.cssHooks.scale.set(a.elem,a.now+a.unit)},b.cssNumber.translate=!0,b.cssHooks.translate={set:function(a,b){p(a,"translate",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.translate?d.translate:[0,0]}}}var q,r;e.csstransitions&&(q={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd",transitionProperty:"transitionEnd"}[j],r=h("transitionDuration"));var s=b.event,t;s.special.smartresize={setup:function(){b(this).bind("resize",s.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",s.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",t&&clearTimeout(t),t=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Isotope=function(a,c,d){this.element=b(c),this._create(a),this._init(d)};var u=["width","height"],v=b(a);b.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!b.browser.opera,itemPositionDataEnabled:!1},b.Isotope.prototype={_create:function(a){this.options=b.extend({},b.Isotope.settings,a),this.styleQueue=[],this.elemCount=0;var c=this.element[0].style;this.originalStyle={};var d=u.slice(0);for(var e in this.options.containerStyle)d.push(e);for(var f=0,g=d.length;fg?1:f0&&(i=function(a,b){b.$el[d](b.style,f).one(q,k)},j=!1)}}b.each(this.styleQueue,i),j&&k(),this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(a){this["_"+this.options.layoutMode+"Reset"](),this.layout(this.$filteredAtoms,a)},addItems:function(a,b){var c=this._getAtoms(a);this.$allAtoms=this.$allAtoms.add(c),b&&b(c)},insert:function(a,b){this.element.append(a);var c=this;this.addItems(a,function(a){var d=c._filter(a);c._addHideAppended(d),c._sort(),c.reLayout(),c._revealAppended(d,b)})},appended:function(a,b){var c=this;this.addItems(a,function(a){c._addHideAppended(a),c.layout(a),c._revealAppended(a,b)})},_addHideAppended:function(a){this.$filteredAtoms=this.$filteredAtoms.add(a),a.addClass("no-transition"),this._isInserting=!0,this.styleQueue.push({$el:a,style:this.options.hiddenStyle})},_revealAppended:function(a,b){var c=this;setTimeout(function(){a.removeClass("no-transition"),c.styleQueue.push({$el:a,style:c.options.visibleStyle}),c._isInserting=!1,c._processStyleQueue(a,b)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(a,b){var c=this,d=function(){c.$allAtoms=c.$allAtoms.not(a),a.remove(),b&&b.call(c.element)};a.filter(":not(."+this.options.hiddenClass+")").length?(this.styleQueue.push({$el:a,style:this.options.hiddenStyle}),this.$filteredAtoms=this.$filteredAtoms.not(a),this._sort(),this.reLayout(d)):d()},shuffle:function(a){this.updateSortData(this.$allAtoms),this.options.sortBy="random",this._sort(),this.reLayout(a)},destroy:function(){var a=this.usingTransforms,b=this.options;this.$allAtoms.removeClass(b.hiddenClass+" "+b.itemClass).each(function(){var b=this.style;b.position="",b.top="",b.left="",b.opacity="",a&&(b[i]="")});var c=this.element[0].style;for(var d in this.originalStyle)c[d]=this.originalStyle[d];this.element.unbind(".isotope").undelegate("."+b.hiddenClass,"click").removeClass(b.containerClass).removeData("isotope"),v.unbind(".isotope")},_getSegments:function(a){var b=this.options.layoutMode,c=a?"rowHeight":"columnWidth",d=a?"height":"width",e=a?"rows":"cols",g=this.element[d](),h,i=this.options[b]&&this.options[b][c]||this.$filteredAtoms["outer"+f(d)](!0)||g;h=Math.floor(g/i),h=Math.max(h,1),this[b][e]=h,this[b][c]=i},_checkIfSegmentsChanged:function(a){var b=this.options.layoutMode,c=a?"rows":"cols",d=this[b][c];return this._getSegments(a),this[b][c]!==d},_masonryReset:function(){this.masonry={},this._getSegments();var a=this.masonry.cols;this.masonry.colYs=[];while(a--)this.masonry.colYs.push(0)},_masonryLayout:function(a){var c=this,d=c.masonry;a.each(function(){var a=b(this),e=Math.ceil(a.outerWidth(!0)/d.columnWidth);e=Math.min(e,d.cols);if(e===1)c._masonryPlaceBrick(a,d.colYs);else{var f=d.cols+1-e,g=[],h,i;for(i=0;id&&(e.x=0,e.y=e.height),c._pushPosition(a,e.x,e.y),e.height=Math.max(e.y+g,e.height),e.x+=f})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0},this._getSegments(),this._getSegments(!0)},_cellsByRowLayout:function(a){var c=this,d=this.cellsByRow;a.each(function(){var a=b(this),e=d.index%d.cols,f=Math.floor(d.index/d.cols),g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,0,c.straightDown.y),c.straightDown.y+=d.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={},this._getSegments(!0);var a=this.masonryHorizontal.rows;this.masonryHorizontal.rowXs=[];while(a--)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(a){var c=this,d=c.masonryHorizontal;a.each(function(){var a=b(this),e=Math.ceil(a.outerHeight(!0)/d.rowHeight);e=Math.min(e,d.rows);if(e===1)c._masonryHorizontalPlaceBrick(a,d.rowXs);else{var f=d.rows+1-e,g=[],h,i;for(i=0;id&&(e.x=e.width,e.y=0),c._pushPosition(a,e.x,e.y),e.width=Math.max(e.x+f,e.width),e.y+=g})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0},this._getSegments(),this._getSegments(!0)},_cellsByColumnLayout:function(a){var c=this,d=this.cellsByColumn;a.each(function(){var a=b(this),e=Math.floor(d.index/d.rows),f=d.index%d.rows,g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,c.straightAcross.x,0),c.straightAcross.x+=d.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}},b.fn.imagesLoaded=function(a){function h(){a.call(c,d)}function i(a){var c=a.target;c.src!==f&&b.inArray(c,g)===-1&&(g.push(c),--e<=0&&(setTimeout(h),d.unbind(".imagesLoaded",i)))}var c=this,d=c.find("img").add(c.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",g=[];return e||h(),d.bind("load.imagesLoaded error.imagesLoaded",i).each(function(){var a=this.src;this.src=f,this.src=a}),c};var w=function(b){a.console&&a.console.error(b)};b.fn.isotope=function(a,c){if(typeof a=="string"){var d=Array.prototype.slice.call(arguments,1);this.each(function(){var c=b.data(this,"isotope");if(!c){w("cannot call methods on isotope prior to initialization; attempted to call method '"+a+"'");return}if(!b.isFunction(c[a])||a.charAt(0)==="_"){w("no such method '"+a+"' for isotope instance");return}c[a].apply(c,d)})}else this.each(function(){var d=b.data(this,"isotope");d?(d.option(a),d._init(c)):b.data(this,"isotope",new b.Isotope(a,this,c))});return this}})(window,jQuery); --------------------------------------------------------------------------------