[FIX] set-toolbar-items postMessage (#11109)

We had some refactors and this code was deleted...

<!-- INSTRUCTION: Link to a https://github.com/RocketChat/docs PR with added/updated documentation or an update to the missing/outdated documentation list, see https://rocket.chat/docs/contributing/documentation/  -->

<!-- INSTRUCTION: Tell us more about your PR with screen shots if you can -->
![image](https://user-images.githubusercontent.com/5263975/41310728-bae165e8-6e58-11e8-8c55-fdfdfecc46e3.png)
![image](https://user-images.githubusercontent.com/5263975/41310793-eb98a91c-6e58-11e8-90b5-905b8aee0148.png)
pull/10862/merge
Guilherme Gazzo 8 years ago committed by GitHub
parent 6e2d906b19
commit 3d81ff0f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/rocketchat-theme/client/imports/components/header.css
  2. 15
      packages/rocketchat-ui-flextab/client/flexTabBar.html
  3. 4
      packages/rocketchat-ui-flextab/client/flexTabBar.js
  4. 21
      packages/rocketchat-ui/client/components/header/header.js
  5. 4
      packages/rocketchat-ui/client/lib/iframeCommands.js

@ -259,6 +259,14 @@
font-size: 12px;
font-weight: 600;
}
& + & {
border-left: 1px var(--color-gray) solid;
.rtl & {
border-left: 0;
border-right: 1px var(--color-gray) solid;
}
}
}
.tab-button-icon--star {

@ -31,6 +31,17 @@
</template>
<template name="RoomsActionTab">
{{# with postButtons}}
<div class="rc-room-actions iframe-toolbar">
{{#each .}}
<div class="rc-room-actions__action tab-button {{active}} {{visible}} {{class}} js-iframe-action" data-id="{{id}}">
<button class="rc-tooltip rc-tooltip--down rc-room-actions__button" aria-label="{{title}}">
{{> icon block="tab-button-icon" icon=icon }}
</button>
</div>
{{/each}}
</div>
{{/with}}
<div class="rc-room-actions">
{{#each buttons}}
<div class="rc-room-actions__action tab-button {{active}} {{visible}} {{class}} js-action" data-id="{{id}}">
@ -39,10 +50,10 @@
</button>
</div>
{{/each}}
{{# with moreButtons}}
{{# with moreButtons}}
<div class="rc-room-actions__action {{opened}}">
<button class="rc-tooltip rc-tooltip--down rc-room-actions__button js-more" aria-label="{{_ 'More'}}">
{{> icon block="tab-button-icon" icon="menu" }}
{{> icon block="tab-button-icon" icon="menu" }}
</button>
</div>
{{/with}}

@ -201,6 +201,10 @@ Template.RoomsActionTab.onCreated(function() {
Template.RoomsActionTab.helpers({
...commonHelpers,
postButtons() {
const toolbar = Session.get('toolbarButtons') || {};
return Object.keys(toolbar.buttons || []).map(key =>({ id: key, ...toolbar.buttons[key] }));
},
active() {
if (this.template === Template.instance().tabBar.getTemplate() && Template.instance().tabBar.getState() === 'opened') {
return 'active';

@ -104,25 +104,32 @@ Template.header.helpers({
});
Template.header.events({
'click .iframe-toolbar button'() {
'click .iframe-toolbar .js-iframe-action'(e) {
fireGlobalEvent('click-toolbar-button', { id: this.id });
e.currentTarget.querySelector('button').blur();
return false;
},
'click .rc-header__toggle-favorite'(event) {
event.stopPropagation();
event.preventDefault();
return Meteor.call('toggleFavorite', this._id, !$(event.currentTarget).hasClass('favorite-room'), function(err) {
if (err) {
return handleError(err);
}
});
return Meteor.call(
'toggleFavorite',
this._id,
!$(event.currentTarget).hasClass('favorite-room'),
err => err && handleError(err)
);
},
'click .edit-room-title'(event) {
event.preventDefault();
Session.set('editRoomTitle', true);
$('.rc-header').addClass('visible');
return Meteor.setTimeout(() => $('#room-title-field').focus().select(), 10);
return Meteor.setTimeout(() =>
$('#room-title-field')
.focus()
.select(),
10);
}
});

@ -54,9 +54,9 @@ const commands = {
});
},
'set-toolbar-button'({ id, icon, label }) {
'set-toolbar-button'({ id, icon, label: i18nTitle }) {
const toolbar = Session.get('toolbarButtons') || { buttons: {} };
toolbar.buttons[id] = { icon, label };
toolbar.buttons[id] = { icon, i18nTitle };
Session.set('toolbarButtons', toolbar);
},

Loading…
Cancel
Save