From b0f8051121697f4049226fa80f469ff07ad4eccd Mon Sep 17 00:00:00 2001 From: Jim Fowler Date: Wed, 20 Mar 2013 11:52:52 -0400 Subject: [PATCH] Created informed consent form and mailer --- Gemfile | 3 + app/controllers/profile_controller.rb | 31 +++- app/mailers/consent_mailer.rb | 10 ++ app/models/user.rb | 2 + .../consent_mailer/informed_consent.html.erb | 13 ++ .../consent_mailer/informed_consent.text.erb | 16 ++ app/views/profile/confirm_consent.html.erb | 9 + app/views/profile/consent.html.erb | 160 ++++++++++++------ app/views/profile/edit.html.erb | 2 - config/routes.rb | 6 +- config/tokenifier.yml | 8 + test/functional/consent_mailer_test.rb | 7 + 12 files changed, 209 insertions(+), 58 deletions(-) create mode 100644 app/mailers/consent_mailer.rb create mode 100644 app/views/consent_mailer/informed_consent.html.erb create mode 100644 app/views/consent_mailer/informed_consent.text.erb create mode 100644 app/views/profile/confirm_consent.html.erb create mode 100644 config/tokenifier.yml create mode 100644 test/functional/consent_mailer_test.rb diff --git a/Gemfile b/Gemfile index 277ca8d..1c9e72c 100644 --- a/Gemfile +++ b/Gemfile @@ -57,3 +57,6 @@ gem 'ambry' # Use gravatar's on profile pages gem 'gravatar_image_tag' + +# Use tokenifier to handle email confirmations +gem "tokenifier", "~> 0.1" diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 76ffa31..56cf201 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -1,4 +1,5 @@ class ProfileController < ApplicationController + def display unless user_signed_in? redirect_to user_omniauth_authorize_path(:coursera) @@ -56,14 +57,34 @@ def record_consent @user = current_user @user.consent = true + @user.osu_name_dot_number = params[:osu_name_dot_number].gsub( '@osu.edu', '' ) + @user.name = params[:name] + + if not @user.osu_name_dot_number.match( /^[A-z0-9]+\.[0-9]+$/ ) + redirect_to action: "consent" + flash[:error] = "Error: Please make sure to enter your OSU lastname.number." + else + if @user.save + ConsentMailer.informed_consent(@user).deliver + + redirect_to action: "display" + flash[:notice] = "Please be sure to respond to the email in order to finish joining the research study." + else + redirect_to action: "consent" + flash[:error] = "There was a problem recording your consent." + end + end + end + + def confirm_consent + @user = User.find( Tokenifier.decrypt(params[:token]).to_i ) + @user.consented_at = Time.now - if @user.save - redirect_to action: "display" - flash[:notice] = "You are now participating in the research study. Thank you!" + if @user.save + flash[:notice] = "You have successfully joined the research study." else - redirect_to action: "consent" - flash[:error] = "There was a problem recording your consent." + flash[:error] = "There was an error; can you try clicking on the link again?" end end diff --git a/app/mailers/consent_mailer.rb b/app/mailers/consent_mailer.rb new file mode 100644 index 0000000..bf30b9e --- /dev/null +++ b/app/mailers/consent_mailer.rb @@ -0,0 +1,10 @@ +class ConsentMailer < ActionMailer::Base + default from: "Jim Fowler " + + def informed_consent(user) + @user = user + encrypted_user_id = Tokenifier.encrypt(user.id) + @url = "https://mooculus.osu.edu/profile/#{encrypted_user_id}" + mail(:to => user.osu_name_dot_number + "@osu.edu", :subject => "Informed Consent for MOOCulus") + end +end diff --git a/app/models/user.rb b/app/models/user.rb index 0f8a400..36cf6fd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -18,6 +18,8 @@ def email_required? attr_accessible :email, :password, :coursera_id, :password_confirmation, :remember_me attr_accessible :name + attr_accessible :osu_name_dot_number + has_many :authentications, :dependent => :delete_all has_many :scores, :dependent => :destroy has_many :competencies, :dependent => :destroy diff --git a/app/views/consent_mailer/informed_consent.html.erb b/app/views/consent_mailer/informed_consent.html.erb new file mode 100644 index 0000000..b557631 --- /dev/null +++ b/app/views/consent_mailer/informed_consent.html.erb @@ -0,0 +1,13 @@ + + + + + + +

