mirror of
				https://github.com/nerzhul/ocsms.git
				synced 2025-10-31 10:27:42 +00:00 
			
		
		
		
	Prepare angular.js template. Merge controllers into one global controller
This commit is contained in:
		
							parent
							
								
									642f78e859
								
							
						
					
					
						commit
						13e3d47620
					
				
							
								
								
									
										14
									
								
								js/script.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								js/script.js
									
									
									
									
									
								
							| @ -22,27 +22,21 @@ var originalTitle = document.title; | |||||||
| 
 | 
 | ||||||
| var app = angular.module('OcSms', ['OC']); | var app = angular.module('OcSms', ['OC']); | ||||||
| 
 | 
 | ||||||
| app.controller('SettingsController', ['$scope', | app.controller('OcSmsController', ['$scope', | ||||||
| 	function ($scope) { | 	function ($scope) { | ||||||
| 		$scope.buttons = [ | 		$scope.buttons = [ | ||||||
| 			{text: "Send"} | 			{text: "Send"} | ||||||
| 		]; | 		]; | ||||||
|  | 		$scope.contacts = []; | ||||||
| 		$scope.sendCountry = function () { | 		$scope.sendCountry = function () { | ||||||
| 			$.post(OC.generateUrl('/apps/ocsms/set/country'),{'country': $('select[name=intl_phone]').val()}); | 			$.post(OC.generateUrl('/apps/ocsms/set/country'),{'country': $('select[name=intl_phone]').val()}); | ||||||
| 		}; | 		}; | ||||||
| 	} |  | ||||||
| ]); |  | ||||||
| 
 |  | ||||||
| app.controller('ContactsController' ['$scope', |  | ||||||
| 	function ($scope) { |  | ||||||
| 		$scope.loadConversation = function () { | 		$scope.loadConversation = function () { | ||||||
| 			alert('loadConversation'); | 			alert('loadConversation'); | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
| ]); | ]); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| $.urlParam = function(name){ | $.urlParam = function(name){ | ||||||
| 	var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); | 	var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); | ||||||
| 	if (results == null) { | 	if (results == null) { | ||||||
| @ -116,7 +110,7 @@ var checkNewMessages = function() { | |||||||
| 					if (typeof jsondata['photos'][peerLabel] != 'undefined') { | 					if (typeof jsondata['photos'][peerLabel] != 'undefined') { | ||||||
| 						peerListBuf += 'style="background-image: url(' + jsondata['photos'][peerLabel] + ');"'; | 						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); | 					$('#app-mailbox-peers ul').prepend(peerListBuf); | ||||||
| 					bufferedContacts.push(peerLabel); | 					bufferedContacts.push(peerLabel); | ||||||
| 
 | 
 | ||||||
| @ -320,7 +314,7 @@ function fetchInitialPeerList(jsondata) { | |||||||
| 			if (typeof jsondata['photos'][peerLabel] != 'undefined') { | 			if (typeof jsondata['photos'][peerLabel] != 'undefined') { | ||||||
| 				peerListBuf += 'style="background-image: url(' + jsondata['photos'][peerLabel] + ');"'; | 				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); | 			bufferedContacts.push(peerLabel); | ||||||
| 		} | 		} | ||||||
| 	}); | 	}); | ||||||
|  | |||||||
| @ -7,17 +7,20 @@ use \OCA\OcSms\Lib\CountryCodes; | |||||||
| \OCP\Util::addStyle('ocsms', 'style'); | \OCP\Util::addStyle('ocsms', 'style'); | ||||||
| ?>
 | ?>
 | ||||||
| 
 | 
 | ||||||
| <div class="ng-scope" id="app" ng-app="OcSms"> | <div class="ng-scope" id="app" ng-app="OcSms" ng-controller="OcSmsController"> | ||||||
| 	<div id="app-mailbox-peers"> | 	<div id="app-mailbox-peers"> | ||||||
| 		<ul> | 		<ul> | ||||||
| 			<li><div id="ocsms-empty-peers">There isn't any conversation</div></li> | 			<li ng-repeat="contact in contacts"> | ||||||
|  | 				<div class="ocsms-plavatar"></div> | ||||||
|  | 				<a mailbox-label="{{ contact.label }}" mailbox-navigation="{{ contact.nav }}" ng-click="loadConversation();" href="#">{{ contact.label }}</a> | ||||||
|  | 			</li> | ||||||
| 		</ul> | 		</ul> | ||||||
| 	</div> | 	</div> | ||||||
| 	<div id="app-settings" class="ng-scope"> | 	<div id="app-settings" class="ng-scope"> | ||||||
| 		<div id="app-settings-header"> | 		<div id="app-settings-header"> | ||||||
| 			<button name="app settings" class="settings-button" data-apps-slide-toggle="#app-settings-content"></button> | 			<button name="app settings" class="settings-button" data-apps-slide-toggle="#app-settings-content"></button> | ||||||
| 		</div> | 		</div> | ||||||
| 		<div id="app-settings-content" ng-controller="SettingsController"> | 		<div id="app-settings-content"> | ||||||
| 			<select name="intl_phone"> | 			<select name="intl_phone"> | ||||||
| 			<?php foreach (CountryCodes::$codes as $code => $cval) { ?>
 | 			<?php foreach (CountryCodes::$codes as $code => $cval) { ?>
 | ||||||
| 			<option><?php p($code); ?></option>
 | 			<option><?php p($code); ?></option>
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user