diff --git a/.gitignore b/.gitignore
index e9059a68..baa23436 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ brakeman.html
cucumber_rerun.txt
rspec.failures
vendor/cache
+.sass-cache
diff --git a/Gemfile b/Gemfile
index 574b8982..d66a8bc5 100644
--- a/Gemfile
+++ b/Gemfile
@@ -59,6 +59,8 @@ gem 'remotipart', '~> 1.0'
gem 'babbler', '~> 1.0.0'
gem 'sketchily', '~> 1.5.0'
+gem 'unconfirm', path: '../unconfirm'
+
gem 'on_the_spot', git: 'https://github.com/kevinburleigh75/on_the_spot.git', ref: '67a423a'
gem 'fine_print', git: 'https://github.com/jpslav/fine_print.git', ref: '3146ce934e337'
diff --git a/Gemfile.lock b/Gemfile.lock
index 32a345ee..1ead6829 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -24,6 +24,14 @@ GIT
on_the_spot (1.0.2)
json_pure (>= 1.4.6)
+PATH
+ remote: ../unconfirm
+ specs:
+ unconfirm (0.0.1)
+ activerecord-typedstore
+ jquery-rails
+ rails (~> 3.2.17)
+
GEM
remote: https://rubygems.org/
specs:
@@ -48,6 +56,8 @@ GEM
activesupport (= 3.2.17)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
+ activerecord-typedstore (0.4.3)
+ activerecord (>= 3.2)
activeresource (3.2.17)
activemodel (= 3.2.17)
activesupport (= 3.2.17)
@@ -396,6 +406,7 @@ DEPENDENCIES
thin (~> 1.4.1)
timecop (~> 0.3.5)
uglifier (>= 1.0.3)
+ unconfirm!
whenever
will_paginate (~> 3.0.3)
yaml_db
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 6535beb1..794ff773 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -24,6 +24,7 @@
//= require raphael-min
//= require_tree .
//= require on_the_spot
+//= require unconfirm
// Loads Bootstrap javascripts for accordions; note loading everything breaks other existing CSS/JS
//= require bootstrap-transition
//= require bootstrap-collapse
@@ -80,4 +81,4 @@ $(document).ready(function() {
return false;
}
});
-});
\ No newline at end of file
+});
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 6189bc47..6b57914d 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -333,6 +333,8 @@
+ <%= include_unconfirm %>
+ <%= unconfirm_tag %>
<%= yield :javascript %>
diff --git a/app/views/student_exercises/_add_and_turn_in_free_responses.html.erb b/app/views/student_exercises/_add_and_turn_in_free_responses.html.erb
index e3bda7af..6f3d062e 100644
--- a/app/views/student_exercises/_add_and_turn_in_free_responses.html.erb
+++ b/app/views/student_exercises/_add_and_turn_in_free_responses.html.erb
@@ -75,13 +75,12 @@
-
+
- <%= f.submit "Turn in my answer",
+ <%= f.submit "Turn in my answer",
:name => "save_and_lock",
- :class => 'link_button',
- :confirm => "After you turn in your answer, you can no longer change it. " +
- "Are you sure you want to turn in your answer?" %>
+ :class => 'link_button unconfirm',
+ :data => data_with_unconfirm('skip_answer_submitted_confirmation_dialog') %>
diff --git a/app/views/student_exercises/_multiple_choice_form.html.erb b/app/views/student_exercises/_multiple_choice_form.html.erb
index b937bb19..c78da6b9 100644
--- a/app/views/student_exercises/_multiple_choice_form.html.erb
+++ b/app/views/student_exercises/_multiple_choice_form.html.erb
@@ -37,10 +37,9 @@
- <%= f.submit "Turn in my choice",
- :class => 'link_button',
- :confirm => "After you turn in your selected answer, you can no longer change it. " +
- "Are you sure you want to turn it in?" %>
+ <%= f.submit "Turn in my choice",
+ :class => 'link_button unconfirm',
+ :data => data_with_unconfirm('skip_answer_submitted_confirmation_dialog') %>
<% end %>
@@ -53,4 +52,4 @@
});
})
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/config/unconfirm/student_user_settings.yml b/config/unconfirm/student_user_settings.yml
new file mode 100644
index 00000000..fd990b2a
--- /dev/null
+++ b/config/unconfirm/student_user_settings.yml
@@ -0,0 +1,20 @@
+category: student
+description: >
+ This category contains the settings for confirmation messages
+ when you are viewing the OST application as a student.
+
+settings:
+ skip_answer_submitted_confirmation_dialog:
+ description: >
+ This setting controls if you are shown a confirmation dialog
+ before you submit a free response or a multiple choice answer.
+ message: >
+ After you turn in your answer, you can no longer change it.
+ Are you sure you want to turn in your answer?
+ message_title: >
+ Are you sure?
+ dont_show_text: Don't show this message again.
+ continue_text: Continue
+ cancel_text: Cancel
+
+
diff --git a/db/migrate/20140622221005_create_unconfirm_user_settings.unconfirm_engine.rb b/db/migrate/20140622221005_create_unconfirm_user_settings.unconfirm_engine.rb
new file mode 100644
index 00000000..4fe337e0
--- /dev/null
+++ b/db/migrate/20140622221005_create_unconfirm_user_settings.unconfirm_engine.rb
@@ -0,0 +1,12 @@
+# This migration comes from unconfirm_engine (originally 20140613110759)
+class CreateUnconfirmUserSettings < ActiveRecord::Migration
+ def change
+ create_table(:unconfirm_user_settings) do |t|
+ t.integer :user_id, :null => false
+ t.text :settings
+ t.timestamps
+ end
+
+ add_index :unconfirm_user_settings, :user_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 30f4abf4..14f85348 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140218235334) do
+ActiveRecord::Schema.define(:version => 20140622221005) do
create_table "assignment_coworkers", :force => true do |t|
t.integer "student_assignment_id"
@@ -588,6 +588,15 @@
add_index "topics", ["name", "learning_plan_id"], :name => "index_topics_on_name_scoped", :unique => true
add_index "topics", ["number", "learning_plan_id"], :name => "index_topics_on_number_scoped", :unique => true
+ create_table "unconfirm_user_settings", :force => true do |t|
+ t.integer "user_id", :null => false
+ t.text "settings"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "unconfirm_user_settings", ["user_id"], :name => "index_unconfirm_user_settings_on_user_id"
+
create_table "users", :force => true do |t|
t.string "email", :null => false
t.string "encrypted_password", :default => "", :null => false