Dear <%= @user.name %>,

+

You have requested to join the research study for Math 1151's online component, MOOCulus.

+

To confirm your participation, please click on <%= @url %>.

+

Thank you again for your help! Your participation will help us to understand the effectiveness of these online tools.

+

thank you for your participation,
~jim

+ + diff --git a/app/views/consent_mailer/informed_consent.text.erb b/app/views/consent_mailer/informed_consent.text.erb new file mode 100644 index 0000000..cbd800f --- /dev/null +++ b/app/views/consent_mailer/informed_consent.text.erb @@ -0,0 +1,16 @@ +Dear <%= @user.name %>, + +You have requested to join the research study for Math 1151's online +component, MOOCulus. + +To confirm your participation, please go to + + <%= @url %> + +in your web browser. + +Thank you again for your help! Your participation will help us to +understand the effectiveness of these online tools. + +thank you for your participation, +~jim diff --git a/app/views/profile/confirm_consent.html.erb b/app/views/profile/confirm_consent.html.erb new file mode 100644 index 0000000..b2c2cdc --- /dev/null +++ b/app/views/profile/confirm_consent.html.erb @@ -0,0 +1,9 @@ + + +

Thank you, <%= @user.name %>.

+

You have confirmed your participation in the research study.

+

Thank you for participating in the research study.

+

Your participation makes it possible for us to determine the effectiveness of these online tools.

diff --git a/app/views/profile/consent.html.erb b/app/views/profile/consent.html.erb index 1c61a2f..57c6e14 100644 --- a/app/views/profile/consent.html.erb +++ b/app/views/profile/consent.html.erb @@ -1,31 +1,76 @@ + +
-
-
- -

