From 6c148d33e3953aea7ea95890205a455a332d9b82 Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Mon, 3 Jun 2013 16:38:22 +0200 Subject: [PATCH] run-hobo OUTPUT_FILE: agility.markdown ## Before you start You'll need a working Ruby on Rails setup. We're assuming you know at least the basics of Rails. If not, you should probably work through a Rails tutorial before attempting this one. ## Create the application with Hobo gem Although Hobo is in fact a group of Rails plugins, it is also available as a gem which gives you the useful `hobo` command: $ gem install hobo --pre The `hobo` command is like the `rails` command, it can create a new blank Rails app that is set-up for Hobo, as well as performing several other tasks. When you run the command, it will ask you many questions. For now, answer exactly as we do. $ hobo new agility Hobo Command Line Interface 2.0.0.pre8 Generating Rails infrastructure... create create README.rdoc create Rakefile ... snip ... Hobo Setup Wizard Do you want to start the Setup Wizard now? (Choose 'n' if you need to manually customize any file before running the Wizard. You can run it later with `hobo g setup_wizard` from the application root dir.) [y|n] Choose yes here to pull in Hobo. User Resource Choose a name for the user resource: [=user|] Press enter to leave the name of the user model as `user`. Do you want to send an activation email to activate the user? [y|n] y Press `y` here because that's a useful feature we'll use. Invite Only Option Do you want to add the features for an invite only website? [y|n] n We're not building an invite-only website, so we'll press `n` here. Templates Option Will your application use only hobo/dryml web page templates? (Choose 'n' only if you also plan to use plain rails/erb web page templates) [y|n] y Press `y` here because we're building a pure Hobo application. Test Framework Do you want to customize the test_framework? [y|n] n Choose no -- we'll use the default test framework, Test::Unit. It's easy enough to select a different test framework later if you change your mind. Front Controller Choose a name for the front controller: [=front|] Press enter to leave the default front controller name as `front`. Front Theme The currently available themes are clean, clean_admin, clean_sidemenu and bootstrap. Choose a theme for the front site: [=bootstrap|] Press enter to choose the default Hobo theme, bootstrap. Front jQuery-UI Theme The currently available jQuery-UI themes are listed here: https://github.com/fatdude/jquery-ui-themes-rails/blob/master/README.markdown Choose a jQuery-UI theme for the front site: [=redmond|] Press enter to select the default jQuery-UI theme, redmond. jQuery-UI is not used very much with the bootstrap theme and may be [removed later](http://hobocentral.net/blog/2012/12/21/using-hobo-2-0-without-jquery-ui/). Admin Subsite Do you want an admin subsite? [y|n] n A subsite in Hobo is a separate collection of views and controllers routed independently. Each subsite can have a different theme. They're easy enough to add later via the [admin_subsite](/manual/generators/admin_subsite) or [subsite](/manual/generators/subsite) generators so we won't add one now. DB Migration Initial Migration: [s]kip, [g]enerate migration file only, generate and [m]igrate: [s|g|m] m Press `m` here. There's a lot going on underneath the hood here, but we'll get to that later. I18n The Hobo supported locales are de en es fr it nb pt-PT ru (please, contribute to more translations) Type the locales (space separated) you want to add to your application or for 'en': Press enter here to choose English. => "en" Git Repository Do you want to initialize a git repository now? [y|n] y Do you want git to ignore the auto-generated files? (Choose 'n' only if you are planning to deploy on a read-only File System like Heroku) [y|n] y Choose `y` to both of these questions to put your project into Git. Even if you don't know git you can still say "yes" here -- maybe you'll find it useful in the future. ## Run the app You should now have a complete bare bones application. Fire it up and give it a try! $ cd agility $ rails server --- .gitignore | 17 ++ Gemfile | 48 +++++ Gemfile.lock | 168 +++++++++++++++ README | 23 --- Rakefile | 7 + app/assets/images/rails.png | Bin 0 -> 6646 bytes app/assets/javascripts/application.js | 11 + app/assets/javascripts/application.js.orig | 15 ++ app/assets/javascripts/application/.gitkeep | 0 app/assets/javascripts/front.js | 16 ++ app/assets/javascripts/front/.gitkeep | 0 app/assets/stylesheets/application.css.orig | 13 ++ app/assets/stylesheets/application.scss | 9 + app/assets/stylesheets/application/.gitkeep | 0 app/assets/stylesheets/front.scss | 16 ++ app/assets/stylesheets/front/.gitkeep | 0 app/controllers/application_controller.rb | 3 + app/controllers/front_controller.rb | 19 ++ app/controllers/users_controller.rb | 20 ++ app/helpers/front_helper.rb | 2 + app/mailers/.gitkeep | 0 app/mailers/user_mailer.rb | 17 ++ app/models/.gitkeep | 0 app/models/guest.rb | 7 + app/models/user.rb | 77 +++++++ app/views/front/index.dryml | 30 +++ app/views/taglibs/application.dryml | 3 + app/views/taglibs/front_site.dryml | 17 ++ app/views/user_mailer/activation.erb | 9 + app/views/user_mailer/forgot_password.erb | 10 + config.ru | 4 + config/application.rb | 68 ++++++ config/boot.rb | 6 + config/database.yml | 25 +++ config/environment.rb | 5 + config/environments/development.rb | 39 ++++ config/environments/production.rb | 67 ++++++ config/environments/test.rb | 37 ++++ config/initializers/backtrace_silencers.rb | 7 + config/initializers/dryml_taglibs.rb | 1 + config/initializers/inflections.rb | 15 ++ config/initializers/mime_types.rb | 5 + config/initializers/secret_token.rb | 7 + config/initializers/session_store.rb | 8 + config/initializers/wrap_parameters.rb | 14 ++ config/locales/app.en.yml | 25 +++ config/locales/hobo.en.yml | 195 ++++++++++++++++++ config/routes.rb | 70 +++++++ .../20130108212536_initial_migration.rb | 22 ++ db/schema.rb | 32 +++ db/seeds.rb | 7 + doc/README_FOR_APP | 2 + lib/assets/.gitkeep | 0 lib/tasks/.gitkeep | 0 log/.gitkeep | 0 public/404.html | 26 +++ public/422.html | 26 +++ public/500.html | 25 +++ public/favicon.ico | 0 public/robots.txt | 5 + script/rails | 6 + test/fixtures/.gitkeep | 0 test/fixtures/users.yml | 11 + test/functional/.gitkeep | 0 test/functional/front_controller_test.rb | 7 + test/functional/user_mailer_test.rb | 7 + test/integration/.gitkeep | 0 test/performance/browsing_test.rb | 12 ++ test/test_helper.rb | 13 ++ test/unit/.gitkeep | 0 test/unit/helpers/front_helper_test.rb | 4 + test/unit/user_test.rb | 7 + vendor/assets/javascripts/.gitkeep | 0 vendor/assets/stylesheets/.gitkeep | 0 vendor/plugins/.gitkeep | 0 75 files changed, 1344 insertions(+), 23 deletions(-) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Gemfile.lock delete mode 100644 README create mode 100644 Rakefile create mode 100644 app/assets/images/rails.png create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/javascripts/application.js.orig create mode 100644 app/assets/javascripts/application/.gitkeep create mode 100644 app/assets/javascripts/front.js create mode 100644 app/assets/javascripts/front/.gitkeep create mode 100644 app/assets/stylesheets/application.css.orig create mode 100644 app/assets/stylesheets/application.scss create mode 100644 app/assets/stylesheets/application/.gitkeep create mode 100644 app/assets/stylesheets/front.scss create mode 100644 app/assets/stylesheets/front/.gitkeep create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/front_controller.rb create mode 100644 app/controllers/users_controller.rb create mode 100644 app/helpers/front_helper.rb create mode 100644 app/mailers/.gitkeep create mode 100644 app/mailers/user_mailer.rb create mode 100644 app/models/.gitkeep create mode 100644 app/models/guest.rb create mode 100644 app/models/user.rb create mode 100644 app/views/front/index.dryml create mode 100644 app/views/taglibs/application.dryml create mode 100644 app/views/taglibs/front_site.dryml create mode 100644 app/views/user_mailer/activation.erb create mode 100644 app/views/user_mailer/forgot_password.erb create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/dryml_taglibs.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/secret_token.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/app.en.yml create mode 100644 config/locales/hobo.en.yml create mode 100644 config/routes.rb create mode 100644 db/migrate/20130108212536_initial_migration.rb create mode 100644 db/schema.rb create mode 100644 db/seeds.rb create mode 100644 doc/README_FOR_APP create mode 100644 lib/assets/.gitkeep create mode 100644 lib/tasks/.gitkeep create mode 100644 log/.gitkeep create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/robots.txt create mode 100755 script/rails create mode 100644 test/fixtures/.gitkeep create mode 100644 test/fixtures/users.yml create mode 100644 test/functional/.gitkeep create mode 100644 test/functional/front_controller_test.rb create mode 100644 test/functional/user_mailer_test.rb create mode 100644 test/integration/.gitkeep create mode 100644 test/performance/browsing_test.rb create mode 100644 test/test_helper.rb create mode 100644 test/unit/.gitkeep create mode 100644 test/unit/helpers/front_helper_test.rb create mode 100644 test/unit/user_test.rb create mode 100644 vendor/assets/javascripts/.gitkeep create mode 100644 vendor/assets/stylesheets/.gitkeep create mode 100644 vendor/plugins/.gitkeep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9d2a5c --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +# Ignore bundler config +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 + +# Ignore all logfiles and tempfiles. +/log/*.log +/tmp +app/views/taglibs/auto/**/* +config/hobo_routes.rb diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ec53aa9 --- /dev/null +++ b/Gemfile @@ -0,0 +1,48 @@ +source 'https://rubygems.org' + +gem 'rails', '3.2.11' + +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + +gem 'sqlite3' + + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + # gem 'therubyracer', :platforms => :ruby + + gem 'uglifier', '>= 1.0.3' +end + +gem 'jquery-rails' + +# To use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + +# To use Jbuilder templates for JSON +# gem 'jbuilder' + +# Use unicorn as the app server +# gem 'unicorn' + +# Deploy with Capistrano +# gem 'capistrano' + +# To use debugger +# gem 'debugger' + +gem "hobo", "= 2.0.0.pre8" +# Hobo has a lot of assets. Stop cluttering the log in development mode. +gem "quiet_assets", :group => :development +# Hobo's version of will_paginate is required. +gem "will_paginate", :git => "git://github.com/Hobo/will_paginate.git" +gem "hobo_bootstrap", "2.0.0.pre8" +gem "hobo_jquery_ui", "2.0.0.pre8" +gem "hobo_bootstrap_ui", "2.0.0.pre8" +gem "jquery-ui-themes", "~> 0.0.4" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..038b15b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,168 @@ +GIT + remote: git://github.com/Hobo/will_paginate.git + revision: cc7ef01551b94fe4f607e38929037234dc70bb62 + specs: + will_paginate (3.0.4.hobo) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (3.2.11) + actionpack (= 3.2.11) + mail (~> 2.4.4) + actionpack (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.4) + rack (~> 1.4.0) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.2.1) + activemodel (3.2.11) + activesupport (= 3.2.11) + builder (~> 3.0.0) + activerecord (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) + activesupport (3.2.11) + i18n (~> 0.6) + multi_json (~> 1.0) + arel (3.0.2) + bootstrap-datepicker-rails (0.6.35) + railties (>= 3.0) + bootstrap-sass (2.2.2.0) + sass (~> 3.2) + builder (3.0.4) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.4.0) + dryml (2.0.0.pre8) + actionpack (~> 3.2.0) + hobo_support (= 2.0.0.pre8) + erubis (2.7.0) + execjs (1.4.0) + multi_json (~> 1.0) + hike (1.2.1) + hobo (2.0.0.pre8) + dryml (= 2.0.0.pre8) + hobo_fields (= 2.0.0.pre8) + hobo_support (= 2.0.0.pre8) + will_paginate (~> 3.0.0) + hobo_bootstrap (2.0.0.pre8) + bootstrap-sass (~> 2.1) + hobo (~> 2.0.0.pre6) + hobo_jquery (~> 2.0.0.pre6) + will_paginate-bootstrap (~> 0.2.1) + hobo_bootstrap_ui (2.0.0.pre8) + bootstrap-datepicker-rails + hobo_bootstrap (~> 2.0.0.pre1) + hobo_fields (2.0.0.pre8) + hobo_support (= 2.0.0.pre8) + hobo_jquery (2.0.0.pre8) + hobo_rapid (= 2.0.0.pre8) + jquery-rails (~> 2.0) + hobo_jquery_ui (2.0.0.pre8) + hobo (= 2.0.0.pre8) + hobo_jquery (= 2.0.0.pre8) + jquery-ui-themes (~> 0.0.4) + hobo_rapid (2.0.0.pre8) + hobo (= 2.0.0.pre8) + hobo_support (2.0.0.pre8) + rails (~> 3.2.0) + httparty (0.9.0) + multi_json (~> 1.0) + multi_xml + i18n (0.6.1) + journey (1.0.4) + jquery-rails (2.1.4) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + jquery-ui-themes (0.0.8) + httparty + json (1.7.6) + mail (2.4.4) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.19) + multi_json (1.5.0) + multi_xml (0.5.1) + polyglot (0.3.3) + quiet_assets (1.0.1) + railties (~> 3.1) + rack (1.4.3) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.2) + rack + rack-test (0.6.2) + rack (>= 1.0) + rails (3.2.11) + actionmailer (= 3.2.11) + actionpack (= 3.2.11) + activerecord (= 3.2.11) + activeresource (= 3.2.11) + activesupport (= 3.2.11) + bundler (~> 1.0) + railties (= 3.2.11) + railties (3.2.11) + actionpack (= 3.2.11) + activesupport (= 3.2.11) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + rake (10.0.3) + rdoc (3.12) + json (~> 1.4) + sass (3.2.5) + sass-rails (3.2.5) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + sprockets (2.2.2) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sqlite3 (1.3.6) + thor (0.16.0) + tilt (1.3.3) + treetop (1.4.12) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.35) + uglifier (1.3.0) + execjs (>= 0.3.0) + multi_json (~> 1.0, >= 1.0.2) + will_paginate-bootstrap (0.2.2) + will_paginate (>= 3.0.3) + +PLATFORMS + ruby + +DEPENDENCIES + coffee-rails (~> 3.2.1) + hobo (= 2.0.0.pre8) + hobo_bootstrap (= 2.0.0.pre8) + hobo_bootstrap_ui (= 2.0.0.pre8) + hobo_jquery_ui (= 2.0.0.pre8) + jquery-rails + jquery-ui-themes (~> 0.0.4) + quiet_assets + rails (= 3.2.11) + sass-rails (~> 3.2.3) + sqlite3 + uglifier (>= 1.0.3) + will_paginate! diff --git a/README b/README deleted file mode 100644 index 73e9cd7..0000000 --- a/README +++ /dev/null @@ -1,23 +0,0 @@ -# Agility - -This is the source code to accompany the [Agility gitorial for -Hobo](http://cookbook.hobocentral.net/tutorials/agility). - -Agility is a simple "Agile Development" application – Agility. The -application tracks projects which consist of a number of user -stories. Stories have a status (e.g. accepted, under development…) as -well as a number of associated tasks. Tasks can be assigned to users, -and each user can see a heads-up of all the tasks they’ve been -assigned to on their home page. - -To keep the gitorial clean, updates to the gitorial **rewrite -history**. That means that you cannot `git pull`. If you wish to -update to a later version, you must `git clone` the repository again -and move any changes you have made from your old clone to the new one. - -The "real" history is kept in our [source -repository](http://github.com/Hobo/agility-gitorial-patches/tree/master). - -There is an [older version of -agility](http://github.com/tablatom/agility/tree/master) that is not -in gitorial format. That tree is mainly used for integration testing Hobo. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..dc92f01 --- /dev/null +++ b/Rakefile @@ -0,0 +1,7 @@ +#!/usr/bin/env rake +# 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__) + +Agility::Application.load_tasks diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png new file mode 100644 index 0000000000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}a)Kh{h{;*V1#hs1xB%(?j>)g~`Wv(9F)f=Qn)(daVB7hZtcp^#LrEr1T1J zZSJ*lVyVVjhy)mkex9Whn=EinKDHe@KlfQI-Fl7M?-c~HnW0;C;+MbUY8?FToy;A+ zs&Nc7VZ=Of+e!G6s#+S5WBU)kgQq_I1@!uH74GJ-+O|%0HXm9Mqlvp|j%0`T>fr9^ zK;qo>XdwZW<>%tTA+<(1^6(>=-2N;hRgBnjvEjN;VbKMbFg--WrGy|XESoH1p|M4` z86(gC^vB4qScASZ&cdpT{~QDN-jC|GJ(RYoW1VW4!SSn- zhQds9&RBKn6M&GVK_Aayt(Hekbnw=tr>f z^o@v9_*iQO1*zeOrts9Q-$pc@!StS&kz$cF`s@pM`rmJXTP&h5G)A74!0e%ZJbl}( zssI|_!%~_hZFypv*S^JE5N&Kvmx7KiG<|fGMO=WrH+@Yhuj+KwiS#l4>@%2nl zS)mDikfmokO4q2A)hRVZBq2-5q&XC>%HOLkOYxZ66(s86?=0s4z5xbiOV)}L-&6b)h6(~CIaR#JNw~46+WBiU7IhB zq!NuR4!TsYnyBg>@G=Ib*cMq^k<}AMpCeYEf&dzfiGI-wOQ7hb+nA zkN7_){y&c3xC0 AQ~&?~ literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..0b6e515 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,11 @@ +// This file is included in all sites and subsites. This is a +// manifest file that'll be compiled into including all the files +// listed below. Add new JavaScript/Coffee code in separate files in +// the application directory and they'll automatically be included. +// It's not advisable to add code directly here, but if you do, it'll +// appear at the bottom of the the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require jquery-ui +//= require_tree ./application diff --git a/app/assets/javascripts/application.js.orig b/app/assets/javascripts/application.js.orig new file mode 100644 index 0000000..9097d83 --- /dev/null +++ b/app/assets/javascripts/application.js.orig @@ -0,0 +1,15 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/app/assets/javascripts/application/.gitkeep b/app/assets/javascripts/application/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/front.js b/app/assets/javascripts/front.js new file mode 100644 index 0000000..3dc1106 --- /dev/null +++ b/app/assets/javascripts/front.js @@ -0,0 +1,16 @@ +// This is a manifest file for the front subsite (which is your whole +// application if you don't have any subsites). It will be compiled +// into including all the files listed below. Add new +// JavaScript/Coffee code in separate files in the front directory and +// they'll automatically be included in the compiled file accessible +// from http://example.com/assets/front.js It's not advisable to add +// code directly here, but if you do, it'll appear at the bottom of +// the the compiled file. +// +//= require application +//= require hobo_rapid +//= require hobo_jquery +//= require hobo_bootstrap +//= require hobo_jquery_ui +//= require hobo_bootstrap_ui +//= require_tree ./front diff --git a/app/assets/javascripts/front/.gitkeep b/app/assets/javascripts/front/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/application.css.orig b/app/assets/stylesheets/application.css.orig new file mode 100644 index 0000000..3192ec8 --- /dev/null +++ b/app/assets/stylesheets/application.css.orig @@ -0,0 +1,13 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require_tree . + */ diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss new file mode 100644 index 0000000..657b322 --- /dev/null +++ b/app/assets/stylesheets/application.scss @@ -0,0 +1,9 @@ +/* + * This is the global stylesheet manifest file. Files or plugins + * referenced from here or placed in the application/ directory will be + * included in all subsites. This file is included by front.css and all + * subsites. + * + *= require_self + *= require_tree ./application +*/ diff --git a/app/assets/stylesheets/application/.gitkeep b/app/assets/stylesheets/application/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/front.scss b/app/assets/stylesheets/front.scss new file mode 100644 index 0000000..bac2fc0 --- /dev/null +++ b/app/assets/stylesheets/front.scss @@ -0,0 +1,16 @@ +/* + * This is the stylesheet manifest file for the front subsite (which + * is your whole application if you don't have any subsites). Files + * or plugins referenced from here or placed in the front/ directory + * will be included. + * + *= require_self + *= require application + *= require hobo_rapid + *= require hobo_jquery + *= require hobo_bootstrap + *= require hobo_jquery_ui + *= require hobo_bootstrap_ui + *= require jquery-ui/redmond + *= require_tree ./front +*/ diff --git a/app/assets/stylesheets/front/.gitkeep b/app/assets/stylesheets/front/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..e8065d9 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery +end diff --git a/app/controllers/front_controller.rb b/app/controllers/front_controller.rb new file mode 100644 index 0000000..86e3201 --- /dev/null +++ b/app/controllers/front_controller.rb @@ -0,0 +1,19 @@ +class FrontController < ApplicationController + + hobo_controller + + def index; end + + def summary + if !current_user.administrator? + redirect_to user_login_path + end + end + + def search + if params[:query] + site_search(params[:query]) + end + end + +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..fdbeb0e --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,20 @@ +class UsersController < ApplicationController + + hobo_user_controller + + auto_actions :all, :except => [ :index, :new, :create ] + + # Normally, users should be created via the user lifecycle, except + # for the initial user created via the form on the front screen on + # first run. This method creates the initial user. + def create + hobo_create do + if valid? + self.current_user = this + flash[:notice] = t("hobo.messages.you_are_site_admin", :default=>"You are now the site administrator") + redirect_to home_page + end + end + end + +end diff --git a/app/helpers/front_helper.rb b/app/helpers/front_helper.rb new file mode 100644 index 0000000..1dbbd46 --- /dev/null +++ b/app/helpers/front_helper.rb @@ -0,0 +1,2 @@ +module FrontHelper +end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb new file mode 100644 index 0000000..0c84be2 --- /dev/null +++ b/app/mailers/user_mailer.rb @@ -0,0 +1,17 @@ +class UserMailer < ActionMailer::Base + default :from => "no-reply@#{host}" + + def forgot_password(user, key) + @user, @key = user, key + mail( :subject => "#{app_name} -- forgotten password", + :to => user.email_address ) + end + + + def activation(user, key) + @user, @key = user, key + mail( :subject => "#{app_name} -- activate", + :to => user.email_address ) + end + +end diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/guest.rb b/app/models/guest.rb new file mode 100644 index 0000000..b7b3230 --- /dev/null +++ b/app/models/guest.rb @@ -0,0 +1,7 @@ +class Guest < Hobo::Model::Guest + + def administrator? + false + end + +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..32600a3 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,77 @@ +class User < ActiveRecord::Base + + hobo_user_model # Don't put anything above this + + fields do + name :string, :required, :unique + email_address :email_address, :login => true + administrator :boolean, :default => false + timestamps + end + attr_accessible :name, :email_address, :password, :password_confirmation + + # This gives admin rights and an :active state to the first sign-up. + # Just remove it if you don't want that + before_create do |user| + if !Rails.env.test? && user.class.count == 0 + user.administrator = true + user.state = "active" + end + end + + + # --- Signup lifecycle --- # + + lifecycle do + + state :inactive, :default => true + state :active + + create :signup, :available_to => "Guest", + :params => [:name, :email_address, :password, :password_confirmation], + :become => :inactive, :new_key => true do + UserMailer.activation(self, lifecycle.key).deliver + end + + transition :activate, { :inactive => :active }, :available_to => :key_holder + + transition :request_password_reset, { :inactive => :inactive }, :new_key => true do + UserMailer.activation(self, lifecycle.key).deliver + end + + transition :request_password_reset, { :active => :active }, :new_key => true do + UserMailer.forgot_password(self, lifecycle.key).deliver + end + + transition :reset_password, { :active => :active }, :available_to => :key_holder, + :params => [ :password, :password_confirmation ] + + end + + def signed_up? + state=="active" + end + + # --- Permissions --- # + + def create_permitted? + # Only the initial admin user can be created + self.class.count == 0 + end + + def update_permitted? + acting_user.administrator? || + (acting_user == self && only_changed?(:email_address, :crypted_password, + :current_password, :password, :password_confirmation)) + # Note: crypted_password has attr_protected so although it is permitted to change, it cannot be changed + # directly from a form submission. + end + + def destroy_permitted? + acting_user.administrator? + end + + def view_permitted?(field) + true + end +end diff --git a/app/views/front/index.dryml b/app/views/front/index.dryml new file mode 100644 index 0000000..5ee72fb --- /dev/null +++ b/app/views/front/index.dryml @@ -0,0 +1,30 @@ + + + + + +
+

