Initial commit
This commit is contained in:
commit
eae3c46912
|
@ -0,0 +1,4 @@
|
||||||
|
.bundle
|
||||||
|
db/*.sqlite3
|
||||||
|
log/*.log
|
||||||
|
tmp/
|
|
@ -0,0 +1,4 @@
|
||||||
|
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
||||||
|
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
||||||
|
|
||||||
|
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
|
@ -0,0 +1,43 @@
|
||||||
|
source 'http://rubygems.org'
|
||||||
|
|
||||||
|
gem 'rails', '3.0.5'
|
||||||
|
|
||||||
|
# Bundle edge Rails instead:
|
||||||
|
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
||||||
|
|
||||||
|
gem 'pg'
|
||||||
|
|
||||||
|
# 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
|
||||||
|
gem "rspec-rails", ">= 2.0.1", :group => [:development, :test]
|
||||||
|
gem "devise"
|
||||||
|
gem "haml", ">= 3.0.0"
|
||||||
|
gem "haml-rails"
|
||||||
|
gem "compass", ">= 0.10.6"
|
||||||
|
gem "html5-boilerplate"
|
||||||
|
gem "capistrano"
|
||||||
|
gem "capistrano-ext"
|
||||||
|
gem "will_paginate", "~> 3.0.pre2"
|
||||||
|
gem 'factory_girl_rails'
|
||||||
|
gem "hoptoad_notifier", "~> 2.3"
|
||||||
|
gem "russian"
|
|
@ -0,0 +1,140 @@
|
||||||
|
GEM
|
||||||
|
remote: http://rubygems.org/
|
||||||
|
specs:
|
||||||
|
abstract (1.0.0)
|
||||||
|
actionmailer (3.0.5)
|
||||||
|
actionpack (= 3.0.5)
|
||||||
|
mail (~> 2.2.15)
|
||||||
|
actionpack (3.0.5)
|
||||||
|
activemodel (= 3.0.5)
|
||||||
|
activesupport (= 3.0.5)
|
||||||
|
builder (~> 2.1.2)
|
||||||
|
erubis (~> 2.6.6)
|
||||||
|
i18n (~> 0.4)
|
||||||
|
rack (~> 1.2.1)
|
||||||
|
rack-mount (~> 0.6.13)
|
||||||
|
rack-test (~> 0.5.7)
|
||||||
|
tzinfo (~> 0.3.23)
|
||||||
|
activemodel (3.0.5)
|
||||||
|
activesupport (= 3.0.5)
|
||||||
|
builder (~> 2.1.2)
|
||||||
|
i18n (~> 0.4)
|
||||||
|
activerecord (3.0.5)
|
||||||
|
activemodel (= 3.0.5)
|
||||||
|
activesupport (= 3.0.5)
|
||||||
|
arel (~> 2.0.2)
|
||||||
|
tzinfo (~> 0.3.23)
|
||||||
|
activeresource (3.0.5)
|
||||||
|
activemodel (= 3.0.5)
|
||||||
|
activesupport (= 3.0.5)
|
||||||
|
activesupport (3.0.5)
|
||||||
|
arel (2.0.9)
|
||||||
|
bcrypt-ruby (2.1.4)
|
||||||
|
builder (2.1.2)
|
||||||
|
capistrano (2.5.19)
|
||||||
|
highline
|
||||||
|
net-scp (>= 1.0.0)
|
||||||
|
net-sftp (>= 2.0.0)
|
||||||
|
net-ssh (>= 2.0.14)
|
||||||
|
net-ssh-gateway (>= 1.0.0)
|
||||||
|
capistrano-ext (1.2.1)
|
||||||
|
capistrano (>= 1.0.0)
|
||||||
|
compass (0.10.6)
|
||||||
|
haml (>= 3.0.4)
|
||||||
|
devise (1.1.7)
|
||||||
|
bcrypt-ruby (~> 2.1.2)
|
||||||
|
warden (~> 1.0.2)
|
||||||
|
diff-lcs (1.1.2)
|
||||||
|
erubis (2.6.6)
|
||||||
|
abstract (>= 1.0.0)
|
||||||
|
factory_girl (1.3.3)
|
||||||
|
factory_girl_rails (1.0.1)
|
||||||
|
factory_girl (~> 1.3)
|
||||||
|
railties (>= 3.0.0)
|
||||||
|
haml (3.0.25)
|
||||||
|
haml-rails (0.3.4)
|
||||||
|
actionpack (~> 3.0)
|
||||||
|
activesupport (~> 3.0)
|
||||||
|
haml (~> 3.0)
|
||||||
|
railties (~> 3.0)
|
||||||
|
highline (1.6.1)
|
||||||
|
hoptoad_notifier (2.4.6)
|
||||||
|
activesupport
|
||||||
|
builder
|
||||||
|
html5-boilerplate (0.3.2)
|
||||||
|
compass (>= 0.10.0)
|
||||||
|
i18n (0.5.0)
|
||||||
|
mail (2.2.15)
|
||||||
|
activesupport (>= 2.3.6)
|
||||||
|
i18n (>= 0.4.0)
|
||||||
|
mime-types (~> 1.16)
|
||||||
|
treetop (~> 1.4.8)
|
||||||
|
mime-types (1.16)
|
||||||
|
net-scp (1.0.4)
|
||||||
|
net-ssh (>= 1.99.1)
|
||||||
|
net-sftp (2.0.5)
|
||||||
|
net-ssh (>= 2.0.9)
|
||||||
|
net-ssh (2.1.3)
|
||||||
|
net-ssh-gateway (1.0.1)
|
||||||
|
net-ssh (>= 1.99.1)
|
||||||
|
pg (0.10.1)
|
||||||
|
polyglot (0.3.1)
|
||||||
|
rack (1.2.1)
|
||||||
|
rack-mount (0.6.13)
|
||||||
|
rack (>= 1.0.0)
|
||||||
|
rack-test (0.5.7)
|
||||||
|
rack (>= 1.0)
|
||||||
|
rails (3.0.5)
|
||||||
|
actionmailer (= 3.0.5)
|
||||||
|
actionpack (= 3.0.5)
|
||||||
|
activerecord (= 3.0.5)
|
||||||
|
activeresource (= 3.0.5)
|
||||||
|
activesupport (= 3.0.5)
|
||||||
|
bundler (~> 1.0)
|
||||||
|
railties (= 3.0.5)
|
||||||
|
railties (3.0.5)
|
||||||
|
actionpack (= 3.0.5)
|
||||||
|
activesupport (= 3.0.5)
|
||||||
|
rake (>= 0.8.7)
|
||||||
|
thor (~> 0.14.4)
|
||||||
|
rake (0.8.7)
|
||||||
|
rspec (2.5.0)
|
||||||
|
rspec-core (~> 2.5.0)
|
||||||
|
rspec-expectations (~> 2.5.0)
|
||||||
|
rspec-mocks (~> 2.5.0)
|
||||||
|
rspec-core (2.5.1)
|
||||||
|
rspec-expectations (2.5.0)
|
||||||
|
diff-lcs (~> 1.1.2)
|
||||||
|
rspec-mocks (2.5.0)
|
||||||
|
rspec-rails (2.5.0)
|
||||||
|
actionpack (~> 3.0)
|
||||||
|
activesupport (~> 3.0)
|
||||||
|
railties (~> 3.0)
|
||||||
|
rspec (~> 2.5.0)
|
||||||
|
russian (0.2.7)
|
||||||
|
thor (0.14.6)
|
||||||
|
treetop (1.4.9)
|
||||||
|
polyglot (>= 0.3.1)
|
||||||
|
tzinfo (0.3.24)
|
||||||
|
warden (1.0.3)
|
||||||
|
rack (>= 1.0.0)
|
||||||
|
will_paginate (3.0.pre2)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
capistrano
|
||||||
|
capistrano-ext
|
||||||
|
compass (>= 0.10.6)
|
||||||
|
devise
|
||||||
|
factory_girl_rails
|
||||||
|
haml (>= 3.0.0)
|
||||||
|
haml-rails
|
||||||
|
hoptoad_notifier (~> 2.3)
|
||||||
|
html5-boilerplate
|
||||||
|
pg
|
||||||
|
rails (= 3.0.5)
|
||||||
|
rspec-rails (>= 2.0.1)
|
||||||
|
russian
|
||||||
|
will_paginate (~> 3.0.pre2)
|
|
@ -0,0 +1,256 @@
|
||||||
|
== Welcome to Rails
|
||||||
|
|
||||||
|
Rails is a web-application framework that includes everything needed to create
|
||||||
|
database-backed web applications according to the Model-View-Control pattern.
|
||||||
|
|
||||||
|
This pattern splits the view (also called the presentation) into "dumb"
|
||||||
|
templates that are primarily responsible for inserting pre-built data in between
|
||||||
|
HTML tags. The model contains the "smart" domain objects (such as Account,
|
||||||
|
Product, Person, Post) that holds all the business logic and knows how to
|
||||||
|
persist themselves to a database. The controller handles the incoming requests
|
||||||
|
(such as Save New Account, Update Product, Show Post) by manipulating the model
|
||||||
|
and directing data to the view.
|
||||||
|
|
||||||
|
In Rails, the model is handled by what's called an object-relational mapping
|
||||||
|
layer entitled Active Record. This layer allows you to present the data from
|
||||||
|
database rows as objects and embellish these data objects with business logic
|
||||||
|
methods. You can read more about Active Record in
|
||||||
|
link:files/vendor/rails/activerecord/README.html.
|
||||||
|
|
||||||
|
The controller and view are handled by the Action Pack, which handles both
|
||||||
|
layers by its two parts: Action View and Action Controller. These two layers
|
||||||
|
are bundled in a single package due to their heavy interdependence. This is
|
||||||
|
unlike the relationship between the Active Record and Action Pack that is much
|
||||||
|
more separate. Each of these packages can be used independently outside of
|
||||||
|
Rails. You can read more about Action Pack in
|
||||||
|
link:files/vendor/rails/actionpack/README.html.
|
||||||
|
|
||||||
|
|
||||||
|
== Getting Started
|
||||||
|
|
||||||
|
1. At the command prompt, create a new Rails application:
|
||||||
|
<tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
|
||||||
|
|
||||||
|
2. Change directory to <tt>myapp</tt> and start the web server:
|
||||||
|
<tt>cd myapp; rails server</tt> (run with --help for options)
|
||||||
|
|
||||||
|
3. Go to http://localhost:3000/ and you'll see:
|
||||||
|
"Welcome aboard: You're riding Ruby on Rails!"
|
||||||
|
|
||||||
|
4. Follow the guidelines to start developing your application. You can find
|
||||||
|
the following resources handy:
|
||||||
|
|
||||||
|
* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
|
||||||
|
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
||||||
|
|
||||||
|
|
||||||
|
== Debugging Rails
|
||||||
|
|
||||||
|
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
||||||
|
will help you debug it and get it back on the rails.
|
||||||
|
|
||||||
|
First area to check is the application log files. Have "tail -f" commands
|
||||||
|
running on the server.log and development.log. Rails will automatically display
|
||||||
|
debugging and runtime information to these files. Debugging info will also be
|
||||||
|
shown in the browser on requests from 127.0.0.1.
|
||||||
|
|
||||||
|
You can also log your own messages directly into the log file from your code
|
||||||
|
using the Ruby logger class from inside your controllers. Example:
|
||||||
|
|
||||||
|
class WeblogController < ActionController::Base
|
||||||
|
def destroy
|
||||||
|
@weblog = Weblog.find(params[:id])
|
||||||
|
@weblog.destroy
|
||||||
|
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
The result will be a message in your log file along the lines of:
|
||||||
|
|
||||||
|
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
|
||||||
|
|
||||||
|
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
||||||
|
|
||||||
|
Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
|
||||||
|
several books available online as well:
|
||||||
|
|
||||||
|
* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
|
||||||
|
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
||||||
|
|
||||||
|
These two books will bring you up to speed on the Ruby language and also on
|
||||||
|
programming in general.
|
||||||
|
|
||||||
|
|
||||||
|
== Debugger
|
||||||
|
|
||||||
|
Debugger support is available through the debugger command when you start your
|
||||||
|
Mongrel or WEBrick server with --debugger. This means that you can break out of
|
||||||
|
execution at any point in the code, investigate and change the model, and then,
|
||||||
|
resume execution! You need to install ruby-debug to run the server in debugging
|
||||||
|
mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
|
||||||
|
|
||||||
|
class WeblogController < ActionController::Base
|
||||||
|
def index
|
||||||
|
@posts = Post.find(:all)
|
||||||
|
debugger
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
So the controller will accept the action, run the first line, then present you
|
||||||
|
with a IRB prompt in the server window. Here you can do things like:
|
||||||
|
|
||||||
|
>> @posts.inspect
|
||||||
|
=> "[#<Post:0x14a6be8
|
||||||
|
@attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
|
||||||
|
#<Post:0x14a6620
|
||||||
|
@attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
|
||||||
|
>> @posts.first.title = "hello from a debugger"
|
||||||
|
=> "hello from a debugger"
|
||||||
|
|
||||||
|
...and even better, you can examine how your runtime objects actually work:
|
||||||
|
|
||||||
|
>> f = @posts.first
|
||||||
|
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
||||||
|
>> f.
|
||||||
|
Display all 152 possibilities? (y or n)
|
||||||
|
|
||||||
|
Finally, when you're ready to resume execution, you can enter "cont".
|
||||||
|
|
||||||
|
|
||||||
|
== Console
|
||||||
|
|
||||||
|
The console is a Ruby shell, which allows you to interact with your
|
||||||
|
application's domain model. Here you'll have all parts of the application
|
||||||
|
configured, just like it is when the application is running. You can inspect
|
||||||
|
domain models, change values, and save to the database. Starting the script
|
||||||
|
without arguments will launch it in the development environment.
|
||||||
|
|
||||||
|
To start the console, run <tt>rails console</tt> from the application
|
||||||
|
directory.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
|
||||||
|
made to the database.
|
||||||
|
* Passing an environment name as an argument will load the corresponding
|
||||||
|
environment. Example: <tt>rails console production</tt>.
|
||||||
|
|
||||||
|
To reload your controllers and models after launching the console run
|
||||||
|
<tt>reload!</tt>
|
||||||
|
|
||||||
|
More information about irb can be found at:
|
||||||
|
link:http://www.rubycentral.com/pickaxe/irb.html
|
||||||
|
|
||||||
|
|
||||||
|
== dbconsole
|
||||||
|
|
||||||
|
You can go to the command line of your database directly through <tt>rails
|
||||||
|
dbconsole</tt>. You would be connected to the database with the credentials
|
||||||
|
defined in database.yml. Starting the script without arguments will connect you
|
||||||
|
to the development database. Passing an argument will connect you to a different
|
||||||
|
database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
|
||||||
|
PostgreSQL and SQLite 3.
|
||||||
|
|
||||||
|
== Description of Contents
|
||||||
|
|
||||||
|
The default directory structure of a generated Ruby on Rails application:
|
||||||
|
|
||||||
|
|-- app
|
||||||
|
| |-- controllers
|
||||||
|
| |-- helpers
|
||||||
|
| |-- mailers
|
||||||
|
| |-- models
|
||||||
|
| `-- views
|
||||||
|
| `-- layouts
|
||||||
|
|-- config
|
||||||
|
| |-- environments
|
||||||
|
| |-- initializers
|
||||||
|
| `-- locales
|
||||||
|
|-- db
|
||||||
|
|-- doc
|
||||||
|
|-- lib
|
||||||
|
| `-- tasks
|
||||||
|
|-- log
|
||||||
|
|-- public
|
||||||
|
| |-- images
|
||||||
|
| |-- javascripts
|
||||||
|
| `-- stylesheets
|
||||||
|
|-- script
|
||||||
|
|-- test
|
||||||
|
| |-- fixtures
|
||||||
|
| |-- functional
|
||||||
|
| |-- integration
|
||||||
|
| |-- performance
|
||||||
|
| `-- unit
|
||||||
|
|-- tmp
|
||||||
|
| |-- cache
|
||||||
|
| |-- pids
|
||||||
|
| |-- sessions
|
||||||
|
| `-- sockets
|
||||||
|
`-- vendor
|
||||||
|
`-- plugins
|
||||||
|
|
||||||
|
app
|
||||||
|
Holds all the code that's specific to this particular application.
|
||||||
|
|
||||||
|
app/controllers
|
||||||
|
Holds controllers that should be named like weblogs_controller.rb for
|
||||||
|
automated URL mapping. All controllers should descend from
|
||||||
|
ApplicationController which itself descends from ActionController::Base.
|
||||||
|
|
||||||
|
app/models
|
||||||
|
Holds models that should be named like post.rb. Models descend from
|
||||||
|
ActiveRecord::Base by default.
|
||||||
|
|
||||||
|
app/views
|
||||||
|
Holds the template files for the view that should be named like
|
||||||
|
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
||||||
|
eRuby syntax by default.
|
||||||
|
|
||||||
|
app/views/layouts
|
||||||
|
Holds the template files for layouts to be used with views. This models the
|
||||||
|
common header/footer method of wrapping views. In your views, define a layout
|
||||||
|
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
||||||
|
Inside default.html.erb, call <% yield %> to render the view using this
|
||||||
|
layout.
|
||||||
|
|
||||||
|
app/helpers
|
||||||
|
Holds view helpers that should be named like weblogs_helper.rb. These are
|
||||||
|
generated for you automatically when using generators for controllers.
|
||||||
|
Helpers can be used to wrap functionality for your views into methods.
|
||||||
|
|
||||||
|
config
|
||||||
|
Configuration files for the Rails environment, the routing map, the database,
|
||||||
|
and other dependencies.
|
||||||
|
|
||||||
|
db
|
||||||
|
Contains the database schema in schema.rb. db/migrate contains all the
|
||||||
|
sequence of Migrations for your schema.
|
||||||
|
|
||||||
|
doc
|
||||||
|
This directory is where your application documentation will be stored when
|
||||||
|
generated using <tt>rake doc:app</tt>
|
||||||
|
|
||||||
|
lib
|
||||||
|
Application specific libraries. Basically, any kind of custom code that
|
||||||
|
doesn't belong under controllers, models, or helpers. This directory is in
|
||||||
|
the load path.
|
||||||
|
|
||||||
|
public
|
||||||
|
The directory available for the web server. Contains subdirectories for
|
||||||
|
images, stylesheets, and javascripts. Also contains the dispatchers and the
|
||||||
|
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
||||||
|
server.
|
||||||
|
|
||||||
|
script
|
||||||
|
Helper scripts for automation and generation.
|
||||||
|
|
||||||
|
test
|
||||||
|
Unit and functional tests along with fixtures. When using the rails generate
|
||||||
|
command, template test files will be generated for you and placed in this
|
||||||
|
directory.
|
||||||
|
|
||||||
|
vendor
|
||||||
|
External libraries that the application depends on. Also includes the plugins
|
||||||
|
subdirectory. If the app has frozen rails, those gems also go here, under
|
||||||
|
vendor/rails/. This directory is in the load path.
|
|
@ -0,0 +1,7 @@
|
||||||
|
# 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'
|
||||||
|
|
||||||
|
Rosa::Application.load_tasks
|
|
@ -0,0 +1,3 @@
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
protect_from_forgery
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
* {
|
||||||
|
float: none; // Screens are not big enough to account for floats
|
||||||
|
background: #fff; // As much contrast as possible */
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Slightly reducing font size to reduce need to scroll
|
||||||
|
body { font-size: 80%; }
|
|
@ -0,0 +1,23 @@
|
||||||
|
// This file must be imported before loading html5-boilerplate
|
||||||
|
|
||||||
|
$base-font-family: unquote('sans-serif'); // default font-family
|
||||||
|
|
||||||
|
$base-font-size: 13px; // default font-size for YUI fonts
|
||||||
|
|
||||||
|
$base-line-height: 1.231; // default line-height for YUI fonts
|
||||||
|
|
||||||
|
$font-color: #444;
|
||||||
|
|
||||||
|
$link-color: #607890;
|
||||||
|
|
||||||
|
$link-hover-color: #036;
|
||||||
|
|
||||||
|
$link-active-color: #607890;
|
||||||
|
|
||||||
|
$link-visited-color: #607890;
|
||||||
|
|
||||||
|
$selected-font-color: #fff; // color for selected text
|
||||||
|
|
||||||
|
$selected-background-color: #ff5E99; // bg-color for selected text
|
||||||
|
|
||||||
|
$list-left-margin: 2em; // left margin for ul an ol
|
|
@ -0,0 +1,4 @@
|
||||||
|
// font-face fonts
|
||||||
|
// see http://compass-style.org/docs/reference/compass/css3/font_face/
|
||||||
|
|
||||||
|
//@import "compass/css3/font-face"
|
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// These are in their own partial because you probably
|
||||||
|
// want to customize on a per-site basis
|
||||||
|
//
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
@include media-print;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media all and (orientation:portrait) {
|
||||||
|
// Style adjustments for portrait mode goes here
|
||||||
|
}
|
||||||
|
|
||||||
|
@media all and (orientation:landscape) {
|
||||||
|
// Style adjustments for landscape mode goes here
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-device-width: 480px) {
|
||||||
|
// Pass in false if you don't want iOS and WinMobile to mobile-optimize the text for you
|
||||||
|
@include media-mobile(true);
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
//--------------------------------
|
||||||
|
// CSS Reset
|
||||||
|
//--------------------------------
|
||||||
|
@include html5-boilerplate-reset;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------
|
||||||
|
// Base Fonts
|
||||||
|
//--------------------------------
|
||||||
|
@include html5-boilerplate-fonts($base-font-family, $base-font-size, $base-line-height);
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------
|
||||||
|
// Minimal Base Styles
|
||||||
|
//--------------------------------
|
||||||
|
html { @include force-scrollbar; }
|
||||||
|
|
||||||
|
ul, ol { margin-left: $list-left-margin; }
|
||||||
|
ol { list-style-type: decimal; }
|
||||||
|
|
||||||
|
td, td img { vertical-align: top; }
|
||||||
|
|
||||||
|
sub { @include sub; }
|
||||||
|
|
||||||
|
sup { @include sup; }
|
||||||
|
|
||||||
|
textarea { overflow: auto; }
|
||||||
|
|
||||||
|
@include accessible-focus;
|
||||||
|
|
||||||
|
@include quoted-pre;
|
||||||
|
|
||||||
|
@include align-input-labels;
|
||||||
|
|
||||||
|
@include hand-cursor-inputs;
|
||||||
|
|
||||||
|
@include webkit-reset-form-elements;
|
||||||
|
|
||||||
|
@include selected-text;
|
||||||
|
|
||||||
|
@include webkit-tap-highlight;
|
||||||
|
|
||||||
|
@include ie-hacks;
|
||||||
|
|
||||||
|
@include no-nav-margins;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------
|
||||||
|
// Helpers
|
||||||
|
//--------------------------------
|
||||||
|
.ir { @include image-replacement; }
|
||||||
|
|
||||||
|
.hidden { @include hidden; }
|
||||||
|
|
||||||
|
.visuallyhidden { @include visually-hidden; }
|
||||||
|
|
||||||
|
.clearfix {
|
||||||
|
@include pie-clearfix; // defined by compass core
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
@import "compass/css3";
|
||||||
|
|
||||||
|
//-----------------------------------------------
|
||||||
|
// The following html5-boilerplate styles should
|
||||||
|
// probably be customized for each site
|
||||||
|
//-----------------------------------------------
|
||||||
|
|
||||||
|
body, select, input, textarea {
|
||||||
|
color: $font-color;
|
||||||
|
// Set your base font here, to apply evenly
|
||||||
|
// font-family: Georgia, serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Headers (h1, h2, etc) have no default font-size or margin; define those yourself
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
// Bold might not be the best choice if you are
|
||||||
|
// embedding a @font-face that's already bold
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
a, a:active, a:visited { color: $link-color; }
|
||||||
|
a:hover { color: $link-hover-color; }
|
||||||
|
|
||||||
|
strong, th {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
// Use font-size mixin to convert to percentage for YUI
|
||||||
|
// http://developer.yahoo.com/yui/3/cssfonts/#fontsize
|
||||||
|
@include font-size(11px); // approx 85% when base-font-size eq 13px
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the 'required' attribute on your
|
||||||
|
// inputs if you want to use these
|
||||||
|
input:valid, textarea:valid {}
|
||||||
|
input:invalid, textarea:invalid {
|
||||||
|
@include border-radius(1px);
|
||||||
|
@include box-shadow(red, 0, 0, 5px, 0);
|
||||||
|
}
|
||||||
|
.no-boxshadow input:invalid,
|
||||||
|
.no-boxshadow textarea:invalid { background-color: #f0dddd; }
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
// Add your own custom styles below
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
body {}
|
||||||
|
|
||||||
|
#container {}
|
||||||
|
|
||||||
|
header {}
|
||||||
|
|
||||||
|
#main {}
|
||||||
|
|
||||||
|
footer {}
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Here's where we define some default constants
|
||||||
|
@import "partials/base";
|
||||||
|
|
||||||
|
// Then we'll import the compass extension
|
||||||
|
@import "html5-boilerplate";
|
||||||
|
|
||||||
|
// Now, you can simply include everything
|
||||||
|
// (except media) by uncommeting this line
|
||||||
|
//@include html5-boilerplate;
|
||||||
|
|
||||||
|
// Or, you can pick and choose only the sections
|
||||||
|
// you want by using the these includes
|
||||||
|
@include html5-boilerplate-reset;
|
||||||
|
@include html5-boilerplate-fonts;
|
||||||
|
@include html5-boilerplate-styles;
|
||||||
|
@include html5-boilerplate-helpers;
|
||||||
|
|
||||||
|
// Or, you can import the "overrides" partial if
|
||||||
|
// you want more control over individual mixins
|
||||||
|
//@import "partials/overrides";
|
||||||
|
|
||||||
|
// Finally, put your own styles in these partials
|
||||||
|
// and add more as needed (i.e. forms, tables, nav)
|
||||||
|
@import "partials/fonts";
|
||||||
|
@import "partials/page";
|
||||||
|
|
||||||
|
// Media should come last
|
||||||
|
@import "partials/media";
|
|
@ -0,0 +1,4 @@
|
||||||
|
#flash
|
||||||
|
- flash.each do |key, value|
|
||||||
|
%div{ :title => key.to_s.humanize, :class => key }
|
||||||
|
%p= value
|
|
@ -0,0 +1,2 @@
|
||||||
|
%small.copyright
|
||||||
|
Copyright © #{Date.today.year}
|
|
@ -0,0 +1,27 @@
|
||||||
|
%head
|
||||||
|
%meta{ :charset => "utf-8" }/
|
||||||
|
|
||||||
|
-#
|
||||||
|
Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
||||||
|
Remove this if you use the .htaccess
|
||||||
|
%meta{ :content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible" }/
|
||||||
|
|
||||||
|
%title
|
||||||
|
== #{ controller.controller_name.titleize } - #{ controller.action_name.titleize }
|
||||||
|
|
||||||
|
%meta{ :content => "", :name => "description" }/
|
||||||
|
%meta{ :content => "", :name => "author" }/
|
||||||
|
|
||||||
|
-# Mobile viewport optimized: j.mp/bplateviewport
|
||||||
|
%meta{ :content => "width=device-width, initial-scale=1.0", :name => "viewport" }/
|
||||||
|
|
||||||
|
-# Place favicon.ico and apple-touch-icon.png in the root of your domain and delete these references
|
||||||
|
-# %link{ :href => "/favicon.ico", :rel => "shortcut icon" }/
|
||||||
|
-# %link{ :href => "/apple-touch-icon.png", :rel => "apple-touch-icon" }/
|
||||||
|
|
||||||
|
= render :partial => 'layouts/stylesheets'
|
||||||
|
|
||||||
|
-# All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects
|
||||||
|
= javascript_include_tag 'modernizr.min'
|
||||||
|
|
||||||
|
= csrf_meta_tag
|
|
@ -0,0 +1 @@
|
||||||
|
%h1 Header
|
|
@ -0,0 +1,37 @@
|
||||||
|
-# Grab Google CDN's jQuery, with a protocol relative URL
|
||||||
|
-# Looks for google_api_key first in ENV['GOOGLE_API_KEY'] then in config/google.yml
|
||||||
|
-# remote_jquery and local_jquery helpers use minified jquery unless Rails.env is development
|
||||||
|
- if !google_api_key.blank?
|
||||||
|
= javascript_include_tag "//www.google.com/jsapi?key=#{google_api_key}"
|
||||||
|
:javascript
|
||||||
|
google.load(#{ remote_jquery("1.5.1") });
|
||||||
|
- else
|
||||||
|
= javascript_include_tag "//ajax.googleapis.com/ajax/libs/jquery/#{ local_jquery("1.5.1") }"
|
||||||
|
|
||||||
|
-# fall back to local jQuery if necessary
|
||||||
|
:javascript
|
||||||
|
!window.jQuery && document.write(unescape('%3Cscript src="/javascripts/jquery.min.js"%3E%3C/script%3E'))
|
||||||
|
|
||||||
|
= javascript_include_tag 'rails', 'plugins', 'application'
|
||||||
|
|
||||||
|
-# Fix any <img> or .png_bg bg-images. Also, please read goo.gl/mZiyb
|
||||||
|
/[if lt IE 7 ]
|
||||||
|
= javascript_include_tag 'dd_belatedpng.js'
|
||||||
|
:javascript
|
||||||
|
//DD_belatedPNG.fix('img, .png_bg');
|
||||||
|
|
||||||
|
-# Append your own using content_for :javascripts
|
||||||
|
= yield :javascripts
|
||||||
|
|
||||||
|
-# asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
|
||||||
|
-# Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/google.yml
|
||||||
|
- if !google_account_id.blank?
|
||||||
|
:javascript
|
||||||
|
var _gaq = [['_setAccount', '#{google_account_id}'], ['_trackPageview']];
|
||||||
|
(function(d, t) {
|
||||||
|
var g = d.createElement(t),
|
||||||
|
s = d.getElementsByTagName(t)[0];
|
||||||
|
g.async = true;
|
||||||
|
g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||||
|
s.parentNode.insertBefore(g, s);
|
||||||
|
})(document, 'script');
|
|
@ -0,0 +1,6 @@
|
||||||
|
-# CSS: implied media="all"
|
||||||
|
-# stylesheet_link_tag 'style', :media => 'all'
|
||||||
|
= stylesheet_link_tag 'compiled/style.css', :media => 'all'
|
||||||
|
|
||||||
|
-# Append your own using content_for :stylesheets
|
||||||
|
= yield :stylesheets
|
|
@ -0,0 +1,15 @@
|
||||||
|
!!! 5
|
||||||
|
-# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
|
||||||
|
-ie_html :class => 'no-js' do
|
||||||
|
= render :partial => 'layouts/head'
|
||||||
|
%body{ :lang => 'en', :class => "#{controller.controller_name}" }
|
||||||
|
#container
|
||||||
|
%header#header
|
||||||
|
= render :partial => 'layouts/header'
|
||||||
|
#main{ :role => 'main' }
|
||||||
|
= render :partial => 'layouts/flashes'
|
||||||
|
= yield
|
||||||
|
%footer#footer
|
||||||
|
= render :partial => 'layouts/footer'
|
||||||
|
-# Javascript at the bottom for fast page loading
|
||||||
|
= render :partial => 'layouts/javascripts'
|
|
@ -0,0 +1,4 @@
|
||||||
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
|
run Rosa::Application
|
|
@ -0,0 +1,44 @@
|
||||||
|
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 Rosa
|
||||||
|
class Application < Rails::Application
|
||||||
|
|
||||||
|
config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
config.action_view.javascript_expansions[:defaults] = %w()
|
||||||
|
|
||||||
|
# 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
|
|
@ -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'])
|
|
@ -0,0 +1,13 @@
|
||||||
|
# This configuration file works with both the Compass command line tool and within Rails.
|
||||||
|
require 'html5-boilerplate'
|
||||||
|
# Require any additional compass plugins here.
|
||||||
|
|
||||||
|
project_type = :rails
|
||||||
|
project_path = Compass::AppIntegration::Rails.root
|
||||||
|
# Set this to the root of your project when deployed:
|
||||||
|
http_path = "/"
|
||||||
|
css_dir = "public/stylesheets/compiled"
|
||||||
|
sass_dir = "app/stylesheets"
|
||||||
|
environment = Compass::AppIntegration::Rails.env
|
||||||
|
# To enable relative paths to assets via compass helper functions. Uncomment:
|
||||||
|
# relative_assets = true
|
|
@ -0,0 +1,23 @@
|
||||||
|
development:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: rosa_development
|
||||||
|
pool: 5
|
||||||
|
username: anayden
|
||||||
|
password: nfhtkrf
|
||||||
|
|
||||||
|
test:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: rosa_test
|
||||||
|
pool: 5
|
||||||
|
username: anayden
|
||||||
|
password: nfhtkrf
|
||||||
|
|
||||||
|
production:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: rosa_production
|
||||||
|
pool: 5
|
||||||
|
username: rosa
|
||||||
|
password:
|
|
@ -0,0 +1,23 @@
|
||||||
|
development:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: rosa_development
|
||||||
|
pool: 5
|
||||||
|
username: rosa
|
||||||
|
password:
|
||||||
|
|
||||||
|
test:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: rosa_test
|
||||||
|
pool: 5
|
||||||
|
username: rosa
|
||||||
|
password:
|
||||||
|
|
||||||
|
production:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: rosa_production
|
||||||
|
pool: 5
|
||||||
|
username: rosa
|
||||||
|
password:
|
|
@ -0,0 +1,22 @@
|
||||||
|
set :application, "set your application name here"
|
||||||
|
set :repository, "set your repository location here"
|
||||||
|
|
||||||
|
set :scm, :subversion
|
||||||
|
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
|
||||||
|
|
||||||
|
role :web, "your web-server here" # Your HTTP server, Apache/etc
|
||||||
|
role :app, "your app-server here" # This may be the same as your `Web` server
|
||||||
|
role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
|
||||||
|
role :db, "your slave db-server here"
|
||||||
|
|
||||||
|
# If you are using Passenger mod_rails uncomment this:
|
||||||
|
# if you're still using the script/reapear helper you will need
|
||||||
|
# these http://github.com/rails/irs_process_scripts
|
||||||
|
|
||||||
|
# namespace :deploy do
|
||||||
|
# task :start do ; end
|
||||||
|
# task :stop do ; end
|
||||||
|
# task :restart, :roles => :app, :except => { :no_release => true } do
|
||||||
|
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
|
||||||
|
# end
|
||||||
|
# end
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Load the rails application
|
||||||
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
|
# Initialize the rails application
|
||||||
|
Rosa::Application.initialize!
|
|
@ -0,0 +1,28 @@
|
||||||
|
Rosa::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb
|
||||||
|
|
||||||
|
# In the development environment your application's code is reloaded on
|
||||||
|
# every request. This slows down response time but is perfect for development
|
||||||
|
# since you don't have to restart the webserver when you make code changes.
|
||||||
|
config.cache_classes = false
|
||||||
|
|
||||||
|
# Log error messages when you accidentally call methods on nil.
|
||||||
|
config.whiny_nils = true
|
||||||
|
|
||||||
|
# Show full error reports and disable caching
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_view.debug_rjs = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Don't care if the mailer can't send
|
||||||
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Print deprecation notices to the Rails logger
|
||||||
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
# Only use best-standards-support built into browsers
|
||||||
|
config.action_dispatch.best_standards_support = :builtin
|
||||||
|
|
||||||
|
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
Rosa::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb
|
||||||
|
|
||||||
|
# The production environment is meant for finished, "live" apps.
|
||||||
|
# Code is not reloaded between requests
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Full error reports are disabled and caching is turned on
|
||||||
|
config.consider_all_requests_local = false
|
||||||
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
|
# Specifies the header that your server uses for sending files
|
||||||
|
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
||||||
|
|
||||||
|
# For nginx:
|
||||||
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
||||||
|
|
||||||
|
# If you have no front-end server that supports something like X-Sendfile,
|
||||||
|
# just comment this out and Rails will serve the files
|
||||||
|
|
||||||
|
# See everything in the log (default is :info)
|
||||||
|
# config.log_level = :debug
|
||||||
|
|
||||||
|
# Use a different logger for distributed setups
|
||||||
|
# config.logger = SyslogLogger.new
|
||||||
|
|
||||||
|
# Use a different cache store in production
|
||||||
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
|
# Disable Rails's static asset server
|
||||||
|
# In production, Apache or nginx will already do this
|
||||||
|
config.serve_static_assets = false
|
||||||
|
|
||||||
|
# Enable serving of images, stylesheets, and javascripts from an asset server
|
||||||
|
# config.action_controller.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
|
# Disable delivery errors, bad email addresses will be ignored
|
||||||
|
# config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Enable threaded mode
|
||||||
|
# config.threadsafe!
|
||||||
|
|
||||||
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
|
# the I18n.default_locale when a translation can not be found)
|
||||||
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
|
# Send deprecation notices to registered listeners
|
||||||
|
config.active_support.deprecation = :notify
|
||||||
|
end
|
|
@ -0,0 +1,35 @@
|
||||||
|
Rosa::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb
|
||||||
|
|
||||||
|
# The test environment is used exclusively to run your application's
|
||||||
|
# test suite. You never need to work with it otherwise. Remember that
|
||||||
|
# your test database is "scratch space" for the test suite and is wiped
|
||||||
|
# and recreated between test runs. Don't rely on the data there!
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Log error messages when you accidentally call methods on nil.
|
||||||
|
config.whiny_nils = true
|
||||||
|
|
||||||
|
# Show full error reports and disable caching
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Raise exceptions instead of rendering exception templates
|
||||||
|
config.action_dispatch.show_exceptions = false
|
||||||
|
|
||||||
|
# Disable request forgery protection in test environment
|
||||||
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
|
# The :test delivery method accumulates sent emails in the
|
||||||
|
# ActionMailer::Base.deliveries array.
|
||||||
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
|
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
||||||
|
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
||||||
|
# like if you have constraints or database-specific column types
|
||||||
|
# config.active_record.schema_format = :sql
|
||||||
|
|
||||||
|
# Print deprecation notices to the stderr
|
||||||
|
config.active_support.deprecation = :stderr
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Html5BoilerplateHelper will first check your ENV and
|
||||||
|
# then this yml file for these values. If they are both
|
||||||
|
# empty, the google code block will not be used.
|
||||||
|
#
|
||||||
|
# e.g. ENV['GOOGLE_ACCOUNT_ID'] || yml[:google_account_id]
|
||||||
|
# e.g. ENV['GOOGLE_API_KEY'] || yml[:google_api_key]
|
||||||
|
#
|
||||||
|
defaults: &defaults
|
||||||
|
:google_account_id: ''
|
||||||
|
:google_api_key: ''
|
||||||
|
|
||||||
|
:development:
|
||||||
|
<<: *defaults
|
||||||
|
|
||||||
|
:test:
|
||||||
|
<<: *defaults
|
||||||
|
|
||||||
|
:staging:
|
||||||
|
<<: *defaults
|
||||||
|
|
||||||
|
:production:
|
||||||
|
<<: *defaults
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||||
|
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||||
|
|
||||||
|
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||||
|
# Rails.backtrace_cleaner.remove_silencers!
|
|
@ -0,0 +1,3 @@
|
||||||
|
require 'compass'
|
||||||
|
require 'compass/app_integration/rails'
|
||||||
|
Compass::AppIntegration::Rails.initialize!
|
|
@ -0,0 +1,3 @@
|
||||||
|
Rails.application.config.generators do |g|
|
||||||
|
g.test_framework = :rspec
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new inflection rules using the following format
|
||||||
|
# (all these examples are active by default):
|
||||||
|
# ActiveSupport::Inflector.inflections do |inflect|
|
||||||
|
# inflect.plural /^(ox)$/i, '\1en'
|
||||||
|
# inflect.singular /^(ox)en/i, '\1'
|
||||||
|
# inflect.irregular 'person', 'people'
|
||||||
|
# inflect.uncountable %w( fish sheep )
|
||||||
|
# end
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new mime types for use in respond_to blocks:
|
||||||
|
# Mime::Type.register "text/richtext", :rtf
|
||||||
|
# Mime::Type.register_alias "text/html", :iphone
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
Rosa::Application.config.session_store :cookie_store, :key => '_rosa_session'
|
||||||
|
|
||||||
|
# Use the database for sessions instead of the cookie-based default,
|
||||||
|
# which shouldn't be used to store highly confidential information
|
||||||
|
# (create the session table with "rails generate session_migration")
|
||||||
|
# Rosa::Application.config.session_store :active_record_store
|
|
@ -0,0 +1,39 @@
|
||||||
|
en:
|
||||||
|
errors:
|
||||||
|
messages:
|
||||||
|
not_found: "not found"
|
||||||
|
already_confirmed: "was already confirmed"
|
||||||
|
not_locked: "was not locked"
|
||||||
|
|
||||||
|
devise:
|
||||||
|
failure:
|
||||||
|
unauthenticated: 'You need to sign in or sign up before continuing.'
|
||||||
|
unconfirmed: 'You have to confirm your account before continuing.'
|
||||||
|
locked: 'Your account is locked.'
|
||||||
|
invalid: 'Invalid email or password.'
|
||||||
|
invalid_token: 'Invalid authentication token.'
|
||||||
|
timeout: 'Your session expired, please sign in again to continue.'
|
||||||
|
inactive: 'Your account was not activated yet.'
|
||||||
|
sessions:
|
||||||
|
signed_in: 'Signed in successfully.'
|
||||||
|
signed_out: 'Signed out successfully.'
|
||||||
|
passwords:
|
||||||
|
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
||||||
|
updated: 'Your password was changed successfully. You are now signed in.'
|
||||||
|
confirmations:
|
||||||
|
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
||||||
|
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
||||||
|
registrations:
|
||||||
|
signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.'
|
||||||
|
updated: 'You updated your account successfully.'
|
||||||
|
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
||||||
|
unlocks:
|
||||||
|
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
||||||
|
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
||||||
|
mailer:
|
||||||
|
confirmation_instructions:
|
||||||
|
subject: 'Confirmation instructions'
|
||||||
|
reset_password_instructions:
|
||||||
|
subject: 'Reset password instructions'
|
||||||
|
unlock_instructions:
|
||||||
|
subject: 'Unlock Instructions'
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Sample localization file for English. Add more files in this directory for other locales.
|
||||||
|
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
||||||
|
|
||||||
|
en:
|
||||||
|
hello: "Hello world"
|
|
@ -0,0 +1,3 @@
|
||||||
|
Rosa::Application.routes.draw do
|
||||||
|
root :to => "platforms#index"
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
# This file is auto-generated from the current state of the database. Instead
|
||||||
|
# of editing this file, please use the migrations feature of Active Record to
|
||||||
|
# incrementally modify your database, and then regenerate this schema definition.
|
||||||
|
#
|
||||||
|
# Note that this schema.rb definition is the authoritative source for your
|
||||||
|
# database schema. If you need to create the application database on another
|
||||||
|
# system, you should be using db:schema:load, not running all the migrations
|
||||||
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||||
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||||
|
#
|
||||||
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
|
ActiveRecord::Schema.define(:version => 0) do
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
# This file should contain all the record creation needed to seed the database with its default values.
|
||||||
|
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
#
|
||||||
|
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
||||||
|
# Mayor.create(:name => 'Daley', :city => cities.first)
|
|
@ -0,0 +1,2 @@
|
||||||
|
Use this README file to introduce your application and point to useful places in the API for learning more.
|
||||||
|
Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
|
|
@ -0,0 +1,420 @@
|
||||||
|
# Apache configuration file
|
||||||
|
# httpd.apache.org/docs/2.2/mod/quickreference.html
|
||||||
|
|
||||||
|
# Note .htaccess files are an overhead, this logic should be in your Apache config if possible
|
||||||
|
# httpd.apache.org/docs/2.2/howto/htaccess.html
|
||||||
|
|
||||||
|
# Techniques in here adapted from all over, including:
|
||||||
|
# Kroc Camen: camendesign.com/.htaccess
|
||||||
|
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
|
||||||
|
# Sample .htaccess file of CMS MODx: modxcms.com
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### If you run a webserver other than apache, consider:
|
||||||
|
### github.com/paulirish/html5-boilerplate-server-configs
|
||||||
|
###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Better website experience for IE users
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Force the latest IE version, in various cases when it may fall back to IE7 mode
|
||||||
|
# github.com/rails/rails/commit/123eb25#commitcomment-118920
|
||||||
|
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
|
||||||
|
|
||||||
|
<IfModule mod_setenvif.c>
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
BrowserMatch MSIE ie
|
||||||
|
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
|
||||||
|
</IfModule>
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
# Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
|
||||||
|
# We need to inform proxies that content changes based on UA
|
||||||
|
Header append Vary User-Agent
|
||||||
|
# Cache control is set only if mod_headers is enabled, so that's unncessary to declare
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Cross-domain AJAX requests
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Serve cross-domain ajax requests, disabled.
|
||||||
|
# enable-cors.org
|
||||||
|
# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
|
||||||
|
|
||||||
|
# <IfModule mod_headers.c>
|
||||||
|
# Header set Access-Control-Allow-Origin "*"
|
||||||
|
# </IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Webfont access
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# allow access from all domains for webfonts
|
||||||
|
# alternatively you could only whitelist
|
||||||
|
# your subdomains like "sub.domain.com"
|
||||||
|
|
||||||
|
<FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
Header set Access-Control-Allow-Origin "*"
|
||||||
|
</IfModule>
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Proper MIME type for all files
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# audio
|
||||||
|
AddType audio/ogg oga ogg
|
||||||
|
|
||||||
|
# video
|
||||||
|
AddType video/ogg ogv
|
||||||
|
AddType video/mp4 mp4
|
||||||
|
AddType video/webm webm
|
||||||
|
|
||||||
|
# Proper svg serving. Required for svg webfonts on iPad
|
||||||
|
# twitter.com/FontSquirrel/status/14855840545
|
||||||
|
AddType image/svg+xml svg svgz
|
||||||
|
AddEncoding gzip svgz
|
||||||
|
|
||||||
|
# webfonts
|
||||||
|
AddType application/vnd.ms-fontobject eot
|
||||||
|
AddType font/truetype ttf
|
||||||
|
AddType font/opentype otf
|
||||||
|
AddType application/x-font-woff woff
|
||||||
|
|
||||||
|
# assorted types
|
||||||
|
AddType image/x-icon ico
|
||||||
|
AddType image/webp webp
|
||||||
|
AddType text/cache-manifest appcache manifest
|
||||||
|
AddType text/x-component htc
|
||||||
|
AddType application/x-chrome-extension crx
|
||||||
|
AddType application/x-xpinstall xpi
|
||||||
|
AddType application/octet-stream safariextz
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Allow concatenation from within specific js and css files
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# e.g. Inside of script.combined.js you could have
|
||||||
|
# <!--#include file="libs/jquery-1.5.0.min.js" -->
|
||||||
|
# <!--#include file="plugins/jquery.idletimer.js" -->
|
||||||
|
# and they would be included into this single file
|
||||||
|
|
||||||
|
# this is not in use in the boilerplate as it stands. you may
|
||||||
|
# choose to name your files in this way for this advantage
|
||||||
|
# or concatenate and minify them manually.
|
||||||
|
# Disabled by default.
|
||||||
|
|
||||||
|
# <FilesMatch "\.combined\.(js|css)$">
|
||||||
|
# Options +Includes
|
||||||
|
# SetOutputFilter INCLUDES
|
||||||
|
# </FilesMatch>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# gzip compression
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
<IfModule mod_deflate.c>
|
||||||
|
|
||||||
|
|
||||||
|
# force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
|
||||||
|
<IfModule mod_setenvif.c>
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s,?\s(gzip|deflate)?|X{4,13}|~{4,13}|-{4,13})$ HAVE_Accept-Encoding
|
||||||
|
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
|
||||||
|
</IfModule>
|
||||||
|
</IfModule>
|
||||||
|
# html, txt, css, js, json, xml, htc:
|
||||||
|
<IfModule filter_module>
|
||||||
|
FilterDeclare COMPRESS
|
||||||
|
FilterProvider COMPRESS DEFLATE resp=Content-Type /text/(html|css|javascript|plain|x(ml|-component))/
|
||||||
|
FilterProvider COMPRESS DEFLATE resp=Content-Type /application/(javascript|json|xml|x-javascript)/
|
||||||
|
FilterChain COMPRESS
|
||||||
|
FilterProtocol COMPRESS change=yes;byteranges=no
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule !mod_filter.c>
|
||||||
|
# Legacy versions of Apache
|
||||||
|
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
|
||||||
|
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
|
||||||
|
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
# webfonts and svg:
|
||||||
|
<FilesMatch "\.(ttf|otf|eot|svg)$" >
|
||||||
|
SetOutputFilter DEFLATE
|
||||||
|
</FilesMatch>
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Expires headers (for better cache control)
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# these are pretty far-future expires headers
|
||||||
|
# they assume you control versioning with cachebusting query params like
|
||||||
|
# <script src="application.js?20100608">
|
||||||
|
# additionally, consider that outdated proxies may miscache
|
||||||
|
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
|
||||||
|
|
||||||
|
# if you don't use filenames to version, lower the css and js to something like
|
||||||
|
# "access plus 1 week" or so
|
||||||
|
|
||||||
|
<IfModule mod_expires.c>
|
||||||
|
ExpiresActive on
|
||||||
|
|
||||||
|
# Perhaps better to whitelist expires rules? Perhaps.
|
||||||
|
ExpiresDefault "access plus 1 month"
|
||||||
|
|
||||||
|
# cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
|
||||||
|
ExpiresByType text/cache-manifest "access plus 0 seconds"
|
||||||
|
|
||||||
|
# your document html
|
||||||
|
ExpiresByType text/html "access plus 0 seconds"
|
||||||
|
|
||||||
|
# data
|
||||||
|
ExpiresByType text/xml "access plus 0 seconds"
|
||||||
|
ExpiresByType application/xml "access plus 0 seconds"
|
||||||
|
ExpiresByType application/json "access plus 0 seconds"
|
||||||
|
|
||||||
|
# rss feed
|
||||||
|
ExpiresByType application/rss+xml "access plus 1 hour"
|
||||||
|
|
||||||
|
# favicon (cannot be renamed)
|
||||||
|
ExpiresByType image/x-icon "access plus 1 week"
|
||||||
|
|
||||||
|
# media: images, video, audio
|
||||||
|
ExpiresByType image/gif "access plus 1 month"
|
||||||
|
ExpiresByType image/png "access plus 1 month"
|
||||||
|
ExpiresByType image/jpg "access plus 1 month"
|
||||||
|
ExpiresByType image/jpeg "access plus 1 month"
|
||||||
|
ExpiresByType video/ogg "access plus 1 month"
|
||||||
|
ExpiresByType audio/ogg "access plus 1 month"
|
||||||
|
ExpiresByType video/mp4 "access plus 1 month"
|
||||||
|
ExpiresByType video/webm "access plus 1 month"
|
||||||
|
|
||||||
|
# htc files (css3pie)
|
||||||
|
ExpiresByType text/x-component "access plus 1 month"
|
||||||
|
|
||||||
|
# webfonts
|
||||||
|
ExpiresByType font/truetype "access plus 1 month"
|
||||||
|
ExpiresByType font/opentype "access plus 1 month"
|
||||||
|
ExpiresByType font/woff "access plus 1 month"
|
||||||
|
ExpiresByType image/svg+xml "access plus 1 month"
|
||||||
|
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
|
||||||
|
|
||||||
|
# css and javascript
|
||||||
|
ExpiresByType text/css "access plus 2 months"
|
||||||
|
ExpiresByType application/javascript "access plus 2 months"
|
||||||
|
ExpiresByType text/javascript "access plus 2 months"
|
||||||
|
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
Header append Cache-Control "public"
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# ETag removal
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Since we're sending far-future expires, we don't need ETags for
|
||||||
|
# static content.
|
||||||
|
# developer.yahoo.com/performance/rules.html#etags
|
||||||
|
FileETag None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Stop screen flicker in IE on CSS rollovers
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# The following directives stop screen flicker in IE on CSS rollovers - in
|
||||||
|
# combination with the "ExpiresByType" rules for images (see above). If
|
||||||
|
# needed, un-comment the following rules.
|
||||||
|
|
||||||
|
# BrowserMatch "MSIE" brokenvary=1
|
||||||
|
# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
|
||||||
|
# BrowserMatch "Opera" !brokenvary
|
||||||
|
# SetEnvIf brokenvary 1 force-no-vary
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Cookie setting from iframes
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Allow cookies to be set from iframes (for IE only)
|
||||||
|
# If needed, uncomment and specify a path or regex in the Location directive
|
||||||
|
|
||||||
|
# <IfModule mod_headers.c>
|
||||||
|
# <Location />
|
||||||
|
# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
|
||||||
|
# </Location>
|
||||||
|
# </IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Start rewrite engine
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Turning on the rewrite engine is necessary for the following rules and features.
|
||||||
|
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Suppress or force the "www." at the beginning of URLs
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# The same content should never be available under two different URLs - especially not with and
|
||||||
|
# without "www." at the beginning, since this can cause SEO problems (duplicate content).
|
||||||
|
# That's why you should choose one of the alternatives and redirect the other one.
|
||||||
|
|
||||||
|
# By default option 1 (no "www.") is activated. Remember: Shorter URLs are sexier.
|
||||||
|
# no-www.org/faq.php?q=class_b
|
||||||
|
|
||||||
|
# If you rather want to use option 2, just comment out all option 1 lines
|
||||||
|
# and uncomment option 2.
|
||||||
|
# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Option 1:
|
||||||
|
# Rewrite "www.domain.com -> domain.com"
|
||||||
|
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteCond %{HTTPS} !=on
|
||||||
|
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
||||||
|
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Option 2:
|
||||||
|
# To rewrite "domain.com -> www.domain.com" uncomment the following lines.
|
||||||
|
# Be aware that the following rule might not be a good idea if you
|
||||||
|
# use "real" subdomains for certain parts of your website.
|
||||||
|
|
||||||
|
# <IfModule mod_rewrite.c>
|
||||||
|
# RewriteCond %{HTTPS} !=on
|
||||||
|
# RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
|
||||||
|
# RewriteCond %{HTTP_HOST} (.+)$ [NC]
|
||||||
|
# RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
|
||||||
|
# </IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Prevent SSL cert warnings
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
|
||||||
|
# https://www.domain.com when your cert only allows https://secure.domain.com
|
||||||
|
# Uncomment the following lines to use this feature.
|
||||||
|
|
||||||
|
# <IfModule mod_rewrite.c>
|
||||||
|
# RewriteCond %{SERVER_PORT} !^443
|
||||||
|
# RewriteRule (.*) https://example-domain-please-change.com.com/$1 [R=301,L]
|
||||||
|
# </IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Prevent 404 errors for non-existing redirected folders
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist
|
||||||
|
# e.g. /blog/hello : webmasterworld.com/apache/3808792.htm
|
||||||
|
|
||||||
|
Options -MultiViews
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# custom 404 page
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# You can add custom pages to handle 500 or 403 pretty easily, if you like.
|
||||||
|
ErrorDocument 404 /404.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# UTF-8 encoding
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# use utf-8 encoding for anything served text/plain or text/html
|
||||||
|
AddDefaultCharset utf-8
|
||||||
|
|
||||||
|
# force utf-8 for a number of file formats
|
||||||
|
AddCharset utf-8 .html .css .js .xml .json .rss
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# A little more security
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
# Do we want to advertise the exact version number of Apache we're running?
|
||||||
|
# Probably not.
|
||||||
|
## This can only be enabled if used in httpd.conf - It will not work in .htaccess
|
||||||
|
# ServerTokens Prod
|
||||||
|
|
||||||
|
|
||||||
|
# "-Indexes" will have Apache block users from browsing folders without a default document
|
||||||
|
# Usually you should leave this activated, because you shouldn't allow everybody to surf through
|
||||||
|
# every folder on your server (which includes rather private places like CMS system folders).
|
||||||
|
# Options -Indexes
|
||||||
|
|
||||||
|
|
||||||
|
# Block access to "hidden" directories whose names begin with a period. This
|
||||||
|
# includes directories used by version control systems such as Subversion or Git.
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteRule "(^|/)\." - [F]
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
# If your server is not already configured as such, the following directive
|
||||||
|
# should be uncommented in order to set PHP's register_globals option to OFF.
|
||||||
|
# This closes a major security hole that is abused by most XSS (cross-site
|
||||||
|
# scripting) attacks. For more information: http://php.net/register_globals
|
||||||
|
#
|
||||||
|
# IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
|
||||||
|
#
|
||||||
|
# Your server does not allow PHP directives to be set via .htaccess. In that
|
||||||
|
# case you must make this change in your php.ini file instead. If you are
|
||||||
|
# using a commercial web host, contact the administrators for assistance in
|
||||||
|
# doing this. Not all servers allow local php.ini files, and they should
|
||||||
|
# include all PHP configurations (not just this one), or you will effectively
|
||||||
|
# reset everything to PHP defaults. Consult www.php.net for more detailed
|
||||||
|
# information about setting PHP directives.
|
||||||
|
|
||||||
|
# php_flag register_globals Off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<!doctype html>
|
||||||
|
<title>not found</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body { text-align: center;}
|
||||||
|
h1 { font-size: 50px; }
|
||||||
|
body { font: 20px Constantia, 'Hoefler Text', "Adobe Caslon Pro", Baskerville, Georgia, Times, serif; color: #999; text-shadow: 2px 2px 2px rgba(200, 200, 200, 0.5); }
|
||||||
|
::-moz-selection{ background:#FF5E99; color:#fff; }
|
||||||
|
::selection { background:#FF5E99; color:#fff; }
|
||||||
|
details { display:block; }
|
||||||
|
a { color: rgb(36, 109, 56); text-decoration:none; }
|
||||||
|
a:hover { color: rgb(96, 73, 141) ; text-shadow: 2px 2px 2px rgba(36, 109, 56, 0.5); }
|
||||||
|
span[frown] { transform: rotate(90deg); display:inline-block; color: #bbb; }
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h1>Not found</h1></summary>
|
||||||
|
<p><span frown>:(</span></p>
|
||||||
|
</details>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>The change you wanted was rejected (422)</title>
|
||||||
|
<style type="text/css">
|
||||||
|
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
||||||
|
div.dialog {
|
||||||
|
width: 25em;
|
||||||
|
padding: 0 4em;
|
||||||
|
margin: 4em auto 0 auto;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
}
|
||||||
|
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/422.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<h1>The change you wanted was rejected.</h1>
|
||||||
|
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>We're sorry, but something went wrong (500)</title>
|
||||||
|
<style type="text/css">
|
||||||
|
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
||||||
|
div.dialog {
|
||||||
|
width: 25em;
|
||||||
|
padding: 0 4em;
|
||||||
|
margin: 4em auto 0 auto;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
}
|
||||||
|
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/500.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<h1>We're sorry, but something went wrong.</h1>
|
||||||
|
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
|
||||||
|
<cross-domain-policy>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
|
||||||
|
|
||||||
|
<!-- Most restrictive policy: -->
|
||||||
|
<site-control permitted-cross-domain-policies="none"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Least restrictive policy: -->
|
||||||
|
<!--
|
||||||
|
<site-control permitted-cross-domain-policies="all"/>
|
||||||
|
<allow-access-from domain="*" to-ports="*" secure="false"/>
|
||||||
|
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
|
||||||
|
-->
|
||||||
|
<!--
|
||||||
|
If you host a crossdomain.xml file with allow-access-from domain=“*”
|
||||||
|
and don’t understand all of the points described here, you probably
|
||||||
|
have a nasty security vulnerability. ~ simon willison
|
||||||
|
-->
|
||||||
|
|
||||||
|
</cross-domain-policy>
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,43 @@
|
||||||
|
/* the humans responsible & colophon */
|
||||||
|
/* humanstxt.org */
|
||||||
|
|
||||||
|
|
||||||
|
/* TEAM */
|
||||||
|
<your title>: <your name>
|
||||||
|
Site:
|
||||||
|
Twitter:
|
||||||
|
Location:
|
||||||
|
|
||||||
|
/* THANKS */
|
||||||
|
Names (& URL):
|
||||||
|
|
||||||
|
/* SITE */
|
||||||
|
Standards: HTML5, CSS3
|
||||||
|
Components: Modernizr, jQuery
|
||||||
|
Software:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-o/-
|
||||||
|
+oo//-
|
||||||
|
:ooo+//:
|
||||||
|
-ooooo///-
|
||||||
|
/oooooo//:
|
||||||
|
:ooooooo+//-
|
||||||
|
-+oooooooo///-
|
||||||
|
-://////////////+oooooooooo++////////////::
|
||||||
|
:+ooooooooooooooooooooooooooooooooooooo+:::-
|
||||||
|
-/+ooooooooooooooooooooooooooooooo+/::////:-
|
||||||
|
-:+oooooooooooooooooooooooooooo/::///////:-
|
||||||
|
--/+ooooooooooooooooooooo+::://////:-
|
||||||
|
-:+ooooooooooooooooo+:://////:--
|
||||||
|
/ooooooooooooooooo+//////:-
|
||||||
|
-ooooooooooooooooooo////-
|
||||||
|
/ooooooooo+oooooooooo//:
|
||||||
|
:ooooooo+/::/+oooooooo+//-
|
||||||
|
-oooooo/::///////+oooooo///-
|
||||||
|
/ooo+::://////:---:/+oooo//:
|
||||||
|
-o+/::///////:- -:/+o+//-
|
||||||
|
:-:///////:- -:/://
|
||||||
|
-////:- --//:
|
||||||
|
-- -:
|
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
|
@ -0,0 +1,239 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Ruby on Rails: Welcome aboard</title>
|
||||||
|
<style type="text/css" media="screen">
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
|
||||||
|
font-size: 13px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 28px;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {color: #03c}
|
||||||
|
a:hover {
|
||||||
|
background-color: #03c;
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#page {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
width: 750px;
|
||||||
|
margin: 0;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content {
|
||||||
|
float: left;
|
||||||
|
background-color: white;
|
||||||
|
border: 3px solid #aaa;
|
||||||
|
border-top: none;
|
||||||
|
padding: 25px;
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar {
|
||||||
|
float: right;
|
||||||
|
width: 175px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#header, #about, #getting-started {
|
||||||
|
padding-left: 75px;
|
||||||
|
padding-right: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#header {
|
||||||
|
background-image: url("images/rails.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: top left;
|
||||||
|
height: 64px;
|
||||||
|
}
|
||||||
|
#header h1, #header h2 {margin: 0}
|
||||||
|
#header h2 {
|
||||||
|
color: #888;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#about h3 {
|
||||||
|
margin: 0;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#about-content {
|
||||||
|
background-color: #ffd;
|
||||||
|
border: 1px solid #fc0;
|
||||||
|
margin-left: -55px;
|
||||||
|
margin-right: -10px;
|
||||||
|
}
|
||||||
|
#about-content table {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 11px;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
#about-content td {
|
||||||
|
padding: 10px;
|
||||||
|
padding-top: 3px;
|
||||||
|
padding-bottom: 3px;
|
||||||
|
}
|
||||||
|
#about-content td.name {color: #555}
|
||||||
|
#about-content td.value {color: #000}
|
||||||
|
|
||||||
|
#about-content ul {
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#about-content.failure {
|
||||||
|
background-color: #fcc;
|
||||||
|
border: 1px solid #f00;
|
||||||
|
}
|
||||||
|
#about-content.failure p {
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#getting-started {
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
margin-top: 25px;
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
|
#getting-started h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
#getting-started h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
#getting-started ol {
|
||||||
|
margin-left: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
#getting-started li {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #888;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
#getting-started li h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 18px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
#getting-started li p {
|
||||||
|
color: #555;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#sidebar ul {
|
||||||
|
margin-left: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
#sidebar ul h3 {
|
||||||
|
margin-top: 25px;
|
||||||
|
font-size: 16px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
#sidebar li {
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
#sidebar ul.links li {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function about() {
|
||||||
|
info = document.getElementById('about-content');
|
||||||
|
if (window.XMLHttpRequest)
|
||||||
|
{ xhr = new XMLHttpRequest(); }
|
||||||
|
else
|
||||||
|
{ xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
|
||||||
|
xhr.open("GET","rails/info/properties",false);
|
||||||
|
xhr.send("");
|
||||||
|
info.innerHTML = xhr.responseText;
|
||||||
|
info.style.display = 'block'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="page">
|
||||||
|
<div id="sidebar">
|
||||||
|
<ul id="sidebar-items">
|
||||||
|
<li>
|
||||||
|
<h3>Browse the documentation</h3>
|
||||||
|
<ul class="links">
|
||||||
|
<li><a href="http://api.rubyonrails.org/">Rails API</a></li>
|
||||||
|
<li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
|
||||||
|
<li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
|
||||||
|
<li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<div id="header">
|
||||||
|
<h1>Welcome aboard</h1>
|
||||||
|
<h2>You’re riding Ruby on Rails!</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="about">
|
||||||
|
<h3><a href="rails/info/properties" onclick="about(); return false">About your application’s environment</a></h3>
|
||||||
|
<div id="about-content" style="display: none"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="getting-started">
|
||||||
|
<h1>Getting started</h1>
|
||||||
|
<h2>Here’s how to get rolling:</h2>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<h2>Use <code>rails generate</code> to create your models and controllers</h2>
|
||||||
|
<p>To see all available options, run it without parameters.</p>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<h2>Set up a default route and remove or rename this file</h2>
|
||||||
|
<p>Routes are set up in config/routes.rb.</p>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<h2>Create your database</h2>
|
||||||
|
<p>Run <code>rake db:migrate</code> to create your database. If you're not using SQLite (the default), edit <code>config/database.yml</code> with your username and password.</p>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="footer"> </div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,11 @@
|
||||||
|
// usage: log('inside coolFunc', this, arguments);
|
||||||
|
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
|
||||||
|
window.log = function(){
|
||||||
|
log.history = log.history || []; // store logs to an array for reference
|
||||||
|
log.history.push(arguments);
|
||||||
|
if(this.console) console.log( Array.prototype.slice.call(arguments) );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// place any jQuery/helper plugins in here, instead of separate, slower script files.
|
|
@ -0,0 +1,157 @@
|
||||||
|
/**
|
||||||
|
* Unobtrusive scripting adapter for jQuery
|
||||||
|
*
|
||||||
|
* Requires jQuery 1.4.3 or later.
|
||||||
|
* https://github.com/rails/jquery-ujs
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function($) {
|
||||||
|
// Make sure that every Ajax request sends the CSRF token
|
||||||
|
function CSRFProtection(xhr) {
|
||||||
|
var token = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
||||||
|
}
|
||||||
|
if ('ajaxPrefilter' in $) $.ajaxPrefilter(function(options, originalOptions, xhr){ CSRFProtection(xhr) });
|
||||||
|
else $(document).ajaxSend(function(e, xhr){ CSRFProtection(xhr) });
|
||||||
|
|
||||||
|
// Triggers an event on an element and returns the event result
|
||||||
|
function fire(obj, name, data) {
|
||||||
|
var event = new $.Event(name);
|
||||||
|
obj.trigger(event, data);
|
||||||
|
return event.result !== false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submits "remote" forms and links with ajax
|
||||||
|
function handleRemote(element) {
|
||||||
|
var method, url, data,
|
||||||
|
dataType = element.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
||||||
|
|
||||||
|
if (element.is('form')) {
|
||||||
|
method = element.attr('method');
|
||||||
|
url = element.attr('action');
|
||||||
|
data = element.serializeArray();
|
||||||
|
// memoized value from clicked submit button
|
||||||
|
var button = element.data('ujs:submit-button');
|
||||||
|
if (button) {
|
||||||
|
data.push(button);
|
||||||
|
element.data('ujs:submit-button', null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
method = element.attr('data-method');
|
||||||
|
url = element.attr('href');
|
||||||
|
data = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: url, type: method || 'GET', data: data, dataType: dataType,
|
||||||
|
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
||||||
|
beforeSend: function(xhr, settings) {
|
||||||
|
if (settings.dataType === undefined) {
|
||||||
|
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
||||||
|
}
|
||||||
|
return fire(element, 'ajax:beforeSend', [xhr, settings]);
|
||||||
|
},
|
||||||
|
success: function(data, status, xhr) {
|
||||||
|
element.trigger('ajax:success', [data, status, xhr]);
|
||||||
|
},
|
||||||
|
complete: function(xhr, status) {
|
||||||
|
element.trigger('ajax:complete', [xhr, status]);
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
element.trigger('ajax:error', [xhr, status, error]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handles "data-method" on links such as:
|
||||||
|
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
||||||
|
function handleMethod(link) {
|
||||||
|
var href = link.attr('href'),
|
||||||
|
method = link.attr('data-method'),
|
||||||
|
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
||||||
|
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
||||||
|
form = $('<form method="post" action="' + href + '"></form>'),
|
||||||
|
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
||||||
|
|
||||||
|
if (csrf_param !== undefined && csrf_token !== undefined) {
|
||||||
|
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
form.hide().append(metadata_input).appendTo('body');
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableFormElements(form) {
|
||||||
|
form.find('input[data-disable-with]').each(function() {
|
||||||
|
var input = $(this);
|
||||||
|
input.data('ujs:enable-with', input.val())
|
||||||
|
.val(input.attr('data-disable-with'))
|
||||||
|
.attr('disabled', 'disabled');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableFormElements(form) {
|
||||||
|
form.find('input[data-disable-with]').each(function() {
|
||||||
|
var input = $(this);
|
||||||
|
input.val(input.data('ujs:enable-with')).removeAttr('disabled');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function allowAction(element) {
|
||||||
|
var message = element.attr('data-confirm');
|
||||||
|
return !message || (fire(element, 'confirm') && confirm(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
function requiredValuesMissing(form) {
|
||||||
|
var missing = false;
|
||||||
|
form.find('input[name][required]').each(function() {
|
||||||
|
if (!$(this).val()) missing = true;
|
||||||
|
});
|
||||||
|
return missing;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
|
||||||
|
var link = $(this);
|
||||||
|
if (!allowAction(link)) return false;
|
||||||
|
|
||||||
|
if (link.attr('data-remote') != undefined) {
|
||||||
|
handleRemote(link);
|
||||||
|
return false;
|
||||||
|
} else if (link.attr('data-method')) {
|
||||||
|
handleMethod(link);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('form').live('submit.rails', function(e) {
|
||||||
|
var form = $(this), remote = form.attr('data-remote') != undefined;
|
||||||
|
if (!allowAction(form)) return false;
|
||||||
|
|
||||||
|
// skip other logic when required values are missing
|
||||||
|
if (requiredValuesMissing(form)) return !remote;
|
||||||
|
|
||||||
|
if (remote) {
|
||||||
|
handleRemote(form);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// slight timeout so that the submit button gets properly serialized
|
||||||
|
setTimeout(function(){ disableFormElements(form) }, 13);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
|
||||||
|
var button = $(this);
|
||||||
|
if (!allowAction(button)) return false;
|
||||||
|
// register the pressed submit button
|
||||||
|
var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
|
||||||
|
button.closest('form').data('ujs:submit-button', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('form').live('ajax:beforeSend.rails', function(event) {
|
||||||
|
if (this == event.target) disableFormElements($(this));
|
||||||
|
});
|
||||||
|
|
||||||
|
$('form').live('ajax:complete.rails', function(event) {
|
||||||
|
if (this == event.target) enableFormElements($(this));
|
||||||
|
});
|
||||||
|
})( jQuery );
|
|
@ -0,0 +1,5 @@
|
||||||
|
# www.robotstxt.org/
|
||||||
|
# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
|
||||||
|
|
||||||
|
User-agent: *
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||||
|
|
||||||
|
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||||
|
require File.expand_path('../../config/boot', __FILE__)
|
||||||
|
require 'rails/commands'
|
|
@ -0,0 +1,27 @@
|
||||||
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
|
ENV["RAILS_ENV"] ||= 'test'
|
||||||
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
|
require 'rspec/rails'
|
||||||
|
|
||||||
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
|
# in spec/support/ and its subdirectories.
|
||||||
|
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# == Mock Framework
|
||||||
|
#
|
||||||
|
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||||
|
#
|
||||||
|
# config.mock_with :mocha
|
||||||
|
# config.mock_with :flexmock
|
||||||
|
# config.mock_with :rr
|
||||||
|
config.mock_with :rspec
|
||||||
|
|
||||||
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||||
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
|
# examples within a transaction, remove the following line or assign false
|
||||||
|
# instead of true.
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
end
|
|
@ -0,0 +1,55 @@
|
||||||
|
= MileMarker Plugin
|
||||||
|
|
||||||
|
Author:: Chad Pytel (mailto:cpytel@thoughtbot.com)
|
||||||
|
Copyright:: Copyright(c) 2007 thoughtbot, inc.
|
||||||
|
License:: Distributes under the same terms as Ruby
|
||||||
|
Website:: http://www.thoughtbot.com/projects/mile_marker
|
||||||
|
|
||||||
|
A Ruby on Rails plugin for visually setting expectations throughout application development.
|
||||||
|
|
||||||
|
Adds a helper for marking page elements with the milestone they are slated to be developed, and makes them unable to be interacted with.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
Once the plugin has been installed, in your views you can now do:
|
||||||
|
|
||||||
|
<div class="person" <%= mile 6 %>>
|
||||||
|
<div class="name">Your Name<div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
When viewed in development mode, the person div would be overlaid with a grey box with the words "Milestone 6" in it.
|
||||||
|
|
||||||
|
If you happen to not call your milestones, "milestones", or for any other reason want the label to be something different, just supply a string instead:
|
||||||
|
|
||||||
|
<div class="person" <%= mile "Next Week" %>>
|
||||||
|
<div class="name">Your Name<div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
And that will still result in the marker being labeled with "Next Week" instead.
|
||||||
|
|
||||||
|
By default, the milestone markers will be only appear in the Rails development environment. To customize this, add the following to the config file of the other environments you want the markers to appear:
|
||||||
|
|
||||||
|
Thoughtbot::MileMarker.enable
|
||||||
|
|
||||||
|
If you prefer not to have it on in development, add the following to development.rb
|
||||||
|
|
||||||
|
Thoughtbot::MileMarker.disable
|
||||||
|
|
||||||
|
Or, if you prefer, add something like the following to environment.rb:
|
||||||
|
|
||||||
|
Thoughtbot::MileMarker.environments = %w(development staging production)
|
||||||
|
|
||||||
|
You can also change some of the styling options (as of right now, just the z-index and background color) by modifying the options hash:
|
||||||
|
|
||||||
|
Thoughtbot::MileMarker.options.update(
|
||||||
|
:z_index => 100,
|
||||||
|
:background_color => "purple"
|
||||||
|
)
|
||||||
|
|
||||||
|
== Requirements
|
||||||
|
|
||||||
|
The overlay functionality requires javascript, and uses the prototype library. So, any page that is using this functionality must also include prototype.
|
||||||
|
|
||||||
|
== Todo
|
||||||
|
|
||||||
|
* Rake task to find and print out (with line numbers) all of the milestone markers
|
|
@ -0,0 +1,22 @@
|
||||||
|
require 'rake'
|
||||||
|
require 'rake/testtask'
|
||||||
|
require 'rake/rdoctask'
|
||||||
|
|
||||||
|
desc 'Default: run unit tests.'
|
||||||
|
task :default => :test
|
||||||
|
|
||||||
|
desc 'Test the mile_marker plugin.'
|
||||||
|
Rake::TestTask.new(:test) do |t|
|
||||||
|
t.libs << 'lib'
|
||||||
|
t.pattern = 'test/**/*_test.rb'
|
||||||
|
t.verbose = true
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Generate documentation for the mile_marker plugin.'
|
||||||
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
||||||
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
|
rdoc.title = 'Mile Marker'
|
||||||
|
rdoc.options << '--line-numbers' << '--inline-source'
|
||||||
|
rdoc.rdoc_files.include('README')
|
||||||
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
require 'mile_marker'
|
||||||
|
ActionView::Base.send :include, Thoughtbot::MileMarkerHelper
|
||||||
|
ActionController::Base.send :include, Thoughtbot::MileMarkerHelper
|
||||||
|
ActionController::Base.send :after_filter, :add_initialize_mile_marker
|
|
@ -0,0 +1 @@
|
||||||
|
# Install hook code here
|
|
@ -0,0 +1,100 @@
|
||||||
|
module Thoughtbot
|
||||||
|
module MileMarkerHelper
|
||||||
|
def mile(detail="")
|
||||||
|
return unless MileMarker.enabled?
|
||||||
|
"mile=\"" + (detail.is_a?(Fixnum) ? "Milestone " : "") + "#{detail}\""
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize_mile_marker(request = nil)
|
||||||
|
return unless MileMarker.enabled?
|
||||||
|
MileMarker.initialize_mile_marker()
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_initialize_mile_marker()
|
||||||
|
init_code = initialize_mile_marker()
|
||||||
|
return if init_code.nil? || init_code.empty?
|
||||||
|
response.body.gsub! /<\/(head)>/i, init_code + '</\1>' if response.body.respond_to?(:gsub!)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class MileMarker
|
||||||
|
# The environments in which to enable the Mile Marker functionality to run. Defaults
|
||||||
|
# to 'development' only.
|
||||||
|
@@environments = ['development']
|
||||||
|
class << self
|
||||||
|
attr_accessor :environments
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.options
|
||||||
|
@options ||= {
|
||||||
|
:z_index => 1000,
|
||||||
|
:background_color => "#000"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Return true if the Mile Marker functionality is enabled for the current environment
|
||||||
|
def self.enabled?
|
||||||
|
environments.include?(ENV['RAILS_ENV'])
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.enable
|
||||||
|
environments.push ENV['RAILS_ENV']
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.disable
|
||||||
|
environments.delete ENV['RAILS_ENV']
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.initialize_mile_marker()
|
||||||
|
%Q~
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
function over(element) {
|
||||||
|
element.setStyle({opacity: 1.0});
|
||||||
|
}
|
||||||
|
function init_miles() {
|
||||||
|
$$('*[mile]').each(function(block, index) {
|
||||||
|
html = '<div id="mile_'+index+'" style="display: none; z-index: #{options[:z_index]}; position: absolute; background-color: #{options[:background_color]}; opacity: 0.4; filter: alpha(opacity=40); color: #eee; font-family: Lucida Sans, Helvetica; font-size: 16px; font-weight: bold; white-space: nowrap; overflow: hidden;"><p style="padding: 3px 5px; background-color: #{options[:background_color]}; opacity: 1.0; filter: alpha(opacity=100); display: inline; color: #f3f3f3;">'+block.getAttribute('mile')+'</p></div>'
|
||||||
|
new Insertion.Before($(block), html);
|
||||||
|
Position.clone($(block), $('mile_'+index));
|
||||||
|
if($('mile_'+index).getHeight() <= 25) { $('mile_'+index).setStyle({fontSize: '10px'}); }
|
||||||
|
$('mile_'+index).observe("mouseover", function(event) {
|
||||||
|
element = Event.element(event);
|
||||||
|
if(element.immediateDescendants()[0])
|
||||||
|
{
|
||||||
|
element.setStyle({opacity: 0.75});
|
||||||
|
if(element.style.filters) element.style.filters.alpha.opacity=75;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
element.up().setStyle({opacity: 0.75});
|
||||||
|
if(element.up().style.filters) element.up().style.filters.alpha.opacity=75;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('mile_'+index).observe("mouseout", function(event) {
|
||||||
|
element = Event.element(event);
|
||||||
|
if(element.immediateDescendants()[0])
|
||||||
|
{
|
||||||
|
element.setStyle({opacity: 0.4});
|
||||||
|
if(element.style.filters) element.style.filters.alpha.opacity=40;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
element.up().setStyle({opacity: 0.4});
|
||||||
|
if(element.up().style.filters) element.up().style.filters.alpha.opacity=40;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('mile_'+index).toggle();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(Event.observe) {
|
||||||
|
Event.observe(window, 'load', init_miles, false);
|
||||||
|
} else {
|
||||||
|
if(window.addEvent) window.addEvent('domready', init_miles);
|
||||||
|
}
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
~
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,82 @@
|
||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
||||||
|
|
||||||
|
class MileMarkerTest < Test::Unit::TestCase
|
||||||
|
include Thoughtbot::MileMarkerHelper
|
||||||
|
|
||||||
|
def test_mile_helper_should_return_nothing_if_no_enabled
|
||||||
|
Thoughtbot::MileMarker.environments = ['development']
|
||||||
|
ENV['RAILS_ENV']="test_environment"
|
||||||
|
output = mile("Milestone 1")
|
||||||
|
assert_nil output
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_mile_helper_should_include_detail_when_supplied_detail
|
||||||
|
Thoughtbot::MileMarker.environments = ['development']
|
||||||
|
ENV['RAILS_ENV']="development"
|
||||||
|
output = mile("Milestone 1")
|
||||||
|
assert_equal "mile=\"Milestone 1\"", output
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_mile_helper_should_include_add_milestone_when_supplied_integer
|
||||||
|
Thoughtbot::MileMarker.environments = ['development']
|
||||||
|
ENV['RAILS_ENV']="development"
|
||||||
|
output = mile(1)
|
||||||
|
assert_equal "mile=\"Milestone 1\"", output
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_mile_helper_should_include_no_detail_when_supplied_no_detail
|
||||||
|
Thoughtbot::MileMarker.environments = ['development']
|
||||||
|
ENV['RAILS_ENV']="development"
|
||||||
|
output = mile
|
||||||
|
assert_equal "mile=\"\"", output
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_calling_enabled_should_add_current_environment_to_environments
|
||||||
|
Thoughtbot::MileMarker.environments = []
|
||||||
|
ENV['RAILS_ENV']="test_environment"
|
||||||
|
Thoughtbot::MileMarker.enable
|
||||||
|
assert Thoughtbot::MileMarker.environments.include?(ENV['RAILS_ENV'])
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_calling_disabled_should_remove_current_environment_from_environments
|
||||||
|
Thoughtbot::MileMarker.environments = []
|
||||||
|
ENV['RAILS_ENV']="test_environment"
|
||||||
|
Thoughtbot::MileMarker.enable
|
||||||
|
assert Thoughtbot::MileMarker.environments.include?(ENV['RAILS_ENV'])
|
||||||
|
Thoughtbot::MileMarker.disable
|
||||||
|
assert !Thoughtbot::MileMarker.environments.include?(ENV['RAILS_ENV'])
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_initialize_mile_should_return_nothing_if_not_enabled
|
||||||
|
ENV['RAILS_ENV']="test_environment"
|
||||||
|
output = initialize_mile_marker
|
||||||
|
assert_nil output
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_initialize_mile_should_return_javascript_if_enabled
|
||||||
|
Thoughtbot::MileMarker.environments = ['development']
|
||||||
|
ENV['RAILS_ENV']="development"
|
||||||
|
output = initialize_mile_marker
|
||||||
|
assert_match /function init_miles/, output
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_javascript_should_be_added_to_head_if_enabled
|
||||||
|
Thoughtbot::MileMarker.environments = ['development']
|
||||||
|
ENV['RAILS_ENV']="development"
|
||||||
|
response.body = "<head></head>"
|
||||||
|
add_initialize_mile_marker
|
||||||
|
assert_match /script/, response.body
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_z_index_and_other_options_in_css_set_as_specified_in_options
|
||||||
|
Thoughtbot::MileMarker.environments = ['development']
|
||||||
|
Thoughtbot::MileMarker.options[:z_index] = "1234"
|
||||||
|
Thoughtbot::MileMarker.options[:background_color] = "purple"
|
||||||
|
ENV['RAILS_ENV']="development"
|
||||||
|
response.body = "<head></head>"
|
||||||
|
add_initialize_mile_marker
|
||||||
|
assert_match /script/, response.body
|
||||||
|
assert_match /z-index: 1234/, response.body
|
||||||
|
assert_match /background-color: purple/, response.body
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
||||||
|
|
||||||
|
ENV['RAILS_ENV'] = 'test'
|
||||||
|
|
||||||
|
require 'test/unit'
|
||||||
|
require File.join(File.dirname(File.dirname(__FILE__)), "lib", "mile_marker")
|
||||||
|
require 'ostruct'
|
||||||
|
|
||||||
|
module MockResponse
|
||||||
|
def response
|
||||||
|
@test_response ||= OpenStruct.new({:body => ""})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Test::Unit::TestCase.send :include, MockResponse
|
||||||
|
Thoughtbot::MileMarkerHelper.send :include, MockResponse
|
|
@ -0,0 +1 @@
|
||||||
|
# Uninstall hook code here
|
Loading…
Reference in New Issue