Jonatas Oliveira d178092c2a Creating Verto Communicator.
Verto Communicator is a web interface built on top of Verto and AngularJS.

Brought to you by Evolux Sistemas and FreeSWITCH team. :)

FS-7795 - implements fullscreen menu and doubleclick function.
FS-7795 - added chat icon on fullscreen video
FS-7796 - fix missing tooltips in call icons
FS-7796 - fix tooltip position
FS-7798 - implements change login information in modal view
FS-7828 - fix esc key bug when leave fullscren mode. Using css instead of javascript in fullscreen for elements manipulation.
FS-7826 - fix chat sender id with name instead of extension
FS-7831 - remove demo from title
FS-7841 - fix compatibility verification
FS-7842 - 'settings' data persistent
FS-7859 - moved popup down
FS-7827 - added screen share functionality
FS-7857 - default name for source media
FS-7879 - prompt before logout [incall]
FS-7873 - querystring for autocall
FS-7875 - persist login and password password
FS-7877 - phone feature: hold, transfer, incoming, answer, decline, call direction in history
FS-7878 - small devices
FS-7881 - added modal dialog for contributors
2015-08-05 23:53:10 -05:00

102 lines
2.4 KiB
JavaScript

angular.module('cgPrompt',['ui.bootstrap']);
angular.module('cgPrompt').factory('prompt',['$modal','$q',function($modal,$q){
var prompt = function(options){
var defaults = {
title: '',
message: '',
input: false,
label: '',
value: '',
values: false,
buttons: [
{label:'Cancel',cancel:true},
{label:'OK',primary:true}
]
};
if (options === undefined){
options = {};
}
for (var key in defaults) {
if (options[key] === undefined) {
options[key] = defaults[key];
}
}
var defer = $q.defer();
$modal.open({
templateUrl:'partials/angular-prompt.html',
controller: 'cgPromptCtrl',
resolve: {
options:function(){
return options;
}
}
}).result.then(function(result){
if (options.input){
defer.resolve(result.input);
} else {
defer.resolve(result.button);
}
}, function(){
defer.reject();
});
return defer.promise;
};
return prompt;
}
]);
angular.module('cgPrompt').controller('cgPromptCtrl',['$scope','options','$timeout',function($scope,options,$timeout){
$scope.input = {name:options.value};
$scope.options = options;
$scope.buttonClicked = function(button){
if (button.cancel){
$scope.$dismiss();
return;
}
if (options.input && angular.element(document.querySelector('#cgPromptForm')).scope().cgPromptForm.$invalid){
$scope.changed = true;
return;
}
$scope.$close({button:button,input:$scope.input.name});
};
$scope.submit = function(){
var ok;
angular.forEach($scope.options.buttons,function(button){
if (button.primary){
ok = button;
}
});
if (ok){
$scope.buttonClicked(ok);
}
};
$timeout(function(){
var elem = document.querySelector('#cgPromptInput');
if (elem) {
if (elem.select) {
elem.select();
}
if (elem.focus) {
elem.focus();
}
}
},100);
}]);