123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- 'use strict';
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Storytelling
- *| (C) Copyright IBM Corp. 2018, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define(['gemini/dashboard/glass/BaseView', './StoryLayoutPickerView', 'storytelling/nls/StringResources', 'text!storytelling/glass/templates/CreateStoryView.html', 'baglass/core-client/js/core-client/utils/UniqueId'], function (BaseView, StoryLayoutPickerView, stringResources, template, UniqueId) {
- var CreateStoryView = BaseView.extend({
- templateString: template,
- events: {
- 'primaryaction .createButton': 'createStoryView',
- 'primaryaction .cancelButton': 'onCancelClick'
- },
- init: function init(options) {
- CreateStoryView.inherited('init', this, arguments);
- this.ui_appbar = options.ui_appbar !== false;
- this.boardName = stringResources.get('defaultStoryName');
- },
- render: function render() {
- this.$el.empty();
- var html = this.dotTemplate({
- createStoryTitle: stringResources.get('createStoryTitle'),
- transitionStyleTitle: stringResources.get('transitionStyleTitle'),
- createButton: stringResources.get('createButton'),
- cancelButton: stringResources.get('cancelButton')
- });
- this.storyLayoutPickerView = new StoryLayoutPickerView({
- action: this.createStoryView.bind(this)
- });
- this.storyLayoutPickerView.render();
- this.$el.html(html);
- this.$el.find('.transitionStyleTitle').after(this.storyLayoutPickerView.el);
- return Promise.resolve();
- },
- getUrl: function getUrl() {
- return null;
- },
- getIcon: function getIcon() {
- return 'common-catalog';
- },
- getTitle: function getTitle() {
- return stringResources.get('createStoryViewTitle');
- },
- onCancelClick: function onCancelClick() {
- this.close();
- },
- createStoryView: function createStoryView() {
- return this.storyLayoutPickerView.getSelectedLayoutSpec().then(function (_ref) {
- var layout = _ref.layout;
- return this._openStory(this._getStorySpec(layout));
- }.bind(this));
- },
- _getStorySpec: function _getStorySpec(navLayout) {
- return {
- name: this.boardName,
- layout: navLayout.layout,
- theme: 'defaultTheme',
- timeline: this._getTimeline(navLayout.widgets),
- widgets: navLayout.widgets,
- _meta: {
- bundleID: null
- }
- };
- },
- _getTimeline: function _getTimeline(widgets) {
- var episodes = [];
- Object.keys(widgets).forEach(function (widgetId) {
- episodes.push({
- 'id': widgetId,
- 'type': 'widget',
- 'acts': [{
- 'id': UniqueId.get('act_'),
- 'timer': 0,
- 'action': 'show'
- }, {
- 'id': UniqueId.get('act_'),
- 'timer': 5000,
- 'action': 'hide'
- }]
- });
- });
- return {
- id: UniqueId.get('timeline_'),
- episodes: episodes
- };
- },
- _openStory: function _openStory(spec) {
- var id = spec._meta.bundleID;
- return this.glassContext.appController.openAppView('story', {
- content: {
- id: UniqueId.get('dashboard_'),
- boardId: id,
- boardSpec: spec,
- isAuthoringMode: true,
- ui_appbar: this.ui_appbar,
- containerAppOptions: this.containerAppOptions
- }
- }).then(function (view) {
- return view.onViewRendered();
- }).then(function () {
- this.close();
- }.bind(this));
- },
- close: function close() {
- this.glassContext.appController.closeAppView('createStory');
- }
- });
- return CreateStoryView;
- });
- //# sourceMappingURL=CreateStoryView.js.map
|