Permalink
Browse files

Adds optional checkboxes for selecting item.

  • Loading branch information...
lrsjng committed Aug 30, 2013
1 parent 3d3d5ba commit f72a09fde05c96b7412767c11c3ebb553b635edf
Showing with 32 additions and 20 deletions.
  1. +18 −15 src/_h5ai/client/css/inc/view.less
  2. +8 −3 src/_h5ai/client/js/inc/ext/select.js
  3. +6 −2 src/_h5ai/conf/options.json
@@ -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,19 +25,21 @@
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;
.transition(all 0.2s ease-in-out);
.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;
@@ -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,15 +145,19 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
onLocationChanged = function (item) {
- _.each(item.content, initItem);
+ if (settings.checkboxes) {
+ _.each(item.content, initItem);
+ }
publish();
},
onLocationRefreshed = function (item, added, removed) {
var selectionChanged = false;
- _.each(added, initItem);
+ if (settings.checkboxes) {
+ _.each(added, initItem);
+ }
_.each(removed, function (item) {
if (item.$view && item.$view.hasClass('selected')) {
@@ -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
},
/*

1 comment on commit f72a09f

@Draxter

This comment has been minimized.

Show comment Hide comment
@Draxter

Draxter Sep 1, 2013

Try making checkboxes visible all the time when checked, instead only when hovered on. This will make it way more clearer.

Draxter commented on f72a09f Sep 1, 2013

Try making checkboxes visible all the time when checked, instead only when hovered on. This will make it way more clearer.

Please sign in to comment.