CRM-12915, fixed dailog output for empty response
authorDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Mon, 29 Jul 2013 10:32:24 +0000 (16:02 +0530)
committerDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Mon, 29 Jul 2013 10:32:24 +0000 (16:02 +0530)
----------------------------------------
* CRM-12915: Improve layout of revision-history for multi-row CustomGroups
  http://issues.civicrm.org/jira/browse/CRM-12915

templates/CRM/common/logButton.tpl

index 9b9eea084a819e624b82c7a7ea065a644e7b7d8c..58362654b33f771bac415b7051764b03959684fc 100644 (file)
@@ -36,7 +36,7 @@
   Note: This file is used by CivHR
 *}
 
-<a class="css_right {$snippet.css_class}" href="#" title="{ts}View Revisions{/ts}">Revisions</a>
+<a class="css_right {$snippet.css_class}" href="#" title="{ts}View Revisions{/ts}">View Revisions</a>
 <div class="dialog-{$snippet.css_class}">
   <div class="revision-content"></div>
 </div>
@@ -49,20 +49,20 @@ cj(document).on("click", ".{/literal}{$snippet.css_class}{literal}", function()
     title: "{/literal}{ts}Revisions{/ts}{literal}",
     modal: true,
     width: "680px",
-    height: "380",
     bgiframe: true,
     overlay: { opacity: 0.5, background: "black" },
     open:function() {
-      var url = CRM.url("civicrm/report/instance/{/literal}{$snippet.instance_id}{literal}", {
-        reset:1,
-        snippet:4,
-        section:2,
-        altered_contact_id_op:"eq",
-        altered_contact_id_value:"{/literal}{$snippet.contact_id}{literal}",
-        log_type_table_op:"has",
-        log_type_table_value:"{/literal}{$snippet.table_name}{literal}"
+      var ajaxurl = {/literal}'{crmURL p="civicrm/report/instance/`$snippet.instance_id`" h=0 }'{literal};
+      cj.ajax({
+        data: "reset=1&snippet=4&section=2&altered_contact_id_op=eq&altered_contact_id_value={/literal}{$snippet.contact_id}{literal}&log_type_table_op=has&log_type_table_value={/literal}{$snippet.table_name}{literal}",
+        url:  ajaxurl,
+        success: function (data) {
+          cj(".dialog-{/literal}{$snippet.css_class}{literal} .revision-content").html(data);
+          if (!cj(".dialog-{/literal}{$snippet.css_class}{literal} .revision-content .report-layout").length) {
+            cj(".dialog-{/literal}{$snippet.css_class}{literal} .revision-content").html("Sorry, couldn't find any revisions.");
+          }
+        }
       });
-      cj(".revision-content", this).load(url);
     },
     buttons: {
       "Done": function() {