journal.html
367 lines
| 13.3 KiB
| text/html
|
HtmlLexer
r995 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.html"/> | ||||
<%def name="title()"> | ||||
${_('Journal')} - ${c.rhodecode_name} | ||||
</%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> | ||||
<input type='submit' value="${_('filter')}" class="ui-btn" style="padding:0px 2px 0px 2px;margin:0px"/> | ||||
${_('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()} | |||
<ul class="links"> | ||||
<li> | ||||
<span><a id="refresh" href="${h.url('journal')}"><img class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/></a></span> | ||||
</li> | ||||
<li> | ||||
Mads Kiilerich
|
r3295 | <span><a href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('ATOM feed')}" alt="${_('ATOM feed')}" src="${h.url('/images/icons/rss_16.png')}"/></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> | |||
r3154 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/> | |||
<input class="q_filter_box" id="q_filter_watched" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/> | ||||
r1741 | </h5> | |||
r3154 | <ul class="links" style="color:#DADADA"> | |||
r1741 | <li> | |||
r3154 | <span><a id="show_watched" class="link-white current" href="#watched">${_('Watched')}</a> </span> | |||
</li> | ||||
<li> | ||||
<span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span> | ||||
r1888 | </li> | |||
</ul> | ||||
r3168 | </div> | |||
r1741 | <!-- end box / title --> | |||
r3154 | <div id="my_container" style="display:none"> | |||
<div class="table yui-skin-sam" id="repos_list_wrap"></div> | ||||
<div id="user-paginator" style="padding: 0px 0px 0px 20px"></div> | ||||
r995 | </div> | |||
r3168 | ||||
r3154 | <div id="watched_container"> | |||
<div class="table yui-skin-sam" id="watched_repos_list_wrap"></div> | ||||
<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 | ||||
r3154 | YUD.addClass('show_my', 'current'); | |||
YUD.removeClass('show_watched','current'); | ||||
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'); | ||||
YUD.addClass('show_watched', 'current'); | ||||
YUD.removeClass('show_my','current'); | ||||
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"}, | ||||
{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"}, | ||||
paginator: new YAHOO.widget.Paginator({ | ||||
rowsPerPage: 25, | ||||
alwaysVisible: false, | ||||
template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}", | ||||
pageLinks: 5, | ||||
containerClass: 'pagination-wh', | ||||
currentPageClass: 'pager_curpage', | ||||
pageLinkClass: 'pager_link', | ||||
nextPageLinkLabel: '>', | ||||
previousPageLinkLabel: '<', | ||||
firstPageLinkLabel: '<<', | ||||
lastPageLinkLabel: '>>', | ||||
containers:['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')){ | ||||
YUD.get('q_filter_watched').value = ''; | ||||
//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"}, | ||||
{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"}, | ||||
paginator: new YAHOO.widget.Paginator({ | ||||
rowsPerPage: 25, | ||||
alwaysVisible: false, | ||||
template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}", | ||||
pageLinks: 5, | ||||
containerClass: 'pagination-wh', | ||||
currentPageClass: 'pager_curpage', | ||||
pageLinkClass: 'pager_link', | ||||
nextPageLinkLabel: '>', | ||||
previousPageLinkLabel: '<', | ||||
firstPageLinkLabel: '<<', | ||||
lastPageLinkLabel: '>>', | ||||
containers:['user-paginator'] | ||||
}), | ||||
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; | ||||
// 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')){ | ||||
YUD.get('q_filter').value = ''; | ||||
//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); | ||||
}); | ||||
r3168 | } | |||
r1888 | </script> | |||
</%def> | ||||