Adds optional checkboxes for selecting item.

This commit is contained in:
Lars Jung 2013-08-30 20:06:39 +02:00
parent 3d3d5ba883
commit f72a09fde0
3 changed files with 32 additions and 20 deletions

View File

@ -1,4 +1,16 @@
@item-border-col-sep: @col-border;
@item-background-col-hover: rgba(0,0,0,0.02);
@item-border-col-hover: @col-border;
@item-background-col-sel: rgba(0,0,0,0.02);
@item-border-col-sel: @col-border-strong;
@icon-size: 48px;
#selection-rect {
display: none;
position: absolute;
@ -13,10 +25,12 @@
position: absolute;
left: 0;
top: 0;
width: 24px;
height: 24px;
margin-top: -3px;
margin-left: -3px;
background-color: #fff;
border: 1px solid #555;
background-color: #f8f8f8;
border: 1px solid rgba(0,0,0,0.3);
border-radius: 3px;
opacity: 0.6;
cursor: pointer;
@ -24,8 +38,8 @@
.on-selected, .on-not-selected {
display: block;
width: 24px;
height: 24px;
width: 100%;
height: 100%;
}
&:hover {
@ -49,17 +63,6 @@
}
@item-border-col-sep: @col-border;
@item-background-col-hover: rgba(0,0,0,0.02);
@item-border-col-hover: @col-border;
@item-background-col-sel: rgba(0,0,0,0.02);
@item-border-col-sel: @col-border-strong;
@icon-size: 48px;
#view {
display: none;
margin: 0 auto;

View File

@ -2,7 +2,8 @@
modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core/event'], function (_, $, allsettings, resource, event) {
var settings = _.extend({
enabled: false
enabled: false,
checkboxes: false
}, allsettings.select),
x = 0, y = 0,
@ -144,7 +145,9 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
onLocationChanged = function (item) {
_.each(item.content, initItem);
if (settings.checkboxes) {
_.each(item.content, initItem);
}
publish();
},
@ -152,7 +155,9 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
var selectionChanged = false;
_.each(added, initItem);
if (settings.checkboxes) {
_.each(added, initItem);
}
_.each(removed, function (item) {
if (item.$view && item.$view.hasClass('selected')) {

View File

@ -269,10 +269,14 @@ Options
},
/*
Make entries selectable. At the moment only needed for packaged download and delete.
Make entries selectable (first mouse button + drag).
At the moment only needed for packaged download and delete.
- checkboxes: boolean, show a checkbox on mouse over item
*/
"select": {
"enabled": true
"enabled": true,
"checkboxes": true
},
/*