CRM-17620 - Convert cases to use expandRow.js
authorColeman Watts <coleman@civicrm.org>
Thu, 3 Dec 2015 05:05:18 +0000 (00:05 -0500)
committerColeman Watts <coleman@civicrm.org>
Thu, 3 Dec 2015 05:05:18 +0000 (00:05 -0500)
css/civicrmNavigation.css
templates/CRM/Case/Form/Selector.tpl
templates/CRM/Case/Page/DashboardSelector.tpl

index f7260f6f9fcd4c08a3a63caf123a971683ce2798..c5c94c2c382f131647cb98e777f02047f4eb3fe0 100644 (file)
@@ -161,4 +161,4 @@ li.menu-separator{
 /* This ensures the drop-down menus appear at the right height */
 #civicrm-menu > li.menumain {
   height: 19px !important;
-}
\ No newline at end of file
+}
index 3b01c20a403e0738427c454d678f43b9dcaabb92..1d2c55caafbb3d51d1c0053d87110983b8720252 100644 (file)
         <td>{$form.$cbName.html}</td>
     {/if}
         <td class="crm-case-id crm-case-id_{$row.case_id}">
-        <span id="{$list}{$row.case_id}_show">
-            <a href="#" onclick="cj('#caseDetails{$list}{$row.case_id}').show();
-                                 buildCaseDetails('{$list}{$row.case_id}','{$row.contact_id}');
-                                 cj('#{$list}{$row.case_id}_show').hide();
-                                 cj('#minus{$list}{$row.case_id}_hide').show();
-                                 cj('#{$list}{$row.case_id}_hide').show();
-                                 return false;"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}Show recent activities{/ts}"/></a>
-        </span>
-        <span id="minus{$list}{$row.case_id}_hide">
-            <a href="#" onclick="cj('#caseDetails{$list}{$row.case_id}').hide();
-                                 cj('#{$list}{$row.case_id}_show').show();
-                                 cj('#{$list}{$row.case_id}_hide').hide();
-                                 cj('#minus{$list}{$row.case_id}_hide').hide();
-                                 return false;"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}Hide activities{/ts}"/></a>
+          <a title="{ts}Activities{/ts}" class="crm-expand-row" href="{crmURL p='civicrm/case/details' q="caseId=`$row.case_id`&cid=`$row.contact_id`"}"></a>
         </td>
 
     {if !$single}
     <td class="crm-case-case_scheduled_activity_type">{if $row.case_scheduled_activity_type}
   {$row.case_scheduled_activity_type}<br />{$row.case_scheduled_activity_date|crmDate}{else}---{/if}</td>
     <td>{$row.action|replace:'xx':$row.case_id}{$row.moreActions|replace:'xx':$row.case_id}</td>
-   </tr>
-   <tr id="{$list}{$row.case_id}_hide" class='{$rowClass}'>
-     <td>
-     </td>
-{if $context EQ 'Search'}
-     <td colspan="10" class="enclosingNested">
-{else}
-     <td colspan="9" class="enclosingNested">
-{/if}
-        <div id="caseDetails{$list}{$row.case_id}"></div>
-     </td>
-   </tr>
- <script type="text/javascript">
-     cj('#{$list}{$row.case_id}_hide').hide();
-     cj('#minus{$list}{$row.case_id}_hide').hide();
- </script>
   {/foreach}
 
     {* Dashboard only lists 10 most recent cases. *}
 {/strip}
 
 {include file="CRM/common/pager.tpl" location="bottom"}
-
-{* Build case details*}
-{literal}
-<script type="text/javascript">
-
-function buildCaseDetails( caseId, contactId ) {
-  var dataUrl = {/literal}"{crmURL p='civicrm/case/details' h=0 q='caseId='}{literal}" + caseId +'&cid=' + contactId;
-  CRM.loadPage(dataUrl, {target: '#caseDetails' + caseId});
-}
-</script>
-
-{/literal}
+{crmScript file='js/crm.expandRow.js'}
index f2b4c28842596885d9a17d762e9b53710bcecbd0..2546998e01e53eedaa8b1233c7e52409ad02ca6f 100644 (file)
 
   <tr id='{$context}-{$list}-rowid-{$row.case_id}' class="crm-case crm-case_{$row.case_id}">
   <td>
-        {* &nbsp;{$row.contact_type_icon}<br /> *}
-        <span id="{$context}{$list}{$row.case_id}_show">
-      <a href="#" onclick="{$context}{$list}CaseDetails('{$row.case_id}','{$row.contact_id}', '{$list}', '{$context}');
-                showCaseActivities('{$row.case_id}','{$list}', '{$context}');
-                             return false;"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a>
-  </span>
-  <span id="minus{$context}{$list}{$row.case_id}_hide">
-      <a href="#" onclick="hideCaseActivities('{$row.case_id}','{$list}', '{$context}');
-                             return false;"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a>
+    <a title="{ts}Activities{/ts}" class="crm-expand-row" href="{crmURL p='civicrm/case/details' q="caseId=`$row.case_id`&cid=`$row.contact_id`&type=$list"}"></a>
   </td>
 
     <td class="crm-case-phone"><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`"}">{$row.sort_name}</a>{if $row.phone}<br /><span class="description">{$row.phone}</span>{/if}<br /><span class="description">{ts}Case ID{/ts}: {$row.case_id}</span></td>
 
     <td>{$row.action}{$row.moreActions}</td>
    </tr>
-   <tr id="{$list}{$row.case_id}_hide" class="crm-case_{$row.case_id}">
-     <td>
-     </td>
-     <td colspan="7" width="99%" class="enclosingNested crm-case_{$row.case_id}">
-        <div id="{$context}-{$list}-casedetails-{$row.case_id}"></div>
-     </td>
-   </tr>
- <script type="text/javascript">
-     cj('#minus{$context}{$list}{$row.case_id}_hide').hide();
- </script>
   {/foreach}
 
     {* Dashboard only lists 10 most recent casess. *}
 
 {/strip}
 
-{* Build case details*}
-{literal}
-<script type="text/javascript">
-function {/literal}{$context}{$list}{literal}CaseDetails( caseId, contactId, type, context )
-{
-    var dataUrl = CRM.url('civicrm/case/details', {caseId: caseId, cid: contactId, type: type});
-    CRM.loadPage(dataUrl, {target: '#'+ context + '-' + type +'-casedetails-' + caseId});
-}
-
-function showCaseActivities( caseId, type, context ) {
-    cj('#' + context + '-' + type +'-casedetails-'+ caseId).show();
-    cj('#' + context+type+caseId+'_show').hide();
-    cj('#minus'+context+type+caseId+'_hide').show();
-}
-
-function hideCaseActivities( caseId , type, context ) {
-    cj('#' + context + '-' + type +'-casedetails-' + caseId).hide();
-    cj('#' + context+type+caseId+'_show').show();
-    cj('#minus'+context+type+caseId+'_hide').hide();
-}
-
-</script>
-{/literal}
+{crmScript file='js/crm.expandRow.js'}