Skip to content
Snippets Groups Projects
Commit 62045360 authored by Jacob Poul Richardt's avatar Jacob Poul Richardt
Browse files

Tab title is now set from experiment name.

parent d185fcb6
No related branches found
No related tags found
No related merge requests found
......@@ -12,12 +12,12 @@ class Header extends QuestionBase<any>
if (inputs.length === 0 || inputs[0].HeaderLabel == undefined) throw new Error("HeaderLabel not found for Header");
ExperimentManager.Title(this.GetFormatted(inputs[0].HeaderLabel));
ExperimentManager.SlideTitle(this.GetFormatted(inputs[0].HeaderLabel));
}
public SlideCompleted(): boolean
{
ExperimentManager.Title("");
ExperimentManager.SlideTitle("");
return false;
}
......
......@@ -38,7 +38,7 @@ class SlideShell
this.IsNextSlideEnabled = knockout.computed(() => this.IsNextSlideVisible() && !this.IsLoadingSlide());
this.IsCloseExperimentVisible = knockout.computed(() => ExperimentManager.IsExperimentCompleted() && ExperimentManager.CloseExperimentEnabled());
this.Title = ExperimentManager.Title;
this.Title = ExperimentManager.SlideTitle;
this.HasTitle = knockout.computed(() => this.Title() !== "");
this._experimentMangerIsReadySubscription = ExperimentManager.IsReady.subscribe(r =>
......
define(["require", "exports", "knockout", "CockpitPortal", "Managers/Navigation"], function (require, exports, knockout, CockpitPortal, Navigation) {
define(["require", "exports", "knockout", "CockpitPortal", "Managers/Navigation", "Managers/Title"], function (require, exports, knockout, CockpitPortal, Navigation, Title) {
var Experiment = (function () {
function Experiment() {
var _this = this;
......@@ -7,6 +7,7 @@ define(["require", "exports", "knockout", "CockpitPortal", "Managers/Navigation"
this.NumberOfSlides = knockout.observable(0);
this.IsExperimentCompleted = knockout.observable(false);
this.Title = knockout.observable("");
this.SlideTitle = knockout.observable("");
this.FooterLabel = knockout.observable(null);
this.StyleSheet = knockout.observable(null);
this.CompletedUrl = knockout.observable(null);
......@@ -26,6 +27,7 @@ define(["require", "exports", "knockout", "CockpitPortal", "Managers/Navigation"
document.head.appendChild(_this._styleSheetElement);
}
});
this.Title.subscribe(function (title) { return Title.ToDefault(title == "" ? null : title); });
this.CloseExperimentEnabled = knockout.computed(function () { return _this.CompletedUrl() != null; });
Navigation.ExperimentId.subscribe(function (id) {
if (id != null)
......@@ -54,6 +56,7 @@ define(["require", "exports", "knockout", "CockpitPortal", "Managers/Navigation"
if (response.Body.Results.length === 0)
throw new Error("No Experiment data retuened");
var config = response.Body.Results[0];
_this.Title(config.Name);
_this.CloseSlidesEnabled(config.LockQuestion);
_this.GoToPreviousSlideEnabled(config.EnablePrevious);
_this.FooterLabel(config.FooterLabel);
......
import knockout = require("knockout");
import CockpitPortal = require("CockpitPortal");
import Navigation = require("Managers/Navigation");
import Title = require("Managers/Title");
class Experiment
{
......@@ -12,6 +13,7 @@ class Experiment
public IsExperimentCompleted: KnockoutObservable<boolean> = knockout.observable(false);
public Title: KnockoutObservable<string> = knockout.observable("");
public SlideTitle: KnockoutObservable<string> = knockout.observable("");
public FooterLabel: KnockoutObservable<string> = knockout.observable(null);
public StyleSheet: KnockoutObservable<string> = knockout.observable(null);
public CompletedUrl: KnockoutObservable<string> = knockout.observable(null);
......@@ -43,6 +45,7 @@ class Experiment
document.head.appendChild(this._styleSheetElement);
}
});
this.Title.subscribe(title => Title.ToDefault(title == "" ? null : title));
this.CloseExperimentEnabled = knockout.computed(() => this.CompletedUrl() != null);
......@@ -79,6 +82,7 @@ class Experiment
var config = response.Body.Results[0];
this.Title(config.Name);
this.CloseSlidesEnabled(config.LockQuestion);
this.GoToPreviousSlideEnabled(config.EnablePrevious);
this.FooterLabel(config.FooterLabel);
......
define(["require", "exports", "knockout", "routie", "Managers/NavigationPage"], function (require, exports, knockout, Routie, NavigationPage) {
define(["require", "exports", "knockout", "routie", "Managers/NavigationPage", "Managers/Title"], function (require, exports, knockout, Routie, NavigationPage, Title) {
var Navigation = (function () {
function Navigation() {
var _this = this;
......@@ -36,12 +36,13 @@ define(["require", "exports", "knockout", "routie", "Managers/NavigationPage"],
Routie(path);
};
Navigation.prototype.LoadPage = function (name, data) {
Title.ToDefault();
this.CurrentPage(new NavigationPage(name, data));
};
Navigation.prototype.LoadSlide = function (id) {
this.ExperimentId(id);
if (this.CurrentPage() == null || this.CurrentPage().Name() !== "SlideShell")
this.CurrentPage(new NavigationPage("SlideShell"));
this.LoadPage("SlideShell");
};
Navigation.prototype.LoadExperimentFromList = function (id) {
this.ExperimentId(null);
......
import knockout = require("knockout");
import Routie = require("routie");
import NavigationPage = require("Managers/NavigationPage");
import Title = require("Managers/Title");
class Navigation
{
......@@ -29,6 +30,7 @@ class Navigation
private LoadPage(name: string, data?:any): void
{
Title.ToDefault();
this.CurrentPage(new NavigationPage(name, data));
}
......@@ -37,7 +39,7 @@ class Navigation
this.ExperimentId(id);
if (this.CurrentPage() == null || this.CurrentPage().Name() !== "SlideShell")
this.CurrentPage(new NavigationPage("SlideShell"));
this.LoadPage("SlideShell");
}
private LoadExperimentFromList(id:string):void
......
......@@ -14,7 +14,7 @@ define(["require", "exports", "knockout"], function (require, exports, knockout)
this.Title((subName == null ? "" : subName + " - ") + Title.defaultName);
this.isDefault = true;
};
Title.defaultName = "Cockpit";
Title.defaultName = document.title;
return Title;
})();
var instance = new Title();
......
......@@ -4,7 +4,7 @@ class Title
{
public Title: KnockoutObservable<string>;
private isDefault: boolean = true;
private static defaultName: string = "Cockpit";
private static defaultName: string = document.title;
constructor()
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment