style tile-view to show images on whole tile with file-name and comment on hover only

This commit is contained in:
Ralf Becker 2015-01-21 18:59:12 +00:00
parent b9da0b6d4c
commit 14a7dd38f3
5 changed files with 78 additions and 14 deletions

View File

@ -81,6 +81,12 @@ var et2_DOMWidget = et2_widget.extend(et2_IDOMNode,
type:"string", type:"string",
default: '', default: '',
description: "Allow Resize height of the widget based on exess height and given ratio" description: "Allow Resize height of the widget based on exess height and given ratio"
},
data: {
name: "comma-separated name:value pairs set as data attributes on DOM node",
type: "string",
default: '',
description: 'data="mime:${row}[mime]" would generate data-mime="..." in DOM, eg. to use it in CSS on a parent'
} }
}, },
@ -404,6 +410,20 @@ var et2_DOMWidget = et2_widget.extend(et2_IDOMNode,
} }
}, },
set_data: function(_value)
{
var node = this.getDOMNode(this);
if (node && _value)
{
var pairs = _value.split(/,/g);
for(var i=0; i < pairs.length; ++i)
{
var name_value = pairs[i].split(':');
$j(node).attr('data-'+name_value[0], name_value[1]);
}
}
},
/** /**
* Set Actions on the widget * Set Actions on the widget
* *

View File

@ -129,6 +129,7 @@ var et2_box = et2_baseWidget.extend([et2_IDetachedDOM],
*/ */
getDetachedAttributes: function(_attrs) getDetachedAttributes: function(_attrs)
{ {
_attrs.push('data');
}, },
getDetachedNodes: function() getDetachedNodes: function()
@ -138,6 +139,15 @@ var et2_box = et2_baseWidget.extend([et2_IDetachedDOM],
setDetachedAttributes: function(_nodes, _values) setDetachedAttributes: function(_nodes, _values)
{ {
if (_values.data)
{
var pairs = _values.data.split(/,/g);
for(var i=0; i < pairs.length; ++i)
{
var name_value = pairs[i].split(':');
$j(_nodes[0]).attr('data-'+name_value[0], name_value[1]);
}
}
} }
}); });

View File

@ -73,20 +73,37 @@ table.egwGridView_grid .tile .file_tile {
display: block; display: block;
max-width: 140px; max-width: 140px;
} }
#filemanager-index_nm .file_tile img.vfsMimeIcon[src*="/etemplate/thumbnail.php"] {
height: auto;
max-height: 128px;
}
.tile .file_tile img.vfsMimeIcon { .tile .file_tile img.vfsMimeIcon {
height: auto; height: auto;
width: auto; width: auto;
max-height: 64px; max-height: 48px;
display:block; display:block;
margin: 0 auto; margin: 0 auto;
} }
.tile .file_tile .et2_label { .tile .file_tile .et2_label {
word-wrap: break-word; word-wrap: break-word;
} }
.tile .file_tile {
position: relative;
}
.tile .file_tile[data-mime^="image"] .et2_label {
display: none;
}
.tile .file_tile[data-mime^="image"]:hover .et2_label {
display: block;
position: absolute;
top: 10px;
color: white;
text-shadow: 2px 2px 8px black;
width: 100%;
}
.tile .file_tile[data-mime^="image"]:hover .et2_label[id*=comment] {
top: 30px;
}
#filemanager-index_nm .file_tile[data-mime^="image"] img.vfsMimeIcon {
height: auto;
max-height: 100px;
}
/** /**
* Select file dialog * Select file dialog

View File

@ -18,7 +18,7 @@
<nextmatch-header/> <nextmatch-header/>
</row> </row>
<row class="tile $row_cont[class]"> <row class="tile $row_cont[class]">
<vbox class="file_tile" width="150px" height="110px"> <vbox class="file_tile" width="135px" height="100px" data="mime:$row_cont[mime]">
<vfs-mime align="center" id="$row" thumb_mime_size="image,128"/> <vfs-mime align="center" id="$row" thumb_mime_size="image,128"/>
<vfs-name id="${row}[name]" no_lang="1" readonly="true"/> <vfs-name id="${row}[name]" no_lang="1" readonly="true"/>
<description id="${row}[comment]"/> <description id="${row}[comment]"/>

View File

@ -100,20 +100,37 @@ table.egwGridView_grid .tile .file_tile {
display: block; display: block;
max-width: 140px; max-width: 140px;
} }
#filemanager-index_nm .file_tile img.vfsMimeIcon[src*="/etemplate/thumbnail.php"] {
height: auto;
max-height: 128px;
}
.tile .file_tile img.vfsMimeIcon { .tile .file_tile img.vfsMimeIcon {
height: auto; height: auto;
width: auto; width: auto;
max-height: 64px; max-height: 48px;
display: block; display: block;
margin: 0 auto; margin: 0 auto;
} }
.tile .file_tile .et2_label { .tile .file_tile .et2_label {
word-wrap: break-word; word-wrap: break-word;
} }
.tile .file_tile {
position: relative;
}
.tile .file_tile[data-mime^="image"] .et2_label {
display: none;
}
.tile .file_tile[data-mime^="image"]:hover .et2_label {
display: block;
position: absolute;
top: 10px;
color: white;
text-shadow: 2px 2px 8px black;
width: 100%;
}
.tile .file_tile[data-mime^="image"]:hover .et2_label[id*=comment] {
top: 30px;
}
#filemanager-index_nm .file_tile[data-mime^="image"] img.vfsMimeIcon {
height: auto;
max-height: 100px;
}
/** /**
* Select file dialog * Select file dialog
*/ */