## 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}
## REPOSITORY RENDERERS <%def name="quick_menu(repo_name)"> <%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 %>
##NAME ##TYPE OF REPO %if h.is_hg(rtype): %elif h.is_git(rtype): %elif h.is_svn(rtype): %endif ##PRIVATE/PUBLIC %if private and c.visual.show_private_icon: %elif not private 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)} <%def name="revision(name,rev,tip,author,last_msg)">
%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="user_gravatar(email, size=16)">
${base.gravatar(email, 16)}
<%def name="repo_actions(repo_name, super_user=True)">
Edit
${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=repo_name), method='POST', 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)"> <% 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.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 name="user_actions(user_id, username)">
Edit
${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 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), method='POST', 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.url('edit_user', user_id=user_id))} <%def name="user_profile(username)"> ${base.gravatar_with_user(username, 16)} <%def name="user_group_name(user_group_id, user_group_name)">
${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)} <%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}
${h.shorter(description, 40)} <%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)}