## DATA TABLE RE USABLE ELEMENTS
## usage:
## <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
<%namespace name="base" file="/base/base.mako"/>
<%def name="metatags_help()">
<%
example_tags = [
('state','[stable]'),
('state','[stale]'),
('state','[featured]'),
('state','[dev]'),
('state','[dead]'),
('state','[deprecated]'),
('label','[personal]'),
('generic','[v2.0.0]'),
('lang','[lang => JavaScript]'),
('license','[license => LicenseName]'),
('ref','[requires => RepoName]'),
('ref','[recommends => GroupName]'),
('ref','[conflicts => SomeName]'),
('ref','[base => SomeName]'),
('url','[url => [linkName](https://rhodecode.com)]'),
('see','[see => http://rhodecode.com]'),
]
%>
% for tag_type, tag in example_tags:
${tag|n} |
${h.style_metatag(tag_type, tag)|n} |
% endfor
%def>
<%def name="render_description(description, stylify_metatags)">
<%
tags = []
if stylify_metatags:
tags, description = h.extract_metatags(description)
%>
% for tag_type, tag in tags:
${h.style_metatag(tag_type, tag)|n,trim}
% endfor
${description}
%def>
## REPOSITORY RENDERERS
<%def name="quick_menu(repo_name)">
%def>
<%def name="repo_name(name,rtype,rstate,private,archived,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="repo_desc(description, stylify_metatags)">
<%
tags, description = h.extract_metatags(description)
%>
% if stylify_metatags:
% for tag_type, tag in tags:
${h.style_metatag(tag_type, tag)|n}
% endfor
% endif
${description}
%def>
<%def name="last_change(last_change)">
${h.age_component(last_change, time_is_local=True)}
%def>
<%def name="revision(repo_name, rev, commit_id, author, last_msg, commit_date)">
%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="repo_actions(repo_name, super_user=True)">
${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=repo_name), request=request)}
${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_desc(description, personal, stylify_metatags)">
<%
if stylify_metatags:
tags, description = h.extract_metatags(description)
%>
% if personal:
${_('personal')}
% endif
% if stylify_metatags:
% for tag_type, tag in tags:
${h.style_metatag(tag_type, tag)|n}
% endfor
% endif
${description}
%def>
<%def name="repo_group_actions(repo_group_id, repo_group_name, gr_count)">
${h.secure_form(h.route_path('edit_repo_group_advanced_delete', repo_group_name=repo_group_name), request=request)}
${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.route_path('user_delete', user_id=user_id), request=request)}
${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.route_path('user_groups_delete', user_group_id=user_group_id), request=request)}
${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.route_path('user_edit', user_id=user_id))}
%def>
<%def name="user_profile(username)">
${base.gravatar_with_user(username, 16, tooltip=True)}
%def>
<%def name="user_group_name(user_group_name)">
${h.link_to_group(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, tooltip=True)}
%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.route_path('repo_summary',repo_name=repo_name))}
%def>
<%def name="pullrequest_status(status)">
%def>
<%def name="pullrequest_title(title, description)">
${title}
%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 !{}').format(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, tooltip=True)}
%def>
## ARTIFACT RENDERERS
<%def name="repo_artifact_name(repo_name, file_uid, artifact_display_name)">
${artifact_display_name or '_EMPTY_NAME_'}
%def>
<%def name="repo_artifact_uid(repo_name, file_uid)">
${h.shorter(file_uid, size=24, prefix=True)}
%def>
<%def name="repo_artifact_sha256(artifact_sha256)">
${h.shorter(artifact_sha256, 12)}
%def>
<%def name="repo_artifact_actions(repo_name, file_store_id, file_uid)">
##
% if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
${h.secure_form(h.route_path('repo_artifacts_delete', repo_name=repo_name, uid=file_store_id), request=request)}
${h.submit('remove_',_('Delete'),id="remove_artifact_%s" % file_store_id, class_="btn btn-link btn-danger",
onclick="return confirm('"+_('Confirm to delete this artifact: %s') % file_uid+"');")}
${h.end_form()}
% endif
%def>
<%def name="markup_form(form_id, form_text='', help_text=None)">
%def>