git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Case when I can not unstage the hunk
@ 2018-10-15 12:33 KES
  0 siblings, 0 replies; only message in thread
From: KES @ 2018-10-15 12:33 UTC (permalink / raw)
  To: git

Hi. 
Here is log:

git reset HEAD -p /home/kes/s/public/v2/js/contact_us.js
diff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js
index e05be6d0..d429d291 100644
--- a/public/v2/js/contact_us.js
+++ b/public/v2/js/contact_us.js
@@ -1,7 +1,19 @@
+
+
+function captchaProcess( form ) {
+      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
+        .attr( 'id' ).match( /\d+$/ );
+      if( id ){ id =  id[0] } else { id = 0 }
+      grecaptcha.reset( Number( id ) );
+      grecaptcha.execute( Number( id ) );
+      // When .execute is done this will trigger callback
+      // which is specified on g-recaptcha div element via data-callback attr
+}
+
+
 // FORM VALIDATION
-var validator;
 $(function(){
-  validator =  $('#contact_us-form').validate({
+  $('#contact_us-form').validate({
     rules: {
       name: {
         required: true,
Unstage this hunk [y,n,q,a,d,j,J,g,/,s,e,?]? s
Split into 3 hunks.
@@ -1 +1,14 @@
+
+
+function captchaProcess( form ) {
+      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
+        .attr( 'id' ).match( /\d+$/ );
+      if( id ){ id =  id[0] } else { id = 0 }
+      grecaptcha.reset( Number( id ) );
+      grecaptcha.execute( Number( id ) );
+      // When .execute is done this will trigger callback
+      // which is specified on g-recaptcha div element via data-callback attr
+}
+
+
 // FORM VALIDATION
Unstage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n
@@ -1,3 +14,2 @@
 // FORM VALIDATION
-var validator;
 $(function(){
Unstage this hunk [y,n,q,a,d,K,j,J,g,/,e,?]? y
@@ -3,5 +15,5 @@
 $(function(){
-  validator =  $('#contact_us-form').validate({
+  $('#contact_us-form').validate({
     rules: {
       name: {
         required: true,
Unstage this hunk [y,n,q,a,d,K,j,J,g,/,e,?]? y
@@ -47,12 +59,7 @@ $(function(){
       $(element).removeClass("error_inp");
     },
     submitHandler: function(form) {
-      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
-        .attr( 'id' ).match( /\d+$/ );
-      if( id ){ id =  id[0] } else { id = 0 }
-      grecaptcha.execute( Number( id ) );
-      // When .execute is done this will trigger callback
-      // which is specified on g-recaptcha div element via data-callback attr
+      captchaProcess( form );
     }
   });
 });
Unstage this hunk [y,n,q,a,d,K,g,/,e,?]? n
error: patch failed: public/v2/js/contact_us.js:1
error: public/v2/js/contact_us.js: patch does not apply
diff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js
index e05be6d0..d429d291 100644
--- a/public/v2/js/contact_us.js
+++ b/public/v2/js/contact_us.js
@@ -1,7 +1,6 @@
 // FORM VALIDATION
-var validator;
 $(function(){
-  validator =  $('#contact_us-form').validate({
+  $('#contact_us-form').validate({
     rules: {
       name: {
         required: true,



DETAILS:

git diff -b -w --ignore-blank-lines /home/kes/s/public/v2/js/contact_us.js
diff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js
index d429d291..bd1f4ddd 100644
--- a/public/v2/js/contact_us.js
+++ b/public/v2/js/contact_us.js
@@ -1,10 +1,24 @@
 
+function show_validator_errors( xhr, validator ) {
+  if( xhr.status == 404 ) { return }
+
+  var res =  xhr.responseJSON;
+  // TODO: Display responseText if there is no responseJSON
+  if( !res ) { return };
+
+  var errors =  {};
+  // convert server response into validator format
+  for( var error in res.error.info ) {
+    errors[error] =  res.error.info[ error ][ 1 ] || 'Error';
+  }
+  validator.showErrors( errors );
+}
+
 
 function captchaProcess( form ) {
       var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
         .attr( 'id' ).match( /\d+$/ );
       if( id ){ id =  id[0] } else { id = 0 }
-      grecaptcha.reset( Number( id ) );
       grecaptcha.execute( Number( id ) );
       // When .execute is done this will trigger callback
       // which is specified on g-recaptcha div element via data-callback attr








git diff -b -w --ignore-blank-lines --staged /home/kes/s/public/v2/js/contact_us.js
diff --git a/public/v2/js/contact_us.js b/public/v2/js/contact_us.js
index e05be6d0..d429d291 100644
--- a/public/v2/js/contact_us.js
+++ b/public/v2/js/contact_us.js
@@ -1,7 +1,19 @@
+
+
+function captchaProcess( form ) {
+      var id =  $(form).find( 'textarea[name=g-recaptcha-response]' )
+        .attr( 'id' ).match( /\d+$/ );
+      if( id ){ id =  id[0] } else { id = 0 }
+      grecaptcha.reset( Number( id ) );
+      grecaptcha.execute( Number( id ) );
+      // When .execute is done this will trigger callback
+      // which is specified on g-recaptcha div element via data-callback attr
+}
+
+
 // FORM VALIDATION
-var validator;
 $(function(){
-  validator =  $('#contact_us-form').validate({
+  $('#contact_us-form').validate({
     rules: {
       name: {
         required: true,





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-15 12:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 12:33 Case when I can not unstage the hunk KES

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).