Skip to content

Commit

Permalink
Closed #88
Browse files Browse the repository at this point in the history
  • Loading branch information
pmanko committed Oct 17, 2014
1 parent 7051a6e commit 225f7df
Show file tree
Hide file tree
Showing 20 changed files with 1,002 additions and 13 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG-MYAPNEAORG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
## 1.0.1
## 1.1.0
- **Bug Fixes**
- Fixed research topic voting problems encountered on Firefox browsers.
- Fixed erroneous 'true' flash message after session expiration.
- **Research Surveys**
- Added survey question about sleep care institutions
- Added ASAA as a choice for how a user heard about MyApnea.
- Implemented new question type, based on `typeahead.js`.

## 1.0.1 (October 15, 2014)

### Bug Fixes
- **Social Profile**
Expand All @@ -16,7 +25,7 @@
- Implemented collapsing sidebar for mobile users.


## 1.0.0
## 1.0.0 (October 3, 2014)

### Major Features

Expand Down
3 changes: 3 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
//= require jquery.PrintArea
//= require d3.min
//= require bootbox.min
//= require typeahead
//= require bloodhound
//= require bootstrap-tagsinput
//= require placeholders.jquery.min
//= require facebook
//= require main
//= require pages
//= require admin
//= require votes
//= require surveys


1 change: 1 addition & 0 deletions app/assets/javascripts/main.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ $.rails.allowAction = (element) ->
@loaders = () ->
mainLoader()
consentReady()
surveysReady()


$(document).ready(loaders)
Expand Down
17 changes: 17 additions & 0 deletions app/assets/javascripts/surveys.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@surveysReady = () ->

if $(".question-form .typeahead").length > 0
@institutions = new Bloodhound(
datumTokenizer: Bloodhound.tokenizers.obj.whitespace("value")
queryTokenizer: Bloodhound.tokenizers.whitespace
prefetch: $(".question-form").data("typeahead-path") + ".json"
)

@institutions.initialize()

$(".question-form .typeahead").typeahead null,
name: "institutions"
displayKey: "value"
source: institutions.ttAdapter()


5 changes: 5 additions & 0 deletions app/controllers/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def frequencies
@answer_session = AnswerSession.find(params[:answer_session_id])
end

def typeahead
@question = Question.find(params[:question_id])

end

# Never trust parameters from the scary internet, only allow the white list through.
def object_params
params.require(:question).permit(:text, :question_type_id, :question_help_message, :answer_type_id, :time_estimate)
Expand Down
3 changes: 3 additions & 0 deletions app/models/surveys/answer_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ class AnswerTemplate < ActiveRecord::Base
belongs_to :display_type
belongs_to :unit




end
1 change: 1 addition & 0 deletions app/views/questions/typeahead.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json.array! @question.answer_templates.first.answer_options, :value
1 change: 0 additions & 1 deletion app/views/social/profile.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,5 @@
= javascript_include_tag "//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places&key=AIzaSyBB91qMUvtmPzct9z7slTqm-lTUEVuYjKo"
= javascript_include_tag 'typeahead'
= javascript_include_tag 'typeahead-addresspicker'
= javascript_include_tag 'social/places'
6 changes: 3 additions & 3 deletions app/views/surveys/partials/_question_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.question-form{data: {parent_question: parent_q, condition: condition}}
.question-form{data: {parent_question: parent_q, condition: condition, typeahead_path: question_typeahead_path}}
.row
.col-md-9
%strong.text-primary= markdown question.text
Expand All @@ -13,12 +13,12 @@

