##// END OF EJS Templates
code cleanup
marcink -
r1961:f48bce87 beta
parent child Browse files
Show More
@@ -160,7 +160,6 b' class ReposGroupsController(BaseControll'
160
160
161 return redirect(url('repos_groups'))
161 return redirect(url('repos_groups'))
162
162
163
164 @HasPermissionAnyDecorator('hg.admin')
163 @HasPermissionAnyDecorator('hg.admin')
165 def delete(self, id):
164 def delete(self, id):
166 """DELETE /repos_groups/id: Delete an existing item"""
165 """DELETE /repos_groups/id: Delete an existing item"""
@@ -112,11 +112,11 b''
112 <%include file="repo_edit_perms.html"/>
112 <%include file="repo_edit_perms.html"/>
113 </div>
113 </div>
114
114
115 <div class="buttons">
115 <div class="buttons">
116 ${h.submit('save','Save',class_="ui-button")}
116 ${h.submit('save','Save',class_="ui-button")}
117 ${h.reset('reset','Reset',class_="ui-button")}
117 ${h.reset('reset','Reset',class_="ui-button")}
118 </div>
118 </div>
119 </div>
119 </div>
120 </div>
120 </div>
121 </div>
121 </div>
122 ${h.end_form()}
122 ${h.end_form()}
@@ -137,9 +137,9 b''
137 %for repo in c.user_repos:
137 %for repo in c.user_repos:
138 <tr>
138 <tr>
139 <td>
139 <td>
140 %if repo['dbrepo']['repo_type'] =='hg':
140 %if h.is_hg(repo['dbrepo']['repo_type']):
141 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
141 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
142 %elif repo['dbrepo']['repo_type'] =='git':
142 %elif h.is_git(repo['dbrepo']['repo_type']):
143 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
143 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
144 %else:
144 %else:
145
145
@@ -140,151 +140,141 b''
140 </div>
140 </div>
141 </div>
141 </div>
142 <script type="text/javascript">
142 <script type="text/javascript">
143 YAHOO.util.Event.onDOMReady(function(){
143 YAHOO.util.Event.onDOMReady(function(){
144 var D = YAHOO.util.Dom;
144 var D = YAHOO.util.Dom;
145 var E = YAHOO.util.Event;
145 var E = YAHOO.util.Event;
146
147 //definition of containers ID's
148 var available_container = 'available_members';
149 var selected_container = 'users_group_members';
150
146
151 //form containing containers id
147 //definition of containers ID's
152 var form_id = 'edit_users_group';
148 var available_container = 'available_members';
149 var selected_container = 'users_group_members';
153
150
154 //temp container for selected storage.
151 //form containing containers id
155 var cache = new Array();
152 var form_id = 'edit_users_group';
156 var av_cache = new Array();
157 var c = D.get(selected_container);
158 var ac = D.get(available_container);
159
153
160 //get only selected options for further fullfilment
154 //temp container for selected storage.
161 for(var i = 0;node =c.options[i];i++){
155 var cache = new Array();
162 if(node.selected){
156 var av_cache = new Array();
163 //push selected to my temp storage left overs :)
157 var c = D.get(selected_container);
164 cache.push(node);
158 var ac = D.get(available_container);
165 }
166 }
167
159
168 //clear 'selected' select
160 //get only selected options for further fullfilment
169 //c.options.length = 0;
161 for(var i = 0;node =c.options[i];i++){
162 if(node.selected){
163 //push selected to my temp storage left overs :)
164 cache.push(node);
165 }
166 }
170
167
171 //fill it with remembered options
168 //get all available options to cache
172 //for(var i = 0;node = cache[i];i++){
169 for(var i = 0;node =ac.options[i];i++){
173 // c.options[i]=new Option(node.text, node.value, false, false);
170 //push selected to my temp storage left overs :)
174 //}
171 av_cache.push(node);
175
172 }
176
173
177 //get all available options to cache
174 //fill available only with those not in choosen
178 for(var i = 0;node =ac.options[i];i++){
175 ac.options.length=0;
179 //push selected to my temp storage left overs :)
176 tmp_cache = new Array();
180 av_cache.push(node);
181 }
182
183 //fill available only with those not in choosen
184 ac.options.length=0;
185 tmp_cache = new Array();
186
177
187 for(var i = 0;node = av_cache[i];i++){
178 for(var i = 0;node = av_cache[i];i++){
188 var add = true;
179 var add = true;
189 for(var i2 = 0;node_2 = cache[i2];i2++){
180 for(var i2 = 0;node_2 = cache[i2];i2++){
190 if(node.value == node_2.value){
181 if(node.value == node_2.value){
191 add=false;
182 add=false;
192 break;
183 break;
193 }
184 }
194 }
185 }
195 if(add){
186 if(add){
196 tmp_cache.push(new Option(node.text, node.value, false, false));
187 tmp_cache.push(new Option(node.text, node.value, false, false));
197 }
188 }
198 }
189 }
199
190
200 for(var i = 0;node = tmp_cache[i];i++){
191 for(var i = 0;node = tmp_cache[i];i++){
201 ac.options[i] = node;
192 ac.options[i] = node;
202 }
193 }
203
194
204 function prompts_action_callback(e){
195 function prompts_action_callback(e){
205
196
206 var choosen = D.get(selected_container);
197 var choosen = D.get(selected_container);
207 var available = D.get(available_container);
198 var available = D.get(available_container);
208
199
209 //get checked and unchecked options from field
200 //get checked and unchecked options from field
210 function get_checked(from_field){
201 function get_checked(from_field){
211 //temp container for storage.
202 //temp container for storage.
212 var sel_cache = new Array();
203 var sel_cache = new Array();
213 var oth_cache = new Array();
204 var oth_cache = new Array();
214
205
215 for(var i = 0;node = from_field.options[i];i++){
206 for(var i = 0;node = from_field.options[i];i++){
216 if(node.selected){
207 if(node.selected){
217 //push selected fields :)
208 //push selected fields :)
218 sel_cache.push(node);
209 sel_cache.push(node);
219 }
210 }
220 else{
211 else{
221 oth_cache.push(node)
212 oth_cache.push(node)
222 }
213 }
223 }
214 }
224
215
225 return [sel_cache,oth_cache]
216 return [sel_cache,oth_cache]
226 }
217 }
227
218
228 //fill the field with given options
219 //fill the field with given options
229 function fill_with(field,options){
220 function fill_with(field,options){
230 //clear firtst
221 //clear firtst
231 field.options.length=0;
222 field.options.length=0;
232 for(var i = 0;node = options[i];i++){
223 for(var i = 0;node = options[i];i++){
233 field.options[i]=new Option(node.text, node.value,
224 field.options[i]=new Option(node.text, node.value,
234 false, false);
225 false, false);
235 }
226 }
236
227
237 }
228 }
238 //adds to current field
229 //adds to current field
239 function add_to(field,options){
230 function add_to(field,options){
240 for(var i = 0;node = options[i];i++){
231 for(var i = 0;node = options[i];i++){
241 field.appendChild(new Option(node.text, node.value,
232 field.appendChild(new Option(node.text, node.value,
242 false, false));
233 false, false));
243 }
234 }
244 }
235 }
245
236
246 // add action
237 // add action
247 if (this.id=='add_element'){
238 if (this.id=='add_element'){
248 var c = get_checked(available);
239 var c = get_checked(available);
249 add_to(choosen,c[0]);
240 add_to(choosen,c[0]);
250 fill_with(available,c[1]);
241 fill_with(available,c[1]);
251 }
242 }
252 // remove action
243 // remove action
253 if (this.id=='remove_element'){
244 if (this.id=='remove_element'){
254 var c = get_checked(choosen);
245 var c = get_checked(choosen);
255 add_to(available,c[0]);
246 add_to(available,c[0]);
256 fill_with(choosen,c[1]);
247 fill_with(choosen,c[1]);
257 }
248 }
258 // add all elements
249 // add all elements
259 if(this.id=='add_all_elements'){
250 if(this.id=='add_all_elements'){
260 for(var i=0; node = available.options[i];i++){
251 for(var i=0; node = available.options[i];i++){
261 choosen.appendChild(new Option(node.text,
252 choosen.appendChild(new Option(node.text,
262 node.value, false, false));
253 node.value, false, false));
263 }
254 }
264 available.options.length = 0;
255 available.options.length = 0;
265 }
256 }
266 //remove all elements
257 //remove all elements
267 if(this.id=='remove_all_elements'){
258 if(this.id=='remove_all_elements'){
268 for(var i=0; node = choosen.options[i];i++){
259 for(var i=0; node = choosen.options[i];i++){
269 available.appendChild(new Option(node.text,
260 available.appendChild(new Option(node.text,
270 node.value, false, false));
261 node.value, false, false));
271 }
262 }
272 choosen.options.length = 0;
263 choosen.options.length = 0;
273 }
264 }
274
265
275 }
266 }
276
277
267
278 E.addListener(['add_element','remove_element',
268 E.addListener(['add_element','remove_element',
279 'add_all_elements','remove_all_elements'],'click',
269 'add_all_elements','remove_all_elements'],'click',
280 prompts_action_callback)
270 prompts_action_callback)
281
271
282 E.addListener(form_id,'submit',function(){
272 E.addListener(form_id,'submit',function(){
283 var choosen = D.get(selected_container);
273 var choosen = D.get(selected_container);
284 for (var i = 0; i < choosen.options.length; i++) {
274 for (var i = 0; i < choosen.options.length; i++) {
285 choosen.options[i].selected = 'selected';
275 choosen.options[i].selected = 'selected';
286 }
276 }
287 })
277 });
288 });
278 });
289 </script>
279 </script>
290 </%def>
280 </%def>
General Comments 0
You need to be logged in to leave comments. Login now