repo_edit_settings.mako
266 lines
| 12.8 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | ## -*- coding: utf-8 -*- | |||
<%namespace name="base" file="/base/base.mako"/> | ||||
<div class="panel panel-default"> | ||||
<div class="panel-heading"> | ||||
r1716 | <h3 class="panel-title">${_('Settings for Repository: %s') % c.rhodecode_db_repo.repo_name}</h3> | |||
r1282 | </div> | |||
<div class="panel-body"> | ||||
r1918 | ${h.secure_form(h.route_path('edit_repo', repo_name=c.rhodecode_db_repo.repo_name), method='POST', request=request)} | |||
r1282 | <div class="form"> | |||
<!-- fields --> | ||||
<div class="fields"> | ||||
r1716 | ||||
r1282 | <div class="field"> | |||
<div class="label"> | ||||
<label for="repo_name">${_('Name')}:</label> | ||||
</div> | ||||
<div class="input"> | ||||
r1716 | ${c.form['repo_name'].render(css_class='medium', oid='repo_name')|n} | |||
${c.form.render_error(request, c.form['repo_name'])|n} | ||||
<p class="help-block">${_('Non-changeable id')}: `_${c.rhodecode_db_repo.repo_id}` <span><a href="#" onclick="$('#clone_id').toggle();return false">${_('what is that ?')}</a></span></p> | ||||
r1282 | <p id="clone_id" style="display:none;"> | |||
r1716 | ${_('URL by id')}: `${c.rhodecode_db_repo.clone_url(with_id=True)}` <br/> | |||
r1282 | ${_('''In case this repository is renamed or moved into another group the repository url changes. | |||
Using above url guarantees that this repository will always be accessible under such url. | ||||
Useful for CI systems, or any other cases that you need to hardcode the url into 3rd party service.''')}</p> | ||||
</div> | ||||
</div> | ||||
r1716 | ||||
<div class="field"> | ||||
<div class="label"> | ||||
<label for="repo_group">${_('Repository group')}:</label> | ||||
</div> | ||||
<div class="select"> | ||||
${c.form['repo_group'].render(css_class='medium', oid='repo_group')|n} | ||||
${c.form.render_error(request, c.form['repo_group'])|n} | ||||
% if c.personal_repo_group: | ||||
<a class="btn" href="#" data-personal-group-name="${c.personal_repo_group.group_name}" data-personal-group-id="${c.personal_repo_group.group_id}" onclick="selectMyGroup(this); return false"> | ||||
${_('Select my personal group (`%(repo_group_name)s`)') % {'repo_group_name': c.personal_repo_group.group_name}} | ||||
</a> | ||||
% endif | ||||
<p class="help-block">${_('Optional select a group to put this repository into.')}</p> | ||||
</div> | ||||
</div> | ||||
% if c.rhodecode_db_repo.repo_type != 'svn': | ||||
r1282 | <div class="field"> | |||
<div class="label"> | ||||
<label for="clone_uri">${_('Remote uri')}:</label> | ||||
</div> | ||||
<div class="input"> | ||||
r1716 | %if c.rhodecode_db_repo.clone_uri: | |||
r1719 | ## display, if we don't have any errors | |||
% if not c.form['repo_clone_uri'].error: | ||||
r1282 | <div id="clone_uri_hidden" class='text-as-placeholder'> | |||
r1716 | <span id="clone_uri_hidden_value">${c.rhodecode_db_repo.clone_uri_hidden}</span> | |||
r1282 | <span class="link" id="edit_clone_uri"><i class="icon-edit"></i>${_('edit')}</span> | |||
</div> | ||||
r1719 | % endif | |||
r1716 | ## alter field | |||
r1719 | <div id="alter_clone_uri" style="${'' if c.form['repo_clone_uri'].error else 'display: none'}"> | |||
r1716 | ${c.form['repo_clone_uri'].render(css_class='medium', oid='clone_uri', placeholder=_('enter new value, or leave empty to remove'))|n} | |||
${c.form.render_error(request, c.form['repo_clone_uri'])|n} | ||||
r1719 | % if c.form['repo_clone_uri'].error: | |||
## we got error from form subit, means we modify the url | ||||
${h.hidden('repo_clone_uri_change', 'MOD')} | ||||
% else: | ||||
${h.hidden('repo_clone_uri_change', 'OLD')} | ||||
% endif | ||||
r1716 | ||||
r1719 | % if not c.form['repo_clone_uri'].error: | |||
r1282 | <span class="link" id="cancel_edit_clone_uri">${_('cancel')}</span> | |||
r1719 | % endif | |||
r1282 | </div> | |||
%else: | ||||
## not set yet, display form to set it | ||||
r1716 | ${c.form['repo_clone_uri'].render(css_class='medium', oid='clone_uri')|n} | |||
${c.form.render_error(request, c.form['repo_clone_uri'])|n} | ||||
${h.hidden('repo_clone_uri_change', 'NEW')} | ||||
r1282 | %endif | |||
r1716 | <p id="alter_clone_uri_help_block" class="help-block"> | |||
r2014 | <% pull_link = h.literal(h.link_to('remote sync', h.route_path('edit_repo_remote', repo_name=c.repo_name))) %> | |||
r1716 | ${_('http[s] url where from repository was imported, this field can used for doing {pull_link}.').format(pull_link=pull_link)|n} <br/> | |||
${_('This field is stored encrypted inside Database, a format of http://user:password@server.com/repo_name can be used and will be hidden from display.')} | ||||
</p> | ||||
r1282 | </div> | |||
</div> | ||||
r1716 | % else: | |||
${h.hidden('repo_clone_uri', '')} | ||||
% endif | ||||
r1282 | <div class="field"> | |||
<div class="label"> | ||||
r1716 | <label for="repo_landing_commit_ref">${_('Landing commit')}:</label> | |||
r1282 | </div> | |||
<div class="select"> | ||||
r1716 | ${c.form['repo_landing_commit_ref'].render(css_class='medium', oid='repo_landing_commit_ref')|n} | |||
${c.form.render_error(request, c.form['repo_landing_commit_ref'])|n} | ||||
<p class="help-block">${_('Default commit for files page, downloads, full text search index and readme')}</p> | ||||
r1282 | </div> | |||
</div> | ||||
<div class="field badged-field"> | ||||
<div class="label"> | ||||
r1716 | <label for="repo_owner">${_('Owner')}:</label> | |||
r1282 | </div> | |||
<div class="input"> | ||||
<div class="badge-input-container"> | ||||
<div class="user-badge"> | ||||
r1733 | ${base.gravatar_with_user(c.rhodecode_db_repo.user.email or c.rhodecode_db_repo.user.username, show_disabled=not c.rhodecode_db_repo.user.active)} | |||
r1282 | </div> | |||
<div class="badge-input-wrap"> | ||||
r1716 | ${c.form['repo_owner'].render(css_class='medium', oid='repo_owner')|n} | |||
r1282 | </div> | |||
</div> | ||||
r1716 | ${c.form.render_error(request, c.form['repo_owner'])|n} | |||
r1282 | <p class="help-block">${_('Change owner of this repository.')}</p> | |||
</div> | ||||
</div> | ||||
<div class="field"> | ||||
<div class="label label-textarea"> | ||||
<label for="repo_description">${_('Description')}:</label> | ||||
</div> | ||||
<div class="textarea text-area editor"> | ||||
r1716 | ${c.form['repo_description'].render(css_class='medium', oid='repo_description')|n} | |||
${c.form.render_error(request, c.form['repo_description'])|n} | ||||
r2091 | ||||
<% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %> | ||||
<span class="help-block">${_('Plain text format with support of {metatags}. Add a README file for longer descriptions').format(metatags=metatags_url)|n}</span> | ||||
<span id="meta-tags-desc" style="display: none"> | ||||
<%namespace name="dt" file="/data_table/_dt_elements.mako"/> | ||||
${dt.metatags_help()} | ||||
</span> | ||||
r1282 | </div> | |||
</div> | ||||
<div class="field"> | ||||
<div class="label label-checkbox"> | ||||
r1716 | <label for="${c.form['repo_private'].oid}">${_('Private repository')}:</label> | |||
r1282 | </div> | |||
<div class="checkboxes"> | ||||
r1716 | ${c.form['repo_private'].render(css_class='medium')|n} | |||
${c.form.render_error(request, c.form['repo_private'])|n} | ||||
r1282 | <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span> | |||
</div> | ||||
</div> | ||||
<div class="field"> | ||||
<div class="label label-checkbox"> | ||||
r1716 | <label for="${c.form['repo_enable_statistics'].oid}">${_('Enable statistics')}:</label> | |||
r1282 | </div> | |||
<div class="checkboxes"> | ||||
r1716 | ${c.form['repo_enable_statistics'].render(css_class='medium')|n} | |||
${c.form.render_error(request, c.form['repo_enable_statistics'])|n} | ||||
r1282 | <span class="help-block">${_('Enable statistics window on summary page.')}</span> | |||
</div> | ||||
</div> | ||||
<div class="field"> | ||||
<div class="label label-checkbox"> | ||||
r1716 | <label for="${c.form['repo_enable_downloads'].oid}">${_('Enable downloads')}:</label> | |||
r1282 | </div> | |||
<div class="checkboxes"> | ||||
r1716 | ${c.form['repo_enable_downloads'].render(css_class='medium')|n} | |||
${c.form.render_error(request, c.form['repo_enable_downloads'])|n} | ||||
r1282 | <span class="help-block">${_('Enable download menu on summary page.')}</span> | |||
</div> | ||||
</div> | ||||
<div class="field"> | ||||
<div class="label label-checkbox"> | ||||
r1716 | <label for="${c.form['repo_enable_locking'].oid}">${_('Enable automatic locking')}:</label> | |||
r1282 | </div> | |||
<div class="checkboxes"> | ||||
r1716 | ${c.form['repo_enable_locking'].render(css_class='medium')|n} | |||
${c.form.render_error(request, c.form['repo_enable_locking'])|n} | ||||
r1282 | <span class="help-block">${_('Enable automatic locking on repository. Pulling from this repository creates a lock that can be released by pushing back by the same user')}</span> | |||
</div> | ||||
</div> | ||||
%if c.visual.repository_fields: | ||||
## EXTRA FIELDS | ||||
%for field in c.repo_fields: | ||||
<div class="field"> | ||||
<div class="label"> | ||||
<label for="${field.field_key_prefixed}">${field.field_label} (${field.field_key}):</label> | ||||
</div> | ||||
<div class="input input-medium"> | ||||
${h.text(field.field_key_prefixed, field.field_value, class_='medium')} | ||||
%if field.field_desc: | ||||
<span class="help-block">${field.field_desc}</span> | ||||
%endif | ||||
</div> | ||||
</div> | ||||
%endfor | ||||
%endif | ||||
<div class="buttons"> | ||||
${h.submit('save',_('Save'),class_="btn")} | ||||
${h.reset('reset',_('Reset'),class_="btn")} | ||||
</div> | ||||
</div> | ||||
</div> | ||||
${h.end_form()} | ||||
</div> | ||||
</div> | ||||
<script> | ||||
$(document).ready(function(){ | ||||
var cloneUrl = function() { | ||||
var alterButton = $('#alter_clone_uri'); | ||||
var editButton = $('#edit_clone_uri'); | ||||
var cancelEditButton = $('#cancel_edit_clone_uri'); | ||||
var hiddenUrl = $('#clone_uri_hidden'); | ||||
var hiddenUrlValue = $('#clone_uri_hidden_value'); | ||||
var input = $('#clone_uri'); | ||||
var helpBlock = $('#alter_clone_uri_help_block'); | ||||
r1716 | var changedFlag = $('#repo_clone_uri_change'); | |||
r1282 | var originalText = helpBlock.html(); | |||
var obfuscatedUrl = hiddenUrlValue.html(); | ||||
var edit = function(e) { | ||||
alterButton.show(); | ||||
editButton.hide(); | ||||
hiddenUrl.hide(); | ||||
//add the old value next to input for verification | ||||
helpBlock.html("(" + obfuscatedUrl + ")" + "<br\>" + originalText); | ||||
changedFlag.val('MOD'); | ||||
}; | ||||
var cancelEdit = function(e) { | ||||
alterButton.hide(); | ||||
editButton.show(); | ||||
hiddenUrl.show(); | ||||
helpBlock.html(originalText); | ||||
changedFlag.val('OLD'); | ||||
input.val(''); | ||||
}; | ||||
var initEvents = function() { | ||||
editButton.on('click', edit); | ||||
cancelEditButton.on('click', cancelEdit); | ||||
}; | ||||
var setInitialState = function() { | ||||
if (input.hasClass('error')) { | ||||
alterButton.show(); | ||||
editButton.hide(); | ||||
hiddenUrl.hide(); | ||||
} | ||||
}; | ||||
setInitialState(); | ||||
initEvents(); | ||||
}(); | ||||
r1716 | selectMyGroup = function(element) { | |||
$("#repo_group").val($(element).data('personalGroupId')).trigger("change"); | ||||
}; | ||||
r1282 | ||||
r1716 | UsersAutoComplete('repo_owner', '${c.rhodecode_user.user_id}'); | |||
r1282 | }); | |||
</script> | ||||