Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build out validations in UI #2

Closed
tparsnick opened this issue Mar 4, 2014 · 6 comments
Closed

Build out validations in UI #2

tparsnick opened this issue Mar 4, 2014 · 6 comments
Assignees

Comments

@tparsnick
Copy link

Range checks, data-type checks, mandatory fields, and other validations are represented in the models as validations but are not enforced in the UI. There should be validation messages to the user.

See NUBIC#34; https://github.com/NUBIC/surveyor/commits/34_support-validations.
Check this branch out and see how far it gets us.

This is a big issue and may be broken up into a few other issues as you see fit.

Mandatory Fields:
One major validation is mandatory fields. You can mark mandatory in DSL. There is model support for this. See surveys/kitchen_sink_survey.rb.
See NUBIC#469; https://github.com/alkalin3/surveyor/compare/validate-mandatory; https://github.com/alkalin3/surveyor/commits/validate-mandatory

@tparsnick
Copy link
Author

Alex, this fork has been implemented in the branch https://github.com/HeHStudy/HeH/tree/1760-Add-NUBIC-surveyor. Notice the Gemfile in this branch contains:

gem 'surveyor', git: 'git://github.com/HeHStudy/surveyor.git'   # or local '/Repos/HeHStudy/surveyor'. Do updates in gem install location: bundle show surveyor

So updates to the HeHStudy/surveyor fork are in its own git repo deep in the gems folder. In my case
/Users/toddparsnick/.rvm/gems/ruby-1.9.3-p327/bundler/gems/surveyor-2d620d674747.

So for your setup I would first get 1760-Add-NUBIC-surveyor. Then do a bundle install which should add this forked surveyor. Then you will do updates in the fork repo or in 1760-Add-NUBIC-surveyor repo depending on which is more appropriate.

@tparsnick
Copy link
Author

FYI I just pushed a custom surveyor controller and layout to 1760-Add-NUBIC-surveyor.
We'll need to have our custom controller, views, and layout for surveyor. Perhaps all the UI stuff just gets done in our custom stuff rather than in the surveyor engine? Something to think about.

see https://github.com/NUBIC/surveyor/blob/master/lib/generators/surveyor/templates/surveys/EXTENDING_SURVEYOR.md

This is what I did to get the custom controller and layout

udp084838uds:HeH toddparsnick$ bundle exec rails generate surveyor:custom
      create  surveys/EXTENDING_SURVEYOR.md
      create  app/controllers/surveyor_controller.rb
      create  app/views/layouts/surveyor_custom.html.erb

@tparsnick
Copy link
Author

FYI.

http://127.0.0.1:3000/surveys
surveys/[survey access code]/[response set access code]
surveys/kitchen-sink-survey/v1uIdOXTeQ/take

The "response set access code" is unique for each survey instance.
If you use the same URL again then you will be presented with the survey filled in with the existing data.
The "survey access code", unless you specify it in the DSL, will be generated automatically (and appear random) when the survey is parsed.

@alexperto
Copy link

@tparsnick I ended up solving this issue on the HeH repo side, it looks like the js files were not loading correctly.

See: https://github.com/HeHStudy/HeH/tree/surveyor-display-validation-errors

@tparsnick
Copy link
Author

Great. So to make this work you needed 34_support-validations. Please merge this into our forked master.

@tparsnick
Copy link
Author

closed by #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants