diff --git a/Gemfile.lock b/Gemfile.lock index 5cd226018..3727ddc06 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ PATH compass (>= 0.12.7) compass-blueprint (~> 1.0.0) compass-rails (>= 1.1.7) - haml (~> 4.0.5) + haml (>= 4.0.5) i18n (~> 0.6) jquery-rails (>= 2.2.2) jquery-ui-rails (~> 3.0.1) @@ -185,7 +185,7 @@ GEM jquery-ui-rails (3.0.1) jquery-rails railties (>= 3.1.0) - json (2.0.4) + json (2.1.0) launchy (2.4.3) addressable (~> 2.3) libv8 (3.16.14.17) @@ -196,7 +196,7 @@ GEM loofah (2.0.3) nokogiri (>= 1.5.9) lumberjack (1.0.10) - mail (2.6.4) + mail (2.6.5) mime-types (>= 1.16, < 4) maruku (0.6.1) syntax (>= 1.0.0) diff --git a/app/views/quby/v1/bulk.html.haml b/app/views/quby/v1/bulk.html.haml index baf572789..d91b9da31 100644 --- a/app/views/quby/v1/bulk.html.haml +++ b/app/views/quby/v1/bulk.html.haml @@ -1,9 +1,9 @@ :javascript window.panel_validations = {}; // for setting values of raw_content - window.extra_question_values = #{@answer.extra_question_values}; + window.extra_question_values = #{raw @answer.extra_question_values}; // for showing validations of raw content - window.extra_failed_validations = #{@answer.extra_failed_validations}; + window.extra_failed_validations = #{raw @answer.extra_failed_validations}; - content_for(:extra_css, raw(@questionnaire.extra_css)) @@ -23,7 +23,7 @@ - panel_id = "panel#{panel_counter}" %fieldset{:id => panel_id, :class => "panel"} :javascript - panel_validations["panel#{panel_counter}"] = #{get_validation_json(panel.validations)}; + panel_validations["panel#{panel_counter}"] = #{raw get_validation_json(panel.validations)}; = render :partial => 'quby/v1/shared/backbone_panel', :locals => {:panel => panel, | :panel_id => panel_id, | :answer => @answer} | diff --git a/app/views/quby/v1/paged.html.haml b/app/views/quby/v1/paged.html.haml index 6b9edde9c..c5ba0bb14 100644 --- a/app/views/quby/v1/paged.html.haml +++ b/app/views/quby/v1/paged.html.haml @@ -1,9 +1,9 @@ :javascript window.panel_validations = {}; // for setting values of raw_content - window.extra_question_values = #{@answer.extra_question_values}; + window.extra_question_values = #{raw @answer.extra_question_values}; // for showing validations of raw content - window.extra_failed_validations = #{@answer.extra_failed_validations}; + window.extra_failed_validations = #{raw @answer.extra_failed_validations}; - content_for(:extra_css, raw(@questionnaire.extra_css)) diff --git a/app/views/quby/v1/paged/_panel.html.haml b/app/views/quby/v1/paged/_panel.html.haml index bae79de45..168f65422 100644 --- a/app/views/quby/v1/paged/_panel.html.haml +++ b/app/views/quby/v1/paged/_panel.html.haml @@ -10,7 +10,7 @@ = render :partial => "quby/v1/hotkey_dialog" :javascript - panel_validations["panel#{panel_counter}"] = #{get_validation_json(panel.validations)}; + panel_validations["panel#{panel_counter}"] = #{raw get_validation_json(panel.validations)}; = render :partial => 'quby/v1/shared/backbone_panel', :locals => {:panel => panel, | :panel_id => panel_id, | :answer => @answer} | diff --git a/app/views/quby/v1/print.html.haml b/app/views/quby/v1/print.html.haml index eec089d41..202c36604 100644 --- a/app/views/quby/v1/print.html.haml +++ b/app/views/quby/v1/print.html.haml @@ -1,9 +1,9 @@ :javascript window.panel_validations = {}; //for setting values of raw_content - window.extra_question_values = #{@answer.extra_question_values}; + window.extra_question_values = #{raw @answer.extra_question_values}; // for showing validations of raw content - window.extra_failed_validations = #{@answer.extra_failed_validations}; + window.extra_failed_validations = #{raw @answer.extra_failed_validations}; - content_for(:extra_css, raw(@questionnaire.extra_css)) diff --git a/app/views/quby/v1/shared/_backbone_panel.html.haml b/app/views/quby/v1/shared/_backbone_panel.html.haml index 08f64f7c4..f5f36faad 100644 --- a/app/views/quby/v1/shared/_backbone_panel.html.haml +++ b/app/views/quby/v1/shared/_backbone_panel.html.haml @@ -11,7 +11,7 @@ :javascript $(function() { Quby.currentPanelQuestions = new Quby.Collections.Questions; - var questions = #{questions.as_json.to_json}; + var questions = #{raw questions.as_json.to_json}; var initializer = new Quby.Logic.InitQuestions(questions); Quby.currentPanelQuestions = initializer.initializeQuestions(); Quby.questions.addQuestions(Quby.currentPanelQuestions); diff --git a/app/views/quby/v1/shared/_footer_javascript.html.haml b/app/views/quby/v1/shared/_footer_javascript.html.haml index 2d9f74065..b1adfe696 100644 --- a/app/views/quby/v1/shared/_footer_javascript.html.haml +++ b/app/views/quby/v1/shared/_footer_javascript.html.haml @@ -1,11 +1,11 @@ :javascript $(function() { Quby.init({ - questionnaire_key: #{@questionnaire.key.to_json}, - answer_value: #{@answer.value.to_json}, - flag_definitions: #{answer.questionnaire.flags.to_json}, - flag_values: #{answer.flags.to_json}, - textvars: #{@answer.textvars.to_json} + questionnaire_key: #{raw @questionnaire.key.to_json}, + answer_value: #{raw @answer.value.to_json}, + flag_definitions: #{raw answer.questionnaire.flags.to_json}, + flag_values: #{raw answer.flags.to_json}, + textvars: #{raw @answer.textvars.to_json} }); // Initialize all panels in bulk, activate first panel otherwise diff --git a/app/views/quby/v1/single_page.html.haml b/app/views/quby/v1/single_page.html.haml index cc3af47f6..d93e2b140 100644 --- a/app/views/quby/v1/single_page.html.haml +++ b/app/views/quby/v1/single_page.html.haml @@ -1,9 +1,9 @@ :javascript window.panel_validations = {}; // for setting values of raw_content - window.extra_question_values = #{@answer.extra_question_values}; + window.extra_question_values = #{raw @answer.extra_question_values}; // for showing validations of raw content - window.extra_failed_validations = #{@answer.extra_failed_validations}; + window.extra_failed_validations = #{raw @answer.extra_failed_validations}; - content_for(:extra_css, raw(@questionnaire.extra_css)) @@ -22,7 +22,7 @@ - panel_id = "panel#{panel_counter}" %fieldset{:id => panel_id, :class => "panel"} :javascript - panel_validations["panel#{panel_counter}"] = #{get_validation_json(panel.validations)}; + panel_validations["panel#{panel_counter}"] = #{raw get_validation_json(panel.validations)}; = render :partial => 'quby/v1/shared/backbone_panel', :locals => {:panel => panel, | :panel_id => panel_id, | :answer => @answer} | diff --git a/gemfiles/rails41.gemfile b/gemfiles/rails41.gemfile index 734c3b542..6fcc939c9 100644 --- a/gemfiles/rails41.gemfile +++ b/gemfiles/rails41.gemfile @@ -11,6 +11,7 @@ gem "susy", "~> 2.2.12" gem "compass-rails", "~> 2.0.0" gem "rails", "~> 4.1.4" gem "jquery-rails", "~> 2.2.2" +gem "haml", "~> 4.0.5" group :assets do gem "coffee-rails" diff --git a/gemfiles/rails42.gemfile b/gemfiles/rails42.gemfile index aa71ef163..8960f1562 100644 --- a/gemfiles/rails42.gemfile +++ b/gemfiles/rails42.gemfile @@ -12,6 +12,7 @@ gem "compass-rails", "~> 2.0.0" gem "rails", "~> 4.2.7" gem "eventmachine", "~> 1.2.0" gem "jquery-rails", "~> 4.2.2" +gem "haml", "~> 4.0.5" group :assets do gem "coffee-rails" diff --git a/gemfiles/rails5.gemfile b/gemfiles/rails5.gemfile index 0c2af3799..adf2094db 100644 --- a/gemfiles/rails5.gemfile +++ b/gemfiles/rails5.gemfile @@ -15,6 +15,7 @@ gem "maruku", "~> 0.6.1" gem "sprockets-rails", "~> 2.3.3" gem "jquery-rails", "~> 4.2.2" gem "rails-controller-testing" +gem "haml", "~> 5.0.1" group :assets do gem "coffee-rails" @@ -26,7 +27,7 @@ group :test, :development do gem "guard-teaspoon", "~> 0.8" gem "guard-spork", "~> 2.1" gem "guard-rubocop", "~> 1.0" - gem "capybara", ">= 2.8.1" + gem "capybara", ">= 2.14.0" gem "capybara-screenshot", "~> 0.3.14" gem "poltergeist" gem "timecop" diff --git a/quby.gemspec b/quby.gemspec index 655da65a7..ee7a76c82 100644 --- a/quby.gemspec +++ b/quby.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |s| # Views s.add_dependency 'coffee-rails' - s.add_dependency "haml", '~> 4.0.5' + s.add_dependency "haml", '>= 4.0.5' s.add_dependency "sass-rails", '>= 4.0.5' s.add_dependency "maruku", '0.6.1' s.add_dependency "compass", '>= 0.12.7' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e897b43fd..c73ed8480 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -48,6 +48,9 @@ end Capybara.javascript_driver = :poltergeist +# Haml 5.0 escapes interpolated code in filters, not good. +Haml::Template.options[:escape_html] = false + # This needs to happen once before the :each block so that spec/features/display_modes_spec.rb # can iterate over all fixtures and add specs for each of them. Quby.questionnaire_repo = Quby::Questionnaires::Repos::DiskRepo.new(Quby.fixtures_path)