## 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: % endfor
${tag|n} ${h.style_metatag(tag_type, tag)|n}
<%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} ## REPOSITORY RENDERERS <%def name="quick_menu(repo_name)"> <%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 %>
##NAME ##TYPE OF REPO %if h.is_hg(rtype): %elif h.is_git(rtype): %elif h.is_svn(rtype): %endif ##PRIVATE/PUBLIC %if private is True and c.visual.show_private_icon: %elif private is False and c.visual.show_public_icon: %else: %endif ${get_name(name)} %if fork_of: %endif %if rstate == 'repo_state_pending': (${_('creating...')}) %endif
<%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 name="last_change(last_change)"> ${h.age_component(last_change, time_is_local=True)} <%def name="revision(name,rev,tip,author,last_msg, commit_date)">
%if rev >= 0: ${'r%s:%s' % (rev,h.short_id(tip))} %else: ${_('No commits yet')} %endif
<%def name="rss(name)"> %if c.rhodecode_user.username != h.DEFAULT_USER: %else: %endif <%def name="atom(name)"> %if c.rhodecode_user.username != h.DEFAULT_USER: %else: %endif <%def name="repo_actions(repo_name, super_user=True)">
Edit
${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 name="repo_state(repo_state)">
%if repo_state == 'repo_state_pending':
${_('Creating')}
%elif repo_state == 'repo_state_created':
${_('Created')}
%else:
invalid
%endif
## REPO GROUP RENDERERS <%def name="quick_repo_group_menu(repo_group_name)"> <%def name="repo_group_name(repo_group_name, children_groups=None)">
%if children_groups: ${h.literal(' » '.join(children_groups))} %else: ${repo_group_name} %endif
<%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 name="repo_group_actions(repo_group_id, repo_group_name, gr_count)">
Edit
${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 name="user_actions(user_id, username)">
${_('Edit')}
${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 name="user_group_actions(user_group_id, user_group_name)">
Edit
${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 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 name="user_profile(username)"> ${base.gravatar_with_user(username, 16, tooltip=True)} <%def name="user_group_name(user_group_name)">
${h.link_to_group(user_group_name)}
## GISTS <%def name="gist_gravatar(full_contact)">
${base.gravatar(full_contact, 30)}
<%def name="gist_access_id(gist_access_id, full_contact)">
gist: ${gist_access_id}
<%def name="gist_author(full_contact, created_on, expires)"> ${base.gravatar_with_user(full_contact, 16, tooltip=True)} <%def name="gist_created(created_on)">
${h.age_component(created_on, time_is_local=True)}
<%def name="gist_expires(expires)">
%if expires == -1: ${_('never')} %else: ${h.age_component(h.time_to_utcdatetime(expires))} %endif
<%def name="gist_type(gist_type)"> %if gist_type != 'public':
${_('Private')}
%endif <%def name="gist_description(gist_description)"> ${gist_description} ## 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 name="pullrequest_status(status)"> <%def name="pullrequest_title(title, description)"> ${title} <%def name="pullrequest_comments(comments_nr)"> ${comments_nr} <%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 name="pullrequest_updated_on(updated_on)"> ${h.age_component(h.time_to_utcdatetime(updated_on))} <%def name="pullrequest_author(full_contact)"> ${base.gravatar_with_user(full_contact, 16, tooltip=True)} ## ARTIFACT RENDERERS <%def name="repo_artifact_name(repo_name, file_uid, artifact_display_name)"> ${artifact_display_name or '_EMPTY_NAME_'} <%def name="repo_artifact_uid(repo_name, file_uid)"> ${h.shorter(file_uid, size=24, prefix=True)} <%def name="repo_artifact_sha256(artifact_sha256)">
${h.shorter(artifact_sha256, 12)}
<%def name="repo_artifact_actions(repo_name, file_store_id, file_uid)"> ##
## ${_('Edit')} ##
${_('Info')}
% 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 name="markup_form(form_id, form_text='', help_text=None)">