Skip to content

RocketChat.TabBar #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 11, 2015
8 changes: 4 additions & 4 deletions client/lib/RoomHistoryManager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
ls = subscription.ls

Meteor.call 'loadHistory', rid, ts, limit, ls, (err, result) ->
room.unreadNotLoaded.set result.unreadNotLoaded
room.unreadNotLoaded.set result?.unreadNotLoaded

wrapper = $('.messages-box .wrapper').get(0)
previousHeight = wrapper.scrollHeight

ChatMessage.insert item for item in result.messages
ChatMessage.insert item for item in result?.messages or []

heightDiff = wrapper.scrollHeight - previousHeight
wrapper.scrollTop += heightDiff
Expand All @@ -51,8 +51,8 @@
RoomManager.updateMentionsMarksOfRoom subscription.t + subscription.name

room.isLoading.set false
room.loaded += result.messages.length
if result.messages.length < limit
room.loaded += result?.messages?.length
if result?.messages?.length < limit
room.hasMore.set false

hasMore = (rid) ->
Expand Down
13 changes: 0 additions & 13 deletions client/lib/flexTab.coffee

This file was deleted.

4 changes: 4 additions & 0 deletions client/lib/sideNav.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
setFlex ""
arrowBindHover()

getSideNav = ->
return sideNav

init: init
setFlex: setFlex
getFlex: getFlex
Expand All @@ -102,4 +105,5 @@
toggleCurrent: toggleCurrent
overArrow: overArrow
leaveArrow: leaveArrow
getSideNav: getSideNav
)()
33 changes: 33 additions & 0 deletions client/routes/adminRouter.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
tabReset = ->
RocketChat.TabBar.reset()

FlowRouter.route '/admin/users',
name: 'admin-users'
triggersEnter: [tabReset]
triggersExit: [tabReset]
action: ->
BlazeLayout.render 'main', {center: 'adminUsers'}


FlowRouter.route '/admin/rooms',
name: 'admin-rooms'
triggersEnter: [tabReset]
triggersExit: [tabReset]
action: ->
BlazeLayout.render 'main', {center: 'adminRooms'}


FlowRouter.route '/admin/statistics',
name: 'admin-statistics'
triggersEnter: [tabReset]
triggersExit: [tabReset]
action: ->
BlazeLayout.render 'main', {center: 'adminStatistics'}


FlowRouter.route '/admin/:group?',
name: 'admin'
triggersEnter: [tabReset]
triggersExit: [tabReset]
action: ->
BlazeLayout.render 'main', {center: 'admin'}
6 changes: 6 additions & 0 deletions client/routes/roomRoute.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ openRoom = (type, name) ->
$('.message-form .input-message').focus()
, 100

RocketChat.TabBar.resetButtons()
RocketChat.TabBar.addButton({ id: 'message-search', title: t('Search'), icon: 'icon-search', template: 'messageSearch', order: 1 })
if type is 'd'
RocketChat.TabBar.addButton({ id: 'members-list', title: t('User_Info'), icon: 'icon-user', template: 'membersList', order: 2 })
else
RocketChat.TabBar.addButton({ id: 'members-list', title: t('Members_List'), icon: 'icon-users', template: 'membersList', order: 2 })

roomExit = ->
mainNode = document.querySelector('.main-content')
Expand Down
33 changes: 4 additions & 29 deletions client/routes/router.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ FlowRouter.route '/home',
name: 'home'

action: ->
RocketChat.TabBar.reset()
BlazeLayout.render 'main', {center: 'home'}
KonchatNotification.getDesktopPermission()

Expand All @@ -52,39 +53,13 @@ FlowRouter.route '/changeavatar',
action: ->
BlazeLayout.render 'main', {center: 'avatarPrompt'}


FlowRouter.route '/admin/users',
name: 'admin-users'

action: ->
BlazeLayout.render 'main', {center: 'adminUsers'}


FlowRouter.route '/admin/rooms',
name: 'admin-rooms'

action: ->
BlazeLayout.render 'main', {center: 'adminRooms'}


FlowRouter.route '/admin/statistics',
name: 'admin-statistics'

action: ->
BlazeLayout.render 'main', {center: 'adminStatistics'}


FlowRouter.route '/admin/:group?',
name: 'admin'

action: ->
BlazeLayout.render 'main', {center: 'admin'}


FlowRouter.route '/account/:group?',
name: 'account'

action: (params) ->
RocketChat.TabBar.closeFlex()
RocketChat.TabBar.resetButtons()

unless params.group
params.group = 'Preferences'
params.group = _.capitalize params.group, true
Expand Down
1 change: 0 additions & 1 deletion client/startup/startup.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Meteor.startup ->
UserPresence.start()
Meteor.subscribe("activeUsers")

Session.setDefault('flexOpened', false)
Session.setDefault('AvatarRandom', 0)

window.lastMessageWindow = {}
Expand Down
39 changes: 30 additions & 9 deletions client/stylesheets/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -1710,10 +1710,12 @@ a.github-fork {
right: 0;
width: auto;
height: auto;
margin-right: 40px;
.transition(width .25s cubic-bezier(.5, 0, .1, 1));
&.flex-opened {
right: @flex-tab-width;
.flex-tab {
right: 40px;
.transform(translateX(0));
}
}
Expand Down Expand Up @@ -2460,6 +2462,34 @@ a.github-fork {
}
}

.flex-tab-bar {
position: absolute;
width: 40px;
height: 100%;
top: 0;
right: 0;
background: #FCFCFC;
border-left: 1px solid #eaeaea;
z-index: 9;

.tab-button {
cursor: pointer;
padding: 10px;
background: #FCFCFC;
border-bottom: 1px solid #eaeaea;

&:hover {
background: #EAEAEA;
}

&.active {
background-color: #F4F4F4;
margin-left: -1px;
padding-left: 11px;
}
}
}

