##// END OF EJS Templates
ui: hide empty no repos or no repo groups display. It often happens that starting...
marcink -
r2447:9ef21084 default
parent child Browse files
Show More
@@ -1849,6 +1849,13 b' BIN_FILENODE = 7'
1849 1849 }
1850 1850 }
1851 1851
1852 .no-object-border {
1853 text-align: center;
1854 padding: 20px;
1855 border-radius: @border-radius-base;
1856 border: 1px solid @grey4;
1857 color: @grey4;
1858 }
1852 1859
1853 1860 .creation_in_progress {
1854 1861 color: @grey4
@@ -60,33 +60,22 b''
60 60 <table id="repo_list_table" class="display"></table>
61 61 </div>
62 62 </div>
63
64 ## no repository groups and repos present, show something to the users
65 % if c.repo_groups_data == '[]' and c.repos_data == '[]':
66 <div class="table">
67 <h2 class="no-object-border">
68 ${_('No repositories or repositories groups exists here.')}
69 </h2>
70 </div>
71 % endif
72
63 73 </div>
64 74 <script>
65 75 $(document).ready(function() {
66 76
67 var get_datatable_count = function() {
68 var api = $('#repo_list_table').dataTable().api();
69 var pageInfo = api.page.info();
70 var repos = pageInfo.recordsDisplay;
71 var reposTotal = pageInfo.recordsTotal;
72
73 api = $('#group_list_table').dataTable().api();
74 pageInfo = api.page.info();
75 var repoGroups = pageInfo.recordsDisplay;
76 var repoGroupsTotal = pageInfo.recordsTotal;
77
78 if (repoGroups !== repoGroupsTotal) {
79 $('#match_count').text(repos+repoGroups);
80 }
81 if (repos !== reposTotal) {
82 $('#match_container').show();
83 }
84 if ($('#q_filter').val() === '') {
85 $('#match_container').hide();
86 }
87 };
88
89 77 // repo group list
78 % if c.repo_groups_data != '[]':
90 79 $('#group_list_table').DataTable({
91 80 data: ${c.repo_groups_data|n},
92 81 dom: 'rtp',
@@ -113,8 +102,10 b''
113 102 quick_repo_menu();
114 103 }
115 104 });
105 % endif
116 106
117 107 // repo list
108 % if c.repos_data != '[]':
118 109 $('#repo_list_table').DataTable({
119 110 data: ${c.repos_data|n},
120 111 dom: 'rtp',
@@ -133,7 +124,7 b''
133 124 "sort": "last_changeset_raw",
134 125 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
135 126 { data: {"_": "owner",
136 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
127 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" }
137 128 ],
138 129 language: {
139 130 paginate: DEFAULT_GRID_PAGINATION,
@@ -144,25 +135,62 b''
144 135 quick_repo_menu();
145 136 }
146 137 });
138 % endif
139
140 var getDatatableCount = function() {
141 var reposCount = 0;
142 var reposCountTotal = 0;
143
144 % if c.repos_data != '[]':
145 var pageInfo = $('#repo_list_table').dataTable().api().page.info();
146 var reposCount = pageInfo.recordsDisplay;
147 var reposCountTotal = pageInfo.recordsTotal;
148 % endif
149
150 var repoGroupsCount = 0;
151 var repoGroupsCountTotal = 0;
152
153 % if c.repo_groups_data != '[]':
154 var pageInfo = $('#group_list_table').dataTable().api().page.info();
155 var repoGroupsCount = pageInfo.recordsDisplay;
156 var repoGroupsCountTotal = pageInfo.recordsTotal;
157 % endif
158
159 if (repoGroupsCount !== repoGroupsCountTotal) {
160 $('#match_count').text(reposCount + repoGroupsCount);
161 }
162 if (reposCount !== reposCountTotal) {
163 $('#match_container').show();
164 }
165 if ($('#q_filter').val() === '') {
166 $('#match_container').hide();
167 }
168 };
147 169
148 170 // update the counter when doing search
149 171 $('#repo_list_table, #group_list_table').on( 'search.dt', function (e,settings) {
150 get_datatable_count();
172 getDatatableCount();
151 173 });
152 174
153 175 // filter, filter both grids
154 176 $('#q_filter').on( 'keyup', function () {
177
178 % if c.repo_groups_data != '[]':
179 var repo_group_api = $('#group_list_table').dataTable().api();
180 repo_group_api
181 .columns( 0 )
182 .search( this.value )
183 .draw();
184 % endif
185
186 % if c.repos_data != '[]':
155 187 var repo_api = $('#repo_list_table').dataTable().api();
156 188 repo_api
157 189 .columns( 0 )
158 190 .search( this.value )
159 191 .draw();
192 % endif
160 193
161 var repo_group_api = $('#group_list_table').dataTable().api();
162 repo_group_api
163 .columns( 0 )
164 .search( this.value )
165 .draw();
166 194 });
167 195
168 196 // refilter table if page load via back button
General Comments 0
You need to be logged in to leave comments. Login now