[PE mobile] Add slides.
This commit is contained in:
parent
35ed40ce15
commit
409121c262
|
@ -150,7 +150,8 @@ require([
|
|||
'AddTable',
|
||||
'AddShape',
|
||||
'AddImage',
|
||||
'AddLink'
|
||||
'AddLink',
|
||||
'AddSlide'
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -214,7 +215,8 @@ require([
|
|||
'presentationeditor/mobile/app/controller/add/AddTable',
|
||||
'presentationeditor/mobile/app/controller/add/AddShape',
|
||||
'presentationeditor/mobile/app/controller/add/AddImage',
|
||||
'presentationeditor/mobile/app/controller/add/AddLink'
|
||||
'presentationeditor/mobile/app/controller/add/AddLink',
|
||||
'presentationeditor/mobile/app/controller/add/AddSlide'
|
||||
|
||||
], function() {
|
||||
app.start();
|
||||
|
|
|
@ -161,7 +161,8 @@ require([
|
|||
'AddTable',
|
||||
'AddShape',
|
||||
'AddImage',
|
||||
'AddLink'
|
||||
'AddLink',
|
||||
'AddSlide'
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -225,7 +226,8 @@ require([
|
|||
'presentationeditor/mobile/app/controller/add/AddTable',
|
||||
'presentationeditor/mobile/app/controller/add/AddShape',
|
||||
'presentationeditor/mobile/app/controller/add/AddImage',
|
||||
'presentationeditor/mobile/app/controller/add/AddLink'
|
||||
'presentationeditor/mobile/app/controller/add/AddLink',
|
||||
'presentationeditor/mobile/app/controller/add/AddSlide'
|
||||
], function() {
|
||||
app.start();
|
||||
});
|
||||
|
|
|
@ -108,7 +108,9 @@ define([
|
|||
addViews.push({
|
||||
caption: me.textSlide,
|
||||
id: 'add-slide',
|
||||
layout: me._dummyEditController().getLayout()
|
||||
layout: PE.getController('AddSlide')
|
||||
.getView('AddSlide')
|
||||
.rootLayout()
|
||||
});
|
||||
|
||||
addViews.push({
|
||||
|
|
127
apps/presentationeditor/mobile/app/controller/add/AddSlide.js
Normal file
127
apps/presentationeditor/mobile/app/controller/add/AddSlide.js
Normal file
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2016
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* AddSlide.js
|
||||
* Presentation Editor
|
||||
*
|
||||
* Created by Julia Radzhabova on 12/06/16
|
||||
* Copyright (c) 2016 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
define([
|
||||
'core',
|
||||
'presentationeditor/mobile/app/view/add/AddSlide'
|
||||
], function (core) {
|
||||
'use strict';
|
||||
|
||||
PE.Controllers.AddSlide = Backbone.Controller.extend(_.extend((function() {
|
||||
var _layouts = [];
|
||||
|
||||
return {
|
||||
models: [],
|
||||
collections: [],
|
||||
views: [
|
||||
'AddSlide'
|
||||
],
|
||||
|
||||
initialize: function () {
|
||||
Common.NotificationCenter.on('addcontainer:show', _.bind(this.initEvents, this));
|
||||
},
|
||||
|
||||
setApi: function (api) {
|
||||
var me = this;
|
||||
me.api = api;
|
||||
me.api.asc_registerCallback('asc_onUpdateLayout', _.bind(me.onUpdateLayout, me));
|
||||
},
|
||||
|
||||
onLaunch: function () {
|
||||
this.createView('AddSlide').render();
|
||||
},
|
||||
|
||||
initEvents: function () {
|
||||
var me = this;
|
||||
me.getView('AddSlide').updateLayouts(_layouts);
|
||||
$('#add-slide .slide-layout li').single('click', _.buffered(me.onStyleClick, 100, me));
|
||||
},
|
||||
|
||||
onStyleClick: function (e) {
|
||||
var me = this,
|
||||
$target = $(e.currentTarget),
|
||||
type = $target.data('type');
|
||||
|
||||
me.api.AddSlide(type);
|
||||
|
||||
PE.getController('AddContainer').hideModal();
|
||||
},
|
||||
|
||||
// Public
|
||||
|
||||
getLayouts: function () {
|
||||
return _layouts;
|
||||
},
|
||||
|
||||
// API handlers
|
||||
|
||||
onUpdateLayout: function(layouts){
|
||||
var me = this;
|
||||
_layouts = [];
|
||||
if (!_.isEmpty(layouts)){
|
||||
_.each(layouts, function(layout){
|
||||
var name = layout.get_Name();
|
||||
_layouts.push({
|
||||
imageUrl : layout.get_Image(),
|
||||
title : (name !== '') ? name : me.layoutNames[layout.getType()],
|
||||
itemWidth : layout.get_Width(),
|
||||
itemHeight : layout.get_Height(),
|
||||
idx : layout.getIndex()
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Common.SharedSettings.set('slidelayouts', _layouts);
|
||||
Common.NotificationCenter.trigger('slidelayouts:load', _layouts);
|
||||
|
||||
this.getView('AddSlide').updateLayouts(_layouts);
|
||||
$('#add-slide .slide-layout li').single('click', _.buffered(me.onStyleClick, 100, me));
|
||||
},
|
||||
|
||||
textTableSize: 'Table Size',
|
||||
textColumns: 'Columns',
|
||||
textRows: 'Rows',
|
||||
textCancel: 'Cancel'
|
||||
}
|
||||
})(), PE.Controllers.AddSlide || {}))
|
||||
});
|
|
@ -0,0 +1,5 @@
|
|||
<!-- Root view -->
|
||||
<div id="add-slide-root">
|
||||
<div class="page-content dataview slide-layout" style="width: 100%;">
|
||||
</div>
|
||||
</div>
|
135
apps/presentationeditor/mobile/app/view/add/AddSlide.js
Normal file
135
apps/presentationeditor/mobile/app/view/add/AddSlide.js
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2016
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* AddSlide.js
|
||||
* Presentation Editor
|
||||
*
|
||||
* Created by Julia Radzhabova on 12/06/16
|
||||
* Copyright (c) 2016 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'text!presentationeditor/mobile/app/template/AddSlide.template',
|
||||
'jquery',
|
||||
'underscore',
|
||||
'backbone'
|
||||
], function (addTemplate, $, _, Backbone) {
|
||||
'use strict';
|
||||
|
||||
PE.Views.AddSlide = Backbone.View.extend(_.extend((function() {
|
||||
// private
|
||||
var _layouts = [];
|
||||
|
||||
return {
|
||||
// el: '.view-main',
|
||||
|
||||
template: _.template(addTemplate),
|
||||
|
||||
events: {
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
Common.NotificationCenter.on('addcontainer:show', _.bind(this.initEvents, this));
|
||||
},
|
||||
|
||||
initEvents: function () {
|
||||
var me = this;
|
||||
me.initControls();
|
||||
},
|
||||
|
||||
// Render layout
|
||||
render: function () {
|
||||
this.layout = $('<div/>').append(this.template({
|
||||
android : Common.SharedSettings.get('android'),
|
||||
phone : Common.SharedSettings.get('phone')
|
||||
}));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
rootLayout: function () {
|
||||
if (this.layout) {
|
||||
return this.layout
|
||||
.find('#add-slide-root')
|
||||
.html();
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
|
||||
initControls: function () {
|
||||
//
|
||||
},
|
||||
|
||||
updateLayouts: function (layouts) {
|
||||
_layouts = layouts;
|
||||
this.renderLayouts();
|
||||
},
|
||||
|
||||
renderLayouts: function() {
|
||||
var $layoutContainer = $('.container-add .slide-layout');
|
||||
if ($layoutContainer.length > 0 && _layouts.length>0) {
|
||||
var columns = parseInt(($layoutContainer.width()-20) / (_layouts[0].itemWidth+2)), // magic
|
||||
row = -1,
|
||||
layouts = [];
|
||||
|
||||
_.each(_layouts, function (layout, index) {
|
||||
if (0 == index % columns) {
|
||||
layouts.push([]);
|
||||
row++
|
||||
}
|
||||
layouts[row].push(layout);
|
||||
});
|
||||
|
||||
var template = _.template([
|
||||
'<% _.each(layouts, function(row) { %>',
|
||||
'<ul class="row">',
|
||||
'<% _.each(row, function(item) { %>',
|
||||
'<li data-type="<%= item.idx %>">',
|
||||
'<img src="<%= item.imageUrl %>" width="<%= item.itemWidth %>" height="<%= item.itemHeight %>">',
|
||||
'</li>',
|
||||
'<% }); %>',
|
||||
'</ul>',
|
||||
'<% }); %>'
|
||||
].join(''), {
|
||||
layouts: layouts
|
||||
});
|
||||
|
||||
$layoutContainer.html(template);
|
||||
}
|
||||
}
|
||||
}
|
||||
})(), PE.Views.AddSlide || {}))
|
||||
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -171,3 +171,22 @@ input, textarea {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Slide layout
|
||||
|
||||
.slide-layout {
|
||||
.row {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 1px;
|
||||
|
||||
img {
|
||||
width: 119px;
|
||||
height: 67px;
|
||||
box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -165,3 +165,21 @@ input, textarea {
|
|||
}
|
||||
}
|
||||
|
||||
// Slide layout
|
||||
|
||||
.slide-layout {
|
||||
.row {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 1px;
|
||||
|
||||
img {
|
||||
width: 119px;
|
||||
height: 67px;
|
||||
box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue