← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20433: Use ui confirmation dialog instead of window.confirm

 

------------------------------------------------------------
revno: 20433
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-01 14:35:14 +0200
message:
  Use ui confirmation dialog instead of window.confirm
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css


--
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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2015-10-01 10:26:37 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2015-10-01 12:35:14 +0000
@@ -677,8 +677,7 @@
         };
 
         // Functions
-        var deleteFileDataValue = function()
-        {
+        var deleteFileDataValue = function() {
             var postData = formData;
             postData.value = '';
 
@@ -702,8 +701,7 @@
             } );
         };
 
-        var setButtonDelete = function()
-        {
+        var setButtonDelete = function() {
             $button.button( {
                 text: false,
                 icons: {
@@ -712,17 +710,26 @@
             } );
             $button.unbind( 'click' );
             $button.on( 'click', function() {
-                // TODO Use jQuery UI dialog
-                var confirmed = window.confirm( 'Delete the file?' );
-                if ( confirmed ) {
-                    deleteFileDataValue();
-                }
+                $( '#fileDeleteConfirmationDialog' ).dialog( {
+                    title: 'Confirm deletion',
+                    resizable: false,
+                    height: 140,
+                    modal: true,
+                    buttons: {
+                        'Delete': function() {
+                            deleteFileDataValue();
+                            $( this ).dialog( 'close' );
+                        },
+                        Cancel: function() {
+                            $( this ).dialog( 'close' );
+                        }
+                    }
+                } );
             } );
             $button.button( 'enable' );
         };
 
-        var setButtonUpload = function()
-        {
+        var setButtonUpload = function() {
             $button.button( {
                 text: false,
                 icons: {

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2015-09-14 11:09:56 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2015-10-01 12:35:14 +0000
@@ -145,3 +145,9 @@
 	</tr>
 </table>
 </div>
+
+<div id="fileDeleteConfirmationDialog">
+    <div class="confirm-dialog-content">
+        <span class="fa fa-exclamation-triangle fa-lg"></span><span>Are you sure you want to delete the file?</span>
+    </div>
+</div>

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css	2015-09-30 18:50:42 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css	2015-10-01 12:35:14 +0000
@@ -357,4 +357,23 @@
 
 .ui-icon.icon-large {
     margin-top: -0.75em;
+}
+
+#fileDeleteConfirmationDialog
+{
+    display: none;
+    font-weight: bold;
+    vertical-align: middle;
+}
+
+.confirm-dialog-content
+{
+    display: inline-block;
+    position: absolute;
+    top: 16px;
+}
+
+#fileDeleteConfirmationDialog .fa
+{
+    margin-right: 5px;
 }
\ No newline at end of file