## DATA TABLE RE USABLE ELEMENTS
## usage:
## <%namespace name="dt" file="/data_table/_dt_elements.html"/>
<%namespace name="base" file="/base/base.html"/>
## REPOSITORY RENDERERS
<%def name="quick_menu(repo_name)">
%def>
<%def name="repo_name(name,rtype,rstate,private,fork_of,short_name=False,admin=False)">
<%
def get_name(name,short_name=short_name):
if short_name:
return name.split('/')[-1]
else:
return name
%>
%def>
<%def name="last_change(last_change)">
${h.age_component(last_change)}
%def>
<%def name="revision(name,rev,tip,author,last_msg)">
%def>
<%def name="rss(name)">
%if c.rhodecode_user.username != h.DEFAULT_USER:
%else:
%endif
%def>
<%def name="atom(name)">
%if c.rhodecode_user.username != h.DEFAULT_USER:
%else:
%endif
%def>
<%def name="user_gravatar(email, size=16)">
${base.gravatar(email, 16)}
%def>
<%def name="repo_actions(repo_name, super_user=True)">
${h.secure_form(h.url('repo', repo_name=repo_name),method='delete')}
${h.submit('remove_%s' % repo_name,_('Delete'),class_="btn btn-link btn-danger",
onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
${h.end_form()}
%def>
<%def name="repo_state(repo_state)">
%if repo_state == 'repo_state_pending':
${_('Creating')}
%elif repo_state == 'repo_state_created':
${_('Created')}
%else:
invalid
%endif
%def>
## REPO GROUP RENDERERS
<%def name="quick_repo_group_menu(repo_group_name)">
%def>
<%def name="repo_group_name(repo_group_name, children_groups=None)">
%def>
<%def name="repo_group_actions(repo_group_id, repo_group_name, gr_count)">
${h.secure_form(h.url('delete_repo_group', group_name=repo_group_name),method='delete')}
${h.submit('remove_%s' % repo_group_name,_('Delete'),class_="btn btn-link btn-danger",
onclick="return confirm('"+ungettext('Confirm to delete this group: %s with %s repository','Confirm to delete this group: %s with %s repositories',gr_count) % (repo_group_name, gr_count)+"');")}
${h.end_form()}
%def>
<%def name="user_actions(user_id, username)">
${h.secure_form(h.url('delete_user', user_id=user_id),method='delete')}
${h.submit('remove_',_('Delete'),id="remove_user_%s" % user_id, class_="btn btn-link btn-danger",
onclick="return confirm('"+_('Confirm to delete this user: %s') % username+"');")}
${h.end_form()}
%def>
<%def name="user_group_actions(user_group_id, user_group_name)">
${h.secure_form(h.url('delete_users_group', user_group_id=user_group_id),method='delete')}
${h.submit('remove_',_('Delete'),id="remove_group_%s" % user_group_id, class_="btn btn-link btn-danger",
onclick="return confirm('"+_('Confirm to delete this user group: %s') % user_group_name+"');")}
${h.end_form()}
%def>
<%def name="user_name(user_id, username)">
${h.link_to(h.person(username, 'username_or_name_or_email'), h.url('edit_user', user_id=user_id))}
%def>
<%def name="user_profile(username)">
${base.gravatar_with_user(username, 16)}
%def>
<%def name="user_group_name(user_group_id, user_group_name)">
%def>
## GISTS
<%def name="gist_gravatar(full_contact)">
${base.gravatar(full_contact, 30)}
%def>
<%def name="gist_access_id(gist_access_id, full_contact)">
%def>
<%def name="gist_author(full_contact, created_on, expires)">
${base.gravatar_with_user(full_contact, 16)}
%def>
<%def name="gist_created(created_on)">
${h.age_component(created_on, time_is_local=True)}
%def>
<%def name="gist_expires(expires)">
%if expires == -1:
${_('never')}
%else:
${h.age_component(h.time_to_utcdatetime(expires))}
%endif
%def>
<%def name="gist_type(gist_type)">
%if gist_type != 'public':
${_('Private')}
%endif
%def>
<%def name="gist_description(gist_description)">
${gist_description}
%def>
## PULL REQUESTS GRID RENDERERS
<%def name="pullrequest_target_repo(repo_name)">
${h.link_to(repo_name,h.url('summary_home',repo_name=repo_name))}
%def>
<%def name="pullrequest_status(status)">
%def>
<%def name="pullrequest_title(title, description)">
${title}
${h.shorter(description, 40)}
%def>
<%def name="pullrequest_comments(comments_nr)">
${comments_nr}
%def>
<%def name="pullrequest_name(pull_request_id, target_repo_name, short=False)">
% if short:
#${pull_request_id}
% else:
${_('Pull request #%(pr_number)s') % {'pr_number': pull_request_id,}}
% endif
%def>
<%def name="pullrequest_updated_on(updated_on)">
${h.age_component(h.time_to_utcdatetime(updated_on))}
%def>
<%def name="pullrequest_author(full_contact)">
${base.gravatar_with_user(full_contact, 16)}
%def>