Mailing db updateb in all 3 cases
authoraditya-nambiar <aditya.nambiar007@gmail.com>
Wed, 18 Jun 2014 18:58:17 +0000 (14:58 -0400)
committeraditya-nambiar <aditya.nambiar007@gmail.com>
Sat, 26 Jul 2014 04:48:16 +0000 (10:18 +0530)
js/angular-crmMailingAB.js
partials/abtesting/from_name.html
partials/abtesting/helloworld.html
partials/abtesting/subject_lines.html
partials/abtesting/two_emails.html

index 48e884e22b411fdefcad262cb2ec25b6806ad8a7..5e8afbb8f09cf6b7fc19bcc1d0e21809ff4acc85 100644 (file)
 
     var crmMailingAB = angular.module('crmMailingAB', ['ngRoute', 'ui.utils']);
 
+    crmMailingAB.run(function($rootScope, $templateCache) {
+        $rootScope.$on('$viewContentLoaded', function() {
+            $templateCache.removeAll();
+        });
+    });
+
     crmMailingAB.config(['$routeProvider',
         function($routeProvider) {
             $routeProvider.when('/mailing', {
 
         $scope.send_date ="10/4/2004";
 
+        $scope.mailA={};
+
+        $scope.mailB={};
+        $scope.save=function(dat){
+
+            var result= crmApi('Mailing', 'create',dat, true);
+            console.log("Ac "+result);
+        };
+
+        $scope.init=function(par){
+
+            $scope.whatnext=par.toString()
+        }
+
+
     });
 
     crmMailingAB.directive('nexttab', function() {
         return {
             // Restrict it to be an attribute in this case
             restrict: 'A',
+            priority: 500,
             // responsible for registering DOM listeners as well as updating the DOM
             link: function(scope, element, attrs) {
 
                     var myArray1 = new Array(  );
                     for ( var i = scope.tab_val+1; i < 4; i++ ) {
                         myArray1.push(i);
-                        console.log( "try " + i );
                     }
                     $(element).parent().parent().parent().tabs( "option", "disabled", myArray1 );
                     $(element).parent().parent().parent().tabs({active:scope.tab_val});
-                    console.log("adiroxxx");
+                    console.log("Adir");
                 });
             }
         };
             }
         };
     });
+
+    crmMailingAB.directive('submitform',function(){
+        return {
+          restrict:'A',
+            priority: 1000,
+          link: function(scope,element,attrs){
+              $(element).on("click",function() {
+
+                  console.log("clicked");
+                  scope.save({
+                      "sequential": 1,
+                       "name": "Aditya Nambiar",
+                      "subject": scope.mailA.subj,
+                      "created_id": "2",
+                      "from_email": scope.mailA.fromEmail,
+                      "body_text": scope.mailA.body
+
+                  });
+                  console.log("Truth "+ scope.whatnext)
+
+                  if(scope.whatnext=="3"){
+                      console.log("sdf");
+                      scope.mailB.subj=scope.mailA.subj;
+                      scope.mailB.body=scope.mailA.body;
+
+                  }
+                  else if(scope.whatnext=="2"){
+                      scope.mailB.fromEmail=scope.mailA.fromEmail;
+                      scope.mailB.body=scope.mailA.body;
+
+                  }
+                  
+
+                  scope.save({
+                      "sequential": 1,
+                      "name": "Aditya Nambiar",
+                      "subject": scope.mailB.subj,
+                      "created_id": "2",
+                      "from_email": scope.mailB.fromEmail,
+                      "body_text": scope.mailB.body
+
+                  });
+
+              });
+          }
+        };
+
+    });
+
+
 })(angular, CRM.$, CRM._);
\ No newline at end of file
index 1c22cc02de36a1bffdda4acc947359aca0bf3d9c..90455b81813285d03ec5d67f5b69c487b928893e 100644 (file)
@@ -4,16 +4,17 @@
     <br><br>
     <pre>
 
-        From Email Address A: <input type="text"><br>
-        From Email Address B: <input type="text"><br>
+        From Email Address A: <input type="text" ng-model="mailA.fromEmail"><br>
+        From Email Address B: <input type="text" ng-model="mailB.fromEmail"><br>
         Use Template : <input type="text"><br>
-        Mail Subject: <input type="text"><br>
+        Mail Subject: <input type="text" ng-model="mailA.subj" ><br>
 
-        <textarea rows="4" cols="50">
+        <textarea rows="4" cols="50" ng-model="mailA.body" >
 
         </textarea>
 
 
+        <span ng-init="init('3')" ></span>
 
     </pre>
 </div>
\ No newline at end of file
index f7c08a4e096355b2398c946d31a5e8fd8e043e39..9b57e092edded5affae4cd29f370af08c76b5081 100644 (file)
@@ -25,7 +25,8 @@
             <form>
             <div  ng-include="template.url">
             </div>
-            <button  id="campaignbutton" nexttab={{adi}} >Done</button><br>
+                gghvjhkv
+            <button  id="campaignbutton" submitform={{whatnext}} nexttab={{adi}} >Done</button><br>
             </form>
         </div>
 
index 4522eb29231f5d4383748fcf0e6479b25ea17ec3..c44a656783ac0ad9211ec1764c2b22be9b6adcaa 100644 (file)
@@ -4,15 +4,16 @@
     <br><br>
     <pre>
 
-        From Email Address: <input type="text"><br>
+        From Email Address: <input type="text" ng-model="mailA.fromEmail"><br>
         Use Template : <input type="text"><br>
-        Mail Subject A: <input type="text"><br>
-        Mail Subject B: <input type="text"><br>
+        Mail Subject A: <input type="text" ng-model="mailA.subj"><br>
+        Mail Subject B: <input type="text" ng-model="mailB.subj"><br>
 
-        <textarea rows="4" cols="50">
+        <textarea rows="4" cols="50" ng-model="mailA.body">
 
         </textarea>
 
+        <span ng-init="init('2')" ></span>
 
 
     </pre>
index 1e09b7f6acedef90b9a180e01c07a0566d2082d7..c5252d4322069a2e08f92725bd1121c46907ce4d 100644 (file)
@@ -8,22 +8,22 @@
       </ul>
 
       <div id="tabs-21">
-          From Email Address : <input type="text"><br>
-          Use Template : <input type="text"><br>
-          Mail Subject: <input type="text"><br>
+          From Email Address : <input type="text" ng-model="mailA.fromEmail"><br>
+          Use Template : <input type="text" ><br>
+          Mail Subject: <input type="text" ng-model="mailA.subj"><br>
 
-          <textarea rows="4" cols="50">
+          <textarea rows="4" cols="50" ng-model="mailA.body">
 
           </textarea>
 
 
       </div>
       <div id="tabs-22">
-          From Email Address : <input type="text"><br>
+          From Email Address : <input type="text" ng-model="mailB.fromEmail"><br>
           Use Template : <input type="text"><br>
-          Mail Subject: <input type="text"><br>
+          Mail Subject: <input type="text" ng-model="mailB.subj"><br>
 
-          <textarea rows="4" cols="50">
+          <textarea rows="4" cols="50" ng-model="mailB.body">
 
           </textarea>
 
@@ -33,4 +33,5 @@
   </div>
 
 
+
 </div>
\ No newline at end of file