Skip to content

Commit

Permalink
First basic grid view layout with toggle
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Christoph Borchardt <[email protected]>
  • Loading branch information
jancborchardt committed Sep 4, 2018
1 parent 7c16b32 commit f62701e
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
61 changes: 61 additions & 0 deletions apps/files/css/files.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,73 @@
min-width: 500px;
}

#filestable #fileList {
display: flex;
flex-direction: column;
}

#filestable .list-element {
height: 51px;
display: flex;
flex-direction: row;
}

#filestable.view-grid {
#fileList {
display: flex;
flex-direction: row;
flex-wrap: wrap;

.list-element {
position: relative;
display: inline-block;
height: 200px;
width: 200px;
border-bottom: none;

.filename a.name {
flex-direction: column;
height: 100%;

.thumbnail-wrapper {
width: 100%;
max-width: 100%;
height: 150px;

.thumbnail {
width: 150px;
height: 150px;
background-size: 150px;
border-radius: 10px;
}
}

.nametext {
width: auto;
max-width: 100%;
margin: auto;
}
}

.selection {
position: absolute;
top: 0;
left: 0;
z-index: 100;
}

.fileactions {

}

.filesize,
.date {
display: none;
}
}
}
}

/* fit app list view heights */
.app-files #app-content>.viewcontainer {
min-height: 0%;
Expand Down
10 changes: 10 additions & 0 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@

this.$el.find('.list-header .columntitle').click(_.bind(this._onClickHeader, this));

// Toggle for grid view
$('#view-button').on('click', this._onGridToggle);

this._onResize = _.debounce(_.bind(this._onResize, this), 250);
$('#app-content').on('appresized', this._onResize);
$(window).resize(this._onResize);
Expand Down Expand Up @@ -584,6 +587,13 @@
this.$table.find('>thead').width($('#app-content').width() - OC.Util.getScrollBarWidth());
},

/**
* Event handler for grid view toggle
*/
_onGridToggle: function() {
$('.list-container').toggleClass('view-grid');
},

/**
* Event handler when leaving previously hidden state
*/
Expand Down
3 changes: 2 additions & 1 deletion apps/files/templates/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<?php endif;?>
<input type="hidden" class="max_human_file_size"
value="(max <?php isset($_['uploadMaxHumanFilesize']) ? p($_['uploadMaxHumanFilesize']) : ''; ?>)">
<button id="view-button" class="button view-switcher icon-toggle-pictures"><span class="hidden-visually"><?php p($l->t('Toggle grid view'))?></button>
</div>

<div id="emptycontent" class="hidden">
Expand All @@ -38,7 +39,7 @@
<p></p>
</div>

<div id="filestable" class="list-container" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="32" data-preview-y="32">
<div id="filestable" class="view-grid list-container" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="32" data-preview-y="32">
<div class="list-header">
<div>
<div id="headerSelection" class="hidden list-column column-selection">
Expand Down

0 comments on commit f62701e

Please sign in to comment.