Welcome to

+
+

Congratulations! Your Hobo Rails App is up and running

+
    +
  • To customise this page: edit app/views/front/index.dryml
  • +
+ + <% if User.count == 0 -%> +

There are no user accounts - please provide the details of the site administrator

+
+ + + + <% end -%> + + +
+
+ +
+
+
+ +
diff --git a/app/views/taglibs/application.dryml b/app/views/taglibs/application.dryml new file mode 100644 index 0000000..dc60cac --- /dev/null +++ b/app/views/taglibs/application.dryml @@ -0,0 +1,3 @@ + + diff --git a/app/views/taglibs/front_site.dryml b/app/views/taglibs/front_site.dryml new file mode 100644 index 0000000..f16084d --- /dev/null +++ b/app/views/taglibs/front_site.dryml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/app/views/user_mailer/activation.erb b/app/views/user_mailer/activation.erb new file mode 100644 index 0000000..2608569 --- /dev/null +++ b/app/views/user_mailer/activation.erb @@ -0,0 +1,9 @@ +<%= @user %>, + +To activate your account for <%= @app_name %>, click on this link: + + <%= activate_from_email_url :id => @user, :key => @key %> + +Thank you, + +The <%= @app_name %> team. diff --git a/app/views/user_mailer/forgot_password.erb b/app/views/user_mailer/forgot_password.erb new file mode 100644 index 0000000..4708709 --- /dev/null +++ b/app/views/user_mailer/forgot_password.erb @@ -0,0 +1,10 @@ +<%= @user %>, + +If you have forgotten your password for <%= @app_name %>, you can choose +a new one by clicking on this link: + + <%= reset_password_from_email_url :id => @user, :key => @key %> + +Thank you, + +The <%= @app_name %> team. diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..cda9ca9 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Agility::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..37588fb --- /dev/null +++ b/config/application.rb @@ -0,0 +1,68 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + Bundler.require(*Rails.groups(:assets => %w(development test))) + # If you want your assets lazily compiled in production, use this line + # Bundler.require(:default, :assets, Rails.env) +end + +module Agility + class Application < Rails::Application + # Hobo: Named routes have changed in Hobo 2.0. Set to false to emit both the 2.0 and 1.3 names. + config.hobo.dont_emit_deprecated_routes = true + # Hobo: remove support for ERB templates + config.hobo.dryml_only_templates = true + # Hobo: the front subsite loads front.css & front.js + config.assets.precompile += %w(front.css front.js) + # 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 + + # 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] + + # Enable escaping HTML in JSON. + config.active_support.escape_html_entities_in_json = true + + # Use SQL instead of Active Record's schema dumper when creating the 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 + + # Enforce whitelist mode for mass assignment. + # This will create an empty whitelist of attributes available for mass-assignment for all models + # in your app. As such, your models will need to explicitly whitelist or blacklist accessible + # parameters by using an attr_accessible or attr_protected declaration. + config.active_record.whitelist_attributes = true + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..4489e58 --- /dev/null +++ b/config/boot.rb @@ -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']) diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..51a4dd4 --- /dev/null +++ b/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +development: + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: sqlite3 + database: db/test.sqlite3 + pool: 5 + timeout: 5000 + +production: + adapter: sqlite3 + database: db/production.sqlite3 + pool: 5 + timeout: 5000 diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..0a0d748 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Agility::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..a9d6741 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,39 @@ +Agility::Application.configure do + # Hobo: tell ActiveReload about dryml + config.watchable_dirs[File.join(config.root, 'app/views')] = ['dryml'] + # 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 web server 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_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 + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..ca62a96 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,67 @@ +Agility::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # 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 + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to nil and saved in location specified by config.assets.prefix + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Prepend all log lines with the following tags + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # 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 + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + # config.active_record.auto_explain_threshold_in_seconds = 0.5 +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..0734bb6 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,37 @@ +Agility::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 + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # 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 + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -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! diff --git a/config/initializers/dryml_taglibs.rb b/config/initializers/dryml_taglibs.rb new file mode 100644 index 0000000..89b2d39 --- /dev/null +++ b/config/initializers/dryml_taglibs.rb @@ -0,0 +1 @@ +Dryml.precompile_taglibs if File.basename($0) != "rake" && Rails.env.production? diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..5d8d9be --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,15 @@ +# 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 +# +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/config/initializers/mime_types.rb @@ -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 diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 0000000..1988567 --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +Agility::Application.config.secret_token = '2bda209599cfd54665ee03ce037417525a4568a1314d137883a57280cb8bdb6e78c281980f3635f677f370c2372b774cdaca0c15a162d703b251a09db52b5894' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 0000000..dadf0de --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +Agility::Application.config.session_store :cookie_store, key: '_agility_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") +# Agility::Application.config.session_store :active_record_store diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..999df20 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end diff --git a/config/locales/app.en.yml b/config/locales/app.en.yml new file mode 100644 index 0000000..26256ec --- /dev/null +++ b/config/locales/app.en.yml @@ -0,0 +1,25 @@ +# Even if you only support one language, you can use this file to customise the names that appear in the UI +# e.g. + +en: + hello: "Hello world" + +# attributes: +# created_at: Created at +# updated_at: Updated at +# +# activerecord: +# models: +# user: +# one: User +# other: Users +# attributes: +# user: +# name: Name +# password: Password +# current_password: Current Password +# password_confirmation: Password Confirmation +# email_address: Email Address +# attribute_help: +# user: +# email_address: We will never share your address with third parties diff --git a/config/locales/hobo.en.yml b/config/locales/hobo.en.yml new file mode 100644 index 0000000..18dad6f --- /dev/null +++ b/config/locales/hobo.en.yml @@ -0,0 +1,195 @@ +# Hobo internals translation file for English +en: + hobo: + # default hobo pages translations + index: + # if you uncomment the following you will loose the automatic selection of dynamically pluralized nav-tabs + # if you need a different title you should implement a different way to select the tab on your own + #title: "%{model} Index" + heading: "%{model} Index" + + new: + title: "New %{model}" + heading: "New %{model}" + + show: + title: "%{model}" + heading: "%{model} %{name}" + back_link: "Back" + edit_link: "Edit %{model}" + new_link: "New %{model}" + add_form_heading: "Add %{model}" + + edit: + title: "Edit %{model}" + heading: "Edit %{model}" + + index_for_owner: + title: "%{model} for" + # be aware that you will loose the automatic Your / Jom's + # default output for User models + # you better define the heading.* in the specific collection namespace + #heading: + subheading: "For:" + + new_for_owner: + title: "New %{model} for" + heading: "New %{model}" + subheading: "For:" + + login: + title: "Login" + heading: "Login" + email_address: &email_address "E-mail" + name: "Name" + password: "Password" + remember_me: "Remember me" + login: "Login" + signup: "Signup" + forgot_password: &forgot_password "Forgotten password?" + + signup: + title: "Signup" + heading: "Signup new user" + + forgot_password: + title: *forgot_password + heading: *forgot_password + text: "Enter the e-mail address you used when you signed up for this site. + We will then send you an e-mail that you can use to generate a new password." + email_address: *email_address + send: "Send" + + forgot_password_sent: + title: "Forgotten password - E-mail sent" + heading: "Forgotten password - E-mail sent" + text: "An e-mail with instructions on how to generate a new password has been sent to %{email_address}. If you don't receive this e-mail please check your spam folder." + + account_disabled_page: + title: "Account disabled" + heading: "Account disabled" + text: "Your account is disabled at this time." + + account_page: + title: "Your Account" + heading: "Your Account" + new_password: "New Password" + confirm_new_password: "Confirm New Password" + + # default hobo action translation + # The action with added model variable are new, create, delete, save, + # edit and back_to_parent + actions: + new: "New %{model}" + create: "Create %{model}" + previous: "Previous" + next: "Next" + add: "Add" + show_all: "Show all %{model}..." + delete: "Delete %{model}" + save: "Save %{model}" + cancel: "Cancel" + edit: "Edit %{model}" + edit_control: "Edit" + back: "Back to" + back_to_parent: "Back to %{parent} %{name}" + send: "Send" + remove: "Remove" + signup: "Signup" + login: "Login" + logout: "Log out" + logged_in_as: "Logged in as %{name}" + account: "Account" + save_account: "Save Your Data" + + # default hobo message translation + messages: + create: + success: "The %{model} was created successfully" + error: "Couldn't create the %{model}.\n%{errors}" + creator: + error: "Couldn't do creator %{name}.\n%{errors}" + transition: + error: "Couldn't do transition %{name}.\n%{errors}" + update: + no_attribute_error: "No update specified in params" + success: "Changes to the %{model} were saved" + error: "There was a problem with that change.\\n%{errors}" + destroy: + success: "The %{model} was deleted" + signup: + success: "Thanks for signing up!" + must_activate: "You must activate your account before you can log in. Please check your email." + login: + success: "You have logged in." + error: "You did not provide a valid %{login} and Password!" + logout: "You have logged out." + reset_password: "Your password has been reset." + permission_denied: "Permission Denied" + not_found: "The page you requested cannot be found." + unauthenticated: "Couldn't authenticate you" + validate_password: "must be at least 6 characters long and must not consist solely of lowercase letters" + current_password_is_not_correct: "is not correct" + you_are_site_admin: "You are now the site administrator" + you_signed_up: "You have signed up" + none: "No %{model} available." + confirm: "Are you sure?" + + # default hobo collection translation + collection: + count: &collection_count + zero: &no_model "No %{model}" + one: "There is one %{model}." + other: "There are %{count} %{model}." + # you can use the following to completely override the collection heading + # be aware that you will loose the automatic Your / Jom's + # default output for User models + # you better define the heading.* in the specific collection namespace + #heading: + add_form_heading: "Add %{model}" + empty_message: "No records to display" + + # default hobo form translation + form: + new: + heading: "New %{model}" + error: + heading: "The following error occurred:" + select_many: + prompt: "Add %{model}" + + # hobo support + support: + or: "or" + a: "a" + an: "an" + + table_plus: + search: "Search" + submit_label: "Go" + + live_search: + label: "Search" + results_label: "Search Results" + close_button: "close" + no_results: "Your search returned no matches." + + dev_user_changer: + guest: "Guest" + + admin: + subsite_name: "Admin" + invite_new_user: "Invite a new user" + + subsite: + back_link: "View Site" + + boolean_yes: "Yes" + boolean_no: "No" + password_hidden: "[password hidden]" + + in_place_editor: + click_to_edit: "(click to edit)" + + select_one_editor: + blank_message: *no_model diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..2058eff --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,70 @@ +Agility::Application.routes.draw do + match ENV['RAILS_RELATIVE_URL_ROOT'] => 'front#index' if ENV['RAILS_RELATIVE_URL_ROOT'] + + root :to => 'front#index' + + match 'users/:id/reset_password_from_email/:key' => 'users#reset_password', :as => 'reset_password_from_email' + + match 'users/:id/accept_invitation_from_email/:key' => 'users#accept_invitation', :as => 'accept_invitation_from_email' + + match 'users/:id/activate_from_email/:key' => 'users#activate', :as => 'activate_from_email' + + match 'search' => 'front#search', :as => 'site_search' + + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + # root :to => 'welcome#index' + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id))(.:format)' +end diff --git a/db/migrate/20130108212536_initial_migration.rb b/db/migrate/20130108212536_initial_migration.rb new file mode 100644 index 0000000..b4aa668 --- /dev/null +++ b/db/migrate/20130108212536_initial_migration.rb @@ -0,0 +1,22 @@ +class InitialMigration < ActiveRecord::Migration + def self.up + create_table :users do |t| + t.string :crypted_password, :limit => 40 + t.string :salt, :limit => 40 + t.string :remember_token + t.datetime :remember_token_expires_at + t.string :name + t.string :email_address + t.boolean :administrator, :default => false + t.datetime :created_at + t.datetime :updated_at + t.string :state, :default => "inactive" + t.datetime :key_timestamp + end + add_index :users, [:state] + end + + def self.down + drop_table :users + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..f39af9a --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,32 @@ +# encoding: UTF-8 +# 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 => 20130108212536) do + + create_table "users", :force => true do |t| + t.string "crypted_password", :limit => 40 + t.string "salt", :limit => 40 + t.string "remember_token" + t.datetime "remember_token_expires_at" + t.string "name" + t.string "email_address" + t.boolean "administrator", :default => false + t.datetime "created_at" + t.datetime "updated_at" + t.string "state", :default => "inactive" + t.datetime "key_timestamp" + end + + add_index "users", ["state"], :name => "index_users_on_state" + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..4edb1e8 --- /dev/null +++ b/db/seeds.rb @@ -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: 'Emanuel', city: cities.first) diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP new file mode 100644 index 0000000..fe41f5c --- /dev/null +++ b/doc/README_FOR_APP @@ -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. diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/log/.gitkeep b/log/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..9a48320 --- /dev/null +++ b/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 0000000..83660ab --- /dev/null +++ b/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 0000000..f3648a0 --- /dev/null +++ b/public/500.html @@ -0,0 +1,25 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+
+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..085187f --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-Agent: * +# Disallow: / diff --git a/script/rails b/script/rails new file mode 100755 index 0000000..f8da2cf --- /dev/null +++ b/script/rails @@ -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' diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..c63aac0 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/functional/front_controller_test.rb b/test/functional/front_controller_test.rb new file mode 100644 index 0000000..4b30f25 --- /dev/null +++ b/test/functional/front_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class FrontControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/functional/user_mailer_test.rb b/test/functional/user_mailer_test.rb new file mode 100644 index 0000000..67a1629 --- /dev/null +++ b/test/functional/user_mailer_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserMailerTest < ActionMailer::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb new file mode 100644 index 0000000..3fea27b --- /dev/null +++ b/test/performance/browsing_test.rb @@ -0,0 +1,12 @@ +require 'test_helper' +require 'rails/performance_test_help' + +class BrowsingTest < ActionDispatch::PerformanceTest + # Refer to the documentation for all available options + # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] + # :output => 'tmp/performance', :formats => [:flat] } + + def test_homepage + get '/' + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..8bf1192 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,13 @@ +ENV["RAILS_ENV"] = "test" +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/unit/helpers/front_helper_test.rb b/test/unit/helpers/front_helper_test.rb new file mode 100644 index 0000000..27daa72 --- /dev/null +++ b/test/unit/helpers/front_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class FrontHelperTest < ActionView::TestCase +end diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/unit/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep new file mode 100644 index 0000000..e69de29