don't include account CSS on "Updated Terms" page

fixes CNVS-22527

test-plan:
 - when "Updated Terms of Use" page displays, should not include any
   custom account CSS

Change-Id: I98bcc48e1bf4f281ee34db8ee50ed204defc437d
Reviewed-on: https://gerrit.instructure.com/61659
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
This commit is contained in:
Jacob Fugal 2015-08-24 10:36:50 -06:00
parent 0ee76ac83e
commit b7eb10047c
3 changed files with 55 additions and 1 deletions

View File

@ -705,8 +705,18 @@ module ApplicationHelper
end
end
# allows forcing account CSS off universally for a specific situation,
# without requiring the global_includes=0 param
def disable_account_css
@disable_account_css = true
end
def disable_account_css?
@disable_account_css || params[:global_includes] == '0'
end
def include_account_css
return if params[:global_includes] == '0'
return if disable_account_css?
if use_new_styles?
includes = []
includes << brand_config_includes[:css] if brand_config_includes[:css].present?

View File

@ -2,6 +2,8 @@
content_for :page_title, t('updated_terms_of_use', 'Updated Terms of Use')
css_bundle :login
disable_account_css
@headers = false
@body_classes ||= []
@body_classes << "modal"

View File

@ -0,0 +1,42 @@
#
# Copyright (C) 2015 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../views_helper')
describe "/shared/terms_required" do
context "with custom stylesheet on account" do
before do
assigns[:domain_root_account] = Account.default
expect(Account.default.feature_enabled?(:use_new_styles)).to be_falsey
expect(Account.default.feature_enabled?(:k12)).to be_falsey
Account.default.settings = {global_includes: true, global_stylesheet: '/custom_stylesheet.css'}
Account.default.save!
end
it "should still include application stylesheet" do
render template: "shared/terms_required", layout: "layouts/application"
expect(response).to match(%r{<link href="[^"]*bundles/login-[^"]*\.css"})
end
it "should not include custom stylesheet" do
render template: "shared/terms_required", layout: "layouts/application"
expect(response).not_to match(%r{<link href="/custom_stylesheet\.css"})
end
end
end