I consent to participating in (or my child's participation in) research entitled Massive Open Online Course Technology for Calculus Instruction.

- - - +
+
- Anim pariatur clichea dn such and such + The purpose of this study is to determine the impact of learning technology implementation. The results of this study will be used to assist the Department of Mathematics and Learning Technology in determining the feasibility of offering similar courses in the future. +
+
+
+ +
+ +
+
+ This activity involves research. Your participation is voluntary, and you may choose to withdraw at any time without penalty, loss of benefits, or impact on your grade. You can refuse to participate without penalty or loss of benefits to which you are otherwise entitled. +
+
+
+ +
+ +
+
+ There are no risks to this study. Benefits include the opportunity to contribute to the development of technology-assisted teaching models. There are no direct material benefits to individuals who participate in this study.
@@ -33,56 +78,73 @@
- Anim pariatur cliche... + To participate in this study, you will be asked to indicate your agreement to have your course data included in the data analysis. All students have the opportunity to use the practice problems presented on mooculus.osu.edu, regardless of whether they consent to the study. Data for students who do not agree to participate or who are under the age of 18 will not be included in the data analysis. If you agree to take part in the research study, your scores for assignments/activities and your overall course grade will be compared with your activity log on mooculus.osu.edu.
-
+
+ +
+
+ Your performance on course assignments, your use of mooculus.osu.edu will be kept confidential. All identifiers will be stripped from the data before they are analyzed. Comparisons will be kept confidential, and no individual grades or responses will be shared—data will be reported as a class aggregate only. Although every effort to protect confidentiality will be made, no guarantee of Internet survey security can be given as, although unlikely, transmissions can be intercepted and IP addresses can be identified. +
+
+
-

Jim Fowler, Principal Investigator, or his/her authorized -representative has explained the purpose of the study, the procedures -to be followed, and the expected duration of my -participation. Possible benefits of the study have been described, as -have alternative procedures, if such procedures are applicable and -available. I understand that participation in the research is -voluntary and that participating or not participating will have no -effect on my (my child's) grade, course, or class standing.

-

I acknowledge that I have had the opportunity to obtain additional -information regarding the study and that any questions I ahve raised -have been answered to my full satisfaction. Furthermore, I understand -that I am (my child is) free to withdraw consent at any time and to -discontinue participation in the study without prejudice to me (my -child). Students under 18 should opt out from completing the survey -unless parental permission is provided.

+
+ +
+
For questions or concerns regarding this survey questionnaire or project, or if you feel you have been harmed by study participation, you may contact Dr. Jim Fowler at fowler@math.osu.edu or 773-809-5659 or Dr. Robert Griffiths at griffiths.44@osu.edu or 614-292-5901. For questions about your rights as a participant in this study or to discuss other study-related concerns or complaints with someone who is not part of the research team, you may contact Ms. Sandra Meadows in the Office of Responsible Research Practices at meadows.8@osu.edu or 614-688-8641. +
+
+
-

By completing this survey, I acknowledge that I have read and fully -understand the consent form.

+
-

Questions or concerns regarding this project may be directed to Jim -Fowler (fowler@math.osu.edu) -or the ORRP by calling 614–688–8457.

+

I consent to participating in research entitled Enhancing Student Learning with Technology.

+

Participation in the research is voluntary and participating or not will not affect how any assignments in this course are graded.

+

I have had the opportunity to obtain additional information regarding the study. Any questions I have raised have been answered to my full satisfaction. I can stop at any time without penalty to me.

+

I have read the consent form. By completing this form, I consent to participate.

-
+
-
-
-

- <%= button_to "I want to participate.", - { :controller => "profile", :action => "record_consent" }, - :class => "btn btn-large btn-block btn-primary" %> -

-
-
+
+

+ <%= form_tag '/profile/record_consent', {:class=>'form-horizontal'} do %> +

+ <%= label_tag :name, nil, :class => 'control-label' %> +
+ <%= text_field_tag :name, @user.name %> +
+ + <%= label_tag :osu_name_dot_number, 'OSU name.number'.html_safe, :class => 'control-label' %> +
+ <%= text_field_tag :osu_name_dot_number, @user.osu_name_dot_number, :placeholder => "name.123", :class=>'required-input', :style=>'text-align:right;' %>@osu.edu +
+
+ + <%= button_tag "I want to participate.", :class => "btn btn-large btn-block btn-primary join-study" %> + <% end %> +

+
@@ -95,5 +157,3 @@ or the ORRP by calling 614–688–8457.

- - diff --git a/app/views/profile/edit.html.erb b/app/views/profile/edit.html.erb index 09cac67..47610a7 100644 --- a/app/views/profile/edit.html.erb +++ b/app/views/profile/edit.html.erb @@ -2,8 +2,6 @@
Edit Profile - - <%= label_tag :email %> <%= text_field_tag :email, @user.email %> diff --git a/config/routes.rb b/config/routes.rb index 8973556..0db4b54 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,8 +15,12 @@ get "profile/display" => "profile#display" get "profile/edit" => "profile#edit" post "profile/edit" => "profile#update" - get "profile/consent" => "profile#consent" + + # handle the informed consent process via email + get "consent" => "profile#consent" post "profile/record_consent" => "profile#record_consent" + get "consent/:token" => "profile#confirm_consent", :token => /.+/ + # place all special exercise routes about resources :exercises get "exercises/progress" => "exercises#progress" resources :exercises diff --git a/config/tokenifier.yml b/config/tokenifier.yml new file mode 100644 index 0000000..122a1f9 --- /dev/null +++ b/config/tokenifier.yml @@ -0,0 +1,8 @@ +production: + secret: 905f23078c6741cdf95f3ecf324169a4dad4efc1ca082757f0ff9b9c19ba824e + +development: + secret: 01ca1bbe2d41133a6eed213a1ce4e67e26a4d36888915f5c8af862fd97e2b894 + +test: + secret: 7d6c81a02708cdeccc01ba468927f1a55b972a4ab5370c4fb16cd329338673c3 diff --git a/test/functional/consent_mailer_test.rb b/test/functional/consent_mailer_test.rb new file mode 100644 index 0000000..9ba3a24 --- /dev/null +++ b/test/functional/consent_mailer_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ConsentMailerTest < ActionMailer::TestCase + # test "the truth" do + # assert true + # end +end