// FLEX-TAB and FLEX-TAB views
.flex-tab {
border-left: 1px solid;
Expand All @@ -2486,14 +2516,6 @@ a.github-fork {
> form {
float: left;
}
&:before {
content: " ";
height: 1px;
left: 15px;
position: absolute;
bottom: 0px;
.calc(width, ~'100% - 15px');
}
.button {
min-height: 36px;
margin: 0 1px;
Expand Down Expand Up @@ -2582,7 +2604,6 @@ a.github-fork {
}
.content {
&:extend(.fill-all);
margin-top: 60px;
overflow-x: hidden;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
Expand Down
4 changes: 2 additions & 2 deletions client/views/account/account.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Template.account.helpers
flexOpened: ->
return 'opened' if Session.equals('flexOpened', true)
return 'opened' if RocketChat.TabBar.isFlexOpen()
arrowPosition: ->
console.log 'room.helpers arrowPosition' if window.rocketDebug
return 'left' unless Session.equals('flexOpened', true)
return 'left' unless RocketChat.TabBar.isFlexOpen()

Template.account.onRendered ->
Tracker.afterFlush ->
Expand Down
4 changes: 2 additions & 2 deletions client/views/admin/admin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Template.admin.helpers
return sectionsArray

flexOpened: ->
return 'opened' if Session.equals('flexOpened', true)
return 'opened' if RocketChat.TabBar.isFlexOpen()
arrowPosition: ->
console.log 'room.helpers arrowPosition' if window.rocketDebug
return 'left' unless Session.equals('flexOpened', true)
return 'left' unless RocketChat.TabBar.isFlexOpen()
label: ->
label = @i18nLabel or @_id
if label?.indexOf(':') is -1
Expand Down
12 changes: 6 additions & 6 deletions client/views/admin/rooms/adminRooms.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Template.adminRooms.helpers
rooms: ->
return Template.instance().rooms()
flexOpened: ->
return 'opened' if Session.equals('flexOpened', true)
return 'opened' if RocketChat.TabBar.isFlexOpen()
arrowPosition: ->
return 'left' unless Session.equals('flexOpened', true)
return 'left' unless RocketChat.TabBar.isFlexOpen()
isLoading: ->
return 'btn-loading' unless Template.instance().ready?.get()
hasMore: ->
Expand Down Expand Up @@ -83,15 +83,15 @@ Template.adminRooms.events
t.filter.set e.currentTarget.value

'click .flex-tab .more': ->
if (Session.get('flexOpened'))
Session.set('flexOpened',false)
if RocketChat.TabBar.isFlexOpen()
RocketChat.TabBar.closeFlex()
else
Session.set('flexOpened', true)
RocketChat.TabBar.openFlex()

'click .room-info': (e) ->
e.preventDefault()
Session.set 'adminRoomsSelected', $(e.currentTarget).data('id')
Session.set 'flexOpened', true
RocketChat.TabBar.openFlex()

'click .room-info-tabs a': (e) ->
e.preventDefault()
Expand Down
3 changes: 1 addition & 2 deletions client/views/admin/users/adminUserEdit.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ Template.adminUserEdit.onCreated ->
instance = @

@cancel = ->
$('.user-info-content').hide()
$('#adminUserInfo').show()
RocketChat.TabBar.setTemplate 'adminUserInfo'

@save = ->
userData = { _id: Template.currentData()._id }
Expand Down
7 changes: 4 additions & 3 deletions client/views/admin/users/adminUserInfo.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Template.adminUserInfo.helpers
isAdmin: ->
return Meteor.user()?.admin is true
name: ->
return if @name then @name else TAPi18next.t 'project:Unnamed'
email: ->
Expand Down Expand Up @@ -81,10 +83,9 @@ Template.adminUserInfo.events
Meteor.call 'deleteUser', _id, (error, result) ->
if error
toastr.error error.reason
Session.set 'adminSelectedUser'

'click .edit-user': (e) ->
e.stopPropagation()
e.preventDefault()

$('.user-info-content').hide()
$('#user-edit-form').show()
RocketChat.TabBar.setTemplate 'adminUserEdit'
32 changes: 17 additions & 15 deletions client/views/admin/users/adminUserInfo.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<template name="adminUserInfo">
{{> userInfo user=.}}
<nav>
<button class='button lightblue edit-user button-block'><span><i class='icon-edit'></i> {{_ "Edit"}}</span></button>
{{#if admin}}
<button class='button lightblue remove-admin button-block'><span><i class='icon-shield'></i> {{_ "Remove_Admin"}}</span></button>
{{else}}
<button class='button lightblue make-admin button-block'><span><i class='icon-shield'></i> {{_ "Make_Admin"}}</span></button>
{{/if}}
{{#if active}}
<button class='button deactivate button-block'><span><i class='icon-block'></i> {{_ "Deactivate"}}</span></button>
{{else}}
<button class='button activate button-block'><span><i class='icon-ok-circled'></i> {{_ "Activate"}}</span></button>
{{/if}}
<button class='button delete red button-block'><span><i class='icon-trash'></i> {{_ "Delete"}}</span></button>
</nav>
{{#if isAdmin}}
{{> userInfo user=.}}
<nav>
<button class='button lightblue edit-user button-block'><span><i class='icon-edit'></i> {{_ "Edit"}}</span></button>
{{#if admin}}
<button class='button lightblue remove-admin button-block'><span><i class='icon-shield'></i> {{_ "Remove_Admin"}}</span></button>
{{else}}
<button class='button lightblue make-admin button-block'><span><i class='icon-shield'></i> {{_ "Make_Admin"}}</span></button>
{{/if}}
{{#if active}}
<button class='button deactivate button-block'><span><i class='icon-block'></i> {{_ "Deactivate"}}</span></button>
{{else}}
<button class='button activate button-block'><span><i class='icon-ok-circled'></i> {{_ "Activate"}}</span></button>
{{/if}}
<button class='button delete red button-block'><span><i class='icon-trash'></i> {{_ "Delete"}}</span></button>
</nav>
{{/if}}
</template>
Loading