##// END OF EJS Templates
fix(permissions): added a common way to update private flag via repo model...
fix(permissions): added a common way to update private flag via repo model - this allows to have a one and only one way to control the flag with the business logic shared - added test for that - changed view to use this method instead of DB update and custom permissions flush - fixed a case when update of repo settings didn't flush permissions actually while it should when private flag changed

File last commit:

r5037:bd722d6e default
r5551:5b9b5ed2 default
Show More
repo_edit_settings.mako
336 lines | 16.2 KiB | application/x-mako | MakoHtmlLexer
/ rhodecode / templates / admin / repos / repo_edit_settings.mako
templating: use .mako as extensions for template files.
r1282 <%namespace name="base" file="/base/base.mako"/>
<div class="panel panel-default">
<div class="panel-heading">
repo-settings: converted repo settings to pyramid...
r1716 <h3 class="panel-title">${_('Settings for Repository: %s') % c.rhodecode_db_repo.repo_name}</h3>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="panel-body">
forms: unified usage of h.secure_form. Make sure we ALWAYS pass in...
r2105 ${h.secure_form(h.route_path('edit_repo', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
templating: use .mako as extensions for template files.
r1282 <div class="form">
<!-- fields -->
<div class="fields">
repo-settings: converted repo settings to pyramid...
r1716
templating: use .mako as extensions for template files.
r1282 <div class="field">
<div class="label">
<label for="repo_name">${_('Name')}:</label>
</div>
<div class="input">
repo-settings: converted repo settings to pyramid...
r1716 ${c.form['repo_name'].render(css_class='medium', oid='repo_name')|n}
${c.form.render_error(request, c.form['repo_name'])|n}
repo-settings: non-changeable is a bad name. We use permalink notation in the app.
r2415 <p class="help-block">${_('permalink id')}: `_${c.rhodecode_db_repo.repo_id}` <span><a href="#" onclick="$('#clone_id').toggle();return false">${_('what is that ?')}</a></span></p>
templating: use .mako as extensions for template files.
r1282 <p id="clone_id" style="display:none;">
repo-settings: converted repo settings to pyramid...
r1716 ${_('URL by id')}: `${c.rhodecode_db_repo.clone_url(with_id=True)}` <br/>
templating: use .mako as extensions for template files.
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>
repo-settings: converted repo settings to pyramid...
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':
repositories: allow properly updating repository push url.
r2562 <% sync_link = h.literal(h.link_to('remote sync', h.route_path('edit_repo_remote', repo_name=c.repo_name))) %>
templating: use .mako as extensions for template files.
r1282 <div class="field">
<div class="label">
repositories: allow properly updating repository push url.
r2562 <label for="clone_uri">${_('Remote pull uri')}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="input">
repo-settings: converted repo settings to pyramid...
r1716 %if c.rhodecode_db_repo.clone_uri:
repo-schema: added a custom schema for repo settings....
r1719 ## display, if we don't have any errors
% if not c.form['repo_clone_uri'].error:
templating: use .mako as extensions for template files.
r1282 <div id="clone_uri_hidden" class='text-as-placeholder'>
repo-settings: converted repo settings to pyramid...
r1716 <span id="clone_uri_hidden_value">${c.rhodecode_db_repo.clone_uri_hidden}</span>
dan
ui: fixed some missed icons during redesign phase
r3798 <span class="link" id="edit_clone_uri">${_('edit')}</span>
templating: use .mako as extensions for template files.
r1282 </div>
repo-schema: added a custom schema for repo settings....
r1719 % endif
repo-settings: converted repo settings to pyramid...
r1716 ## alter field
repo-schema: added a custom schema for repo settings....
r1719 <div id="alter_clone_uri" style="${'' if c.form['repo_clone_uri'].error else 'display: none'}">
repo-settings: converted repo settings to pyramid...
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}
repo-schema: added a custom schema for repo settings....
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
repo-settings: converted repo settings to pyramid...
r1716
repo-schema: added a custom schema for repo settings....
r1719 % if not c.form['repo_clone_uri'].error:
templating: use .mako as extensions for template files.
r1282 <span class="link" id="cancel_edit_clone_uri">${_('cancel')}</span>
repo-schema: added a custom schema for repo settings....
r1719 % endif
templating: use .mako as extensions for template files.
r1282 </div>
%else:
## not set yet, display form to set it
repo-settings: converted repo settings to pyramid...
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')}
templating: use .mako as extensions for template files.
r1282 %endif
repo-settings: converted repo settings to pyramid...
r1716 <p id="alter_clone_uri_help_block" class="help-block">
repositories: allow properly updating repository push url.
r2562 ${_('http[s] url where from repository was imported. This field can used for doing {sync_link}.').format(sync_link=sync_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>
</div>
</div>
<div class="field">
<div class="label">
<label for="push_uri">${_('Remote push uri')}:</label>
</div>
<div class="input">
%if c.rhodecode_db_repo.push_uri:
## display, if we don't have any errors
% if not c.form['repo_push_uri'].error:
<div id="push_uri_hidden" class='text-as-placeholder'>
<span id="push_uri_hidden_value">${c.rhodecode_db_repo.push_uri_hidden}</span>
dan
ui: fixed some missed icons during redesign phase
r3798 <span class="link" id="edit_push_uri">${_('edit')}</span>
repositories: allow properly updating repository push url.
r2562 </div>
% endif
## alter field
<div id="alter_push_uri" style="${'' if c.form['repo_push_uri'].error else 'display: none'}">
${c.form['repo_push_uri'].render(css_class='medium', oid='push_uri', placeholder=_('enter new value, or leave empty to remove'))|n}
${c.form.render_error(request, c.form['repo_push_uri'])|n}
% if c.form['repo_push_uri'].error:
## we got error from form subit, means we modify the url
${h.hidden('repo_push_uri_change', 'MOD')}
% else:
${h.hidden('repo_push_uri_change', 'OLD')}
% endif
% if not c.form['repo_push_uri'].error:
<span class="link" id="cancel_edit_push_uri">${_('cancel')}</span>
% endif
</div>
%else:
## not set yet, display form to set it
${c.form['repo_push_uri'].render(css_class='medium', oid='push_uri')|n}
${c.form.render_error(request, c.form['repo_push_uri'])|n}
${h.hidden('repo_push_uri_change', 'NEW')}
%endif
<p id="alter_push_uri_help_block" class="help-block">
${_('http[s] url to sync data back. This field can used for doing {sync_link}.').format(sync_link=sync_link)|n} <br/>
repo-settings: converted repo settings to pyramid...
r1716 ${_('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>
templating: use .mako as extensions for template files.
r1282 </div>
</div>
repo-settings: converted repo settings to pyramid...
r1716 % else:
${h.hidden('repo_clone_uri', '')}
repositories: allow properly updating repository push url.
r2562 ${h.hidden('repo_push_uri', '')}
repo-settings: converted repo settings to pyramid...
r1716 % endif
templating: use .mako as extensions for template files.
r1282 <div class="field">
<div class="label">
repo-settings: converted repo settings to pyramid...
r1716 <label for="repo_landing_commit_ref">${_('Landing commit')}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="select">
repo-settings: converted repo settings to pyramid...
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}
users: use two distinct actions for user password reset....
r3378 <p class="help-block">${_('The default commit for file pages, downloads, full text search index, and README generation.')}</p>
templating: use .mako as extensions for template files.
r1282 </div>
</div>
<div class="field badged-field">
<div class="label">
repo-settings: converted repo settings to pyramid...
r1716 <label for="repo_owner">${_('Owner')}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="input">
<div class="badge-input-container">
<div class="user-badge">
ui: owner icon is consistent width for better user experience
r5011 ${base.gravatar(c.rhodecode_db_repo.user.email or c.rhodecode_db_repo.user.username, user=c.rhodecode_db_repo.user, tooltip=True)}
templating: use .mako as extensions for template files.
r1282 </div>
<div class="badge-input-wrap">
repo-settings: converted repo settings to pyramid...
r1716 ${c.form['repo_owner'].render(css_class='medium', oid='repo_owner')|n}
templating: use .mako as extensions for template files.
r1282 </div>
</div>
repo-settings: converted repo settings to pyramid...
r1716 ${c.form.render_error(request, c.form['repo_owner'])|n}
templating: use .mako as extensions for template files.
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">
repo-settings: converted repo settings to pyramid...
r1716 ${c.form['repo_description'].render(css_class='medium', oid='repo_description')|n}
${c.form.render_error(request, c.form['repo_description'])|n}
meta-tags: cleanup support for metatags....
r2091
<% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
descriptions: show mention of metatags only if they are enabled.
r4241 <span class="help-block">
% if c.visual.stylify_metatags:
${_('Plain text format with {metatags} support.').format(metatags=metatags_url)|n}
% else:
${_('Plain text format.')}
% endif
${_('Add a README file for longer descriptions')}
</span>
meta-tags: cleanup support for metatags....
r2091 <span id="meta-tags-desc" style="display: none">
<%namespace name="dt" file="/data_table/_dt_elements.mako"/>
${dt.metatags_help()}
</span>
templating: use .mako as extensions for template files.
r1282 </div>
</div>
<div class="field">
<div class="label label-checkbox">
repo-settings: converted repo settings to pyramid...
r1716 <label for="${c.form['repo_private'].oid}">${_('Private repository')}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="checkboxes">
repo-settings: converted repo settings to pyramid...
r1716 ${c.form['repo_private'].render(css_class='medium')|n}
${c.form.render_error(request, c.form['repo_private'])|n}
templating: use .mako as extensions for template files.
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">
repo-settings: converted repo settings to pyramid...
r1716 <label for="${c.form['repo_enable_statistics'].oid}">${_('Enable statistics')}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="checkboxes">
repo-settings: converted repo settings to pyramid...
r1716 ${c.form['repo_enable_statistics'].render(css_class='medium')|n}
${c.form.render_error(request, c.form['repo_enable_statistics'])|n}
templating: use .mako as extensions for template files.
r1282 <span class="help-block">${_('Enable statistics window on summary page.')}</span>
</div>
</div>
<div class="field">
<div class="label label-checkbox">
repo-settings: converted repo settings to pyramid...
r1716 <label for="${c.form['repo_enable_downloads'].oid}">${_('Enable downloads')}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="checkboxes">
repo-settings: converted repo settings to pyramid...
r1716 ${c.form['repo_enable_downloads'].render(css_class='medium')|n}
${c.form.render_error(request, c.form['repo_enable_downloads'])|n}
templating: use .mako as extensions for template files.
r1282 <span class="help-block">${_('Enable download menu on summary page.')}</span>
</div>
</div>
<div class="field">
<div class="label label-checkbox">
repo-settings: converted repo settings to pyramid...
r1716 <label for="${c.form['repo_enable_locking'].oid}">${_('Enable automatic locking')}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="checkboxes">
repo-settings: converted repo settings to pyramid...
r1716 ${c.form['repo_enable_locking'].render(css_class='medium')|n}
${c.form.render_error(request, c.form['repo_enable_locking'])|n}
templating: use .mako as extensions for template files.
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">
extra-keys: fixed some texts
r4586 <label for="${field.field_key_prefixed}">${(field.field_label or field.field_key)}:</label>
templating: use .mako as extensions for template files.
r1282 </div>
<div class="input input-medium">
${h.text(field.field_key_prefixed, field.field_value, class_='medium')}
extra-keys: fixed some texts
r4586 <span class="help-block">
key: ${field.field_key};
${field.field_desc}
</span>
templating: use .mako as extensions for template files.
r1282 </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>
repositories: allow properly updating repository push url.
r2562 $(document).ready(function () {
var cloneUrl = function (
alterButton, editButton, cancelEditButton,
hiddenUrl, hiddenUrlValue, input, helpBlock, changedFlag) {
templating: use .mako as extensions for template files.
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();
repositories: allow properly updating repository push url.
r2562 };
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');
var changedFlag = $('#repo_clone_uri_change');
cloneUrl(
alterButton, editButton, cancelEditButton, hiddenUrl,
hiddenUrlValue, input, helpBlock, changedFlag);
var alterButton = $('#alter_push_uri');
var editButton = $('#edit_push_uri');
var cancelEditButton = $('#cancel_edit_push_uri');
var hiddenUrl = $('#push_uri_hidden');
var hiddenUrlValue = $('#push_uri_hidden_value');
var input = $('#push_uri');
var helpBlock = $('#alter_push_uri_help_block');
var changedFlag = $('#repo_push_uri_change');
cloneUrl(
alterButton, editButton, cancelEditButton, hiddenUrl,
hiddenUrlValue, input, helpBlock, changedFlag);
templating: use .mako as extensions for template files.
r1282
repo-settings: converted repo settings to pyramid...
r1716 selectMyGroup = function(element) {
$("#repo_group").val($(element).data('personalGroupId')).trigger("change");
};
templating: use .mako as extensions for template files.
r1282
repo-settings: converted repo settings to pyramid...
r1716 UsersAutoComplete('repo_owner', '${c.rhodecode_user.user_id}');
templating: use .mako as extensions for template files.
r1282 });
</script>