- question.answer_templates.each_with_index do |answer_template|
%div{class: "col-md-#{12/(question.answer_templates.length)}"}
- if answer_template.answer_options.present?
- if answer_template.data_type == "answer_option_id"
- answer_template.answer_options.each_with_index do |answer_option, i|
%div{:class => answer_template.display_type.input_type}
%label
- haml_tag(answer_template.display_type.tag, {type: answer_template.display_type.input_type, name: "#{question.id}[#{answer_template.id}]#{[] if answer_template.allow_multiple}", id: "question_#{question.id}_#{answer_template.id}_#{i+1}", value: answer_option.id, checked: have_checked?(answer, answer_template, answer_option.id)})
= answer_option.value
- else
.form-group
- haml_tag(answer_template.display_type.tag, {type: answer_template.display_type.input_type, class: 'form-control', name: "#{question.id}[#{answer_template.id}]", id: "question_#{question.id}_#{answer_template.id}", value: answer.value[answer_template.id], placeholder: answer_template.unit.present? ? answer_template.unit.name : nil })
- haml_tag(answer_template.display_type.tag, {type: answer_template.display_type.input_type, class: "form-control #{answer_template.display_type.class_string}", name: "#{question.id}[#{answer_template.id}]", id: "question_#{question.id}_#{answer_template.id}", value: answer.value[answer_template.id], placeholder: answer_template.unit.present? ? answer_template.unit.name : nil })
2 changes: 1 addition & 1 deletion config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Rails.application.config.assets.precompile += %w( font-awesome-4.1.0/css/font-awesome.min.css )
Rails.application.config.assets.precompile += %w( pages.css )
Rails.application.config.assets.precompile += %w( forem.css forem.js )
Rails.application.config.assets.precompile += %w( social/maps.js social/places.js typeahead.js typeahead-addresspicker.js google_analytics.js uservoice.js )
Rails.application.config.assets.precompile += %w( social/maps.js social/places.js typeahead-addresspicker.js google_analytics.js uservoice.js )
Rails.application.config.assets.precompile += %w( .svg .eot .woff .ttf)
Rails.application.config.assets.precompile += %w( bootswatch.js )
Rails.application.config.assets.precompile += %w( home.js dashboard.js)
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/version.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module WwwMyapneaOrg
module VERSION #:nodoc:
MAJOR = 1
MINOR = 0
TINY = 1
BUILD = nil # nil, "pre", "beta1", "beta2", "rc", "rc2"
MINOR = 1
TINY = 0
BUILD = "pre" # nil, "pre", "beta1", "beta2", "rc", "rc2"

STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
end
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
get 'research_surveys/:answer_session_id/:question_id', to: 'surveys#ask_question', as: :ask_question
match 'research_surveys/process_answer', to: 'surveys#process_answer', via: :post, as: :process_answer
get 'questions/frequencies(/:question_id/:answer_session_id)', to: "questions#frequencies", as: :question_frequencies, format: :json

get 'questions/typeahead/:question_id', to: "questions#typeahead", as: :question_typeahead, format: :json

