Permalink
Browse files

adding app

  • Loading branch information...
1 parent 1915581 commit 7993def57e9089a509ccf9f5f7bec1a29b912e85 @alterisian committed Jun 23, 2011
Showing with 10,718 additions and 0 deletions.
  1. +32 −0 Gemfile
  2. +84 −0 Gemfile.lock
  3. +8 −0 Rakefile
  4. +3 −0 app/controllers/application_controller.rb
  5. +83 −0 app/controllers/ratings_controller.rb
  6. +2 −0 app/helpers/application_helper.rb
  7. +2 −0 app/helpers/ratings_helper.rb
  8. +2 −0 app/models/rating.rb
  9. +9 −0 app/models/user.rb
  10. +23 −0 app/views/layouts/application.html.erb
  11. +25 −0 app/views/ratings/_form.html.erb
  12. +6 −0 app/views/ratings/edit.html.erb
  13. +25 −0 app/views/ratings/index.html.erb
  14. +5 −0 app/views/ratings/new.html.erb
  15. +15 −0 app/views/ratings/show.html.erb
  16. +4 −0 config.ru
  17. +42 −0 config/application.rb
  18. +6 −0 config/boot.rb
  19. +22 −0 config/database.yml
  20. +5 −0 config/environment.rb
  21. +27 −0 config/environments/development.rb
  22. +49 −0 config/environments/production.rb
  23. +35 −0 config/environments/test.rb
  24. +7 −0 config/initializers/backtrace_silencers.rb
  25. +204 −0 config/initializers/devise.rb
  26. +10 −0 config/initializers/inflections.rb
  27. +5 −0 config/initializers/mime_types.rb
  28. +7 −0 config/initializers/secret_token.rb
  29. +8 −0 config/initializers/session_store.rb
  30. +53 −0 config/locales/devise.en.yml
  31. +5 −0 config/locales/en.yml
  32. +62 −0 config/routes.rb
  33. +14 −0 db/migrate/20110623161206_create_ratings.rb
  34. +28 −0 db/migrate/20110623163817_devise_create_users.rb
  35. +40 −0 db/schema.rb
  36. +7 −0 db/seeds.rb
  37. +2 −0 doc/README_FOR_APP
  38. 0 lib/tasks/.gitkeep
  39. +26 −0 public/404.html
  40. +26 −0 public/422.html
  41. +26 −0 public/500.html
  42. +239 −0 public/_index.html
  43. 0 public/favicon.ico
  44. BIN public/images/rails.png
  45. +2 −0 public/javascripts/application.js
  46. +965 −0 public/javascripts/controls.js
  47. +974 −0 public/javascripts/dragdrop.js
  48. +1,123 −0 public/javascripts/effects.js
  49. +6,001 −0 public/javascripts/prototype.js
  50. +191 −0 public/javascripts/rails.js
  51. +5 −0 public/robots.txt
  52. 0 public/stylesheets/.gitkeep
  53. +56 −0 public/stylesheets/scaffold.css
  54. +6 −0 script/rails
  55. +9 −0 test/fixtures/ratings.yml
  56. +11 −0 test/fixtures/users.yml
  57. +49 −0 test/functional/ratings_controller_test.rb
  58. +9 −0 test/performance/browsing_test.rb
  59. +13 −0 test/test_helper.rb
  60. +4 −0 test/unit/helpers/ratings_helper_test.rb
  61. +8 −0 test/unit/rating_test.rb
  62. +8 −0 test/unit/user_test.rb
  63. +1 −0 tmp/pids/server.pid
  64. 0 vendor/plugins/.gitkeep
View
32 Gemfile
@@ -0,0 +1,32 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.9'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+gem 'devise'
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
+# gem 'ruby-debug'
+# gem 'ruby-debug19', :require => 'ruby-debug'
+
+# Bundle the extra gems:
+# gem 'bj'
+# gem 'nokogiri'
+# gem 'sqlite3-ruby', :require => 'sqlite3'
+# gem 'aws-s3', :require => 'aws/s3'
+
+# Bundle gems for the local environment. Make sure to
+# put test-only gems in this group so their generators
+# and rake tasks are available in development mode:
+# group :development, :test do
+# gem 'webrat'
+# end
View
@@ -0,0 +1,84 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.9)
+ actionpack (= 3.0.9)
+ mail (~> 2.2.19)
+ actionpack (3.0.9)
+ activemodel (= 3.0.9)
+ activesupport (= 3.0.9)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.5.0)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.14)
+ rack-test (~> 0.5.7)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.9)
+ activesupport (= 3.0.9)
+ builder (~> 2.1.2)
+ i18n (~> 0.5.0)
+ activerecord (3.0.9)
+ activemodel (= 3.0.9)
+ activesupport (= 3.0.9)
+ arel (~> 2.0.10)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.9)
+ activemodel (= 3.0.9)
+ activesupport (= 3.0.9)
+ activesupport (3.0.9)
+ arel (2.0.10)
+ bcrypt-ruby (2.1.4-x86-mingw32)
+ builder (2.1.2)
+ devise (1.4.0)
+ bcrypt-ruby (~> 2.1.2)
+ orm_adapter (~> 0.0.3)
+ warden (~> 1.0.3)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ i18n (0.5.0)
+ mail (2.2.19)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ orm_adapter (0.0.5)
+ polyglot (0.3.1)
+ rack (1.2.3)
+ rack-mount (0.6.14)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ rails (3.0.9)
+ actionmailer (= 3.0.9)
+ actionpack (= 3.0.9)
+ activerecord (= 3.0.9)
+ activeresource (= 3.0.9)
+ activesupport (= 3.0.9)
+ bundler (~> 1.0)
+ railties (= 3.0.9)
+ railties (3.0.9)
+ actionpack (= 3.0.9)
+ activesupport (= 3.0.9)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.4)
+ rake (0.9.2)
+ rdoc (3.6.1)
+ sqlite3 (1.3.3-x86-mingw32)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.28)
+ warden (1.0.4)
+ rack (>= 1.0)
+
+PLATFORMS
+ x86-mingw32
+
+DEPENDENCIES
+ devise
+ rails (= 3.0.9)
+ sqlite3
View
@@ -0,0 +1,8 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+require 'rake/dsl_definition'
+require 'rake'
+
+Templateapp::Application.load_tasks
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
@@ -0,0 +1,83 @@
+class RatingsController < ApplicationController
+ # GET /ratings
+ # GET /ratings.xml
+ def index
+ @ratings = Rating.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @ratings }
+ end
+ end
+
+ # GET /ratings/1
+ # GET /ratings/1.xml
+ def show
+ @rating = Rating.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @rating }
+ end
+ end
+
+ # GET /ratings/new
+ # GET /ratings/new.xml
+ def new
+ @rating = Rating.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @rating }
+ end
+ end
+
+ # GET /ratings/1/edit
+ def edit
+ @rating = Rating.find(params[:id])
+ end
+
+ # POST /ratings
+ # POST /ratings.xml
+ def create
+ @rating = Rating.new(params[:rating])
+
+ respond_to do |format|
+ if @rating.save
+ format.html { redirect_to(@rating, :notice => 'Rating was successfully created.') }
+ format.xml { render :xml => @rating, :status => :created, :location => @rating }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /ratings/1
+ # PUT /ratings/1.xml
+ def update
+ @rating = Rating.find(params[:id])
+
+ respond_to do |format|
+ if @rating.update_attributes(params[:rating])
+ format.html { redirect_to(@rating, :notice => 'Rating was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /ratings/1
+ # DELETE /ratings/1.xml
+ def destroy
+ @rating = Rating.find(params[:id])
+ @rating.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(ratings_url) }
+ format.xml { head :ok }
+ end
+ end
+end
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
@@ -0,0 +1,2 @@
+module RatingsHelper
+end
View
@@ -0,0 +1,2 @@
+class Rating < ActiveRecord::Base
+end
View
@@ -0,0 +1,9 @@
+class User < ActiveRecord::Base
+ # Include default devise modules. Others available are:
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :validatable
+
+ # Setup accessible (or protected) attributes for your model
+ attr_accessible :email, :password, :password_confirmation, :remember_me
+end
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Templateapp</title>
+ <%= stylesheet_link_tag :all %>
+ <%= javascript_include_tag :defaults %>
+ <%= csrf_meta_tag %>
+</head>
+<body>
+
+<div id="user_nav">
+ <% if user_signed_in? %>
+ Signed in as <%= current_user.email %>. Not you?
+ <%= link_to "Sign out", destroy_user_session_path %>
+ <% else %>
+ <%= link_to "Sign up", new_user_registration_path %> or <%= link_to "sign in", new_user_session_path %>
+ <% end %>
+</div>
+
+<%= yield %>
+
+</body>
+</html>
@@ -0,0 +1,25 @@
+<%= form_for(@rating) do |f| %>
+ <% if @rating.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@rating.errors.count, "error") %> prohibited this rating from being saved:</h2>
+
+ <ul>
+ <% @rating.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :value %><br />
+ <%= f.text_field :value %>
+ </div>
+ <div class="field">
+ <%= f.label :description %><br />
+ <%= f.text_field :description %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
@@ -0,0 +1,6 @@
+<h1>Editing rating</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @rating %> |
+<%= link_to 'Back', ratings_path %>
@@ -0,0 +1,25 @@
+<h1>Listing ratings</h1>
+
+<table>
+ <tr>
+ <th>Value</th>
+ <th>Description</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @ratings.each do |rating| %>
+ <tr>
+ <td><%= rating.value %></td>
+ <td><%= rating.description %></td>
+ <td><%= link_to 'Show', rating %></td>
+ <td><%= link_to 'Edit', edit_rating_path(rating) %></td>
+ <td><%= link_to 'Destroy', rating, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Rating', new_rating_path %>
@@ -0,0 +1,5 @@
+<h1>New rating</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', ratings_path %>
@@ -0,0 +1,15 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Value:</b>
+ <%= @rating.value %>
+</p>
+
+<p>
+ <b>Description:</b>
+ <%= @rating.description %>
+</p>
+
+
+<%= link_to 'Edit', edit_rating_path(@rating) %> |
+<%= link_to 'Back', ratings_path %>
View
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Templateapp::Application
View
@@ -0,0 +1,42 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+# If you have a Gemfile, require the gems listed there, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+module Templateapp
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # JavaScript files you want as :defaults (application.js is always included).
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+ end
+end
View
@@ -0,0 +1,6 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
Oops, something went wrong.

0 comments on commit 7993def

Please sign in to comment.