Merge pull request #3367 from kirkatcaat/empty-labels-on-profile-fields
[civicrm-core.git] / js / Common.js
index e2f0b7a4473abbf7631b0b2fd793365356cc62df..68b06ce38d34170cb91934de71828576c863bec5 100644 (file)
@@ -247,7 +247,8 @@ CRM.validate = CRM.validate || {
     var isDirty = false;
     $(':input:visible, :input.select2-offscreen', el).each(function () {
       var initialValue = $(this).data('crm-initial-value');
-      if (initialValue !== undefined && initialValue != $(this).val()) {
+      // skip change of value for submit buttons
+      if (initialValue !== undefined && !$(this).hasClass('form-submit') && initialValue != $(this).val()) {
         isDirty = true;
       }
     });
@@ -451,6 +452,13 @@ CRM.validate = CRM.validate || {
   // Initialize widgets
   $(document)
     .on('crmLoad', function(e) {
+      $('table.form-layout-compressed')
+        .on('change', 'input.select-rows', function () {
+          if ($(this).prop('checked')) {
+            $('input#toggleSelect:checked').prop('checked', false);
+            $('input.select-row:checked').prop('checked', false);
+          }
+         })
       $('table.row-highlight', e.target)
         .off('.rowHighlight')
         .on('change.rowHighlight', 'input.select-row, input.select-rows', function (e, data) {
@@ -464,6 +472,9 @@ CRM.validate = CRM.validate || {
             if (data !== 'master-selected') {
               $('input.select-rows', $table).prop('checked', $(".select-row:not(':checked')", $table).length < 1);
             }
+           if ($(this).prop('checked')) {
+             $('input[value=ts_sel]:radio').prop('checked', true);
+           }
           }
         })
         .find('input.select-row:checked').parents('tr').addClass('crm-row-selected');
@@ -762,6 +773,16 @@ CRM.validate = CRM.validate || {
     return dialog.dialog(settings).trigger('crmLoad');
   };
 
+  /** provides a local copy of ts for a domain */
+  CRM.ts = function(domain) {
+    return function(message, options) {
+      if (domain) {
+        options = $.extend(options || {}, {domain: domain});
+      }
+      return ts(message, options);
+    };
+  };
+
   /**
    * @see https://wiki.civicrm.org/confluence/display/CRMDOC/Notification+Reference
    */