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 { #selection-rect {
display: none; display: none;
position: absolute; position: absolute;
@@ -13,10 +25,12 @@
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
width: 24px;
height: 24px;
margin-top: -3px; margin-top: -3px;
margin-left: -3px; margin-left: -3px;
background-color: #fff; background-color: #f8f8f8;
border: 1px solid #555; border: 1px solid rgba(0,0,0,0.3);
border-radius: 3px; border-radius: 3px;
opacity: 0.6; opacity: 0.6;
cursor: pointer; cursor: pointer;
@@ -24,8 +38,8 @@
.on-selected, .on-not-selected { .on-selected, .on-not-selected {
display: block; display: block;
width: 24px; width: 100%;
height: 24px; height: 100%;
} }
&:hover { &: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 { #view {
display: none; display: none;
margin: 0 auto; margin: 0 auto;

View File

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