# Health Data Section
get 'data_explore' => 'health_data#explore'
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20141016210432_add_class_to_display_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddClassToDisplayType < ActiveRecord::Migration
def change
add_column :display_types, :class_string, :string
end
end
125 changes: 125 additions & 0 deletions lib/data/surveys/answer_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,131 @@
text_value_en: High school diploma
- id: 296
text_value_en: American Sleep Apnea Association (ASAA)
# Sleep Champioons
- id: 10002
text_value_en: Albert Einstein College of Medicine
- id: 10003
text_value_en: Beth Israel Deaconess Medical Center
- id: 10004
text_value_en: Biomedical Research Alliance of New York
- id: 10005
text_value_en: Boston Children’s Hospital
- id: 10006
text_value_en: Boston Health Net (Boston Medical Center and Community Health Centers)
- id: 10007
text_value_en: Case Western Research University
- id: 10008
text_value_en: Children's Mercy Hospital
- id: 10009
text_value_en: Children’s Hospital Colorado
- id: 10010
text_value_en: Cincinnati Children's Hospital Medical Center
- id: 10011
text_value_en: Cleveland Clinic
- id: 10012
text_value_en: College of Physicians and Surgeons at Columbia University
- id: 10013
text_value_en: Columbia University Medical Center
- id: 10014
text_value_en: Fenway Health
- id: 10015
text_value_en: Health Choice Network
- id: 10016
text_value_en: Hershey Medical Center
- id: 10017
text_value_en: Icahn School of Medicine at Mount Sinai
- id: 10018
text_value_en: Johns Hopkins Health Care
- id: 10019
text_value_en: Johns Hopkins Health System
- id: 10020
text_value_en: Louisiana Public Health Institute (LPHI)
- id: 10021
text_value_en: Marshfield Clinic
- id: 10022
text_value_en: Massachusetts General Hospital
- id: 10023
text_value_en: Medical College of Wisconsin
- id: 10024
text_value_en: MetroHealth Medical Center
- id: 10025
text_value_en: Montefiore Medical Center
- id: 10026
text_value_en: Morehouse School of Medicine/Grady Memorial Hospital (Research Centers in Minority Institutions)
- id: 10027
text_value_en: Morehouse University
- id: 10028
text_value_en: Mount Sinai Health System
- id: 10029
text_value_en: Nationwide Children’s Hospital
- id: 10030
text_value_en: Nemours Children’s Health System
- id: 10031
text_value_en: New York Presbyterian Hospital
- id: 10032
text_value_en: NYU Langone Medical Center
- id: 10033
text_value_en: NYU School of Medicine
- id: 10034
text_value_en: Oregon Community Health Information Network
- id: 10035
text_value_en: Partners Healthcare System
- id: 10036
text_value_en: Brigham & Women's Hospital
- id: 10037
text_value_en: Penn State College of Medicine
- id: 10038
text_value_en: Pennington Biomedical Research Center
- id: 10039
text_value_en: Rockefeller University - New York Presbyterian Hospital
- id: 10040
text_value_en: Seattle Children’s Hospital
- id: 10041
text_value_en: St. Louis Children’s Hospital
- id: 10042
text_value_en: Temple University School of Medicine
- id: 10043
text_value_en: The Children’s Hospital of Philadelphia
- id: 10044
text_value_en: The University of Texas Health Science Center at Houston
- id: 10045
text_value_en: Tulane University
- id: 10046
text_value_en: University of Mississippi Medical Center
- id: 10047
text_value_en: University of California San Francisco
- id: 10048
text_value_en: University of California, San Diego (UCSD)
- id: 10049
text_value_en: University of Iowa Healthcare
- id: 10050
text_value_en: University of Kansas Medical Center
- id: 10051
text_value_en: University of Minnesota Academic Health Center
- id: 10052
text_value_en: University of Nebraska Medical Center
- id: 10053
text_value_en: University of Pittsburgh at Pittsburgh
- id: 10054
text_value_en: University of Texas Health Sciences Center at San Antonio
- id: 10055
text_value_en: University of Texas Southwestern Medical Center
- id: 10056
text_value_en: UPMC Health Plan
- id: 10057
text_value_en: Vanderbilt Healthcare Affiliated Network
- id: 10058
text_value_en: Vanderbilt University
- id: 10059
text_value_en: W.G. Hefner VAMC
- id: 10060
text_value_en: Wake Forest Baptist Medical Center
- id: 10061
text_value_en: Wake Forest Medical Center
- id: 10062
text_value_en: Weill Medical College of Cornell University

#
- id: 200001
numeric_value: 1

Expand Down
73 changes: 72 additions & 1 deletion lib/data/surveys/answer_templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
name: generic_text
display_type_id: 1
data_type: text_value
- id: 26
name: autocomplete_text
display_type_id: 9
data_type: text_value
- id: 2
name: generic_paragraph
display_type_id: 2
Expand Down Expand Up @@ -166,4 +170,71 @@
answer_option_ids:
- 36
- 20
- 19
- 19

- id: 25
name: sleep_care_institutions
display_type_id: 9
data_type: text_value
answer_option_ids:
- 10002
- 10003
- 10004
- 10005
- 10006
- 10007
- 10008
- 10009
- 10010
- 10011
- 10012
- 10013
- 10014
- 10015
- 10016
- 10017
- 10018
- 10019
- 10020
- 10021
- 10022
- 10023
- 10024
- 10025
- 10026
- 10027
- 10028
- 10029
- 10030
- 10031
- 10032
- 10033
- 10034
- 10035
- 10036
- 10037
- 10038
- 10039
- 10040
- 10041
- 10042
- 10043
- 10044
- 10045
- 10046
- 10047
- 10048
- 10049
- 10050
- 10051
- 10052
- 10053
- 10054
- 10055
- 10056
- 10057
- 10058
- 10059
- 10060
- 10061
- 10062
5 changes: 5 additions & 0 deletions lib/data/surveys/display_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
name: text
tag: input
input_type: text
- id: 9
name: autocomplete
tag: input
input_type: text
class_string: 'typeahead'
- id: 2
name: paragraph
tag: textarea
Expand Down
6 changes: 5 additions & 1 deletion lib/data/surveys/question_edges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
condition: 34
- question_flow_id: 13
parent_question_id: 489
child_question_id: 491
child_question_id: 10491
condition:
- question_flow_id: 13
parent_question_id: 490
child_question_id: 10491
condition:
- question_flow_id: 13
parent_question_id: 10491
child_question_id: 491
condition:
- question_flow_id: 13
Expand Down
Loading

0 comments on commit 225f7df

Please sign in to comment.