Skip to content

Commit

Permalink
Merge pull request #1759 from informatics-isi-edu/editmode-filename
Browse files Browse the repository at this point in the history
added a tooltip to the file upload fields.
  • Loading branch information
jrchudy authored Apr 12, 2019
2 parents 79023a1 + e7aff84 commit ced0a7f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/templates/upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="form-group" style="margin-bottom: 0px;">
<input name="{{::column.name}}" type="file" accept="{{fileExtensions}}" tabindex="-1" id="{{fileElId}}" style="position: absolute; clip: rect(0px 0px 0px 0px);" ng-disabled="isDisabled">
<div class="input-group input-group-sm" style="width: 100%;">
<input name="txt{{::column.name}}" type="text" class="form-control" ng-required="isRequired" ng-disabled="isDisabled" placeholder="{{placeholder}}" readonly="" ng-model="value.url" ng-click="select()" ng-style="column.getInputDisabled($root.context.appContext) ? {'cursor': 'default'} : {'cursor': 'pointer'}" style="padding-right: 25px;font-size: 14px; height: 34px; pointer-events: all;"/>
<input name="txt{{::column.name}}" type="text" class="form-control" ng-required="isRequired" ng-disabled="isDisabled" placeholder="{{placeholder}}" readonly="" ng-model="setFilename" ng-model-options="{getterSetter: true}" ng-click="select()" tooltip-placement="bottom-left" uib-tooltip="{{setFilename()}}" ng-style="column.getInputDisabled($root.context.appContext) ? {'cursor': 'default'} : {'cursor': 'pointer'}" style="padding-right: 25px;font-size: 14px; height: 34px; pointer-events: all;"/>
<div class="form-control-feedback coltooltip" ng-click="clear()" ng-hide="!value.url || value.url == '' || isDisabled" style="cursor: pointer;right: 105px;top: 2px;pointer-events: all; height: 34px;">
<span class="glyphicon glyphicon-remove coltooltiptext foreignkey-remove" tooltip-placement="bottom" uib-tooltip="Clear field"></span>
</div>
Expand Down
14 changes: 13 additions & 1 deletion common/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
column: scope.column,
reference: scope.reference
});
scope.value.url = scope.value.file.name;
scope.value.url = scope.value.filename = scope.value.file.name;
scope.$apply();
}
});
Expand All @@ -74,10 +74,22 @@

scope.clear = function() {
scope.value.url = "";
scope.value.filename = "";
delete scope.value.file;
delete scope.value.hatracObj;
scope.fileEl.val("");
};

scope.setFilename = function () {
var value = scope.value;
if (value) {
if (value.filename) {
return value.filename;
} else {
return value.url;
}
}
}
}
};
}])
Expand Down
5 changes: 4 additions & 1 deletion recordedit/recordEdit.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@
default:
// the structure for asset type columns is an object with a 'url' property
if (column.isAsset && colModel.inputType !== "disabled") {
value = { url: values[i] || "" };
value = {
url: values[i] || "",
filename: tuple.data[column._filenameColumn.name]
};
} else {
value = values[i];
}
Expand Down

0 comments on commit ced0a7f

Please sign in to comment.