Commit 9c65d45f authored by Julia Radzhabova's avatar Julia Radzhabova

[PE mobile] Edit hyperlinks.

parent 9be7b6ef
......@@ -141,12 +141,11 @@ require([
'Settings',
'EditContainer',
'EditText',
// 'EditParagraph',
'EditTable',
'EditImage',
'EditShape',
// 'EditChart',
// 'EditHyperlink',
'EditLink',
'AddContainer',
'AddTable',
'AddShape',
......@@ -206,12 +205,11 @@ require([
'presentationeditor/mobile/app/controller/Settings',
'presentationeditor/mobile/app/controller/edit/EditContainer',
'presentationeditor/mobile/app/controller/edit/EditText',
// 'presentationeditor/mobile/app/controller/edit/EditParagraph',
'presentationeditor/mobile/app/controller/edit/EditTable',
'presentationeditor/mobile/app/controller/edit/EditImage',
'presentationeditor/mobile/app/controller/edit/EditShape',
// 'presentationeditor/mobile/app/controller/edit/EditChart',
// 'presentationeditor/mobile/app/controller/edit/EditHyperlink',
'presentationeditor/mobile/app/controller/edit/EditLink',
'presentationeditor/mobile/app/controller/add/AddContainer',
'presentationeditor/mobile/app/controller/add/AddTable',
'presentationeditor/mobile/app/controller/add/AddShape',
......
......@@ -152,12 +152,11 @@ require([
// 'Settings',
// 'EditContainer',
'EditText',
// 'EditParagraph'
'EditTable',
'EditImage',
'EditShape',
// 'EditChart',
// 'EditHyperlink',
'EditLink',
'AddContainer',
'AddTable',
'AddShape',
......@@ -217,12 +216,11 @@ require([
// 'presentationeditor/mobile/app/controller/Settings',
'presentationeditor/mobile/app/controller/edit/EditContainer',
'presentationeditor/mobile/app/controller/edit/EditText',
// 'presentationeditor/mobile/app/controller/edit/EditParagraph'
'presentationeditor/mobile/app/controller/edit/EditTable',
'presentationeditor/mobile/app/controller/edit/EditImage',
'presentationeditor/mobile/app/controller/edit/EditShape',
// 'presentationeditor/mobile/app/controller/edit/EditChart',
// 'presentationeditor/mobile/app/controller/edit/EditHyperlink',
'presentationeditor/mobile/app/controller/edit/EditLink',
'presentationeditor/mobile/app/controller/add/AddContainer',
'presentationeditor/mobile/app/controller/add/AddTable',
'presentationeditor/mobile/app/controller/add/AddShape',
......
......@@ -46,8 +46,7 @@ define([
'use strict';
PE.Controllers.AddLink = Backbone.Controller.extend(_.extend((function() {
var _linkObject = undefined,
c_oHyperlinkType = {
var c_oHyperlinkType = {
InternalLink:0,
WebLink: 1
},
......@@ -105,11 +104,15 @@ define([
var $target = $(e.currentTarget);
if ($target && $target.prop('id') === 'add-link') {
_linkType = c_oHyperlinkType.WebLink;
_slideLink = _slideNum = 0;
_isDisplayChanged = false;
var text = this.api.can_AddHyperlink();
if (text !== false) {
_linkObject = new Asc.CHyperlinkProperty();
_linkObject.put_Text(text);
$('#add-link-display input').val((text !== null) ? text : this.textDefault);
$('#add-link-display').toggleClass('disabled', text === null);
}
this.initSettings();
}
},
......@@ -123,11 +126,7 @@ define([
_slidesCount = me.api.getCountPages();
$('#page-addlink-slidenumber input').val([_slideLink]);
$('#addlink-slide-number .item-after label').text(_slideNum+1);
} else if (_linkObject) {
var text = _linkObject.get_Text();
$('#add-link-display input').val((text!==null) ? text : me.textDefault);
$('#add-link-display').toggleClass('disabled',text===null);
} else {
$('#add-link-type .item-after').text((_linkType==c_oHyperlinkType.WebLink) ? me.textExternalLink : me.textInternalLink);
$('#add-link-url')[(_linkType==c_oHyperlinkType.WebLink) ? 'show' : 'hide']();
$('#add-link-number')[(_linkType==c_oHyperlinkType.WebLink) ? 'hide' : 'show']();
......
......@@ -157,7 +157,7 @@ define([
editors.push({
caption: me.textHyperlink,
id: 'edit-link',
layout: PE.getController('EditHyperlink').getView('EditHyperlink').rootLayout()
layout: PE.getController('EditLink').getView('EditLink').rootLayout()
})
}
}
......@@ -334,7 +334,7 @@ define([
_settings.push('shape');
no_text = false;
} else if (Asc.c_oAscTypeSelectElement.Hyperlink == type) {
// _settings.push('hyperlink');
_settings.push('hyperlink');
}
});
if (!no_text)
......
This diff is collapsed.
<!-- Root view -->
<div id="edit-link-root">
<div class="list-block">
<ul>
<li>
<div id="edit-link-type" class="item-content item-link">
<div class="item-inner">
<div class="item-title"><%= scope.textLinkType %></div>
<div class="item-after"><%= scope.textExternalLink %></div>
</div>
</div>
</li>
<li>
<div id="edit-link-url" class="item-content">
<div class="item-inner">
<div class="item-title label"><%= scope.textLink %></div>
<div class="item-input">
<input type="url" placeholder="<%= scope.textLink %>">
</div>
</div>
</div>
</li>
<li>
<div id="edit-link-number" class="item-content item-link">
<div class="item-inner">
<div class="item-title label"><%= scope.textLinkSlide %></div>
<div class="item-after"><%= scope.textNext %></div>
</div>
</div>
</li>
<li>
<div id="edit-link-display" class="item-content">
<div class="item-inner">
<div class="item-title label"><%= scope.textDisplay %></div>
<div class="item-input">
<input type="text" placeholder="<%= scope.textDisplay %>">
</div>
</div>
</div>
</li>
<li>
<div id="edit-link-tip" class="item-content">
<div class="item-inner">
<div class="item-title label"><%= scope.textTip %></div>
<div class="item-input">
<input type="text" placeholder="<%= scope.textTip %>">
</div>
</div>
</div>
</li>
</ul>
</div>
<div class="list-block">
<% if (android) { %>
<a href="#" id="edit-link-edit" class="button button-raised button-fill disabled" style="margin: 20px 16px;"><%= scope.textEdit %></a>
<a href="#" id="edit-link-remove" class="button button-raised button-fill" style="margin: 20px 16px; background-color: #f44336;"><%= scope.textRemove %></a>
<% } else { %>
<ul>
<li>
<a href="#" id="edit-link-edit" class="list-button item-link disabled" style="text-align: center;"><%= scope.textEdit %></a>
</li>
<li>
<a href="#" id="edit-link-remove" class="list-button item-link" style="text-align: center; color: #f00"><%= scope.textRemove %></a>
</li>
</ul>
<% } %>
</div>
</div>
<!-- Link Type view -->
<div id="editlink-type">
<div class="navbar">
<div class="navbar-inner">
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
<div class="center sliding"><%= scope.textLinkType %></div>
</div>
</div>
<div class="page" id="page-editlink-type" data-page="editlink-type">
<div class="page-content">
<div class="list-block">
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="editlink-type" value="1">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textExternalLink %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="editlink-type" value="0">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textInternalLink %></div>
</div>
</label>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- Slide Number view -->
<div id="editlink-slidenumber">
<div class="navbar">
<div class="navbar-inner">
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
<div class="center sliding"><%= scope.textLinkSlide %></div>
</div>
</div>
<div class="page" id="page-editlink-slidenumber" data-page="editlink-slidenumber">
<div class="page-content">
<div class="list-block">
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="editlink-slide" value="0">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textNext %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="editlink-slide" value="1">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textPrev %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="editlink-slide" value="2">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textFirst %></div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="editlink-slide" value="3">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textLast %></div>
</div>
</label>
</li>
<li id="editlink-slide-number">
<label class="label-radio item-content">
<input type="radio" name="editlink-slide" value="4">
<% if (android) { %><div class="item-media"><i class="icon icon-form-radio"></i></div><% } %>
<div class="item-inner">
<div class="item-title"><%= scope.textNumber %></div>
<div class="item-after splitter">
<% if (!android) { %><label></label><% } %>
<p class="buttons-row">
<span class="button decrement"><% if (android) { %><i class="icon icon-expand-down"></i><% } else { %>-<% } %></span>
<% if (android) { %><label></label><% } %>
<span class="button increment"><% if (android) { %><i class="icon icon-expand-up"></i><% } else { %>+<% } %></span>
</p>
</div>
</div>
</label>
</li>
</ul>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -68,8 +68,6 @@ define([
$('#add-link-number').single('click', _.bind(me.showPageNumber, me));
$('#add-link-type').single('click', _.bind(me.showLinkType, me));
me.initControls();
},
// Render layout
......@@ -93,10 +91,6 @@ define([
return '';
},
initControls: function () {
//
},
showPage: function (templateId) {
var rootView = PE.getController('AddContainer').rootView;
......@@ -139,8 +133,6 @@ define([
textFirst: 'First Slide',
textLast: 'Last Slide',
textNumber: 'Slide Number'
}
})(), PE.Views.AddLink || {}))
});
\ No newline at end of file
/*
*
* (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
*
*/
/**
* EditLink.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/EditLink.template',
'jquery',
'underscore',
'backbone'
], function (editTemplate, $, _, Backbone) {
'use strict';
PE.Views.EditLink = Backbone.View.extend(_.extend((function() {
// private
return {
// el: '.view-main',
template: _.template(editTemplate),
events: {
},
initialize: function () {
Common.NotificationCenter.on('editcontainer:show', _.bind(this.initEvents, this));
},
initEvents: function () {
var me = this;
$('#edit-link-number').single('click', _.bind(me.showPageNumber, me));
$('#edit-link-type').single('click', _.bind(me.showLinkType, me));
},
// Render layout
render: function () {
this.layout = $('<div/>').append(this.template({
android : Common.SharedSettings.get('android'),
phone : Common.SharedSettings.get('phone'),
scope : this
}));
return this;
},
rootLayout: function () {
if (this.layout) {
return this.layout
.find('#edit-link-root')
.html();
}
return '';
},
showPage: function (templateId) {
var rootView = PE.getController('EditContainer').rootView;
if (rootView && this.layout) {
var $content = this.layout.find(templateId);
// Android fix for navigation
if (Framework7.prototype.device.android) {
$content.find('.page').append($content.find('.navbar'));
}
rootView.router.load({
content: $content.html()
});
this.fireEvent('page:show', [this, templateId]);
}
},
showLinkType: function () {
this.showPage('#editlink-type');
},
showPageNumber: function () {
this.showPage('#editlink-slidenumber');
},
textLinkType: 'Link Type',
textExternalLink: 'External Link',
textInternalLink: 'Slide in this Presentation',
textLink: 'Link',
textLinkSlide: 'Link to',
textBack: 'Back',
textAddLink: 'Add Link',
textDisplay: 'Display',
textTip: 'Screen Tip',
textInsert: 'Insert',
textNext: 'Next Slide',
textPrev: 'Previous Slide',
textFirst: 'First Slide',
textLast: 'Last Slide',
textNumber: 'Slide Number',
textEdit: 'Edit Link',
textRemove: 'Remove Link'
}
})(), PE.Views.EditLink || {}))
});
\ No newline at end of file
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