-
- $(element).parent().parent().tabs();
-
- $(element).on("click",function() {
- scope.acttab=scope.acttab -1;
- $(element).parent().parent().tabs({active:scope.acttab});
- console.log("sid");
- });
- }
- };
- });
-
-
- crmMailing.directive('chsgroup',function(){
- return {
- restrict : 'AE',
- link: function(scope,element, attrs){
- $(element).select2(
- {width:"400px",
- placeholder: "Include Group",
- });
- }
- };
-
- });
-
-
-crmMailing.directive('chsdate',function(){
- return {
- scope :{
- dat : '=send_date'
- },
- restrict: 'AE',
- link: function(scope,element,attrs){
- $(element).datepicker({
- dateFormat: 'yy-mm-dd',
- onSelect: function(date) {
- $(".ui-datepicker a").removeAttr("href");
- scope.dat =date;
- }
- });
- }
- };
- });
-
-
-
-crmMailing.controller('browse', function($scope){
- $scope.fileList = [];
- $('#fileupload').bind('fileuploadadd', function(e, data){
- // Add the files to the list
- numFiles = $scope.fileList.length
- for (var i=0; i < data.files.length; ++i) {
- var file = data.files[i];
- // .$apply to update angular when something else makes changes
- $scope.$apply(
- $scope.fileList.push({name: file.name})
- );
- }
- // Begin upload immediately
- data.submit();
- });
-});
-
-
- crmMailing.directive('add',function(){
- return {
- restrict : 'AE',
- link: function(scope,element, attrs){
- $(document).ready(function(){
- $('#fileupload').fileupload({
- dataType: 'json'
- });
- });
-
-
- }
- };
- });
-
-
- crmMailing.controller('mailingListCtrl', function($scope, crmApi, mailingList) {
- $scope.mailingList = mailingList.values;
- $scope.mailStatus = _.pluck(CRM.crmMailing.mailStatus, 'status');
- });
+ $(element).parent().parent().tabs();
+ $(element).on("click",function() {
+ scope.acttab=scope.acttab -1;
+ $(element).parent().parent().tabs({active:scope.acttab});
+ console.log("sid");
+ });
+ }
+ };
+ });
+
+ // Select 2 Widget for selecting the group
+ crmMailing.directive('chsgroup',function(){
+ return {
+ restrict : 'AE',
+ link: function(scope,element, attrs){
+ $(element).select2({
+ width:"400px",
+ placeholder: "Include Group",
+ });
+ }
+ };
+ });
+
+ // Used for the select date option. This is used for giving scheduled_date its date value
+ crmMailing.directive('chsdate',function(){
+ return {
+ scope :{
+ dat : '=send_date'
+ },
+ restrict: 'AE',
+ link: function(scope,element,attrs){
+ $(element).datepicker({
+ dateFormat: 'yy-mm-dd',
+ onSelect: function(date) {
+ $(".ui-datepicker a").removeAttr("href");
+ scope.dat =date;
+ }
+ });
+ }
+ };
+ });
+
+/*
+ //browsing controller. to add selected files. not working currently
+ crmMailing.controller('browse', function($scope){
+ $scope.fileList = [];
+ $('#fileupload').bind('fileuploadadd', function(e, data){
+ // Add the files to the list
+ numFiles = $scope.fileList.length
+ for (var i=0; i < data.files.length; ++i) {
+ var file = data.files[i];
+ // .$apply to update angular when something else makes changes
+ $scope.$apply(
+ $scope.fileList.push({name: file.name})
+ );
+ }
+ // Begin upload immediately
+ data.submit();
+ });
+ });
+
+ //adding directive. to add selected files. not working currently
+ crmMailing.directive('add',function(){
+ return {
+ restrict : 'AE',
+ link: function(scope,element, attrs){
+ $(document).ready(function(){
+ $('#fileupload').fileupload({
+ dataType: 'json'
+ });
+ });
+ }
+ };
+ });
+*/
+ //This controller is used for creating the mailing list. Simply gets all the mailing data from civiAPI
+ crmMailing.controller('mailingListCtrl', function($scope, crmApi, mailingList) {
+ $scope.mailingList = mailingList.values;
+ $scope.mailStatus = _.pluck(CRM.crmMailing.mailStatus, 'status');
+ });