Skip to content

Commit

Permalink
Convert rocketchat-ui-flextab to main module structure (#12859)
Browse files Browse the repository at this point in the history
* Exposing isRtl and UserRoles

* Convert rocketchat-ui-flextab to main module structure
  • Loading branch information
MarcosSpessatto authored and rodrigok committed Dec 6, 2018
1 parent 38e0dd0 commit 7c26f30
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 24 deletions.
3 changes: 2 additions & 1 deletion packages/rocketchat-ui-flextab/client/flexTabBar.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* globals popover */
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { t, popover } from 'meteor/rocketchat:ui';
import _ from 'underscore';

const commonHelpers = {
Expand Down
13 changes: 13 additions & 0 deletions packages/rocketchat-ui-flextab/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import './flexTabBar.html';
import './tabs/inviteUsers.html';
import './tabs/membersList.html';
import './tabs/uploadedFilesList.html';
import './tabs/userEdit.html';
import './tabs/userInfo.html';
import './flexTabBar';
import './tabs/inviteUsers';
import './tabs/membersList';
import './tabs/uploadedFilesList';
import './tabs/userEdit';
import './tabs/userInfo';
import './tabs/keyboardShortcuts.html';
2 changes: 2 additions & 0 deletions packages/rocketchat-ui-flextab/client/tabs/inviteUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Blaze } from 'meteor/blaze';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';
import { AutoComplete } from 'meteor/mizzao:autocomplete';
import { RocketChat } from 'meteor/rocketchat:lib';
import { t } from 'meteor/rocketchat:ui';
import toastr from 'toastr';

const acEvents = {
Expand Down
4 changes: 3 additions & 1 deletion packages/rocketchat-ui-flextab/client/tabs/membersList.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* globals WebRTC popover isRtl */
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';
import { RocketChat, handleError } from 'meteor/rocketchat:lib';
import { t, ChatRoom, RoomManager, popover, isRtl } from 'meteor/rocketchat:ui';
import { WebRTC } from 'meteor/rocketchat:webrtc';
import _ from 'underscore';
import { getActions } from './userActions';

Expand Down
5 changes: 3 additions & 2 deletions packages/rocketchat-ui-flextab/client/tabs/userActions.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* globals RoomRoles, WebRTC*/
import { Meteor } from 'meteor/meteor';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Session } from 'meteor/session';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat, handleError } from 'meteor/rocketchat:lib';
import { WebRTC } from 'meteor/rocketchat:webrtc';
import { t, modal, ChatRoom, ChatSubscription, RoomRoles } from 'meteor/rocketchat:ui';
import _ from 'underscore';
import toastr from 'toastr';


export const getActions = function({ user, directActions, hideAdminControls }) {

const hasPermission = RocketChat.authz.hasAllPermission;
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-ui-flextab/client/tabs/userEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ReactiveVar } from 'meteor/reactive-var';
import { Random } from 'meteor/random';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat, handleError } from 'meteor/rocketchat:lib';
import { t } from 'meteor/rocketchat:ui';
import toastr from 'toastr';
import s from 'underscore.string';

Expand Down
5 changes: 2 additions & 3 deletions packages/rocketchat-ui-flextab/client/tabs/userInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* globals RoomRoles UserRoles popover */
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
Expand All @@ -7,8 +6,8 @@ import { TAPi18n } from 'meteor/tap:i18n';
import _ from 'underscore';
import s from 'underscore.string';
import moment from 'moment';
import { DateFormat } from 'meteor/rocketchat:lib';

import { DateFormat, RocketChat } from 'meteor/rocketchat:lib';
import { RoomRoles, popover, UserRoles } from 'meteor/rocketchat:ui';
import { getActions } from './userActions';

const more = function() {
Expand Down
17 changes: 2 additions & 15 deletions packages/rocketchat-ui-flextab/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,7 @@ Package.onUse(function(api) {
'templating',
'rocketchat:lib',
'mizzao:autocomplete',
'rocketchat:webrtc',
]);

api.addFiles('client/flexTabBar.html', 'client');
api.addFiles('client/tabs/inviteUsers.html', 'client');
api.addFiles('client/tabs/membersList.html', 'client');
api.addFiles('client/tabs/uploadedFilesList.html', 'client');
api.addFiles('client/tabs/userEdit.html', 'client');
api.addFiles('client/tabs/userInfo.html', 'client');

api.addFiles('client/flexTabBar.js', 'client');
api.addFiles('client/tabs/inviteUsers.js', 'client');
api.addFiles('client/tabs/membersList.js', 'client');
api.addFiles('client/tabs/uploadedFilesList.js', 'client');
api.addFiles('client/tabs/userEdit.js', 'client');
api.addFiles('client/tabs/userInfo.js', 'client');
api.addFiles('client/tabs/keyboardShortcuts.html', 'client');
api.mainModule('client/index.js', 'client');
});
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/lib/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ChatRoom = this.CachedChatRoom.collection;

this.CachedChatSubscription = new RocketChat.CachedCollection({ name: 'subscriptions' });
ChatSubscription = this.CachedChatSubscription.collection; //eslint-disable-line
this.UserRoles = new Mongo.Collection(null);
UserRoles = new Mongo.Collection(null); //eslint-disable-line
RoomRoles = new Mongo.Collection(null); //eslint-disable-line
this.UserAndRoom = new Mongo.Collection(null);
this.CachedChannelList = new Mongo.Collection(null);
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/lib/tapi18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ this.tr = function(key, options, ...replaces) {
}
};

this.isRtl = (lang) => {
isRtl = (lang) => { //eslint-disable-line
const language = lang || localStorage.getItem('userLanguage') || 'en-US';
return ['ar', 'dv', 'fa', 'he', 'ku', 'ps', 'sd', 'ug', 'ur', 'yi'].includes(language.split('-').shift().toLowerCase());
};
2 changes: 2 additions & 0 deletions packages/rocketchat-ui/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,6 @@ Package.onUse(function(api) {
api.export('ChatMessage', 'client');
api.export('RoomHistoryManager', 'client');
api.export('KonchatNotification', 'client');
api.export('UserRoles', 'client');
api.export('isRtl', 'client');
});

0 comments on commit 7c26f30

Please sign in to comment.