File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ OCA.Sharing.PublicApp = {
6262
6363 // file list mode ?
6464 if ( $el . find ( '.files-filestable' ) . length ) {
65+ // Toggle for grid view
66+ this . $showGridView = $ ( 'input#showgridview' ) ;
67+ this . $showGridView . on ( 'change' , _ . bind ( this . _onGridviewChange , this ) ) ;
68+ $ ( '#view-toggle' ) . tooltip ( { placement : 'bottom' , trigger : 'hover' } ) ;
69+
6570 var filesClient = new OC . Files . Client ( {
6671 host : OC . getHost ( ) ,
6772 port : OC . getPort ( ) ,
@@ -364,6 +369,26 @@ OCA.Sharing.PublicApp = {
364369 }
365370 } ,
366371
372+ /**
373+ * Toggle showing gridview by default or not
374+ *
375+ * @returns {undefined }
376+ */
377+ _onGridviewChange : function ( ) {
378+ const isGridView = this . $showGridView . is ( ':checked' ) ;
379+ this . $showGridView . next ( '#view-toggle' )
380+ . removeClass ( 'icon-toggle-filelist icon-toggle-pictures' )
381+ . addClass ( isGridView ? 'icon-toggle-filelist' : 'icon-toggle-pictures' )
382+ this . $showGridView . next ( '#view-toggle' ) . attr (
383+ 'data-original-title' ,
384+ isGridView ? t ( 'files' , 'Show list view' ) : t ( 'files' , 'Show grid view' ) ,
385+ )
386+
387+ if ( this . fileList ) {
388+ this . fileList . setGridView ( isGridView ) ;
389+ }
390+ } ,
391+
367392 _onDirectoryChanged : function ( e ) {
368393 OC . Util . History . pushState ( {
369394 // arghhhh, why is this not called "dir" !?
You can’t perform that action at this time.
0 commit comments