Permalink
Browse files

First release

  • Loading branch information...
0 parents commit 7a0f27402380ef69103f64fd6cab70df78969e00 Timur Vafin committed Jul 27, 2010
Showing with 9,936 additions and 0 deletions.
  1. +6 −0 .gitignore
  2. +30 −0 Gemfile
  3. +31 −0 README
  4. +7 −0 Rakefile
  5. +4 −0 app/controllers/application_controller.rb
  6. +7 −0 app/controllers/dashboard_controller.rb
  7. +10 −0 app/helpers/application_helper.rb
  8. +11 −0 app/models/user.rb
  9. +1 −0 app/views/dashboard/index.html.erb
  10. +11 −0 app/views/devise/confirmations/new.html.erb
  11. +5 −0 app/views/devise/mailer/confirmation_instructions.html.erb
  12. +8 −0 app/views/devise/mailer/reset_password_instructions.html.erb
  13. +7 −0 app/views/devise/mailer/unlock_instructions.html.erb
  14. +14 −0 app/views/devise/passwords/edit.html.erb
  15. +11 −0 app/views/devise/passwords/new.html.erb
  16. +17 −0 app/views/devise/registrations/edit.html.erb
  17. +16 −0 app/views/devise/registrations/new.html.erb
  18. +15 −0 app/views/devise/sessions/new.html.erb
  19. +19 −0 app/views/devise/shared/_links.erb
  20. +11 −0 app/views/devise/unlocks/new.html.erb
  21. +3 −0 app/views/layouts/_messages.html.erb
  22. +4 −0 app/views/layouts/_navigation.html.erb
  23. +24 −0 app/views/layouts/application.html.erb
  24. +4 −0 config.ru
  25. +46 −0 config/application.rb
  26. +13 −0 config/boot.rb
  27. +14 −0 config/config.yml
  28. +10 −0 config/cucumber.yml
  29. +39 −0 config/database.yml.example
  30. +5 −0 config/environment.rb
  31. +19 −0 config/environments/development.rb
  32. +46 −0 config/environments/production.rb
  33. +32 −0 config/environments/test.rb
  34. +7 −0 config/initializers/backtrace_silencers.rb
  35. +1 −0 config/initializers/config.rb
  36. +135 −0 config/initializers/devise.rb
  37. +54 −0 config/initializers/formtastic.rb
  38. +7 −0 config/initializers/generators.rb
  39. +10 −0 config/initializers/inflections.rb
  40. +1 −0 config/initializers/mailer.rb
  41. +5 −0 config/initializers/mime_types.rb
  42. +7 −0 config/initializers/secret_token.rb
  43. +8 −0 config/initializers/session_store.rb
  44. +1 −0 config/initializers/simple_navigation.rb
  45. +6 −0 config/initializers/time_formats.rb
  46. +5 −0 config/locales/en.yml
  47. +11 −0 config/navigations/main_navigation.rb
  48. +17 −0 config/navigations/user_navigation.rb
  49. +8 −0 config/routes.rb
  50. +19 −0 db/migrate/20100713113845_devise_create_users.rb
  51. +34 −0 db/schema.rb
  52. +7 −0 db/seeds.rb
  53. +2 −0 doc/README_FOR_APP
  54. +10 −0 features/devise.feature
  55. +16 −0 features/step_definitions/app_steps.rb
  56. +87 −0 features/step_definitions/pickle_steps.rb
  57. +219 −0 features/step_definitions/web_steps.rb
  58. +58 −0 features/support/env.rb
  59. +1 −0 features/support/factory_girl.rb
  60. +37 −0 features/support/paths.rb
  61. +6 −0 features/support/pickle.rb
  62. 0 lib/tasks/.gitkeep
  63. +53 −0 lib/tasks/cucumber.rake
  64. +26 −0 public/404.html
  65. +26 −0 public/422.html
  66. +26 −0 public/500.html
  67. 0 public/favicon.ico
  68. +85 −0 public/flutie/stylesheets/defaults.css
  69. +117 −0 public/flutie/stylesheets/forms.css
  70. +25 −0 public/flutie/stylesheets/lists.css
  71. +49 −0 public/flutie/stylesheets/reset.css
  72. 0 public/flutie/stylesheets/screen.css
  73. +27 −0 public/flutie/stylesheets/tables.css
  74. +90 −0 public/flutie/stylesheets/type.css
  75. BIN public/images/rails.png
  76. +2 −0 public/javascripts/application.js
  77. +965 −0 public/javascripts/controls.js
  78. +974 −0 public/javascripts/dragdrop.js
  79. +1,123 −0 public/javascripts/effects.js
  80. +4,874 −0 public/javascripts/prototype.js
  81. +118 −0 public/javascripts/rails.js
  82. +5 −0 public/robots.txt
  83. 0 public/stylesheets/.gitkeep
  84. +33 −0 public/stylesheets/application.css
  85. +6 −0 script/rails
  86. +9 −0 spec/factories/user.rb
  87. +24 −0 spec/spec_helper.rb
  88. 0 vendor/plugins/.gitkeep
