9 changed files with 159 additions and 19 deletions
@ -0,0 +1,67 @@ |
|||||||
|
/* |
||||||
|
* Spreed WebRTC. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed WebRTC. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define([], function() { |
||||||
|
|
||||||
|
// ContactsmanagereditController
|
||||||
|
return ["$scope", "$modalInstance", "data", "contacts", 'buddyData', function($scope, $modalInstance, data, contacts, buddyData) { |
||||||
|
$scope.header = data.header; |
||||||
|
$scope.contact = data.contact ? data.contact : null; |
||||||
|
$scope.buddySyncable = false; |
||||||
|
|
||||||
|
var originalDisplayName = null; |
||||||
|
var setContactInfo = function(contact) { |
||||||
|
contacts.update(contact); |
||||||
|
}; |
||||||
|
if ($scope.contact) { |
||||||
|
originalDisplayName = $scope.contact.Status.displayName; |
||||||
|
var scope = buddyData.lookup($scope.contact.Userid, false, false); |
||||||
|
if (scope) { |
||||||
|
var session = scope.session.get(); |
||||||
|
$scope.buddySyncable = session && session.Type ? true : false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
$scope.removeContact = function() { |
||||||
|
contacts.remove($scope.contact.Userid); |
||||||
|
$modalInstance.close(); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.syncContactInfo = function() { |
||||||
|
var scope = buddyData.lookup($scope.contact.Userid, false, false); |
||||||
|
if (scope) { |
||||||
|
var session = scope.session.get(); |
||||||
|
$scope.contact.Status.displayName = session.Status.displayName; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.save = function() { |
||||||
|
setContactInfo($scope.contact); |
||||||
|
$modalInstance.close(); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.cancel = function(contact) { |
||||||
|
$scope.contact.Status.displayName = originalDisplayName; |
||||||
|
$modalInstance.dismiss(); |
||||||
|
}; |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
@ -0,0 +1,35 @@ |
|||||||
|
<div> |
||||||
|
<div class="modal-header"> |
||||||
|
<button type="button" class="close" ng-click="$close()">×</button> |
||||||
|
<h3 class="modal-title" ng-bind-html="header"></h3> |
||||||
|
</div> |
||||||
|
<div class="modal-body"> |
||||||
|
<div class="row form-horizontal"> |
||||||
|
<div class="form-group"> |
||||||
|
<label for="contact-name" class="col-xs-4 control-label">{{_('Name')}}</label> |
||||||
|
<div class="col-xs-6"> |
||||||
|
<input id="contact-name" class="form-control" type="text" placeholder="{{_('Contact alias')}}" ng-model="contact.Status.displayName"> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="form-group" ng-if="buddySyncable"> |
||||||
|
<label for="contact-sync" class="col-xs-4 control-label">{{_('Sync')}}</label> |
||||||
|
<div class="col-xs-6"> |
||||||
|
<button id="contact-sync" class="btn btn-warning" ng-click="syncContactInfo()"><span class="fa fa-rotate-right"></span> {{_('Sync contact info')}}</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="modal-footer"> |
||||||
|
<div class="row"> |
||||||
|
<div class="col-xs-2"> |
||||||
|
<button class="btn btn-danger" ng-click="removeContact()">{{_('Remove')}}</button> |
||||||
|
</div> |
||||||
|
<div class="col-xs-offset-4 col-xs-6"> |
||||||
|
<div class="pull-right"> |
||||||
|
<button class="btn btn-default" ng-click="cancel()">{{_('Cancel')}}</button> |
||||||
|
<button class="btn btn-primary" ng-click="save()">{{_('Save')}}</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
Loading…
Reference in new issue