Skip to content

Commit

Permalink
Added history
Browse files Browse the repository at this point in the history
  • Loading branch information
gugahoi committed Aug 24, 2014
1 parent 0e855f5 commit 58416d2
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/nzbdrone.py
Expand Up @@ -90,6 +90,22 @@ def series():
)


@app.route('/xhr/nzbdrone/history/')
def nzbdrone_history():
params = '/History?page=1&pageSize=50&sortKey=date&sortDir=desc'

try:
nzbdrone = nzbdrone_api(params)
except:
return render_template('nzbdrone.html',
nzbdrone='Error',
)

return render_template('nzbdrone/history.html',
nzbdrone=nzbdrone['records'],
)


# @app.route('/xhr/nzbdrone/search_ep/<tvdbid>/<season>/<episode>/')
# @requires_auth
# def search_ep(tvdbid, season, episode):
Expand Down
6 changes: 6 additions & 0 deletions static/js/index.js
Expand Up @@ -1157,6 +1157,12 @@ $(document).ready(function() {
});
});

// History Menu
$(document).on('click', '#nzbdrone .menu .history', function(){
$.get(WEBROOT + '/xhr/nzbdrone/history/', function(data){
$('#nzbdrone').replaceWith(data);
});
});
/****** END NZBDRONE Functions *******/

/*********** EXTRA SETTINGS *************/
Expand Down
28 changes: 28 additions & 0 deletions static/less/module-nzbdrone.less
Expand Up @@ -150,4 +150,32 @@
}
}
}

#history {
max-height: 264px;
overflow: auto;

ul {
li {
background: url('/@{webroot}/images/alpha/fff_10.png');
padding: 5px;
margin: 5px;
line-height: 1.5em;
cursor: pointer;
.border-radius(4px);
&:hover {
background: url('/@{webroot}/images/alpha/fff_20.png');
}
&.downloadFailed{
background: rgba(255, 0, 0, 0.3);
}
&.grabbed{
background: rgba(0, 0, 255, 0.3);
}
&.downloadFolderImported{
background: rgba(0, 255, 0, 0.3);
}
}
}
}
}
24 changes: 24 additions & 0 deletions templates/nzbdrone/history.html
@@ -0,0 +1,24 @@
{% extends "nzbdrone/base.html" %}

{% block nzbdrone_menu %}
<ul class="menu">
<li class="history active" title="View History"><span>History</span></li>
<li class="all" title="View all"><span>All</span></li>
<li class="upcoming" title="View upcoming"><span>Upcoming</span></li>
</ul>
{% endblock %}


{% block nzbdrone_content %}

<div id="history" class="noscroll">
<ul>
{%for item in nzbdrone %}
<li class="{{ item.eventType }}" id="{{item.id}}" data-episodeId="{{item.episodeId}}" data-seriesId="{{item.seriesId}}" title="{{item.sourceTitle}}">
<span class="float-right">{{item.data.indexer}}</span>
{{ item.series.title }} - S{{ "%02d" % item.episode.seasonNumber }}E{{ "%02d" % item.episode.episodeNumber }}
</li>
{% endfor %}
</ul>
</div>
{% endblock %}

0 comments on commit 58416d2

Please sign in to comment.