dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40380
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20467: Disable file upload fields when offline
------------------------------------------------------------
revno: 20467
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-10-02 13:06:55 +0200
message:
Disable file upload fields when offline
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.fileresource.js
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/entry.fileresource.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.fileresource.js 2015-10-01 18:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.fileresource.js 2015-10-02 11:06:55 +0000
@@ -2,7 +2,6 @@
$.fn.fileEntryField = function() {
// TODO Use i18n
- // TODO Disable field when offline
var $container = $( this );
@@ -35,7 +34,6 @@
'pe': periodId
};
- // Logic
var deleteFileDataValue = function() {
var postData = formData;
postData.value = '';
@@ -132,13 +130,26 @@
$button.button( 'enable' );
};
- setButtonBlocked();
+ var disableField = function() {
+ $button.button( 'disable' );
+ $field.toggleClass( 'entryfileresource-disabled', true );
+ };
+
+ var enableField = function() {
+ $button.button( 'enable' );
+ $field.toggleClass( 'entryfileresource-disabled', false );
+ };
$( document ).on( dhis2.de.event.dataValuesLoaded, function() {
( !$field.data( 'value' ) ) ? setButtonUpload() : setButtonDelete();
} );
- // Initialize file uploader
+ $( document ).on( "dhis2.offline", disableField );
+ $( document ).on( "dhis2.online", enableField );
+
+ // Init
+ setButtonBlocked();
+
$fileInput.fileupload( {
url: '../api/dataValues/files',
paramName: 'file',
=== 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-10-01 13:22:12 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/style/dhis-web-dataentry.css 2015-10-02 11:06:55 +0000
@@ -261,11 +261,17 @@
{
height: 28px;
width: 200px;
- border: 1px solid #aaa;
+ border: 1px solid #dadada;
display: table-cell;
overflow: hidden;
position: relative;
}
+
+.entryfileresource-disabled
+{
+ background-color: #f3f3f3 !important;
+}
+
/* Upload progress display */
.upload-progress