Appearance: Select card by clicking on the card

Add support for selecting a document from the UI by just clicking
on the title of the body of the card, not just on the checkbox
next to the title.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-20 20:40:26 -04:00
parent bd54877e0c
commit 263d646c7c
3 changed files with 46 additions and 1 deletions

View File

@@ -207,6 +207,9 @@
navigation links will be displayed here. The notification,
user and system tools are now displayed at the top navigation
bar.
- Added support for selecting a document from the UI by just
clicking on the title of the body of the card, not just on
the checkbox next to the title.
3.1.9 (2018-11-01)
==================

View File

@@ -223,6 +223,7 @@ class MayanApp {
value.app = self;
app.doRefreshAJAXMenu(value);
});
this.setupPanelSelection();
partialNavigation.initialize();
}
@@ -312,6 +313,7 @@ class MayanApp {
app.lastChecked = this;
return;
}
if(e.shiftKey) {
var $checkBoxes = $('.check-all-slave');
@@ -348,6 +350,47 @@ class MayanApp {
});
}
setupPanelSelection () {
var app = this;
$('body').on('click', '.panel-item', function (event) {
var $this = $(this);
var targetSrc = $(event.target).prop('src');
var targetHref = $(event.target).prop('href');
var lastChecked = null;
if ((targetSrc === undefined) && (targetHref === undefined)) {
var $checkbox = $this.find('.check-all-slave');
var checked = $checkbox.prop('checked');
if (checked) {
$checkbox.prop('checked', '');
$checkbox.trigger('change');
} else {
$checkbox.prop('checked', 'checked');
$checkbox.trigger('change');
}
if(!app.lastChecked) {
app.lastChecked = $checkbox;
}
if (event.shiftKey) {
var $checkBoxes = $('.check-all-slave');
var start = $checkBoxes.index($checkbox);
var end = $checkBoxes.index(app.lastChecked);
$checkBoxes.slice(
Math.min(start, end), Math.max(start, end) + 1
).prop('checked', app.lastChecked.prop('checked')).trigger('change');
}
app.lastChecked = $checkbox;
window.getSelection().removeAllRanges();
}
});
}
setupScrollView () {
$('.scrollable').scrollview();
}

View File

@@ -107,7 +107,6 @@
{# Transfer variable from Django to javascript #}
var initialURL = '{% url home_view %}';
var djangoDEBUG = {% if debug %}true{% else %}false{% endif %};
var apiTemplateMainMenuURL = '{% url "rest_api:template-detail" "menu_main" %}';
</script>
<script src="{% static 'appearance/js/base.js' %}" type="text/javascript"></script>
<script>