Unverified Commit 18e43fc5 authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #624 from hypothesis/clean-config

Bundle the clean theme related config options into the theme = 'clean…
parents 37ffd908 293195ba
...@@ -18,14 +18,7 @@ function configFrom(window_) { ...@@ -18,14 +18,7 @@ function configFrom(window_) {
// URL of the client's boot script. Used when injecting the client into // URL of the client's boot script. Used when injecting the client into
// child iframes. // child iframes.
clientUrl: settings.clientUrl, clientUrl: settings.clientUrl,
disableToolbarCloseBtn:settings.hostPageSetting('disableToolbarCloseBtn', {defaultValue: true}),
disableToolbarMinimizeBtn: settings.hostPageSetting('disableToolbarMinimizeBtn'),
disableToolbarHighlightsBtn: settings.hostPageSetting('disableToolbarHighlightsBtn'),
disableToolbarNewNoteBtn: settings.hostPageSetting('disableToolbarNewNoteBtn'),
disableBucketBar: settings.hostPageSetting('disableBucketBar'),
enableCleanOnboardingTheme: settings.hostPageSetting('enableCleanOnboardingTheme'),
enableExperimentalNewNoteButton: settings.hostPageSetting('enableExperimentalNewNoteButton'), enableExperimentalNewNoteButton: settings.hostPageSetting('enableExperimentalNewNoteButton'),
enableSidebarDropShadow: settings.hostPageSetting('enableSidebarDropShadow'),
theme: settings.hostPageSetting('theme'), theme: settings.hostPageSetting('theme'),
usernameUrl: settings.hostPageSetting('usernameUrl'), usernameUrl: settings.hostPageSetting('usernameUrl'),
onLayoutChange: settings.hostPageSetting('onLayoutChange'), onLayoutChange: settings.hostPageSetting('onLayoutChange'),
......
...@@ -45,7 +45,7 @@ module.exports = class Host extends Guest ...@@ -45,7 +45,7 @@ module.exports = class Host extends Guest
.css('display', 'none') .css('display', 'none')
.addClass('annotator-frame annotator-outer') .addClass('annotator-frame annotator-outer')
if config.enableSidebarDropShadow if config.theme == 'clean'
@frame.addClass('annotator-frame--drop-shadow-enabled') @frame.addClass('annotator-frame--drop-shadow-enabled')
@frame.appendTo(element) @frame.appendTo(element)
......
...@@ -59,7 +59,7 @@ $.noConflict(true)(function() { ...@@ -59,7 +59,7 @@ $.noConflict(true)(function() {
window.__hypothesis_frame = true; window.__hypothesis_frame = true;
} }
if(config.disableBucketBar) { if(config.theme === 'clean') {
delete pluginClasses.BucketBar; delete pluginClasses.BucketBar;
} }
......
...@@ -36,15 +36,10 @@ module.exports = class Sidebar extends Host ...@@ -36,15 +36,10 @@ module.exports = class Sidebar extends Host
if @plugins.Toolbar? if @plugins.Toolbar?
@toolbarWidth = @plugins.Toolbar.getWidth() @toolbarWidth = @plugins.Toolbar.getWidth()
if config.theme == 'clean'
if config.disableToolbarMinimizeBtn
@plugins.Toolbar.disableMinimizeBtn() @plugins.Toolbar.disableMinimizeBtn()
if config.disableToolbarHighlightsBtn
@plugins.Toolbar.disableHighlightsBtn() @plugins.Toolbar.disableHighlightsBtn()
if config.disableToolbarNewNoteBtn
@plugins.Toolbar.disableNewNoteBtn() @plugins.Toolbar.disableNewNoteBtn()
if config.disableToolbarCloseBtn
@plugins.Toolbar.disableCloseBtn()
this._setupGestures() this._setupGestures()
......
...@@ -81,6 +81,6 @@ describe 'Host', -> ...@@ -81,6 +81,6 @@ describe 'Host', ->
configStr = encodeURIComponent(JSON.stringify({annotations: '1234'})) configStr = encodeURIComponent(JSON.stringify({annotations: '1234'}))
assert.equal(host.frame[0].children[0].src, appURL + '?config=' + configStr) assert.equal(host.frame[0].children[0].src, appURL + '?config=' + configStr)
it 'adds drop shadow if in enableSidebarDropShadow', -> it 'adds drop shadow if the clean theme is enabled', ->
host = createHost({enableSidebarDropShadow: true}) host = createHost({theme: 'clean'})
assert.isTrue(host.frame.hasClass('annotator-frame--drop-shadow-enabled')) assert.isTrue(host.frame.hasClass('annotator-frame--drop-shadow-enabled'))
...@@ -278,26 +278,21 @@ describe 'Sidebar', -> ...@@ -278,26 +278,21 @@ describe 'Sidebar', ->
context 'Hide toolbar buttons', -> context 'Hide toolbar buttons', ->
it 'disables minimize btn', -> it 'disables minimize btn for the clean theme', ->
sidebar = createSidebar(config={disableToolbarMinimizeBtn: true}) sidebar = createSidebar(config={theme: 'clean'})
assert.called(sidebar.plugins.Toolbar.disableMinimizeBtn) assert.called(sidebar.plugins.Toolbar.disableMinimizeBtn)
it 'disables minimize btn', -> it 'disables toolbar highlights btn for the clean theme', ->
sidebar = createSidebar(config={disableToolbarHighlightsBtn: true}) sidebar = createSidebar(config={theme: 'clean'})
assert.called(sidebar.plugins.Toolbar.disableHighlightsBtn) assert.called(sidebar.plugins.Toolbar.disableHighlightsBtn)
it 'disables minimize btn', -> it 'disables new note btn for the clean theme', ->
sidebar = createSidebar(config={disableToolbarNewNoteBtn: true}) sidebar = createSidebar(config={theme: 'clean'})
assert.called(sidebar.plugins.Toolbar.disableNewNoteBtn) assert.called(sidebar.plugins.Toolbar.disableNewNoteBtn)
it 'disables minimize btn', ->
sidebar = createSidebar(config={disableToolbarCloseBtn: true})
assert.called(sidebar.plugins.Toolbar.disableCloseBtn)
describe 'layout change notifier', -> describe 'layout change notifier', ->
......
...@@ -4,7 +4,7 @@ var sessionUtil = require('../util/session-util'); ...@@ -4,7 +4,7 @@ var sessionUtil = require('../util/session-util');
// @ngInject // @ngInject
function SidebarTutorialController(session, settings) { function SidebarTutorialController(session, settings) {
this.cleanOnboardingThemeEnabled = settings.enableCleanOnboardingTheme; this.isThemeClean = settings.theme === 'clean';
this.showSidebarTutorial = function () { this.showSidebarTutorial = function () {
return sessionUtil.shouldShowSidebarTutorial(session.state); return sessionUtil.shouldShowSidebarTutorial(session.state);
......
...@@ -5,7 +5,7 @@ var Controller = require('../sidebar-tutorial').controller; ...@@ -5,7 +5,7 @@ var Controller = require('../sidebar-tutorial').controller;
describe('SidebarTutorialController', function () { describe('SidebarTutorialController', function () {
describe('showSidebarTutorial', function () { describe('showSidebarTutorial', function () {
var settings = { enableCleanOnboardingTheme: true }; var settings = { theme: 'theme' };
it('returns true if show_sidebar_tutorial is true', function () { it('returns true if show_sidebar_tutorial is true', function () {
var session = { var session = {
......
...@@ -35,9 +35,6 @@ function hostPageConfig(window) { ...@@ -35,9 +35,6 @@ function hostPageConfig(window) {
// This should be removed once new note button is enabled for everybody. // This should be removed once new note button is enabled for everybody.
'enableExperimentalNewNoteButton', 'enableExperimentalNewNoteButton',
// New onboarding theme override.
'enableCleanOnboardingTheme',
// Theme which can either be specified as 'clean'. // Theme which can either be specified as 'clean'.
// If nothing is the specified the classic look is applied. // If nothing is the specified the classic look is applied.
'theme', 'theme',
......
<div class="sheet" ng-if="vm.showSidebarTutorial() && !vm.cleanOnboardingThemeEnabled"> <div class="sheet" ng-if="vm.showSidebarTutorial() && !vm.isThemeClean">
<i class="close h-icon-close" role="button" title="Close" <i class="close h-icon-close" role="button" title="Close"
ng-click="vm.dismiss()"></i> ng-click="vm.dismiss()"></i>
<h1 class="sidebar-tutorial__header">How to get started</h1> <h1 class="sidebar-tutorial__header">How to get started</h1>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</li> </li>
</ol> </ol>
</div> </div>
<div class="sheet sheet--is-theme-clean" ng-if="vm.showSidebarTutorial() && vm.cleanOnboardingThemeEnabled"> <div class="sheet sheet--is-theme-clean" ng-if="vm.showSidebarTutorial() && vm.isThemeClean">
<i class="close h-icon-close" role="button" title="Close" <i class="close h-icon-close" role="button" title="Close"
ng-click="vm.dismiss()"></i> ng-click="vm.dismiss()"></i>
<h1 class="sidebar-tutorial__header sidebar-tutorial__header--is-theme-clean"> <h1 class="sidebar-tutorial__header sidebar-tutorial__header--is-theme-clean">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment