journal.html
348 lines
| 12.2 KiB
| text/html
|
HtmlLexer
r995 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.html"/> | ||||
<%def name="title()"> | ||||
Bradley M. Kuhn
|
r4116 | ${_('Journal')} | ||
%if c.rhodecode_name: | ||||
· ${c.rhodecode_name} | ||||
%endif | ||||
r995 | </%def> | |||
<%def name="breadcrumbs()"> | ||||
r3070 | <h5> | |||
<form id="filter_form"> | ||||
<input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or _('quick filter...')}"/> | ||||
<span class="tooltip" title="${h.tooltip(h.journal_filter_help())}">?</span> | ||||
Bradley M. Kuhn
|
r4116 | <input type='submit' value="${_('filter')}" class="btn btn-small" style="padding:0px 2px 0px 2px;margin:0px"/> | ||
r3070 | ${_('journal')} - ${ungettext('%s entry', '%s entries', c.journal_pager.item_count) % (c.journal_pager.item_count)} | |||
</form> | ||||
${h.end_form()} | ||||
</h5> | ||||
r995 | </%def> | |||
<%def name="page_nav()"> | ||||
r3208 | ${self.menu('journal')} | |||
r995 | </%def> | |||
r2413 | <%def name="head_extra()"> | |||
<link href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" /> | ||||
<link href="${h.url('journal_rss', api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" /> | ||||
</%def> | ||||
r995 | <%def name="main()"> | |||
r1888 | ||||
r995 | <div class="box box-left"> | |||
Mads Kiilerich
|
r3197 | <!-- box / title --> | ||
<div class="title"> | ||||
r3070 | ${self.breadcrumbs()} | |||
Bradley M. Kuhn
|
r4116 | <ul class="links icon-only-links"> | ||
r3070 | <li> | |||
Bradley M. Kuhn
|
r4116 | <span><a id="refresh" href="${h.url('journal')}"><i class="icon-refresh"></i></a></span> | ||
r3070 | </li> | |||
<li> | ||||
Bradley M. Kuhn
|
r4116 | <span><a href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}"><i class="icon-rss-sign"></i></a></span> | ||
r3070 | </li> | |||
</ul> | ||||
Mads Kiilerich
|
r3197 | </div> | ||
<div id="journal">${c.journal_data}</div> | ||||
r995 | </div> | |||
<div class="box box-right"> | ||||
<!-- box / title --> | ||||
r3168 | ||||
r995 | <div class="title"> | |||
r1888 | <h5> | |||
r3665 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value="" style="display: none"/> | |||
<input class="q_filter_box" id="q_filter_watched" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value="" style="display: none"/> | ||||
r1741 | </h5> | |||
Bradley M. Kuhn
|
r4116 | <ul class="links nav nav-tabs"> | ||
<li class="active" id="show_watched_li"> | ||||
<a id="show_watched" href="#watched"><i class="icon-eye-open"></i> ${_('Watched')}</a> | ||||
</li> | ||||
<li id="show_my_li"> | ||||
<a id="show_my" href="#my"><i class="icon-archive"></i> ${_('My repos')}</a> | ||||
r3154 | </li> | |||
Bradley M. Kuhn
|
r4116 | </ul> | ||
r3168 | </div> | |||
r1741 | <!-- end box / title --> | |||
r3154 | <div id="my_container" style="display:none"> | |||
Bradley M. Kuhn
|
r4116 | <div class="table-grid table yui-skin-sam" id="repos_list_wrap"></div> | ||
r3154 | <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div> | |||
r995 | </div> | |||
r3168 | ||||
r3154 | <div id="watched_container"> | |||
Bradley M. Kuhn
|
r4116 | <div class="table-grid table yui-skin-sam" id="watched_repos_list_wrap"></div> | ||
r3154 | <div id="watched-user-paginator" style="padding: 0px 0px 0px 20px"></div> | |||
r1888 | </div> | |||
r1746 | </div> | |||
r1888 | ||||
r1741 | <script type="text/javascript"> | |||
r3149 | ||||
r3070 | YUE.on('j_filter','click',function(){ | |||
var jfilter = YUD.get('j_filter'); | ||||
if(YUD.hasClass(jfilter, 'initial')){ | ||||
jfilter.value = ''; | ||||
} | ||||
}); | ||||
var fix_j_filter_width = function(len){ | ||||
YUD.setStyle(YUD.get('j_filter'),'width',Math.max(80, len*6.50)+'px'); | ||||
} | ||||
YUE.on('j_filter','keyup',function(){ | ||||
fix_j_filter_width(YUD.get('j_filter').value.length); | ||||
}); | ||||
YUE.on('filter_form','submit',function(e){ | ||||
YUE.preventDefault(e) | ||||
var val = YUD.get('j_filter').value; | ||||
window.location = "${url.current(filter='__FILTER__')}".replace('__FILTER__',val); | ||||
}); | ||||
r3149 | fix_j_filter_width(YUD.get('j_filter').value.length); | |||
r3154 | YUE.on('refresh','click',function(e){ | |||
ypjax("${h.url.current(filter=c.search_term)}","journal",function(){ | ||||
show_more_event(); | ||||
r2951 | tooltip_activate(); | |||
r3154 | show_changeset_tooltip(); | |||
}); | ||||
YUE.preventDefault(e); | ||||
r3168 | }); | |||
r3154 | var show_my = function(e){ | |||
YUD.setStyle('watched_container','display','none'); | ||||
YUD.setStyle('my_container','display',''); | ||||
YUD.setStyle('q_filter','display',''); | ||||
YUD.setStyle('q_filter_watched','display','none'); | ||||
r2973 | ||||
Bradley M. Kuhn
|
r4116 | YUD.addClass('show_my_li', 'active'); | ||
YUD.removeClass('show_watched_li','active'); | ||||
r3168 | ||||
r3154 | if(!YUD.hasClass('show_my', 'loaded')){ | |||
table_renderer(${c.data |n}); | ||||
YUD.addClass('show_my', 'loaded'); | ||||
} | ||||
r2951 | } | |||
YUE.on('show_my','click',function(e){ | ||||
show_my(e); | ||||
r1741 | }) | |||
r2951 | var show_watched = function(e){ | |||
Mads Kiilerich
|
r3197 | YUD.setStyle('my_container','display','none'); | ||
r3154 | YUD.setStyle('watched_container','display',''); | |||
YUD.setStyle('q_filter_watched','display',''); | ||||
YUD.setStyle('q_filter','display','none'); | ||||
Bradley M. Kuhn
|
r4116 | YUD.addClass('show_watched_li', 'active'); | ||
YUD.removeClass('show_my_li','active'); | ||||
r3154 | if(!YUD.hasClass('show_watched', 'loaded')){ | |||
Mads Kiilerich
|
r3197 | watched_renderer(${c.watched_data |n}); | ||
r3154 | YUD.addClass('show_watched', 'loaded'); | |||
r3168 | } | |||
r3154 | return | |||
var nodes = YUQ('#watched_container .watched_repo a'); | ||||
r1741 | var target = 'q_filter'; | |||
var func = function(node){ | ||||
return node.parentNode.parentNode; | ||||
} | ||||
r1888 | q_filter(target,nodes,func); | |||
r2951 | } | |||
YUE.on('show_watched','click',function(e){ | ||||
show_watched(e); | ||||
r1741 | }) | |||
r2951 | //init watched | |||
show_watched(); | ||||
r2973 | ||||
r2951 | var tabs = { | |||
'watched': show_watched, | ||||
'my': show_my, | ||||
} | ||||
var url = location.href.split('#'); | ||||
if (url[1]) { | ||||
//We have a hash | ||||
var tabHash = url[1]; | ||||
r3120 | var func = tabs[tabHash] | |||
if (func){ | ||||
Mads Kiilerich
|
r3197 | func(); | ||
r3120 | } | |||
r2973 | } | |||
r3154 | function watched_renderer(data){ | |||
var myDataSource = new YAHOO.util.DataSource(data); | ||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; | ||||
r2973 | ||||
r3154 | myDataSource.responseSchema = { | |||
resultsList: "records", | ||||
fields: [ | ||||
{key:"menu"}, | ||||
{key:"raw_name"}, | ||||
{key:"name"}, | ||||
{key:"last_changeset"}, | ||||
Bradley M. Kuhn
|
r4116 | {key:"last_rev_raw"}, | ||
r3154 | {key:"action"}, | |||
] | ||||
}; | ||||
myDataSource.doBeforeCallback = function(req,raw,res,cb) { | ||||
// This is the filter function | ||||
var data = res.results || [], | ||||
filtered = [], | ||||
i,l; | ||||
r1888 | ||||
r3154 | if (req) { | |||
req = req.toLowerCase(); | ||||
for (i = 0; i<data.length; i++) { | ||||
var pos = data[i].raw_name.toLowerCase().indexOf(req) | ||||
if (pos != -1) { | ||||
filtered.push(data[i]); | ||||
} | ||||
} | ||||
res.results = filtered; | ||||
} | ||||
return res; | ||||
} | ||||
// main table sorting | ||||
var myColumnDefs = [ | ||||
{key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, | ||||
{key:"name",label:"${_('Name')}",sortable:true, | ||||
sortOptions: { sortFunction: nameSort }}, | ||||
{key:"last_changeset",label:"${_('Tip')}",sortable:true, | ||||
r3168 | sortOptions: { sortFunction: revisionSort }}, | |||
r3154 | {key:"action",label:"${_('Action')}",sortable:false}, | |||
]; | ||||
r1779 | ||||
r3154 | var myDataTable = new YAHOO.widget.DataTable("watched_repos_list_wrap", myColumnDefs, myDataSource,{ | |||
sortedBy:{key:"name",dir:"asc"}, | ||||
r3776 | paginator: YUI_paginator(25, ['watched-user-paginator']), | |||
r1779 | ||||
r3154 | MSG_SORTASC:"${_('Click to sort ascending')}", | |||
MSG_SORTDESC:"${_('Click to sort descending')}", | ||||
MSG_EMPTY:"${_('No records found.')}", | ||||
MSG_ERROR:"${_('Data error.')}", | ||||
MSG_LOADING:"${_('Loading...')}", | ||||
} | ||||
); | ||||
myDataTable.subscribe('postRenderEvent',function(oArgs) { | ||||
tooltip_activate(); | ||||
quick_repo_menu(); | ||||
}); | ||||
var filterTimeout = null; | ||||
updateFilter = function () { | ||||
// Reset timeout | ||||
filterTimeout = null; | ||||
r1888 | ||||
r3154 | // Reset sort | |||
var state = myDataTable.getState(); | ||||
state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; | ||||
// Get filtered data | ||||
myDataSource.sendRequest(YUD.get('q_filter_watched').value,{ | ||||
success : myDataTable.onDataReturnInitializeTable, | ||||
failure : myDataTable.onDataReturnInitializeTable, | ||||
scope : myDataTable, | ||||
argument: state | ||||
}); | ||||
}; | ||||
YUE.on('q_filter_watched','click',function(){ | ||||
if(!YUD.hasClass('q_filter_watched', 'loaded')){ | ||||
//TODO: load here full list later to do search within groups | ||||
YUD.addClass('q_filter_watched', 'loaded'); | ||||
} | ||||
}); | ||||
r1888 | ||||
r3154 | YUE.on('q_filter_watched','keyup',function (e) { | |||
clearTimeout(filterTimeout); | ||||
filterTimeout = setTimeout(updateFilter,600); | ||||
}); | ||||
} | ||||
r3168 | ||||
r3154 | function table_renderer(data){ | |||
var myDataSource = new YAHOO.util.DataSource(data); | ||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; | ||||
myDataSource.responseSchema = { | ||||
resultsList: "records", | ||||
fields: [ | ||||
{key:"menu"}, | ||||
{key:"raw_name"}, | ||||
{key:"name"}, | ||||
{key:"last_changeset"}, | ||||
Bradley M. Kuhn
|
r4116 | {key:"last_rev_raw"}, | ||
r3154 | {key:"action"}, | |||
] | ||||
}; | ||||
myDataSource.doBeforeCallback = function(req,raw,res,cb) { | ||||
// This is the filter function | ||||
var data = res.results || [], | ||||
filtered = [], | ||||
i,l; | ||||
if (req) { | ||||
req = req.toLowerCase(); | ||||
for (i = 0; i<data.length; i++) { | ||||
var pos = data[i].raw_name.toLowerCase().indexOf(req) | ||||
if (pos != -1) { | ||||
filtered.push(data[i]); | ||||
} | ||||
} | ||||
res.results = filtered; | ||||
} | ||||
return res; | ||||
} | ||||
// main table sorting | ||||
var myColumnDefs = [ | ||||
{key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"}, | ||||
{key:"name",label:"${_('Name')}",sortable:true, | ||||
sortOptions: { sortFunction: nameSort }}, | ||||
{key:"last_changeset",label:"${_('Tip')}",sortable:true, | ||||
r3168 | sortOptions: { sortFunction: revisionSort }}, | |||
r3154 | {key:"action",label:"${_('Action')}",sortable:false}, | |||
]; | ||||
r1779 | ||||
r3154 | var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{ | |||
sortedBy:{key:"name",dir:"asc"}, | ||||
r3776 | paginator: YUI_paginator(25, ['user-paginator']), | |||
r3154 | ||||
MSG_SORTASC:"${_('Click to sort ascending')}", | ||||
MSG_SORTDESC:"${_('Click to sort descending')}", | ||||
MSG_EMPTY:"${_('No records found.')}", | ||||
MSG_ERROR:"${_('Data error.')}", | ||||
MSG_LOADING:"${_('Loading...')}", | ||||
} | ||||
); | ||||
myDataTable.subscribe('postRenderEvent',function(oArgs) { | ||||
tooltip_activate(); | ||||
quick_repo_menu(); | ||||
}); | ||||
var filterTimeout = null; | ||||
Mads Kiilerich
|
r4000 | updateFilter = function () { | ||
r3154 | // Reset timeout | |||
filterTimeout = null; | ||||
// Reset sort | ||||
var state = myDataTable.getState(); | ||||
state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC}; | ||||
// Get filtered data | ||||
myDataSource.sendRequest(YUD.get('q_filter').value,{ | ||||
success : myDataTable.onDataReturnInitializeTable, | ||||
failure : myDataTable.onDataReturnInitializeTable, | ||||
scope : myDataTable, | ||||
argument: state | ||||
}); | ||||
}; | ||||
YUE.on('q_filter','click',function(){ | ||||
if(!YUD.hasClass('q_filter', 'loaded')){ | ||||
//TODO: load here full list later to do search within groups | ||||
YUD.addClass('q_filter', 'loaded'); | ||||
r1779 | } | |||
r3154 | }); | |||
r1888 | ||||
r3154 | YUE.on('q_filter','keyup',function (e) { | |||
clearTimeout(filterTimeout); | ||||
filterTimeout = setTimeout(updateFilter,600); | ||||
}); | ||||
Mads Kiilerich
|
r4000 | |||
if(YUD.get('q_filter').value) { | ||||
r4002 | updateFilter(); | |||
Mads Kiilerich
|
r4000 | } | ||
} | ||||
r3168 | ||||
r1888 | </script> | |||
</%def> | ||||