File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
resources/templates/lateralbar Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1818 < div class ="files ">
1919 < %= view.component("component.lateralbar.files", {
2020 'path': "/"
21- }, "tree ") %>
21+ }, "files ") %>
2222 </ div >
2323</ div >
2424< %= view.component("component.lateralbar.searchbar", {}, "search") %>
Original file line number Diff line number Diff line change @@ -120,13 +120,22 @@ define([
120120 tagName : "ul" ,
121121 className : "files-tree" ,
122122
123+ // Constructor
124+ initialize : function ( options ) {
125+ FilesTreeView . __super__ . initialize . apply ( this , arguments ) ;
126+ this . countFiles = 0 ;
127+ return this ;
128+ } ,
129+
123130 // Render the files tree
124131 render : function ( ) {
125132 var that = this ;
126133 this . $el . empty ( ) ;
127134
128135 this . model . listdir ( ) . done ( function ( files ) {
129136 that . empty ( ) ;
137+ that . countFiles = 0 ;
138+
130139 _ . each ( files , function ( file ) {
131140 if ( file . isHidden ( ) ) return ;
132141
@@ -136,7 +145,9 @@ define([
136145 } ) ;
137146 v . render ( ) ;
138147 v . $el . appendTo ( that . $el ) ;
148+ that . countFiles = that . countFiles + 1 ;
139149 } ) ;
150+ that . trigger ( "count" , that . countFiles ) ;
140151 } ) ;
141152
142153 return this . ready ( ) ;
Original file line number Diff line number Diff line change @@ -71,10 +71,17 @@ define([
7171 }
7272 } ) ;
7373
74+ // Search bar
7475 this . components . search . on ( "close" , function ( ) {
7576 this . toggleSearch ( false ) ;
7677 } , this ) ;
7778
79+ // Files (count .git files)
80+ this . components . files . on ( "count" , function ( ) {
81+ this . toggleBar ( this . components . files . countFiles > 0 ) ;
82+ } , this ) ;
83+ this . toggleBar ( this . components . files . countFiles > 0 ) ;
84+
7885 return LateralBarView . __super__ . finish . apply ( this , arguments ) ;
7986 } ,
8087
You can’t perform that action at this time.
0 commit comments