No description, website, or topics provided.
Ruby JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
db
demo
doc
features
fonts
lib/tasks
public
script
test
tmp/ballot_zips
vendor/plugins
.gems
.gitignore
.project
BALLOTS.README
README
Rakefile
VERSION
brandeis
rerun.txt

README

INSTALL
# install required gems

sudo rake gems:install
rake ttv:full_resert
rake test # run tests
script/server # start the server

TESTING
To test, first set up seed database
rake db:test:load # resets the schema
rake ttv:seed RAILS_ENV=test  # loads up our seed data
  
For this, I had to write custom rake tasks inside lib/db.rake
http://stackoverflow.com/questions/1097845/how-to-prevent-rake-test-to-call-task-dbtestprepare

GEM COMMENTARY
Prawn 0.6.3 is required due to incompatibility with 0.7
http://github.com/sandal/prawn/issues/#issue/79

BUILT-IN TEST USERS
root user: moe@example.com pw: password
standard user: larry@example.com pw: password
public user: curly@example.com pw: password

TODO
- db transaction logging and viewing
- import of multiple district sets at the same time (allows us to get california, and
a separate set for each county)

AJAX
flash messages are automatically passed on as X-JSON headers, use to report errors, etc

INLINE EDITING
Look at doc/InlineEditArchitecture.xls for DOM ids, and general architecture overview
accepts_nested_attributes_for useful pages
	Mentions attr_accessible: http://apidock.com/rails/ActiveRecord/NestedAttributes/ClassMethods/accepts_nested_attributes_for
	Nested attributes in "new" http://stream.btucker.org/post/93887650/accepts-nested-attributes-for-fields-for
	Original patch discussion http://weblog.rubyonrails.org/2009/1/26/nested-model-forms
	Ryan's scraps, http://ryandaigle.com/articles/2008/7/19/what-s-new-in-edge-rails-nested-models

TEMPLATES
use flash[notice][error] for notifications. In js, use ttv.notice/ttv.error
added startAjax, stopAjax, spinner in matching colors http://www.ajaxload.info/
Use prefetching for election to speed up database

AUTHENTICATION
Using authlogic gem, instructions at 
http://media.railscasts.com/videos/160_authlogic.mov
http://github.com/binarylogic/authlogic_example/tree/master
http://www.binarylogic.com/2008/11/16/tutorial-reset-passwords-with-authlogic/

EMAIL
Sending mail with gmail requires ruby >=1.8.7, does not work on Leopard default

DATA MODELING
- I was unable to use autogenerated ids for yaml, too much data

Started tracking sessions inside database.

FORMS
The best documentation is PragProg Mastering Rails Forms video
Problem: error messages, default schema is not flexible, ugly layouts
Solution: roll your own error solution that displays off the error object
ApplicationHelper::render_error_messages is a error_messages_for replacemet
The html is defined in:
single field: config/initializers/change_field_error.rb ActionView::Base.field_error_proc override
error summary _error_messages.html.erb: used by the helper to display the error.

STYLE and THEMES
Using Web App Theme for a simple set of style sheets to make the pages look a little 
bit nice. No big deal yet just some color etc. Look at these links:
http://github.com/pilu/web-app-theme
http://pilu.github.com/web-app-theme
http://gravityblast.com/2009/07/30/2-minutes-admin-layout-with-rails-and-the-web-app-theme-generator/ 

IMAGE STORAGE and UPLOADING
Using paperclip installed to filesystem with command:
script/plugin install git://github.com/thoughtbot/paperclip.git
http://github.com/thoughtbot/paperclip

ROUTING
Extending REST model, priceless: http://railscasts.com/episodes/35-custom-rest-actions
Routing: http://guides.rubyonrails.org/routing.html

DEBUGGING 
script/console:

- execute url_for like this: app.url_for

# checking routing methods and what they do:
>> r = ActionController::Routing::Routes
>> default_url_options[:host] = "a.com"
>> include ActionController::UrlWriter
>> elections_url(1)
=> "http://a.com/elections.1"

OTHER CODE THAT MIGHT BE USEFUL
auto_resize_options[:onKeyPress] = "if (this.scrollHeight > this.clientHeight && !window.opera)\nthis.rows += 1;"

http://hobocentral.net/about/ Interesting framework, provides fine-grained permissions, authentication, logging
mislav-will-paginate is a recommended pagination gem
Drop-down menu for prototype
http://www.hongkiat.com/blog/drop-down-menu-30-free-scripts-to-enhance-header-navigation/
http://corelib.rubyonrails.org/
http://littlegreenfootballs.com/article/30490_Tech_Note-_Flippy_Triangle_Style
http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html 
/activesupport/lib/activesupport/coreext/hash/conversions Hash::to_xml
Options for generating seed data: http://derekdevries.com/2009/04/13/rails-seed-data/
Doing i10n in database schemas: http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/i18n/i18n5.html