repo_settings.html
197 lines
| 7.4 KiB
| text/html
|
HtmlLexer
r547 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.html"/> | ||||
<%def name="title()"> | ||||
r619 | ${c.repo_name} ${_('Settings')} - ${c.rhodecode_name} | |||
r547 | </%def> | |||
<%def name="breadcrumbs_links()"> | ||||
r1084 | ${h.link_to(u'Home',h.url('/'))} | |||
» | ||||
r547 | ${h.link_to(c.repo_info.repo_name,h.url('summary_home',repo_name=c.repo_info.repo_name))} | |||
» | ||||
${_('Settings')} | ||||
</%def> | ||||
r579 | ||||
r547 | <%def name="page_nav()"> | |||
${self.menu('settings')} | ||||
</%def> | ||||
<%def name="main()"> | ||||
<div class="box"> | ||||
<!-- box / title --> | ||||
<div class="title"> | ||||
${self.breadcrumbs()} | ||||
</div> | ||||
${h.form(url('repo_settings_update', 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> | ||||
<div class="input input-medium"> | ||||
r562 | ${h.text('repo_name',class_="small")} | |||
r547 | </div> | |||
</div> | ||||
<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> | ||||
<div class="field"> | ||||
<div class="label"> | ||||
<label for="">${_('Permissions')}:</label> | ||||
</div> | ||||
<div class="input"> | ||||
r1015 | <%include file="../admin/repos/repo_edit_perms.html"/> | |||
</div> | ||||
r547 | ||||
<div class="buttons"> | ||||
r888 | ${h.submit('update','Update',class_="ui-button")} | |||
${h.reset('reset','Reset',class_="ui-button")} | ||||
r547 | </div> | |||
</div> | ||||
</div> | ||||
${h.end_form()} | ||||
<script type="text/javascript"> | ||||
YAHOO.util.Event.onDOMReady(function(){ | ||||
var D = YAHOO.util.Dom; | ||||
if(!D.hasClass('perm_new_user_name','error')){ | ||||
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(){ | ||||
var myContacts = ${c.users_array|n} | ||||
// Define a custom search function for the DataSource | ||||
var matchNames = function(sQuery) { | ||||
// Case insensitive matching | ||||
var query = sQuery.toLowerCase(), | ||||
contact, | ||||
i=0, | ||||
l=myContacts.length, | ||||
matches = []; | ||||
// Match against each name of each contact | ||||
for(; i<l; i++) { | ||||
contact = myContacts[i]; | ||||
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; | ||||
}; | ||||
// Use a FunctionDataSource | ||||
var oDS = new YAHOO.util.FunctionDataSource(matchNames); | ||||
oDS.responseSchema = { | ||||
fields: ["id", "fname", "lname", "nname"] | ||||
} | ||||
// Instantiate AutoComplete for perms | ||||
var oAC_perms = new YAHOO.widget.AutoComplete("perm_new_user_name", "perm_container", oDS); | ||||
oAC_perms.useShadow = false; | ||||
oAC_perms.resultTypeList = false; | ||||
// Instantiate AutoComplete for owner | ||||
var oAC_owner = new YAHOO.widget.AutoComplete("user", "owner_container", oDS); | ||||
oAC_owner.useShadow = false; | ||||
oAC_owner.resultTypeList = false; | ||||
// Custom formatter to highlight the matching letters | ||||
var custom_formatter = function(oResultData, sQuery, sResultMatch) { | ||||
var query = sQuery.toLowerCase(), | ||||
fname = oResultData.fname, | ||||
lname = oResultData.lname, | ||||
nname = oResultData.nname || "", // Guard against null value | ||||
query = sQuery.toLowerCase(), | ||||
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; | ||||
}; | ||||
oAC_perms.formatResult = custom_formatter; | ||||
oAC_owner.formatResult = custom_formatter; | ||||
// Helper function for the formatter | ||||
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); | ||||
}; | ||||
var myHandler = function(sType, aArgs) { | ||||
var myAC = aArgs[0]; // reference back to the AC instance | ||||
var elLI = aArgs[1]; // reference to the selected LI element | ||||
var oData = aArgs[2]; // object literal of selected item's result data | ||||
myAC.getInputEl().value = oData.nname; | ||||
}; | ||||
oAC_perms.itemSelectEvent.subscribe(myHandler); | ||||
//oAC_owner.itemSelectEvent.subscribe(myHandler); | ||||
return { | ||||
oDS: oDS, | ||||
oAC_perms: oAC_perms, | ||||
oAC_owner: oAC_owner, | ||||
}; | ||||
}(); | ||||
</script> | ||||
</div> | ||||
r579 | </div> | |||
r547 | </%def> | |||