_dt_elements.mako
377 lines
| 12.1 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | ## DATA TABLE RE USABLE ELEMENTS | |||
## usage: | ||||
## <%namespace name="dt" file="/data_table/_dt_elements.mako"/> | ||||
<%namespace name="base" file="/base/base.mako"/> | ||||
r2091 | <%def name="metatags_help()"> | |||
<table> | ||||
<% | ||||
example_tags = [ | ||||
('state','[stable]'), | ||||
('state','[stale]'), | ||||
('state','[featured]'), | ||||
('state','[dev]'), | ||||
('state','[dead]'), | ||||
r2093 | ('state','[deprecated]'), | |||
r2091 | ||||
('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: | ||||
<tr> | ||||
<td>${tag|n}</td> | ||||
<td>${h.style_metatag(tag_type, tag)|n}</td> | ||||
</tr> | ||||
% endfor | ||||
</table> | ||||
</%def> | ||||
r1282 | ## REPOSITORY RENDERERS | |||
<%def name="quick_menu(repo_name)"> | ||||
r1952 | <i class="icon-more"></i> | |||
r1282 | <div class="menu_items_container hidden"> | |||
<ul class="menu_items"> | ||||
<li> | ||||
r1785 | <a title="${_('Summary')}" href="${h.route_path('repo_summary',repo_name=repo_name)}"> | |||
r1282 | <span>${_('Summary')}</span> | |||
</a> | ||||
</li> | ||||
<li> | ||||
r1931 | <a title="${_('Changelog')}" href="${h.route_path('repo_changelog',repo_name=repo_name)}"> | |||
r1282 | <span>${_('Changelog')}</span> | |||
</a> | ||||
</li> | ||||
<li> | ||||
r1927 | <a title="${_('Files')}" href="${h.route_path('repo_files:default_commit',repo_name=repo_name)}"> | |||
r1282 | <span>${_('Files')}</span> | |||
</a> | ||||
</li> | ||||
<li> | ||||
r1988 | <a title="${_('Fork')}" href="${h.route_path('repo_fork_new',repo_name=repo_name)}"> | |||
r1282 | <span>${_('Fork')}</span> | |||
</a> | ||||
</li> | ||||
</ul> | ||||
</div> | ||||
</%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 | ||||
%> | ||||
<div class="${'repo_state_pending' if rstate == 'repo_state_pending' else ''} truncate"> | ||||
##NAME | ||||
r1785 | <a href="${h.route_path('edit_repo',repo_name=name) if admin else h.route_path('repo_summary',repo_name=name)}"> | |||
r1282 | ||||
##TYPE OF REPO | ||||
%if h.is_hg(rtype): | ||||
r2092 | <span title="${_('Mercurial repository')}"><i class="icon-hg" style="font-size: 14px;"></i></span> | |||
r1282 | %elif h.is_git(rtype): | |||
r2092 | <span title="${_('Git repository')}"><i class="icon-git" style="font-size: 14px"></i></span> | |||
r1282 | %elif h.is_svn(rtype): | |||
r2092 | <span title="${_('Subversion repository')}"><i class="icon-svn" style="font-size: 14px"></i></span> | |||
r1282 | %endif | |||
##PRIVATE/PUBLIC | ||||
%if private and c.visual.show_private_icon: | ||||
<i class="icon-lock" title="${_('Private repository')}"></i> | ||||
%elif not private and c.visual.show_public_icon: | ||||
<i class="icon-unlock-alt" title="${_('Public repository')}"></i> | ||||
%else: | ||||
<span></span> | ||||
%endif | ||||
${get_name(name)} | ||||
</a> | ||||
%if fork_of: | ||||
r1785 | <a href="${h.route_path('repo_summary',repo_name=fork_of.repo_name)}"><i class="icon-code-fork"></i></a> | |||
r1282 | %endif | |||
%if rstate == 'repo_state_pending': | ||||
r1985 | <span class="creation_in_progress tooltip" title="${_('This repository is being created in a background task')}"> | |||
(${_('creating...')}) | ||||
</span> | ||||
r1282 | %endif | |||
</div> | ||||
</%def> | ||||
r2091 | <%def name="repo_desc(description, stylify_metatags)"> | |||
<% | ||||
tags, description = h.extract_metatags(description) | ||||
%> | ||||
<div class="truncate-wrap"> | ||||
% if stylify_metatags: | ||||
% for tag_type, tag in tags: | ||||
${h.style_metatag(tag_type, tag)|n} | ||||
% endfor | ||||
% endif | ||||
${description} | ||||
</div> | ||||
r1282 | </%def> | |||
<%def name="last_change(last_change)"> | ||||
r2490 | ${h.age_component(last_change, time_is_local=True)} | |||
r1282 | </%def> | |||
r2489 | <%def name="revision(name,rev,tip,author,last_msg, commit_date)"> | |||
r1282 | <div> | |||
%if rev >= 0: | ||||
r2489 | <code><a title="${h.tooltip('%s\n%s\n\n%s' % (author, commit_date, last_msg))}" class="tooltip" href="${h.route_path('repo_commit',repo_name=name,commit_id=tip)}">${'r%s:%s' % (rev,h.short_id(tip))}</a></code> | |||
r1282 | %else: | |||
${_('No commits yet')} | ||||
%endif | ||||
</div> | ||||
</%def> | ||||
<%def name="rss(name)"> | ||||
%if c.rhodecode_user.username != h.DEFAULT_USER: | ||||
r1899 | <a title="${h.tooltip(_('Subscribe to %s rss feed')% name)}" href="${h.route_path('rss_feed_home', repo_name=name, _query=dict(auth_token=c.rhodecode_user.feed_token))}"><i class="icon-rss-sign"></i></a> | |||
r1282 | %else: | |||
r1899 | <a title="${h.tooltip(_('Subscribe to %s rss feed')% name)}" href="${h.route_path('rss_feed_home', repo_name=name)}"><i class="icon-rss-sign"></i></a> | |||
r1282 | %endif | |||
</%def> | ||||
<%def name="atom(name)"> | ||||
%if c.rhodecode_user.username != h.DEFAULT_USER: | ||||
r1899 | <a title="${h.tooltip(_('Subscribe to %s atom feed')% name)}" href="${h.route_path('atom_feed_home', repo_name=name, _query=dict(auth_token=c.rhodecode_user.feed_token))}"><i class="icon-rss-sign"></i></a> | |||
r1282 | %else: | |||
r1899 | <a title="${h.tooltip(_('Subscribe to %s atom feed')% name)}" href="${h.route_path('atom_feed_home', repo_name=name)}"><i class="icon-rss-sign"></i></a> | |||
r1282 | %endif | |||
</%def> | ||||
<%def name="user_gravatar(email, size=16)"> | ||||
r1843 | <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}"> | |||
r1282 | ${base.gravatar(email, 16)} | |||
</div> | ||||
</%def> | ||||
<%def name="repo_actions(repo_name, super_user=True)"> | ||||
<div> | ||||
<div class="grid_edit"> | ||||
r1716 | <a href="${h.route_path('edit_repo',repo_name=repo_name)}" title="${_('Edit')}"> | |||
r1282 | <i class="icon-pencil"></i>Edit</a> | |||
</div> | ||||
<div class="grid_delete"> | ||||
r2105 | ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=repo_name), request=request)} | |||
r1282 | ${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()} | ||||
</div> | ||||
</div> | ||||
</%def> | ||||
<%def name="repo_state(repo_state)"> | ||||
<div> | ||||
%if repo_state == 'repo_state_pending': | ||||
<div class="tag tag4">${_('Creating')}</div> | ||||
%elif repo_state == 'repo_state_created': | ||||
<div class="tag tag1">${_('Created')}</div> | ||||
%else: | ||||
r1843 | <div class="tag alert2" title="${h.tooltip(repo_state)}">invalid</div> | |||
r1282 | %endif | |||
</div> | ||||
</%def> | ||||
## REPO GROUP RENDERERS | ||||
<%def name="quick_repo_group_menu(repo_group_name)"> | ||||
r1952 | <i class="icon-more"></i> | |||
r1282 | <div class="menu_items_container hidden"> | |||
<ul class="menu_items"> | ||||
<li> | ||||
r2012 | <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}">${_('Summary')}</a> | |||
r1282 | </li> | |||
</ul> | ||||
</div> | ||||
</%def> | ||||
<%def name="repo_group_name(repo_group_name, children_groups=None)"> | ||||
<div> | ||||
r1774 | <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}"> | |||
r2092 | <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i> | |||
r1282 | %if children_groups: | |||
${h.literal(' » '.join(children_groups))} | ||||
%else: | ||||
${repo_group_name} | ||||
%endif | ||||
</a> | ||||
</div> | ||||
</%def> | ||||
r2091 | <%def name="repo_group_desc(description, personal, stylify_metatags)"> | |||
<% | ||||
tags, description = h.extract_metatags(description) | ||||
%> | ||||
<div class="truncate-wrap"> | ||||
% if personal: | ||||
<div class="metatag" tag="personal">${_('personal')}</div> | ||||
% endif | ||||
% if stylify_metatags: | ||||
% for tag_type, tag in tags: | ||||
${h.style_metatag(tag_type, tag)|n} | ||||
% endfor | ||||
% endif | ||||
${description} | ||||
</div> | ||||
r1282 | </%def> | |||
<%def name="repo_group_actions(repo_group_id, repo_group_name, gr_count)"> | ||||
<div class="grid_edit"> | ||||
r2175 | <a href="${h.route_path('edit_repo_group',repo_group_name=repo_group_name)}" title="${_('Edit')}">Edit</a> | |||
r1282 | </div> | |||
<div class="grid_delete"> | ||||
r2175 | ${h.secure_form(h.route_path('edit_repo_group_advanced_delete', repo_group_name=repo_group_name), request=request)} | |||
r1282 | ${h.submit('remove_%s' % repo_group_name,_('Delete'),class_="btn btn-link btn-danger", | |||
r1945 | 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)+"');")} | |||
r1282 | ${h.end_form()} | |||
</div> | ||||
</%def> | ||||
<%def name="user_actions(user_id, username)"> | ||||
<div class="grid_edit"> | ||||
r2114 | <a href="${h.route_path('user_edit',user_id=user_id)}" title="${_('Edit')}"> | |||
<i class="icon-pencil"></i>${_('Edit')}</a> | ||||
r1282 | </div> | |||
<div class="grid_delete"> | ||||
r2114 | ${h.secure_form(h.route_path('user_delete', user_id=user_id), request=request)} | |||
r1282 | ${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()} | ||||
</div> | ||||
</%def> | ||||
<%def name="user_group_actions(user_group_id, user_group_name)"> | ||||
<div class="grid_edit"> | ||||
r2068 | <a href="${h.route_path('edit_user_group', user_group_id=user_group_id)}" title="${_('Edit')}">Edit</a> | |||
r1282 | </div> | |||
<div class="grid_delete"> | ||||
r2105 | ${h.secure_form(h.route_path('user_groups_delete', user_group_id=user_group_id), request=request)} | |||
r1282 | ${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()} | ||||
</div> | ||||
</%def> | ||||
<%def name="user_name(user_id, username)"> | ||||
r2114 | ${h.link_to(h.person(username, 'username_or_name_or_email'), h.route_path('user_edit', user_id=user_id))} | |||
r1282 | </%def> | |||
<%def name="user_profile(username)"> | ||||
${base.gravatar_with_user(username, 16)} | ||||
</%def> | ||||
<%def name="user_group_name(user_group_id, user_group_name)"> | ||||
<div> | ||||
r2068 | <a href="${h.route_path('edit_user_group', user_group_id=user_group_id)}"> | |||
r1282 | <i class="icon-group" title="${_('User group')}"></i> ${user_group_name}</a> | |||
</div> | ||||
</%def> | ||||
## GISTS | ||||
<%def name="gist_gravatar(full_contact)"> | ||||
<div class="gist_gravatar"> | ||||
${base.gravatar(full_contact, 30)} | ||||
</div> | ||||
</%def> | ||||
<%def name="gist_access_id(gist_access_id, full_contact)"> | ||||
<div> | ||||
<b> | ||||
r1891 | <a href="${h.route_path('gist_show', gist_id=gist_access_id)}">gist: ${gist_access_id}</a> | |||
r1282 | </b> | |||
</div> | ||||
</%def> | ||||
<%def name="gist_author(full_contact, created_on, expires)"> | ||||
${base.gravatar_with_user(full_contact, 16)} | ||||
</%def> | ||||
<%def name="gist_created(created_on)"> | ||||
<div class="created"> | ||||
${h.age_component(created_on, time_is_local=True)} | ||||
</div> | ||||
</%def> | ||||
<%def name="gist_expires(expires)"> | ||||
<div class="created"> | ||||
%if expires == -1: | ||||
${_('never')} | ||||
%else: | ||||
${h.age_component(h.time_to_utcdatetime(expires))} | ||||
%endif | ||||
</div> | ||||
</%def> | ||||
<%def name="gist_type(gist_type)"> | ||||
%if gist_type != 'public': | ||||
<div class="tag">${_('Private')}</div> | ||||
%endif | ||||
</%def> | ||||
<%def name="gist_description(gist_description)"> | ||||
${gist_description} | ||||
</%def> | ||||
## PULL REQUESTS GRID RENDERERS | ||||
<%def name="pullrequest_target_repo(repo_name)"> | ||||
<div class="truncate"> | ||||
r1785 | ${h.link_to(repo_name,h.route_path('repo_summary',repo_name=repo_name))} | |||
r1282 | </div> | |||
</%def> | ||||
<%def name="pullrequest_status(status)"> | ||||
<div class="${'flag_status %s' % status} pull-left"></div> | ||||
</%def> | ||||
<%def name="pullrequest_title(title, description)"> | ||||
${title} <br/> | ||||
${h.shorter(description, 40)} | ||||
</%def> | ||||
<%def name="pullrequest_comments(comments_nr)"> | ||||
<i class="icon-comment"></i> ${comments_nr} | ||||
</%def> | ||||
<%def name="pullrequest_name(pull_request_id, target_repo_name, short=False)"> | ||||
r1813 | <a href="${h.route_path('pullrequest_show',repo_name=target_repo_name,pull_request_id=pull_request_id)}"> | |||
r1282 | % if short: | |||
#${pull_request_id} | ||||
% else: | ||||
${_('Pull request #%(pr_number)s') % {'pr_number': pull_request_id,}} | ||||
% endif | ||||
</a> | ||||
</%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> | ||||