##// END OF EJS Templates
index: always use lightweight - there shouldn't be any reason not to
Mads Kiilerich -
r3752:1e5bb8ed beta
parent child Browse files
Show More
@@ -360,19 +360,15 b' class ReposGroupsController(BaseControll'
360 360 .filter(RepoGroup.group_parent_id == c.group.group_id).all()
361 361 c.groups = self.scm_model.get_repos_groups(groups)
362 362
363 if not c.visual.lightweight_dashboard:
364 c.repos_list = self.scm_model.get_repos(all_repos=gr_filter)
365 ## lightweight version of dashboard
366 else:
367 c.repos_list = Repository.query()\
368 .filter(Repository.group_id == c.group.group_id)\
369 .order_by(func.lower(Repository.repo_name))\
370 .all()
363 c.repos_list = Repository.query()\
364 .filter(Repository.group_id == c.group.group_id)\
365 .order_by(func.lower(Repository.repo_name))\
366 .all()
371 367
372 repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
373 admin=False)
374 #json used to render the grid
375 c.data = json.dumps(repos_data)
368 repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
369 admin=False)
370 #json used to render the grid
371 c.data = json.dumps(repos_data)
376 372
377 373 return render('admin/repos_groups/repos_groups.html')
378 374
@@ -198,11 +198,6 b' class SettingsController(BaseController)'
198 198 form_result['rhodecode_stylify_metatags']
199 199 Session().add(sett3)
200 200
201 sett4 = RhodeCodeSetting.get_by_name_or_create('lightweight_dashboard')
202 sett4.app_settings_value = \
203 form_result['rhodecode_lightweight_dashboard']
204 Session().add(sett4)
205
206 201 sett4 = RhodeCodeSetting.get_by_name_or_create('repository_fields')
207 202 sett4.app_settings_value = \
208 203 form_result['rhodecode_repository_fields']
@@ -52,19 +52,15 b' class HomeController(BaseController):'
52 52 c.groups = self.scm_model.get_repos_groups()
53 53 c.group = None
54 54
55 if not c.visual.lightweight_dashboard:
56 c.repos_list = self.scm_model.get_repos()
57 ## lightweight version of dashboard
58 else:
59 c.repos_list = Repository.query()\
60 .filter(Repository.group_id == None)\
61 .order_by(func.lower(Repository.repo_name))\
62 .all()
55 c.repos_list = Repository.query()\
56 .filter(Repository.group_id == None)\
57 .order_by(func.lower(Repository.repo_name))\
58 .all()
63 59
64 repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
65 admin=False)
66 #json used to render the grid
67 c.data = json.dumps(repos_data)
60 repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
61 admin=False)
62 #json used to render the grid
63 c.data = json.dumps(repos_data)
68 64
69 65 return render('/index.html')
70 66
@@ -271,8 +271,7 b' class BaseController(WSGIController):'
271 271 c.visual.show_public_icon = str2bool(rc_config.get('rhodecode_show_public_icon'))
272 272 c.visual.show_private_icon = str2bool(rc_config.get('rhodecode_show_private_icon'))
273 273 c.visual.stylify_metatags = str2bool(rc_config.get('rhodecode_stylify_metatags'))
274 c.visual.lightweight_dashboard = str2bool(rc_config.get('rhodecode_lightweight_dashboard'))
275 c.visual.lightweight_dashboard_items = safe_int(config.get('dashboard_items', 100))
274 c.visual.dashboard_items = safe_int(config.get('dashboard_items', 100))
276 275 c.visual.repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
277 276 c.repo_name = get_repo_slug(request) # can be empty
278 277 c.backends = BACKENDS.keys()
@@ -282,7 +282,6 b' def ApplicationVisualisationForm():'
282 282 rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
283 283 rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
284 284
285 rhodecode_lightweight_dashboard = v.StringBoolean(if_missing=False)
286 285 rhodecode_repository_fields = v.StringBoolean(if_missing=False)
287 286 rhodecode_lightweight_journal = v.StringBoolean(if_missing=False)
288 287
@@ -130,12 +130,6 b''
130 130 </div>
131 131 <div class="checkboxes">
132 132 <div class="checkbox">
133 ${h.checkbox('rhodecode_lightweight_dashboard','True')}
134 <label for="rhodecode_lightweight_dashboard">${_('Use lightweight dashboard')}</label>
135 </div>
136 </div>
137 <div class="checkboxes">
138 <div class="checkbox">
139 133 ${h.checkbox('rhodecode_repository_fields','True')}
140 134 <label for="rhodecode_repository_fields">${_('Use repository extra fields')}</label>
141 135 </div>
@@ -70,160 +70,13 b''
70 70 <div id="welcome" style="display:none;text-align:center">
71 71 <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1>
72 72 </div>
73 <%cnt=0%>
74 <%namespace name="dt" file="/data_table/_dt_elements.html"/>
75 % if not c.visual.lightweight_dashboard:
76 ## old full detailed version
77 <div id='repos_list_wrap' class="yui-skin-sam">
78 <table id="repos_list">
79 <thead>
80 <tr>
81 <th class="left"></th>
82 <th class="left">${_('Name')}</th>
83 <th class="left">${_('Description')}</th>
84 <th class="left">${_('Last change')}</th>
85 <th class="left">${_('Tip')}</th>
86 <th class="left">${_('Owner')}</th>
87 <th class="left">${_('Atom')}</th>
88 </tr>
89 </thead>
90 <tbody>
91 %for cnt,repo in enumerate(c.repos_list):
92 <tr class="parity${(cnt+1)%2}">
93 ##QUICK MENU
94 <td class="quick_repo_menu">
95 ${dt.quick_menu(repo['name'])}
96 </td>
97 ##REPO NAME AND ICONS
98 <td class="reponame">
99 ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],h.AttributeDict(repo['dbrepo_fork']),pageargs.get('short_repo_names'))}
100 </td>
101 ##DESCRIPTION
102 <td><span class="tooltip" title="${h.tooltip(repo['description'])}">
103 %if c.visual.stylify_metatags:
104 ${h.urlify_text(h.desc_stylize(h.truncate(repo['description'],60)))}</span>
105 %else:
106 ${h.truncate(repo['description'],60)}</span>
107 %endif
108 </td>
109 ##LAST CHANGE DATE
110 <td>
111 ${dt.last_change(repo['last_change'])}
112 </td>
113 ##LAST REVISION
114 <td>
115 ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])}
116 </td>
117 ##
118 <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
119 <td>
120 ${dt.atom(repo['name'])}
121 </td>
122 </tr>
123 %endfor
124 </tbody>
125 </table>
126 </div>
127 % else:
128 ## lightweight version
129 <div class="yui-skin-sam" id="repos_list_wrap"></div>
130 <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div>
131 % endif
73 <%cnt=0%>
74 <%namespace name="dt" file="/data_table/_dt_elements.html"/>
75 <div class="yui-skin-sam" id="repos_list_wrap"></div>
76 <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div>
132 77 </div>
133 78 </div>
134 % if not c.visual.lightweight_dashboard:
135 <script>
136 YUD.get('repo_count').innerHTML = ${cnt+1 if cnt else 0};
137 79
138 // groups table sorting
139 var myColumnDefs = [
140 {key:"name",label:"${_('Group name')}",sortable:true,
141 sortOptions: { sortFunction: groupNameSort }},
142 {key:"desc",label:"${_('Description')}",sortable:true},
143 ];
144
145 var myDataSource = new YAHOO.util.DataSource(YUD.get("groups_list"));
146
147 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
148 myDataSource.responseSchema = {
149 fields: [
150 {key:"name"},
151 {key:"desc"},
152 ]
153 };
154
155 var myDataTable = new YAHOO.widget.DataTable("groups_list_wrap", myColumnDefs, myDataSource,{
156 sortedBy:{key:"name",dir:"asc"},
157 paginator: new YAHOO.widget.Paginator({
158 rowsPerPage: 50,
159 alwaysVisible: false,
160 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
161 pageLinks: 5,
162 containerClass: 'pagination-wh',
163 currentPageClass: 'pager_curpage',
164 pageLinkClass: 'pager_link',
165 nextPageLinkLabel: '&gt;',
166 previousPageLinkLabel: '&lt;',
167 firstPageLinkLabel: '&lt;&lt;',
168 lastPageLinkLabel: '&gt;&gt;',
169 containers:['group-user-paginator']
170 }),
171 MSG_SORTASC:"${_('Click to sort ascending')}",
172 MSG_SORTDESC:"${_('Click to sort descending')}"
173 });
174
175 // main table sorting
176 var myColumnDefs = [
177 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
178 {key:"name",label:"${_('Name')}",sortable:true,
179 sortOptions: { sortFunction: nameSort }},
180 {key:"desc",label:"${_('Description')}",sortable:true},
181 {key:"last_change",label:"${_('Last Change')}",sortable:true,
182 sortOptions: { sortFunction: ageSort }},
183 {key:"tip",label:"${_('Tip')}",sortable:true,
184 sortOptions: { sortFunction: revisionSort }},
185 {key:"owner",label:"${_('Owner')}",sortable:true},
186 {key:"atom",label:"",sortable:false},
187 ];
188
189 var myDataSource = new YAHOO.util.DataSource(YUD.get("repos_list"));
190
191 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
192
193 myDataSource.responseSchema = {
194 fields: [
195 {key:"menu"},
196 //{key:"raw_name"},
197 {key:"name"},
198 {key:"desc"},
199 {key:"last_change"},
200 {key:"tip"},
201 {key:"owner"},
202 {key:"atom"},
203 ]
204 };
205
206 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,
207 {
208 sortedBy:{key:"name",dir:"asc"},
209 MSG_SORTASC:"${_('Click to sort ascending')}",
210 MSG_SORTDESC:"${_('Click to sort descending')}",
211 MSG_EMPTY:"${_('No records found.')}",
212 MSG_ERROR:"${_('Data error.')}",
213 MSG_LOADING:"${_('Loading...')}",
214 }
215 );
216 myDataTable.subscribe('postRenderEvent',function(oArgs) {
217 tooltip_activate();
218 quick_repo_menu();
219 var func = function(node){
220 return node.parentNode.parentNode.parentNode.parentNode;
221 }
222 q_filter('q_filter',YUQ('div.table tr td a.repo_name'),func);
223 });
224
225 </script>
226 % else:
227 80 <script>
228 81 var data = ${c.data|n};
229 82 var myDataSource = new YAHOO.util.DataSource(data);
@@ -279,7 +132,7 b''
279 132 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
280 133 sortedBy:{key:"name",dir:"asc"},
281 134 paginator: new YAHOO.widget.Paginator({
282 rowsPerPage: ${c.visual.lightweight_dashboard_items},
135 rowsPerPage: ${c.visual.dashboard_items},
283 136 alwaysVisible: false,
284 137 template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
285 138 pageLinks: 5,
@@ -336,4 +189,3 b''
336 189 filterTimeout = setTimeout(updateFilter,600);
337 190 });
338 191 </script>
339 % endif
@@ -17,19 +17,22 b' class TestHomeController(TestController)'
17 17 response = self.app.get(url(controller='home', action='index'))
18 18 #if global permission is set
19 19 response.mustcontain('Add repository')
20 response.mustcontain('href="/%s"' % HG_REPO)
20 # html in javascript variable:
21 response.mustcontain("""var data = {"totalRecords": %s"""
22 % len(Repository.getAll()))
23 response.mustcontain(r'href=\"/%s\"' % HG_REPO)
21 24
22 response.mustcontain("""<img class="icon" title="Mercurial repository" """
23 """alt="Mercurial repository" src="/images/icons/hg"""
24 """icon.png"/>""")
25 response.mustcontain("""<img class="icon" title="Public repository" """
26 """alt="Public repository" src="/images/icons/lock_"""
27 """open.png"/>""")
25 response.mustcontain(r"""<img class=\"icon\" title=\"Mercurial repository\" """
26 r"""alt=\"Mercurial repository\" src=\"/images/icons/hg"""
27 r"""icon.png\"/>""")
28 response.mustcontain(r"""<img class=\"icon\" title=\"Public repository\" """
29 r"""alt=\"Public repository\" src=\"/images/icons/lock_"""
30 r"""open.png\"/>""")
28 31
29 32 response.mustcontain(
30 """<a title="Marcin Kuzminski &amp;lt;marcin@python-works.com&amp;gt;:\n
31 merge" class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232"""
32 """dffcd24178a07ffeb5dfc">r173:27cd5cce30c9</a>"""
33 r"""<a title=\"Marcin Kuzminski &amp;lt;marcin@python-works.com&amp;gt;:\n\n"""
34 r"""merge\" class=\"tooltip\" href=\"/vcs_test_hg/changeset/27cd5cce30c96924232"""
35 r"""dffcd24178a07ffeb5dfc\">r173:27cd5cce30c9</a>"""
33 36 )
34 37
35 38 def test_repo_summary_with_anonymous_access_disabled(self):
@@ -66,22 +69,6 b' merge" class="tooltip" href="/vcs_test_h'
66 69 Session().add(anon)
67 70 Session().commit()
68 71
69 def _set_l_dash(self, set_to):
70 self.app.post(url('admin_setting', setting_id='visual'),
71 params=dict(_method='put',
72 rhodecode_lightweight_dashboard=set_to,))
73
74 def test_index_with_lightweight_dashboard(self):
75 self.log_user()
76 self._set_l_dash(True)
77
78 try:
79 response = self.app.get(url(controller='home', action='index'))
80 response.mustcontain("""var data = {"totalRecords": %s"""
81 % len(Repository.getAll()))
82 finally:
83 self._set_l_dash(False)
84
85 72 def test_index_page_on_groups(self):
86 73 self.log_user()
87 74 gr = fixture.create_group('gr1')
@@ -94,18 +81,3 b' merge" class="tooltip" href="/vcs_test_h'
94 81 RepoModel().delete('gr1/repo_in_group')
95 82 ReposGroupModel().delete(repos_group='gr1', force_delete=True)
96 83 Session().commit()
97
98 def test_index_page_on_groups_with_lightweight_dashboard(self):
99 self.log_user()
100 self._set_l_dash(True)
101 fixture.create_repo(name='gr1/repo_in_group',
102 repos_group=fixture.create_group('gr1'))
103 response = self.app.get(url('repos_group_home', group_name='gr1'))
104
105 try:
106 response.mustcontain("""gr1/repo_in_group""")
107 finally:
108 self._set_l_dash(False)
109 RepoModel().delete('gr1/repo_in_group')
110 ReposGroupModel().delete(repos_group='gr1', force_delete=True)
111 Session().commit()
General Comments 0
You need to be logged in to leave comments. Login now