Skip to content

Guide: Special topics

toby cabot edited this page Aug 14, 2013 · 4 revisions

TABLE OF CONTENTS

The asset pipeline

Surveyor is now aware of the Rails asset pipeline (http://guides.rubyonrails.org/asset_pipeline.html). With the asset pipeline enabled Rails.application.config.assets.enabled == true, then the surveyor:install generator will generate app/assets/stylesheets/surveyor_all.css and app/assets/javascripts/surveyor_all.js manifest files and link them from the surveyor_default layout. Assets remain in the gem and are picked up for inclusion and pre-compilation from there if config/environments/production.rb is set to include surveyor assets.

# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( surveyor_all.js surveyor_all.css )

The previous copy-to-application behavior still exists in the case where the asset pipeline is missing or disabled.

Survey terms

This is a brief look at the similarities and differences between quizzes, surveys, questionnaires, and forms.

Forms

Forms are a series of fields to be filled out by a user. Some forms are highly structured (such as a User form, or an Address form). Those highly structured forms can be created beforehand by a developer because they map directly to models in the database. Other forms are highly unstructured, such as a questionnaire about your favorite types of food. Those don’t (and shouldn’t) map directly to database tables because they are volatile. Only map forms to database tables if you have a very abstract and well defined set of rules for that form, and it can be reused in multiple situations.

Forms are validatable.

Surveys

A Survey is a type of Form. Surveys are semi-structured data, in that we want to formulate the questions so they have “mineable” data, but they are not so structured as to be directly mappable to database tables (unless we desired to have one table per survey, do we?).

Surveys are validatable. If a field is not appropriately filled out (such as a misformatting), the user should be prompted to correct his/her answer.

Surveys should not prevent the user from completing them if they miss an answer, however.

Questionnaires

A Questionnaire is a type of Survey.

Questionnaires are validatable.

Quizzes

A Quiz is a type of Survey.

A Quiz is validatable and correctable.

Validness and Correctness

Validation refers to the formatting of form field input. Correctness refers to whether or not the input is the correct/desired input. All forms fields can have a “correctness” if that is desirable.

Survey resources

Presentations

Best Practices for Form Design - Amazing presentation on how to make good forms.
HTML Form Best Practices for Beginners

Projects

Exports