1
0
mirror of https://github.com/nextcloud/ocsms.git synced 2026-08-11 16:32:55 +00:00

Prepare angular.js template. Merge controllers into one global controller

This commit is contained in:
Loic Blot
2015-01-10 13:40:33 +00:00
parent 642f78e859
commit 13e3d47620
2 changed files with 10 additions and 13 deletions
+4 -10
View File
@@ -22,27 +22,21 @@ var originalTitle = document.title;
var app = angular.module('OcSms', ['OC']);
app.controller('SettingsController', ['$scope',
app.controller('OcSmsController', ['$scope',
function ($scope) {
$scope.buttons = [
{text: "Send"}
];
$scope.contacts = [];
$scope.sendCountry = function () {
$.post(OC.generateUrl('/apps/ocsms/set/country'),{'country': $('select[name=intl_phone]').val()});
};
}
]);
app.controller('ContactsController' ['$scope',
function ($scope) {
$scope.loadConversation = function () {
alert('loadConversation');
};
}
]);
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) {
@@ -116,7 +110,7 @@ var checkNewMessages = function() {
if (typeof jsondata['photos'][peerLabel] != 'undefined') {
peerListBuf += 'style="background-image: url(' + jsondata['photos'][peerLabel] + ');"';
}
peerListBuf += '></div><a href="#" ng-click="ctCtl.loadConversation();" mailbox-navigation="' + idxVal2 + '" style="font-weight: bold;" mailbox-label="' + peerLabel + '">' + peerLabel + ' (' + val + ')</a></li>';
peerListBuf += '></div><a href="#" ng-click="loadConversation();" mailbox-navigation="' + idxVal2 + '" style="font-weight: bold;" mailbox-label="' + peerLabel + '">' + peerLabel + ' (' + val + ')</a></li>';
$('#app-mailbox-peers ul').prepend(peerListBuf);
bufferedContacts.push(peerLabel);
@@ -320,7 +314,7 @@ function fetchInitialPeerList(jsondata) {
if (typeof jsondata['photos'][peerLabel] != 'undefined') {
peerListBuf += 'style="background-image: url(' + jsondata['photos'][peerLabel] + ');"';
}
peerListBuf += '></div><a href="#" ng-click="ctCtl.loadConversation();" mailbox-navigation="' + idxVal2 + '" mailbox-label="' + peerLabel + '">' + peerLabel + '</a></li>';
peerListBuf += '></div><a href="#" ng-click="loadConversation();" mailbox-navigation="' + idxVal2 + '" mailbox-label="' + peerLabel + '">' + peerLabel + '</a></li>';
bufferedContacts.push(peerLabel);
}
});