##// END OF EJS Templates
template: action buttons shouldn't have .btn-success unless we mean it
Andrew Shadura -
r4930:72a8d256 default
parent child Browse files
Show More
@@ -1,190 +1,190 b''
1 1 <%page args="parent,group_name=''" />
2 2 <div class="box">
3 3 <!-- box / title -->
4 4 <div class="title">
5 5 <h5>
6 6 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> ${parent.breadcrumbs()} <span id="repo_count">0</span> ${_('repositories')}
7 7 </h5>
8 8 %if c.authuser.username != 'default':
9 9 <ul class="links">
10 10 <li>
11 11 <%
12 12 gr_name = c.group.group_name if c.group else None
13 13 # create repositories with write permission on group is set to true
14 14 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
15 15 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'can write into group index page')
16 16 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
17 17 %>
18 18 %if h.HasPermissionAny('hg.admin','hg.create.repository')() or (group_admin or (group_write and create_on_write)):
19 19 %if c.group:
20 <a href="${h.url('new_repo',parent_group=c.group.group_id)}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_('Add Repository')}</a>
20 <a href="${h.url('new_repo',parent_group=c.group.group_id)}" class="btn btn-small"><i class="icon-plus"></i> ${_('Add Repository')}</a>
21 21 %if h.HasPermissionAny('hg.admin')() or h.HasRepoGroupPermissionAny('group.admin')(c.group.group_name):
22 22 <a href="${h.url('new_repos_group', parent_group=c.group.group_id)}" class="btn btn-small"><i class="icon-plus"></i> ${_(u'Add Repository Group')}</a>
23 23 %endif
24 24 %else:
25 <a href="${h.url('new_repo')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_('Add Repository')}</a>
25 <a href="${h.url('new_repo')}" class="btn btn-small"><i class="icon-plus"></i> ${_('Add Repository')}</a>
26 26 %if h.HasPermissionAny('hg.admin')():
27 27 <a href="${h.url('new_repos_group')}" class="btn btn-small"><i class="icon-plus"></i> ${_(u'Add Repository Group')}</a>
28 28 %endif
29 29 %endif
30 30 %endif
31 31 %if c.group and h.HasRepoGroupPermissionAny('group.admin')(c.group.group_name):
32 32 <a href="${h.url('edit_repo_group',group_name=c.group.group_name)}" title="${_('You have admin right to this group, and can edit it')}" class="btn btn-small"><i class="icon-pencil"></i> ${_('Edit Repository Group')}</a>
33 33 %endif
34 34 </li>
35 35 </ul>
36 36 %endif
37 37 </div>
38 38 <!-- end box / title -->
39 39 <div class="table">
40 40 % if c.groups:
41 41 <div id='groups_list_wrap' class="yui-skin-sam">
42 42 <table id="groups_list">
43 43 <thead>
44 44 <tr>
45 45 <th class="left"><a href="#">${_('Group Name')}</a></th>
46 46 <th class="left"><a href="#">${_('Description')}</a></th>
47 47 ##<th class="left"><a href="#">${_('Number of Repositories')}</a></th>
48 48 </tr>
49 49 </thead>
50 50
51 51 ## REPO GROUPS
52 52 % for gr in c.groups:
53 53 <tr>
54 54 <td>
55 55 <div class="dt_repo">
56 56 <a href="${url('repos_group_home',group_name=gr.group_name)}">
57 57 <i class="icon-folder"></i>
58 58 <span class="dt_repo_name">${gr.name}</span>
59 59 </a>
60 60 </div>
61 61 </td>
62 62 %if c.visual.stylify_metatags:
63 63 <td>${h.urlify_text(h.desc_stylize(gr.group_description))}</td>
64 64 %else:
65 65 <td>${gr.group_description}</td>
66 66 %endif
67 67 ## this is commented out since for multi nested repos can be HEAVY!
68 68 ## in number of executed queries during traversing uncomment at will
69 69 ##<td><b>${gr.repositories_recursive_count}</b></td>
70 70 </tr>
71 71 % endfor
72 72 </table>
73 73 </div>
74 74 <div id="group-user-paginator" style="padding: 0px 0px 0px 0px"></div>
75 75 <div style="height: 20px"></div>
76 76 % endif
77 77 <div id="welcome" style="display:none;text-align:center">
78 78 <h1><a href="${h.url('home')}">${c.site_name} ${c.kallithea_version}</a></h1>
79 79 </div>
80 80 <%cnt=0%>
81 81 <%namespace name="dt" file="/data_table/_dt_elements.html"/>
82 82 <div class="yui-skin-sam" id="repos_list_wrap"></div>
83 83 <div id="user-paginator" style="padding: 0px 0px 0px 0px"></div>
84 84 </div>
85 85 </div>
86 86
87 87 <script>
88 88 var data = ${c.data|n};
89 89 var myDataSource = new YAHOO.util.DataSource(data);
90 90 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
91 91
92 92 myDataSource.responseSchema = {
93 93 resultsList: "records",
94 94 fields: [
95 95 {key:"menu"},
96 96 {key:"raw_name"},
97 97 {key:"name"},
98 98 {key:"desc"},
99 99 {key:"last_change"},
100 100 {key:"last_changeset"},
101 101 {key:"last_rev_raw"},
102 102 {key:"owner"},
103 103 {key:"atom"}
104 104 ]
105 105 };
106 106 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
107 107 // This is the filter function
108 108 var data = res.results || [],
109 109 filtered = [],
110 110 i,l;
111 111
112 112 if (req) {
113 113 req = req.toLowerCase();
114 114 for (i = 0; i<data.length; i++) {
115 115 var pos = data[i].raw_name.toLowerCase().indexOf(req, ${len(group_name)})
116 116 if (pos != -1) {
117 117 filtered.push(data[i]);
118 118 }
119 119 }
120 120 res.results = filtered;
121 121 }
122 122 YUD.get('repo_count').innerHTML = res.results.length;
123 123 return res;
124 124 }
125 125
126 126 // main table sorting
127 127 var myColumnDefs = [
128 128 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
129 129 {key:"name",label:"${_('Name')}",sortable:true,
130 130 sortOptions: { sortFunction: nameSort }},
131 131 {key:"desc",label:"${_('Description')}",sortable:true},
132 132 {key:"last_change",label:"${_('Last Change')}",sortable:true,
133 133 sortOptions: { sortFunction: ageSort }},
134 134 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
135 135 sortOptions: { sortFunction: revisionSort }},
136 136 {key:"owner",label:"${_('Owner')}",sortable:true},
137 137 {key:"atom",label:"",sortable:false}
138 138 ];
139 139
140 140 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
141 141 sortedBy:{key:"name",dir:"asc"},
142 142 paginator: YUI_paginator(${c.visual.dashboard_items},['user-paginator']),
143 143
144 144 MSG_SORTASC:"${_('Click to sort ascending')}",
145 145 MSG_SORTDESC:"${_('Click to sort descending')}",
146 146 MSG_EMPTY:"${_('No repositories found.')}",
147 147 MSG_ERROR:"${_('Data error.')}",
148 148 MSG_LOADING:"${_('Loading...')}"
149 149 }
150 150 );
151 151 myDataTable.subscribe('postRenderEvent',function(oArgs) {
152 152 tooltip_activate();
153 153 quick_repo_menu();
154 154 });
155 155
156 156 var filterTimeout = null;
157 157
158 158 updateFilter = function () {
159 159 // Reset timeout
160 160 filterTimeout = null;
161 161
162 162 // Reset sort
163 163 var state = myDataTable.getState();
164 164 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
165 165
166 166 // Get filtered data
167 167 myDataSource.sendRequest(YUD.get('q_filter').value,{
168 168 success : myDataTable.onDataReturnInitializeTable,
169 169 failure : myDataTable.onDataReturnInitializeTable,
170 170 scope : myDataTable,
171 171 argument: state
172 172 });
173 173
174 174 };
175 175 $('#q_filter').click(function(){
176 176 if(!$('#q_filter').hasClass('loaded')){
177 177 //TODO: load here full list later to do search within groups
178 178 $('#q_filter').addClass('loaded');
179 179 }
180 180 });
181 181
182 182 $('#q_filter').keyup(function(){
183 183 clearTimeout(filterTimeout);
184 184 filterTimeout = setTimeout(updateFilter,600);
185 185 });
186 186
187 187 if($('#q_filter').val()) {
188 188 updateFilter();
189 189 }
190 190 </script>
General Comments 0
You need to be logged in to leave comments. Login now