Skip to content

Commit

Permalink
Fix loading participants into the sidebar
Browse files Browse the repository at this point in the history
menu still broken

Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Aug 25, 2017
1 parent 96baec5 commit bc0afbe
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion js/models/participantcollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
setRoom: function(room) {
this.room = room;
this.url = OC.linkToOCS('apps/spreed/api/v1/room', 2) + '/' + this.room.get('token') + 'participants';
this.url = OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.room.get('token') + '/participants';
},
// comparator: function(model) {
// return -(model.get('lastPing'));
Expand Down
27 changes: 17 additions & 10 deletions js/views/participantview.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,17 @@

var uiChannel = Backbone.Radio.channel('ui');

var ITEM_TEMPLATE = '<li data-session-id="{{sessionId}}" data-participant="{{participantId}}" class="participant {{#if pariticipantIsOffline}}participant-offline{{/if}}">' +
'<div class="avatar " data-username="test1" data-displayname="User One" style="height: 32px; width: 32px; background-color: rgb(213, 231, 116); color: rgb(255, 255, 255); font-weight: normal; text-align: center; line-height: 32px; font-size: 17.6px;">U</div>' +
'<!--div class="avatar" data-username="{{participantId}}" data-displayname="{{participantDisplayName}}"></div-->' +
var ITEM_TEMPLATE = '<li data-session-id="{{sessionId}}" data-participant="{{userId}}" class="participant {{#if pariticipantIsOffline}}participant-offline{{/if}}">' +
'<div class="avatar" data-user-id="{{userId}}" data-displayname="{{displayName}}"></div>' +
'<span class="username" title="">' +
'{{username}}' +
'{{displayName}}' +
'{{#if participantIsOwner}}<span class="participant-moderator-indicator">(' + t('spreed', 'owner') + ')</span>{{/if}}' +
'{{#if participantIsModerator}}<span class="participant-moderator-indicator">(' + t('spreed', 'moderator') + ')</span>{{/if}}' +
'</span>' +
'{{#if canModerate}}' +
'<span class="actionOptionsGroup">' +
'<a href="#"><span class="icon icon-more"></span></a>' +
'<div class="popovermenu bubble hidden menu">' +
'<div class="popovermenu bubble menu">' +
'<ul>' +
'{{#if participantIsModerator}}' +
'<li>' +
Expand All @@ -49,7 +48,7 @@
'</a>' +
'</li>' +
'{{else}}' +
'{{if participantIsUser}}' +
'{{#if participantIsUser}}' +
'<li>' +
'<a href="#" class="menuitem action action-promote permanent">' +
'<span class="icon icon-rename"></span><span>' + t('spreed', 'Promote to moderator') + '</span>' +
Expand Down Expand Up @@ -93,7 +92,7 @@
if (!this.$el.is(target.closest('.participant'))) {
// Click was not triggered by this element -> close menu
this.menuShown = false;
this.toggleMenuClass();
//this.toggleMenuClass();
}
});
},
Expand All @@ -109,11 +108,17 @@
};
},
onRender: function() {
// TODO ?
// var roomURL, completeURL;
// this.initPersonSelector();
this.$el.find('.avatar').each(function() {
var element = $(this);
if (element.data('displayname')) {
element.avatar(element.data('user-id'), 32, undefined, false, undefined, element.data('displayname'));
} else {
element.avatar(element.data('user-id'), 32);
}
});
},
events: {
'click .actionOptionsGroup .icon-more': 'toggleMenu',
'click .actionOptionsGroup .action-promote': 'promoteToModerator',
'click .actionOptionsGroup .action-demote': 'demoteFromModerator',
'click .actionOptionsGroup .action-remove': 'removeParticipant'
Expand All @@ -130,6 +135,8 @@
this.toggleMenuClass();
},
toggleMenuClass: function() {
console.log(this.ui.participant.data('participant'));
console.log(this.menuShown);
this.ui.menu.toggleClass('open', this.menuShown);
},
promoteToModerator: function() {
Expand Down
5 changes: 4 additions & 1 deletion js/views/roomlistview.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,18 @@
var token = this.ui.room.attr('data-token');
OCA.SpreedMe.Calls.join(token);

console.log("joinRoom");
if (!_.isUndefined(this.model)) {
console.log("participants");
var participantCollection = new OCA.SpreedMe.Models.ParticipantCollection();
participantCollection.setRoom(this.model);

var participantView = new OCA.SpreedMe.Views.ParticipantView({
el: '#app-navigation ul',
el: '#participantTabView ul',
collection: participantCollection
});
participantCollection.fetch();
participantView.render();
}

OC.Util.History.pushState({
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public function getParticipants($token) {
$participants = $room->getParticipants();
$results = [];

foreach ($participants['user'] as $userId => $participant) {
foreach ($participants['users'] as $userId => $participant) {
$user = $this->userManager->get($userId);
if (!$user instanceof IUser) {
continue;
Expand Down
6 changes: 3 additions & 3 deletions templates/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
</ul>

<div class="tabsContainer">
<div id="shareTabView" class="tab shareTabView">
<div class="shareeListView subView">
<ul id="shareWithList" class="shareWithList">
<div id="participantTabView" class="tab participantTabView">
<div class="participantListView subView">
<ul id="participantWithList" class="participantWithList">
<li data-share-id="2" data-share-type="0" data-share-with="test1" class="participant-moderator">
<div class="avatar " data-username="test1" data-displayname="User One" style="height: 32px; width: 32px; background-color: rgb(213, 231, 116); color: rgb(255, 255, 255); font-weight: normal; text-align: center; line-height: 32px; font-size: 17.6px;">U</div>
<span class="username" title="">
Expand Down

0 comments on commit bc0afbe

Please sign in to comment.