310 lines
12 KiB
Markdown
310 lines
12 KiB
Markdown
|
|
---
|
|||
|
|
title: Timeline personalizada 1.5.3 para 1.5.4
|
|||
|
|
source: https://tdn.totvs.com/display/fluig/Timeline+personalizada+1.5.3+para+1.5.4
|
|||
|
|
path: \Plataforma Documentação técnica\Recurso de Comunidades (Social)\Timeline\Timeline personalizada 1.5.3 para 1.5.4.md
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# Índice
|
|||
|
|
|
|||
|
|
- 1 [Objetivo](#Timelinepersonalizada1.5.3para1.5.4-Objetivo)
|
|||
|
|
- 2 [application.info](#Timelinepersonalizada1.5.3para1.5.4-application.info)
|
|||
|
|
- 3 [socialtimeline.properties](#Timelinepersonalizada1.5.3para1.5.4-socialtimeline.properties)
|
|||
|
|
- 4 [view.ftl](#Timelinepersonalizada1.5.3para1.5.4-view.ftl)
|
|||
|
|
- 5 [socialtimeline.js](#Timelinepersonalizada1.5.3para1.5.4-socialtimeline.js)
|
|||
|
|
|
|||
|
|
# Objetivo
|
|||
|
|
|
|||
|
|
Este guia é destinado aos desenvolvedores internos e externos do fluig. O objetivo é identificar e mapear todas as diferenças da *Timeline* personalizada entre as versões 1.5.3 e 1.5.4.
|
|||
|
|
|
|||
|
|
Dica
|
|||
|
|
|
|||
|
|
Sugerimos que ao seguir este guia seja utilizado um programa de comparação (diff), que permita visualizadas as diferenças entre as versões 1.5.3 e 1.5.4.
|
|||
|
|
|
|||
|
|
# application.info
|
|||
|
|
|
|||
|
|
Na versão 1.5.4 foi adicionado o novo componente de visualização de artigo, sendo necessário adicionar esta dependência para *widget*.
|
|||
|
|
|
|||
|
|
A linha abaixo, deve ser **ADICIONADA** para a versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
application.resource.component.X=social/socialarticleview
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Atenção!
|
|||
|
|
|
|||
|
|
Não esquecer de substituir o 'X' pela sequência dos componentes já configurados.
|
|||
|
|
|
|||
|
|
# socialtimeline.properties
|
|||
|
|
|
|||
|
|
Na versão 1.5.4 foi adicionada uma chave de tradução e alterada outra, e devem ser **ADICIONADA/ALTERADA** para versão 1.5.3.
|
|||
|
|
|
|||
|
|
Não esquecer de replicar as alterações para os arquivos: socialtimeline\_en\_US.properties, socialtimeline\_es.properties, socialtimeline\_pt\_BR.properties.
|
|||
|
|
|
|||
|
|
Veja abaixo:
|
|||
|
|
|
|||
|
|
**Alterar:**
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
details=Ver mais
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**Adicionar:**
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
error.loading.article=Erro ao carregar artigo.
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
# view.ftl
|
|||
|
|
|
|||
|
|
Na linha 40 da versão 1.5.4, copiar o código abaixo e **SUBSTITUIR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
<li data-post-id="{{postId}}" data-post-community-hidden="{{social.hidden}}" data-post-permissions="{{permissions}}" class="timeline-list-posts-item">
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Na linha 94 da versão 1.5.4, copiar o bloco abaixo e **SUBSTITUIR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
{{#canLike}}
|
|||
|
|
<li class="timeline-list-actions-item">
|
|||
|
|
<span class="counter-group">
|
|||
|
|
{{#supported}}
|
|||
|
|
<a href="#" class="fluigicon fluigicon-thumbs-up-on fs-no-text-underline" title="{{i18n.dislike}}" data-request-running="false" data-timeline-action="support"></a>
|
|||
|
|
{{/supported}}
|
|||
|
|
{{^supported}}
|
|||
|
|
<a href="#" class="fluigicon fluigicon-thumbs-up fs-no-text-underline" title="{{i18n.like}}" data-request-running="false" data-timeline-action="support"></a>
|
|||
|
|
{{/supported}}
|
|||
|
|
<a href="#" class="counter counter-warning pos-right-bottom {{existsNumberLikes}}" title="{{i18n.manylike}}" data-request-running="false" data-timeline-action="listLikes">{{numberLikes}}</a>
|
|||
|
|
</span>
|
|||
|
|
</li>
|
|||
|
|
{{/canLike}}
|
|||
|
|
{{#canComment}}
|
|||
|
|
<li class="timeline-list-actions-item">
|
|||
|
|
<span class="counter-group">
|
|||
|
|
<a href="#" class="fluigicon fluigicon-comment fs-no-text-underline" title="{{i18n.comment}}" data-timeline-action="comment"></a>
|
|||
|
|
<a href="{{tenantURI}}{{url}}" class="counter counter-warning pos-right-bottom {{existsNumberComments}}" title="{{i18n.manycomment}}">{{numberComments}}</a>
|
|||
|
|
</span>
|
|||
|
|
</li>
|
|||
|
|
{{/canComment}}
|
|||
|
|
{{#canNotify}}
|
|||
|
|
<li class="timeline-list-actions-item">
|
|||
|
|
<span class="counter-group">
|
|||
|
|
{{#watching}}
|
|||
|
|
<a href="#" class="fluigicon fluigicon-bell fs-no-text-underline" title="{{i18n.stopwatching}}" data-request-running="false" data-timeline-action="watch"></a>
|
|||
|
|
{{/watching}}
|
|||
|
|
{{^watching}}
|
|||
|
|
<a href="#" class="fluigicon fluigicon-bell-empty fs-no-text-underline" title="{{i18n.startwatching}}" data-request-running="false" data-timeline-action="watch"></a>
|
|||
|
|
{{/watching}}
|
|||
|
|
<a href="#" class="counter counter-warning pos-right-bottom {{existsNumberWatchers}}" title="{{i18n.manywatch}}" data-request-running="false" data-timeline-action="listWatchers">{{numberWatchers}}</a>
|
|||
|
|
</span>
|
|||
|
|
</li>
|
|||
|
|
{{/canNotify}}
|
|||
|
|
{{#canShare}}
|
|||
|
|
<li class="timeline-list-actions-item">
|
|||
|
|
<span class="counter-group">
|
|||
|
|
{{#shared}}
|
|||
|
|
<a href="#" title="${i18n.getTranslation('recommend')}" data-clipboard-text="link to copy" data-timeline-action="share" class="fluigicon fluigicon-share-on fs-no-text-underline"></a>
|
|||
|
|
{{/shared}}
|
|||
|
|
{{^shared}}
|
|||
|
|
<a href="#" title="${i18n.getTranslation('recommend')}" data-clipboard-text="link to copy" data-timeline-action="share" class="fluigicon fluigicon-share fs-no-text-underline"></a>
|
|||
|
|
{{/shared}}
|
|||
|
|
<a href="#" class="counter counter-warning pos-right-bottom {{existsNumberShares}}" title="{{i18n.manywatch}}" data-request-running="false" data-timeline-action="listShares">{{numberShares}}</a>
|
|||
|
|
</span>
|
|||
|
|
</li>
|
|||
|
|
{{/canShare}}
|
|||
|
|
{{#canDenounce}}
|
|||
|
|
<li class="timeline-list-actions-item">
|
|||
|
|
<span class="counter-group">
|
|||
|
|
<a href="#" class="fluigicon fluigicon-flag fs-no-text-underline" title="{{i18n.denounce}}" data-request-running="false" data-timeline-action="denounce"></a>
|
|||
|
|
</span>
|
|||
|
|
</li>
|
|||
|
|
{{/canDenounce}}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Na linha 196 da versão 1.5.4, copiar o bloco abaixo e **SUBSTITUIR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
{{#canLike}}
|
|||
|
|
<li class="timeline-list-actions-item">
|
|||
|
|
<span class="counter-group">
|
|||
|
|
{{#supported}}
|
|||
|
|
<a href="#" class="fluigicon fluigicon-thumbs-up-on fs-no-text-underline" title="{{i18n.dislike}}" data-request-running="false" data-timeline-action="support"></a>
|
|||
|
|
{{/supported}}
|
|||
|
|
{{^supported}}
|
|||
|
|
<a href="#" class="fluigicon fluigicon-thumbs-up fs-no-text-underline" title="{{i18n.like}}" data-request-running="false" data-timeline-action="support"></a>
|
|||
|
|
{{/supported}}
|
|||
|
|
<a href="#" class="counter counter-warning pos-right-bottom {{existsNumberLikes}}" title="{{i18n.manylike}}" data-request-running="false" data-timeline-action="listLikes">{{numberLikes}}</a>
|
|||
|
|
</span>
|
|||
|
|
</li>
|
|||
|
|
{{/canLike}}
|
|||
|
|
{{#canDenounce}}
|
|||
|
|
<li class="timeline-list-actions-item">
|
|||
|
|
<span class="counter-group">
|
|||
|
|
<a href="#" class="fluigicon fluigicon-flag fs-no-text-underline" title="{{i18n.denounce}}" data-request-running="false" data-timeline-action="denounce"></a>
|
|||
|
|
</span>
|
|||
|
|
</li>
|
|||
|
|
{{/canDenounce}}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Na linha 419 da versão 1.5.4, copiar o código abaixo e **SUBSTITUIR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
<script type="text/template" class="social-timeline-content-article-template">
|
|||
|
|
<#--ARTIGOS NOVOS, COM IMAGEM DE CAPA-->
|
|||
|
|
<div class="container-fluid row fs-cursor-pointer" data-timeline-action="articleLink" data-href="{{tenantURI}}{{linkedObject.url}}" data-articleId="{{documentId}}" data-articleTitle="{{linkedObject.description}}">
|
|||
|
|
{{#hasShareText}}
|
|||
|
|
<div class="panel panel-default"><div class="panel-body">
|
|||
|
|
{{/hasShareText}}
|
|||
|
|
{{#linkedObject.thumbURL}}
|
|||
|
|
<div class="col-xs-12">
|
|||
|
|
{{^hasShareText}} {{/hasShareText}}
|
|||
|
|
<div class="row embed-responsive embed-responsive-5by1 img-rounded">
|
|||
|
|
<a data-timeline-action="articleLink" href="{{tenantURI}}{{linkedObject.url}}" data-href="{{tenantURI}}{{linkedObject.url}}" data-articleId="{{documentId}}" data-articleTitle="{{linkedObject.description}}">
|
|||
|
|
<img class="embed-responsive-item" src="{{linkedObject.thumbURL}}">
|
|||
|
|
</a>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
{{/linkedObject.thumbURL}}
|
|||
|
|
<h2 {{#hasShareText}}{{^linkedObject.thumbURL}}class="fs-no-margin-top"{{/linkedObject.thumbURL}}{{/hasShareText}}>
|
|||
|
|
<a data-timeline-action="articleLink" href="{{tenantURI}}{{linkedObject.url}}" data-href="{{tenantURI}}{{linkedObject.url}}" data-articleId="{{documentId}}" data-articleTitle="{{linkedObject.description}}">{{linkedObject.description}}</a>
|
|||
|
|
</h2>
|
|||
|
|
<p>
|
|||
|
|
{{linkedObject.text}}
|
|||
|
|
<a data-timeline-action="articleLink" href="{{tenantURI}}{{linkedObject.url}}" data-href="{{tenantURI}}{{linkedObject.url}}" data-articleId="{{documentId}}" data-articleTitle="{{linkedObject.description}}">{{i18n.details}}</a>
|
|||
|
|
</p>
|
|||
|
|
{{#hasShareText}}
|
|||
|
|
</div></div>
|
|||
|
|
{{/hasShareText}}
|
|||
|
|
</div>
|
|||
|
|
</script>
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
# socialtimeline.js
|
|||
|
|
|
|||
|
|
Na linha 24 da versão 1.5.4, copiar o conteúdo abaixo e **ADICIONAR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
commandKey: false,
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Copiar a linha 88 da versão 1.5.4 e **ADICIONAR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
'errorLoadingArticle': '${i18n.getTranslation("error.loading.article")}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Copiar as linhas 165 até 189 da versão 1.5.4 e **ADICIONAR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
articleLinkAction: function(el, ev) {
|
|||
|
|
var $el = $(el), that = this;
|
|||
|
|
if (FLUIGC.utilities.ctrlIsPressed(ev)) {
|
|||
|
|
var articleHref = $(el).data('href');
|
|||
|
|
window.open(articleHref, '_blank');
|
|||
|
|
} else {
|
|||
|
|
var articleId = $el.attr('data-articleId'), articleTitle = $el.attr('data-articleTitle'), communityAlias = this.socialAlias;
|
|||
|
|
SOCIALBC.viewArticle({
|
|||
|
|
'title': articleTitle,
|
|||
|
|
'articleId': articleId,
|
|||
|
|
'alias': communityAlias,
|
|||
|
|
'instanceId': that.instanceId
|
|||
|
|
}, function(error, data) {
|
|||
|
|
if (error) {
|
|||
|
|
FLUIGC.toast({
|
|||
|
|
message: that.i18n.labels['errorLoadingArticle'],
|
|||
|
|
type: 'danger'
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
$('[data-close-articleview]').on('click', function() {
|
|||
|
|
$('#articleview-modal-' + that.instanceId).modal('hide');
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Copiar as linhas a partir da linha 294 da versão 1.5.4 e **ADICIONAR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
posts[i].canLike = this.hasPermission(posts[i].permissions,'LIKE');
|
|||
|
|
posts[i].canComment = this.hasPermission(posts[i].permissions,'COMMENT');
|
|||
|
|
posts[i].canNotify = this.hasPermission(posts[i].permissions,'NOTIFY_POST');
|
|||
|
|
posts[i].canShare = this.hasPermission(posts[i].permissions,'SHARE');
|
|||
|
|
posts[i].canDenounce = this.hasPermission(posts[i].permissions,'DENOUNCE');
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Na a partir da linha 354 da versão 1.5.4, copiar o bloco abaixo e **ADICIONAR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
hasPermission: function(permissions, permission){
|
|||
|
|
return permissions && permissions.indexOf(permission) > - 1;
|
|||
|
|
},
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Copiar a partir da linha 358 da versão 1.5.4 e **SUBSTITUIR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
showComments: function(data, $post, isNew) {
|
|||
|
|
var len = data.length, i = 0, html = '';
|
|||
|
|
for (i; i < len; i++) {
|
|||
|
|
try {
|
|||
|
|
data[i].tenantURI = this.tenantURI;
|
|||
|
|
data[i].comment = this.generateContentTextFormatted(data[i].comment, data[i].mentions);
|
|||
|
|
data[i].i18n = this.i18n['labels'];
|
|||
|
|
data[i].allowsRemoveActions = this.loggedUserAlias === data[i].user.alias;
|
|||
|
|
data[i].existsNumberLikes = this.generateListClass(data[i].numberLikes);
|
|||
|
|
//novos comentários não tem o permissionamento do post
|
|||
|
|
if(isNew){
|
|||
|
|
if($post.data("post-permissions")){
|
|||
|
|
permissions = $post.data("post-permissions").split(",");
|
|||
|
|
data[i].canLike = this.hasPermission(permissions,'LIKE');
|
|||
|
|
data[i].canDenounce = this.hasPermission(permissions,'DENOUNCE');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
html += Mustache.render(this.templates['social-timeline-comment-template'], data[i]);
|
|||
|
|
} catch (err) {
|
|||
|
|
if (console) {
|
|||
|
|
console.log(data[i] || '', err);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// Validar se é um novo comentário ou listagem/paginação.
|
|||
|
|
if (isNew) {
|
|||
|
|
$post.find('[data-timeline-container-comment]').after(html);
|
|||
|
|
} else {
|
|||
|
|
$post.find('[data-comment-id]:last').after(html);
|
|||
|
|
}
|
|||
|
|
this.showVideos();
|
|||
|
|
this.showCardPopover();
|
|||
|
|
this.instanceTimeInteraction();
|
|||
|
|
},
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Copiar a partir da linha 851 da versão 1.5.4, copiar o bloco abaixo e **SUBSTITUIR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
openAnswerFormAction: function(el, ev) {
|
|||
|
|
var $el = $(el), documentId = $el.data('timeline-form-id');
|
|||
|
|
if (FLUIGC.utilities.ctrlIsPressed(ev)) {
|
|||
|
|
var articleHref = $el.attr('href');
|
|||
|
|
window.open(articleHref, '_blank');
|
|||
|
|
} else {
|
|||
|
|
SOCIALBC.openAnswerForm(documentId);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Copiar a partir da linha 1271 da versão 1.5.4, copiar o bloco abaixo e **SUBSTITUIR** na versão 1.5.3:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
// Template para exibição de artigos.
|
|||
|
|
else if (obj.linkedObject.objectClass.indexOf('com.totvs.technology.social.article') !== -1) {
|
|||
|
|
if (data.formattedText !== "") {
|
|||
|
|
obj.hasShareText = true;
|
|||
|
|
}
|
|||
|
|
obj.tlpName = 'social-timeline-content-article-template';
|
|||
|
|
|
|||
|
|
return obj;
|
|||
|
|
}
|
|||
|
|
```
|