##// END OF EJS Templates
Fixed permissions for users groups, group can have create repo permission now....
Fixed permissions for users groups, group can have create repo permission now. Some code refactor + pep8ify

File last commit:

r1159:187a924e beta
r1271:aa7e45ad beta
Show More
repo_edit.html
382 lines | 15.0 KiB | text/html | HtmlLexer
renamed project to rhodecode
r547 ## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%def name="title()">
#38 updated RhodeCode titles
r619 ${_('Edit repository')} ${c.repo_info.repo_name} - ${c.rhodecode_name}
renamed project to rhodecode
r547 </%def>
<%def name="breadcrumbs_links()">
${h.link_to(_('Admin'),h.url('admin_home'))}
&raquo;
${h.link_to(_('Repositories'),h.url('repos'))}
&raquo;
Changes for repo groups
r1159 ${_('edit')} &raquo; ${h.link_to(c.repo_info.just_name,h.url('summary_home',repo_name=c.repo_name))}
renamed project to rhodecode
r547 </%def>
<%def name="page_nav()">
${self.menu('admin')}
</%def>
<%def name="main()">
Code refactor for auth func, preparing for ldap support...
r699 <div class="box box-left">
renamed project to rhodecode
r547 <!-- box / title -->
<div class="title">
${self.breadcrumbs()}
</div>
${h.form(url('repo', repo_name=c.repo_info.repo_name),method='put')}
<div class="form">
<!-- fields -->
<div class="fields">
<div class="field">
<div class="label">
<label for="repo_name">${_('Name')}:</label>
</div>
Small templates update
r703 <div class="input">
Code refactor for auth func, preparing for ldap support...
r699 ${h.text('repo_name',class_="medium")}
renamed project to rhodecode
r547 </div>
#109, added optional clone uri when creating repo....
r1112 </div>
<div class="field">
<div class="label">
<label for="clone_uri">${_('Clone uri')}:</label>
</div>
<div class="input">
Changes for repo groups
r1159 ${h.text('clone_uri',class_="medium")}
#109, added optional clone uri when creating repo....
r1112 </div>
</div>
<div class="field">
<div class="label">
<label for="repo_group">${_('Repository group')}:</label>
</div>
<div class="input">
${h.select('repo_group','',c.repo_groups,class_="medium")}
<span>${h.link_to(_('add new group'),h.url(''))}</span>
</div>
</div>
extended repo creation by repo type. fixed fork creation to maintain repo type.
r659 <div class="field">
<div class="label">
<label for="repo_type">${_('Type')}:</label>
</div>
<div class="input">
Code refactor for auth func, preparing for ldap support...
r699 ${h.select('repo_type','hg',c.backends,class_="medium")}
extended repo creation by repo type. fixed fork creation to maintain repo type.
r659 </div>
#109, added optional clone uri when creating repo....
r1112 </div>
renamed project to rhodecode
r547 <div class="field">
<div class="label label-textarea">
<label for="description">${_('Description')}:</label>
</div>
<div class="textarea text-area editor">
${h.textarea('description',cols=23,rows=5)}
</div>
</div>
<div class="field">
<div class="label label-checkbox">
<label for="private">${_('Private')}:</label>
</div>
<div class="checkboxes">
${h.checkbox('private',value="True")}
</div>
</div>
fixes #62, added option to disable statistics for each repository
r810 <div class="field">
<div class="label label-checkbox">
<label for="enable_statistics">${_('Enable statistics')}:</label>
</div>
<div class="checkboxes">
${h.checkbox('enable_statistics',value="True")}
</div>
implemented #84 downloads can be enabled/disabled per each repository from now.
r962 </div>
<div class="field">
<div class="label label-checkbox">
<label for="enable_downloads">${_('Enable downloads')}:</label>
</div>
<div class="checkboxes">
${h.checkbox('enable_downloads',value="True")}
</div>
</div>
renamed project to rhodecode
r547 <div class="field">
fixed bug when autocomplete could not display names (hidden by div)...
r581 <div class="label">
renamed project to rhodecode
r547 <label for="user">${_('Owner')}:</label>
</div>
<div class="input input-small ac">
<div class="perm_ac">
${h.text('user',class_='yui-ac-input')}
<div id="owner_container"></div>
</div>
</div>
</div>
<div class="field">
<div class="label">
<label for="input">${_('Permissions')}:</label>
</div>
<div class="input">
#56 added ajax removal of users groups,...
r1015 <%include file="repo_edit_perms.html"/>
</div>
renamed project to rhodecode
r547
<div class="buttons">
css optimizations
r888 ${h.submit('save','Save',class_="ui-button")}
${h.reset('reset','Reset',class_="ui-button")}
renamed project to rhodecode
r547 </div>
</div>
</div>
</div>
${h.end_form()}
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function(){
var D = YAHOO.util.Dom;
#56 added users/groups autocomplete for repository editing....
r1012 if(!D.hasClass('perm_new_member_name','error')){
renamed project to rhodecode
r547 D.setStyle('add_perm_input','display','none');
}
YAHOO.util.Event.addListener('add_perm','click',function(){
D.setStyle('add_perm_input','display','');
D.setStyle('add_perm','opacity','0.6');
D.setStyle('add_perm','cursor','default');
});
});
</script>
<script type="text/javascript">
YAHOO.example.FnMultipleFields = function(){
#56 added users/groups autocomplete for repository editing....
r1012 var myUsers = ${c.users_array|n};
var myGroups = ${c.users_groups_array|n};
renamed project to rhodecode
r547
#56 added users/groups autocomplete for repository editing....
r1012 // Define a custom search function for the DataSource of users
var matchUsers = function(sQuery) {
renamed project to rhodecode
r547 // Case insensitive matching
#56 added users/groups autocomplete for repository editing....
r1012 var query = sQuery.toLowerCase();
var i=0;
var l=myUsers.length;
var matches = [];
renamed project to rhodecode
r547
// Match against each name of each contact
for(; i<l; i++) {
#56 added users/groups autocomplete for repository editing....
r1012 contact = myUsers[i];
renamed project to rhodecode
r547 if((contact.fname.toLowerCase().indexOf(query) > -1) ||
(contact.lname.toLowerCase().indexOf(query) > -1) ||
(contact.nname && (contact.nname.toLowerCase().indexOf(query) > -1))) {
matches[matches.length] = contact;
}
}
return matches;
};
#56 added users/groups autocomplete for repository editing....
r1012
// Define a custom search function for the DataSource of usersGroups
var matchGroups = function(sQuery) {
// Case insensitive matching
var query = sQuery.toLowerCase();
var i=0;
var l=myGroups.length;
var matches = [];
// Match against each name of each contact
for(; i<l; i++) {
matched_group = myGroups[i];
if(matched_group.grname.toLowerCase().indexOf(query) > -1) {
matches[matches.length] = matched_group;
}
}
return matches;
};
//match all
var matchAll = function(sQuery){
u = matchUsers(sQuery);
g = matchGroups(sQuery);
return u.concat(g);
};
// DataScheme for members
var memberDS = new YAHOO.util.FunctionDataSource(matchAll);
memberDS.responseSchema = {
fields: ["id", "fname", "lname", "nname", "grname", "grmembers"]
};
// DataScheme for owner
var ownerDS = new YAHOO.util.FunctionDataSource(matchUsers);
ownerDS.responseSchema = {
renamed project to rhodecode
r547 fields: ["id", "fname", "lname", "nname"]
#56 added users/groups autocomplete for repository editing....
r1012 };
renamed project to rhodecode
r547 // Instantiate AutoComplete for perms
#56 added users/groups autocomplete for repository editing....
r1012 var membersAC = new YAHOO.widget.AutoComplete("perm_new_member_name", "perm_container", memberDS);
membersAC.useShadow = false;
membersAC.resultTypeList = false;
renamed project to rhodecode
r547
// Instantiate AutoComplete for owner
#56 added users/groups autocomplete for repository editing....
r1012 var ownerAC = new YAHOO.widget.AutoComplete("user", "owner_container", ownerDS);
ownerAC.useShadow = false;
ownerAC.resultTypeList = false;
renamed project to rhodecode
r547
#56 added users/groups autocomplete for repository editing....
r1012
// Helper highlight function for the formatter
renamed project to rhodecode
r547 var highlightMatch = function(full, snippet, matchindex) {
return full.substring(0, matchindex) +
"<span class='match'>" +
full.substr(matchindex, snippet.length) +
"</span>" +
full.substring(matchindex + snippet.length);
};
#56 added users/groups autocomplete for repository editing....
r1012
// Custom formatter to highlight the matching letters
var custom_formatter = function(oResultData, sQuery, sResultMatch) {
var query = sQuery.toLowerCase();
if (oResultData.grname != undefined){
var grname = oResultData.grname;
var grmembers = oResultData.grmembers;
var grnameMatchIndex = grname.toLowerCase().indexOf(query);
var grprefix = "${_('Group')}: ";
var grsuffix = " ("+grmembers+" ${_('members')})";
if (grnameMatchIndex > -1){
return grprefix+highlightMatch(grname,query,grnameMatchIndex)+grsuffix;
}
return grprefix+oResultData.grname+grsuffix;
}
else if(oResultData.fname != undefined){
var fname = oResultData.fname,
lname = oResultData.lname,
nname = oResultData.nname || "", // Guard against null value
fnameMatchIndex = fname.toLowerCase().indexOf(query),
lnameMatchIndex = lname.toLowerCase().indexOf(query),
nnameMatchIndex = nname.toLowerCase().indexOf(query),
displayfname, displaylname, displaynname;
if(fnameMatchIndex > -1) {
displayfname = highlightMatch(fname, query, fnameMatchIndex);
}
else {
displayfname = fname;
}
if(lnameMatchIndex > -1) {
displaylname = highlightMatch(lname, query, lnameMatchIndex);
}
else {
displaylname = lname;
}
if(nnameMatchIndex > -1) {
displaynname = "(" + highlightMatch(nname, query, nnameMatchIndex) + ")";
}
else {
displaynname = nname ? "(" + nname + ")" : "";
}
return displayfname + " " + displaylname + " " + displaynname;
}
else{
return '';
}
};
membersAC.formatResult = custom_formatter;
ownerAC.formatResult = custom_formatter;
renamed project to rhodecode
r547 var myHandler = function(sType, aArgs) {
#56 added users/groups autocomplete for repository editing....
r1012
var myAC = aArgs[0]; // reference back to the AC instance
var elLI = aArgs[1]; // reference to the selected LI element
renamed project to rhodecode
r547 var oData = aArgs[2]; // object literal of selected item's result data
#56 added users/groups autocomplete for repository editing....
r1012
//fill the autocomplete with value
if(oData.nname != undefined){
//users
myAC.getInputEl().value = oData.nname;
YUD.get('perm_new_member_type').value = 'user';
}
else{
//groups
myAC.getInputEl().value = oData.grname;
YUD.get('perm_new_member_type').value = 'users_group';
}
renamed project to rhodecode
r547 };
#56 added users/groups autocomplete for repository editing....
r1012 membersAC.itemSelectEvent.subscribe(myHandler);
ownerAC.itemSelectEvent.subscribe(myHandler);
renamed project to rhodecode
r547
return {
#56 added users/groups autocomplete for repository editing....
r1012 memberDS: memberDS,
ownerDS: ownerDS,
membersAC: membersAC,
ownerAC: ownerAC,
renamed project to rhodecode
r547 };
}();
</script>
</div>
Code refactor for auth func, preparing for ldap support...
r699
<div class="box box-right">
<div class="title">
<h5>${_('Administration')}</h5>
</div>
added cache reset, stats reset, and delete into repository settings in admin....
r708 <h3>${_('Statistics')}</h3>
${h.form(url('repo_stats', repo_name=c.repo_info.repo_name),method='delete')}
<div class="form">
<div class="fields">
${h.submit('reset_stats_%s' % c.repo_info.repo_name,_('Reset current statistics'),class_="refresh_icon action_button",onclick="return confirm('Confirm to remove current statistics');")}
#109, added manual pull of changes for repositories that have remote location filled in....
r1114 <div class="field" style="border:none">
added cache reset, stats reset, and delete into repository settings in admin....
r708 <ul>
<li>${_('Fetched to rev')}: ${c.stats_revision}/${c.repo_last_rev}</li>
<li>${_('Percentage of stats gathered')}: ${c.stats_percentage} %</li>
</ul>
</div>
</div>
</div>
${h.end_form()}
#109, added manual pull of changes for repositories that have remote location filled in....
r1114 %if c.repo_info.clone_uri:
<h3>${_('Remote')}</h3>
${h.form(url('repo_pull', repo_name=c.repo_info.repo_name),method='put')}
<div class="form">
<div class="fields">
${h.submit('remote_pull_%s' % c.repo_info.repo_name,_('Pull changes from remote location'),class_="pull_icon action_button",onclick="return confirm('Confirm to pull changes from remote side');")}
<div class="field" style="border:none">
<ul>
<li><a href="${c.repo_info.clone_uri}">${c.repo_info.clone_uri}</a></li>
</ul>
</div>
</div>
</div>
${h.end_form()}
%endif
added cache reset, stats reset, and delete into repository settings in admin....
r708 <h3>${_('Cache')}</h3>
${h.form(url('repo_cache', repo_name=c.repo_info.repo_name),method='delete')}
<div class="form">
<div class="fields">
${h.submit('reset_cache_%s' % c.repo_info.repo_name,_('Invalidate repository cache'),class_="refresh_icon action_button",onclick="return confirm('Confirm to invalidate repository cache');")}
</div>
</div>
${h.end_form()}
Code refactor for auth func, preparing for ldap support...
r699
implemented public journal for anonymous users, admin can control which repositories...
r1085 <h3>${_('Public journal')}</h3>
${h.form(url('repo_public_journal', repo_name=c.repo_info.repo_name),method='put')}
<div class="form">
<div class="fields">
${h.hidden('auth_token',str(h.get_token()))}
%if c.in_public_journal:
${h.submit('set_public_%s' % c.repo_info.repo_name,_('Remove from public journal'),class_="stop_following_icon action_button")}
%else:
${h.submit('set_public_%s' % c.repo_info.repo_name,_('Add to public journal'),class_="start_following_icon action_button")}
%endif
</div>
</div>
${h.end_form()}
Code refactor for auth func, preparing for ldap support...
r699
added cache reset, stats reset, and delete into repository settings in admin....
r708 <h3>${_('Delete')}</h3>
${h.form(url('repo', repo_name=c.repo_info.repo_name),method='delete')}
<div class="form">
<div class="fields">
${h.submit('remove_%s' % c.repo_info.repo_name,_('Remove this repository'),class_="delete_icon action_button",onclick="return confirm('Confirm to delete this repository');")}
</div>
</div>
${h.end_form()}
Code refactor for auth func, preparing for ldap support...
r699
</div>
renamed project to rhodecode
r547 </%def>