dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26593
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13152: context-menus in maint-patient module, wip
------------------------------------------------------------
revno: 13152
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-12-05 12:31:19 +0100
message:
context-menus in maint-patient module, wip
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttributeGroup.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2013-04-17 07:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2013-12-05 11:31:19 +0000
@@ -1,10 +1,21 @@
+
+$(function() {
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive'
+ });
+});
+
// -----------------------------------------------------------------------------
// View details
// -----------------------------------------------------------------------------
-function showPatientAttributeDetails( patientAttributeId )
-{
- jQuery.getJSON( 'getPatientAttribute.action', { id: patientAttributeId },
+function showUpdatePatientAttributeForm( context ) {
+ location.href = 'showUpdatePatientAttributeForm.action?id=' + context.id;
+}
+
+function showPatientAttributeDetails( context ) {
+ jQuery.getJSON( 'getPatientAttribute.action', { id: context.id },
function ( json ) {
setInnerHTML( 'nameField', json.patientAttribute.name );
setInnerHTML( 'descriptionField', json.patientAttribute.description );
@@ -37,9 +48,9 @@
// Remove Patient Attribute
// -----------------------------------------------------------------------------
-function removePatientAttribute( patientAttributeId, name )
+function removePatientAttribute( context )
{
- removeItem( patientAttributeId, name, i18n_confirm_delete, 'removePatientAttribute.action' );
+ removeItem( context.id, context.name, i18n_confirm_delete, 'removePatientAttribute.action' );
}
ATTRIBUTE_OPTION =
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttributeGroup.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttributeGroup.js 2012-03-13 09:47:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttributeGroup.js 2013-12-05 11:31:19 +0000
@@ -1,24 +1,33 @@
+$(function() {
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive'
+ });
+});
+
// -----------------------------------------------------------------------------
// View details
// -----------------------------------------------------------------------------
-function showPatientAttributeGroupDetails( patientAttributeGroupId )
-{
- jQuery.getJSON( 'getPatientAttributeGroup.action', { id: patientAttributeGroupId },
- function ( json ) {
- setInnerHTML( 'nameField', json.patientAttributeGroup.name );
- setInnerHTML( 'descriptionField', json.patientAttributeGroup.description );
- setInnerHTML( 'noAttributeField', json.patientAttributeGroup.noAttribute );
-
- showDetails();
- });
+function showUpdatePatientAttributeGroupForm( context ) {
+ location.href = 'showUpdatePatientAttributeGroupForm.action?id=' + context.id;
+}
+
+function showPatientAttributeGroupDetails( context ) {
+ jQuery.getJSON('getPatientAttributeGroup.action', { id: context.id },
+ function( json ) {
+ setInnerHTML('nameField', json.patientAttributeGroup.name);
+ setInnerHTML('descriptionField', json.patientAttributeGroup.description);
+ setInnerHTML('noAttributeField', json.patientAttributeGroup.noAttribute);
+
+ showDetails();
+ });
}
// -----------------------------------------------------------------------------
// Remove Patient Attribute
// -----------------------------------------------------------------------------
-function removePatientAttributeGroup( patientAttributeGroupId, name )
-{
- removeItem( patientAttributeGroupId, name, i18n_confirm_delete, 'removePatientAttributeGroup.action' );
-}
\ No newline at end of file
+function removePatientAttributeGroup( context ) {
+ removeItem(context.id, context.name, i18n_confirm_delete, 'removePatientAttributeGroup.action');
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm 2013-06-29 14:16:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm 2013-12-05 11:31:19 +0000
@@ -1,6 +1,15 @@
<h3>$i18n.getString( "patient_attribute_management" ) #openHelp( "patient_attribute" )</h3>
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showUpdatePatientAttributeForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i> $i18n.getString( "translation_translate" )</a></li>
+ <li><a data-target-fn="removePatientAttribute"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showPatientAttributeDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
<table class="mainPageTable">
<tr>
<td style="vertical-align:top">
@@ -15,43 +24,33 @@
<table class="listTable">
<col>
- <col width="120">
<thead>
<tr>
<th>$i18n.getString( "name" )</th>
- <th colspan="3">$i18n.getString( "operations" )</th>
</tr>
</thead>
<tbody id="list">
- #foreach( $patientAttribute in $patientAttributes )
- <tr id="tr${patientAttribute.id}">
-
- <td onclick="showPatientAttributeDetails( $patientAttribute.id )">$encoder.htmlEncode( $patientAttribute.displayName )</td>
-
- <td style="text-align:center">
- <a href="showUpdatePatientAttributeForm.action?id=$patientAttribute.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="javascript:translate( 'PatientAttribute', '$patientAttribute.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- <a href="javascript:removePatientAttribute( '$patientAttribute.id', '$encoder.jsEncode( $patientAttribute.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- <a href="javascript:showPatientAttributeDetails( $patientAttribute.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- </td>
-
- </tr>
- #end
-
- </tbody>
-
- </table>
+ #foreach( $patientAttribute in $patientAttributes )
+ <tr id="tr${patientAttribute.id}" data-id="$!patientAttribute.id" data-uid="$!patientAttribute.uid" data-type="PatientAttribute" data-name="$encoder.htmlEncode( $!patientAttribute.displayName )"
+ data-can-manage="$security.canManage( $patientAttribute )"
+ data-can-update="$security.canUpdate( $patientAttribute )"
+ data-can-delete="$security.canDelete( $patientAttribute )">
+ <td>$encoder.htmlEncode( $!patientAttribute.displayName )</td>
+ </tr>
+ #end
+ </tbody>
+ </table>
</td>
+
<td id="detailsData">
-
- <div id="detailsArea">
- <div id="hideDetailsArea">
- <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
- </div>
- <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
- <p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
- <p><label class="bold">$i18n.getString( "mandatory" ):</label><br><span id="mandatoryField"></span></p>
- <p><label class="bold">$i18n.getString( "inherit" ):</label><br><span id="inheritField"></span></p>
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
+ </div>
+ <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
+ <p><label class="bold">$i18n.getString( "mandatory" ):</label><br><span id="mandatoryField"></span></p>
+ <p><label class="bold">$i18n.getString( "inherit" ):</label><br><span id="inheritField"></span></p>
<p><label class="bold">$i18n.getString( "value_type" ):</label><br><span id="valueTypeField"></span></p>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm 2013-06-29 14:16:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm 2013-12-05 11:31:19 +0000
@@ -1,56 +1,59 @@
-
<h3>$i18n.getString( "patient_attribute_group_management" ) #openHelp( "patient_attribute_group" )</h3>
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showUpdatePatientAttributeGroupForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i> $i18n.getString( "translation_translate" )</a></li>
+ <li><a data-target-fn="removePatientAttributeGroup"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showPatientAttributeGroupDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
<table class="mainPageTable">
<tr>
<td style="vertical-align:top">
-
- <table class="listTable">
- <col>
- <col width="120">
- <tr>
- <td></td>
- <td style="text-align:right">
- <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddPatientAttributeGroupForm.action'" style="width:75px">
- <input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortPatientAttributeGroup.action'" style="width:75px"><br>
- </td>
- </tr>
- <tr>
- <th>$i18n.getString( "name" )</th>
- <th>$i18n.getString( "operations" )</th>
+ <table width="100%">
+ <tr>
+ <td>
+ $i18n.getString( "filter_by_name" ): <input type="text" onkeyup="filterValues( this.value , 1)" style="width:250px"/>
+ </td>
+ <td colspan="3" style="text-align:right">
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddPatientAttributeGroupForm.action'" style="width:75px">
+ <input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortPatientAttributeGroup.action'" style="width:75px"><br>
+ </td>
+ </tr>
+ </table>
+
+ <table class="listTable">
+ <col>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $patientAttributeGroup in $patientAttributeGroups )
+ <tr id="tr${patientAttributeGroup.id}" data-id="$!patientAttributeGroup.id" data-uid="$!patientAttributeGroup.uid" data-type="PatientAttributeGroup" data-name="$encoder.htmlEncode( $!patientAttributeGroup.displayName )"
+ data-can-manage="$security.canManage( $patientAttributeGroup )"
+ data-can-update="$security.canUpdate( $patientAttributeGroup )"
+ data-can-delete="$security.canDelete( $patientAttributeGroup )">
+ <td>$encoder.htmlEncode( $!patientAttributeGroup.displayName )</td>
</tr>
-
- <tbody id="list">
- #foreach( $patientAttributeGroup in $patientAttributeGroups )
- <tr id="tr${patientAttributeGroup.id}">
-
- <td onclick="showPatientAttributeGroupDetails( $patientAttributeGroup.id )">$encoder.htmlEncode( $patientAttributeGroup.displayName )</td>
-
- <td>
- <a href="showUpdatePatientAttributeGroupForm.action?id=$patientAttributeGroup.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="javascript:translate( 'PatientAttributeGroup', '$patientAttributeGroup.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- <a href="javascript:removePatientAttributeGroup( '$patientAttributeGroup.id', '$encoder.jsEncode( $patientAttributeGroup.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- <a href="javascript:showPatientAttributeGroupDetails( $patientAttributeGroup.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- </td>
-
- </tr>
- #end
-
- </tbody>
-
- </table>
+ #end
+ </tbody>
+ </table>
+
</td>
+
<td id="detailsData">
-
- <div id="detailsArea">
- <div id="hideDetailsArea">
- <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
- </div>
- <p><label class="bold">$i18n.getString( "name" )</label><br><span id="nameField"></span></p>
- <p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
- <p><label class="bold">$i18n.getString( "number_of_attribute" ):</label><br><span id="noAttributeField"></span></p>
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
+ </div>
+ <p><label class="bold">$i18n.getString( "name" )</label><br><span id="nameField"></span></p>
+ <p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
+ <p><label class="bold">$i18n.getString( "number_of_attribute" ):</label><br><span id="noAttributeField"></span></p>
</div>
-
</td>
</tr>
</table>