Auto select checkbox when updating metadata values.

Closes GitLab issue #371.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-05-24 02:27:43 -04:00
parent ce563bfb6a
commit 76e8fd2b07
5 changed files with 32 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
2.2.1 (2017-05-25)
==================
- Allow for bigger indexing expression templates.
- Auto select checkbox when updating metadata values. GitLab issue #371.
2.2 (2017-04-26)
================

View File

@@ -14,6 +14,8 @@ Changes
-------------
- Index node expression template field changed from a 128 character field to an
unlimited size text field to allow for complex indexing expressions.
- When updating the metadata of a document, any input in the value form field
will select the adjacent checkbox.
Removals
--------
@@ -68,6 +70,6 @@ Backward incompatible changes
Bugs fixed or issues closed
===========================
* `GitLab issue #357 <https://gitlab.com/mayan-edms/mayan-edms/issues/357>`_ It should be possible to retrieve all workflows for a given DocumentType from the API
* `GitLab issue #371 <https://gitlab.com/mayan-edms/mayan-edms/issues/371>`_ Auto select checkbox when updating metadata
.. _PyPI: https://pypi.python.org/pypi/mayan-edms/

View File

@@ -33,6 +33,17 @@
{% block stylesheets %}{% endblock %}
{% endcompress %}
<script>
function waitForJQuery(func) {
if (window.jQuery) {
func();
} else {
setTimeout(function() {
waitForJQuery(func)
}, 50);
}
}
</script>
</head>
<body>
{% if appearance_type == 'plain' %}

View File

@@ -16,11 +16,16 @@ class DocumentMetadataForm(forms.Form):
label=_('Name'), required=False,
widget=forms.TextInput(attrs={'readonly': 'readonly'})
)
value = forms.CharField(label=_('Value'), required=False)
value = forms.CharField(label=_('Value'), required=False,
widget=forms.TextInput(attrs={'class': 'metadata-value'})
)
update = forms.BooleanField(
initial=True, label=_('Update'), required=False
)
class Media:
js = ('metadata/js/metadata_form.js',)
def __init__(self, *args, **kwargs):
super(DocumentMetadataForm, self).__init__(*args, **kwargs)

View File

@@ -0,0 +1,11 @@
'use strict';
waitForJQuery(function() {
jQuery(document).ready(function() {
$('.metadata-value').on('input', function(event) {
// Check the checkbox next to a metadata value input when there is
// data entry in the value's input.
$(event.target).parents('tr').find(':checkbox').prop('checked', true);
});
});
});