@@ -0,0 +1,6 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/**/*
+rerun.txt
+config/database.yml
30 Gemfile
@@ -0,0 +1,30 @@
+HEROKU = ENV['USER'].match(/^repo\d+/)
+
+source 'http://rubygems.org'
+
+gem 'mysql'
+gem 'rails', '3.0.0.beta4'
+gem 'sqlite3-ruby', :require => 'sqlite3'
+gem 'devise', '1.1.rc2'
+gem 'simple-navigation'
+gem 'formtastic', :git => "http://github.com/justinfrench/formtastic.git", :branch => "rails3"
+gem 'flutie'
+
+# Heroku hack b/c we don't want use these gem on heroku env
+unless HEROKU
+ group :test do
+ gem 'redgreen', '1.2.2'
+ gem 'rr', '0.10.9'
+ gem 'factory_girl_rails'
+ gem 'pickle', :git => 'git://github.com/codegram/pickle.git', :ref => '929ee633'
+
+ gem "rspec-rails", ">= 2.0.0.beta.17"
+ gem 'cucumber'
+ gem 'cucumber-rails'
+ gem 'capybara', '0.3.8'
+ gem 'autotest-rails'
+ gem 'autotest'
+
+ gem 'ruby-debug'
+ end
+end
31 README
@@ -0,0 +1,31 @@
+== Rails 3 based application
+
+== Implemented
+
+* Auth based on devise, checkout app/models/user.rb
+* Navigation based on simple navigation, checkout config/initializers/simple_navigation.rb and config/navigations
+* formstatic with flutie
+* application config, checkout config/config.yml
+* Default host for mailer from config, checkout config/initializers/mailer.rb
+* Added time formats, checkout config/initializers/time_formats.rb
+* Cucumber, rspec, factory girl, pickle, autotest
+
+== Quick start
+
+* fork repository
+* clone repository
+* tune config/config.yml
+* tune in the sources application name: config/application.rb, config/initializers/generators.rb
+* tune config/database.yml.example and copy it to the config/database.yml
+* bundle install
+* rake cucumber
+* for autotest run in the shell "export AUTOFEATURE=true" and than run autotest command
+* feel free to to use pull request or patch you application code with new features from skeleton usign fork queue github feature
+
+
+Thanks,
+Flatsoft
+
+
+
+
@@ -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'
+
+Rails::Application.load_tasks
@@ -0,0 +1,4 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+ layout 'application'
+end
@@ -0,0 +1,7 @@
+class DashboardController < ApplicationController
+ navigation :dashbaord
+ before_filter :authenticate_user!
+
+ def index
+ end
+end
@@ -0,0 +1,10 @@
+module ApplicationHelper
+ def title(page_title, show_title = true)
+ @show_title = show_title
+ content_for(:title) { page_title.to_s }
+ end
+
+ def show_title?
+ @show_title
+ end
+end
@@ -0,0 +1,11 @@
+class User < ActiveRecord::Base
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :validatable, :invitable
+
+ attr_accessible :full_name, :email, :password, :password_confirmation
+ validates :full_name, :presence => true
+
+ def full_name_with_email
+ "#{self[:full_name]} (#{email})"
+ end
+end
@@ -0,0 +1 @@
+<% title 'Dashboard' %>
@@ -0,0 +1,11 @@
+<% title 'Resend confirmation instructions' %>
+
+<%= semantic_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name)) do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :email, :required => true %>
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button 'Resend confirmation instructions' %>
+ <% end %>
+<% end %>
@@ -0,0 +1,5 @@
+<p>Welcome <%= @resource.email %>!</p>
+
+<p>You can confirm your account through the link below:</p>
+
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
@@ -0,0 +1,8 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
+
+<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
+
+<p>If you didn't request this, please ignore this email.</p>
+<p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
+
+<p>Click the link below to unlock your account:</p>
+
+<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
@@ -0,0 +1,14 @@
+<% title 'Change your password' %>
+
+<%= semantic_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |form| %>
+ <%= form.hidden_field :reset_password_token %>
+
+ <%= form.inputs do %>
+ <%= form.input :password, :required => true %>
+ <%= form.input :password_confirmation, :required => true %>
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button 'Change my password' %>
+ <% end %>
+<% end %>
@@ -0,0 +1,11 @@
+<% title 'Forgot your password?' %>
+
+<%= semantic_form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :email, :required => true %>
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button 'Send me reset password instructions' %>
+ <% end %>
+<% end %>
@@ -0,0 +1,17 @@
+<% title "Edit #{resource_name.to_s.humanize}" %>
+
+<%= semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :full_name, :required => true %>
+ <%= form.input :email, :required => true %>
+ <%= form.input :password, :required => true, :hint => "leave blank if you don't want to change it" %>
+ <%= form.input :password_confirmation, :required => true %>
+ <%= form.input :current_password, :required => true, :hint => "we need your current password to confirm your changes" %>
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button 'Update' %>
+ <% end %>
+<% end %>
+
+<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
@@ -0,0 +1,16 @@
+<% title 'Sing up' %>
+
+<%= semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :full_name, :required => true %>
+ <%= form.input :email, :required => true %>
+ <%= form.input :password, :required => true %>
+ <%= form.input :password_confirmation, :required => true %>
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button 'Sing up' %>
+ <% end %>
+<% end %>
+
+<%= render :partial => 'devise/shared/links' %>
@@ -0,0 +1,15 @@
+<% title 'Sign in' %>
+
+<%= semantic_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :email, :required => true %>
+ <%= form.input :password, :required => true %>
+ <%= form.input :remember_me, :as => :boolean if devise_mapping.rememberable? %>
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button 'Sign in' %>
+ <% end %>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,19 @@
+<%- if controller_name != 'sessions' %>
+ <%= link_to "Sign in", new_session_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
+<% end -%>
@@ -0,0 +1,11 @@
+<% title 'Resend unlock instructions' %>
+
+<%= semantic_form_for(resource, :as => resource_name, :url => unlock_path(resource_name)) do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :email, :required => true %>
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button 'Resend unlock instructions' %>
+ <% end %>
+<% end %>
@@ -0,0 +1,3 @@
+<% flash.each do |type, content| %>
+ <%= content_tag :div, content, :class => type %>
+<% end %>
@@ -0,0 +1,4 @@
+<div id="navigation">
+ <%= render_navigation(:context => :main) %>
+ <%= render_navigation(:context => :user) %>
+</div>
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <%= stylesheet_link_tag :flutie, 'application' %>
+ <%= javascript_include_tag :defaults %>
+ <%= csrf_meta_tag %>
+ <%= yield(:head) %>
+ </head>
+ <body>
+ <div class="content">
+ <%= render 'layouts/navigation' %>
+ <hr />
+ <%= render 'layouts/messages' %>
+
+ <% if show_title? %>
+ <h1><%= yield(:title) %></h1>
+ <% end %>
+
+ <%= yield %>
+ </div>
+ </body>
+</html>
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Features::Application
@@ -0,0 +1,46 @@
+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 Features
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Add additional load paths for your own custom dirs
+ # config.load_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
+
+ # Configure generators values. Many other options are available, be sure to check the documentation.
+ # config.generators do |g|
+ # g.orm :active_record
+ # g.template_engine :erb
+ # g.test_framework :test_unit, :fixture => true
+ # end
+
+ # 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,13 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+gemfile = File.expand_path('../../Gemfile', __FILE__)
+begin
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ require 'bundler'
+ Bundler.setup
+rescue Bundler::GemNotFound => e
+ STDERR.puts e.message
+ STDERR.puts "Try running `bundle install`."
+ exit!
+end if File.exist?(gemfile)
@@ -0,0 +1,14 @@
+defaults: &defaults
+ app_name: Features
+ noreply: noreply@features.flatsoft.com
+ host: localhost:3000
+
+development:
+ <<: *defaults
+
+test:
+ <<: *defaults
+
+production:
+ <<: *defaults
+ host: features.flatsoft.com
@@ -0,0 +1,10 @@
+<%
+rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
+rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
+std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
+%>
+default: <%= std_opts %> features
+wip: --tags @wip:3 --wip features
+rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
+autotest-all: --require features --require lib --format progress --color features
+autotest: --require features --require lib --format pretty --color features
Oops, something went wrong.

0 comments on commit 7a0f274

Please sign in to comment.