Skip to content

Commit

Permalink
Links in modules titles.
Browse files Browse the repository at this point in the history
Title name is now a link to the application.
http://forums.maraschinoproject.com/showthread.php?tid=208
  • Loading branch information
gugahoi committed Feb 9, 2014
1 parent 008907a commit 4e5785a
Show file tree
Hide file tree
Showing 19 changed files with 65 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -27,7 +27,7 @@ static/images/trakt/shows
######################
.Spotlight-V100
.Trashes
.DS_Store?
*.DS_Store
desktop.ini
ehthumbs.db
Thumbs.db
Expand Down
1 change: 1 addition & 0 deletions modules/couchpotato.py
Expand Up @@ -131,6 +131,7 @@ def xhr_couchpotato(status='active'):

return render_template(template,
url=couchpotato_url(),
app_link=couchpotato_url_no_api(),
couchpotato=couchpotato,
profiles=profiles,
compact_view=get_setting_value('couchpotato_compact') == '1',
Expand Down
1 change: 1 addition & 0 deletions modules/headphones.py
Expand Up @@ -147,6 +147,7 @@ def xhr_headphones_artists(mobile=False):

return render_template('headphones/artists.html',
headphones=True,
app_link=headphones_url(),
artists=artists,
updates=updates,
compact=hp_compact(),
Expand Down
11 changes: 9 additions & 2 deletions modules/library.py
@@ -1,5 +1,5 @@
from flask import render_template, jsonify, request, json
from maraschino.noneditable import server_api_address
from maraschino.noneditable import server_api_address, safe_server_address
from maraschino.models import Setting
from maraschino.database import db_session
from maraschino.tools import requires_auth, get_setting, get_setting_value, natural_sort, format_seconds
Expand Down Expand Up @@ -478,7 +478,6 @@ def xhr_xbmc_library_media(media_type=None):
path = None
back_path = '/'
library = None

if not server_api_address():
logger.log('LIBRARY :: No XBMC server defined', 'ERROR')
return render_xbmc_library(message="You need to configure XBMC server settings first.")
Expand Down Expand Up @@ -1097,6 +1096,13 @@ def xhr_library_resume_check(type, id):
return jsonify(resume=False, template=None)


def app_link():
if safe_server_address() is None:
return "http://xbmc.org/"

return safe_server_address()


def render_xbmc_library(template='library.html',
library=None,
title='XBMC Library',
Expand Down Expand Up @@ -1127,6 +1133,7 @@ def render_xbmc_library(template='library.html',
library=library,
title=title,
message=message,
app_link=app_link(),
settings=settings,
view=view,
media=media,
Expand Down
1 change: 1 addition & 0 deletions modules/sabnzbd.py
Expand Up @@ -111,6 +111,7 @@ def xhr_sabnzbd(queue_status='hide'):

return render_template('sabnzbd/queue.html',
sabnzbd=sabnzbd,
app_link=sabnzbd_url_no_api(),
item=downloading,
download_speed=download_speed,
old_config=old_config,
Expand Down
1 change: 1 addition & 0 deletions modules/sickbeard.py
Expand Up @@ -87,6 +87,7 @@ def xhr_sickbeard():

return render_template('sickbeard.html',
url=sickbeard_url_no_api(),
app_link=sickbeard_url_no_api(),
sickbeard=sickbeard,
missed=sickbeard['missed'],
today=sickbeard['today'],
Expand Down
7 changes: 7 additions & 0 deletions modules/transmission.py
Expand Up @@ -7,6 +7,12 @@
from maraschino.tools import *
from maraschino import app, logger

def app_link():
transmission_ip = get_setting_value('transmission_ip')
transmission_port = get_setting_value('transmission_ip')

return 'http://%s:%s/' % (transmission_ip, transmission_port)


def log_exception(e):
logger.log('Transmission :: EXCEPTION -- %s' % e, 'DEBUG')
Expand Down Expand Up @@ -65,6 +71,7 @@ def xhr_transmission():

return render_template('transmission.html',
connection = connection,
applink=applink(),
show_empty = get_setting_value('transmission_show_empty') == '1',
transmission = transmission,
seeding = seeding,
Expand Down
10 changes: 9 additions & 1 deletion modules/utorrent.py
Expand Up @@ -9,6 +9,12 @@
from Maraschino import app
from maraschino.tools import *

def app_link():
utorrent_ip = get_setting_value('utorrent_ip')
utorrent_port = get_setting_value('utorrent_port')

return 'http://%s:%s/gui/' % (utorrent_ip, utorrent_port)

@app.route('/xhr/utorrent/')
@requires_auth
def xhr_utorrent():
Expand All @@ -24,6 +30,7 @@ def xhr_utorrent():
try:
client = utorrentclient.uTorrent(get_setting_value('utorrent_ip'),get_setting_value('utorrent_port'),get_setting_value('utorrent_user'),get_setting_value('utorrent_password'))


# return list of running jobs:
# {1: <Torrent 1 "Hello">, 2: <Torrent 2 "World">}
torrents = client.listTorrents()
Expand All @@ -41,6 +48,7 @@ def xhr_utorrent():


return render_template('utorrent.html',
torrents = utorrent
torrents = utorrent,
app_link = app_link()
)

8 changes: 8 additions & 0 deletions static/less/common.less
Expand Up @@ -187,3 +187,11 @@
{
color: #d92525;
}

.app_link
{
color: white;
&:hover {
color: white;
}
}
3 changes: 2 additions & 1 deletion static/less/module-couchpotato.less
Expand Up @@ -170,6 +170,7 @@
display: block;
padding-bottom: 5px;
&.title{
color: white;
font-size: 1.2em;
white-space: nowrap;
text-overflow: ellipsis;
Expand Down Expand Up @@ -531,4 +532,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion static/less/module-headphones.less
Expand Up @@ -206,4 +206,4 @@
color: #eee;
}
}
}
}
2 changes: 0 additions & 2 deletions static/less/module-recently_added.less
Expand Up @@ -91,8 +91,6 @@
overflow: hidden;

.box-shadow(#222, 0, 0, 2px);


}
}

Expand Down
7 changes: 6 additions & 1 deletion templates/couchpotato/base.html
Expand Up @@ -4,7 +4,12 @@
<div class="module_settings"><span>Settings</span></div>
<div class="module_remove"><span>Remove</span></div>

<h2 class="title">{% block couchpotato_title %}CouchPotato{% endblock %}</h2>
<h2 class="title">
{% block couchpotato_title %}
<a href="{{ app_link }}" class="app_link" target="_blank">CouchPotato</a>
{% endblock %}
</h2>


{% block couchpotato_menu %}
<ul class="menu">
Expand Down
4 changes: 3 additions & 1 deletion templates/headphones/base.html
Expand Up @@ -3,7 +3,9 @@
<div class="module_settings"><span>Settings</span></div>
<div class="module_remove"><span>Remove</span></div>

<h2 class="title">Headphones</h2>
<h2 class="title">
<a href="{{ app_link }}" class="app_link" target="_blank">Headphones</a>
</h2>

<div class="headphones_head operation_only">
{% if albums %}
Expand Down
4 changes: 3 additions & 1 deletion templates/library/base.html
Expand Up @@ -4,7 +4,9 @@
<div class="module_remove"><span>Remove</span></div>

<h2 class="module_title">
{% block xbmc_library_title %}{{ title }}{% endblock %}
<a href="{{ app_link }}" class="app_link" target="_blank">
{% block xbmc_library_title %}{{ title }}{% endblock %}
</a>
</h2>

<img class="xhrloading" src="{{ url_for('static', filename='images/xhrloading.gif') }}" />
Expand Down
6 changes: 4 additions & 2 deletions templates/sabnzbd/base.html
Expand Up @@ -4,7 +4,9 @@
<div class="module_settings"><span>Settings</span></div>
<div class="module_remove"><span>Remove</span></div>

<h2>SABnzbd+</h2>
<h2>
<a href="{{ app_link }}" class="app_link" target="_blank">SABnzbd+</a>
</h2>

<div class="inner">
{% if sabnzbd %}
Expand All @@ -19,7 +21,7 @@ <h2>SABnzbd+</h2>
<div class="placeholder" data-module="sabnzbd">
<div class="module_settings"><span>Settings</span></div>
<div class="module_remove"><span>Remove</span></div>
<h2>SABnzbd+</h2>
<h2><a href="{{ app_link }}" class="app_link" target="_blank">SABnzbd+</a></h2>
{% if old_config %}<p style="margin: 0 15px 15px;"><strong>Warning:</strong> the configuration for this module has changed, please edit its settings.</p>{% endif %}
</div>
{% endif %}
6 changes: 5 additions & 1 deletion templates/sickbeard/base.html
Expand Up @@ -4,7 +4,11 @@
<div class="module_settings"><span>Settings</span></div>
<div class="module_remove"><span>Remove</span></div>

<h2 class="title">{% block sickbeard_title %}Sickbeard{% endblock %}</h2>
<h2 class="title">
{% block sickbeard_title %}
<a href="{{ app_link }}" class="app_link" target="_blank">Sickbeard</a>
{% endblock %}
</h2>

{% block sickbeard_menu %}
<ul class="menu">
Expand Down
4 changes: 2 additions & 2 deletions templates/transmission.html
Expand Up @@ -3,7 +3,7 @@

<div class="module_settings"><span>Settings</span></div>
<div class="module_remove"><span>Remove</span></div>
<h2>Transmission</h2>
<h2><a href="{{ app_link }}" class="app_link" target="_blank">Transmission</a></h2>
<div class="inner">
{% if transmission %}
<div id="status">{{ download }}KB/s</div><div class="eta">{{ eta }}</div>
Expand Down Expand Up @@ -53,7 +53,7 @@ <h2>Transmission</h2>
<div class="placeholder" data-module="transmission">
<div class="module_settings"><span>Settings</span></div>
<div class="module_remove"><span>Remove</span></div>
<h2>Transmission</h2>
<h2><a href="{{ app_link }}" class="app_link" target="_blank">Transmission</a></h2>
<p style="margin: 0 15px 15px;"><strong>Warning:</strong> unable to connect to Transmission.</p>
</div>
{% endif %}
2 changes: 1 addition & 1 deletion templates/utorrent.html
Expand Up @@ -5,7 +5,7 @@
<div class="module_settings"><span>Settings</span></div>
<div class="module_remove"><span>Remove</span></div>

<h2>uTorrent</h2>
<h2><a href="{{ app_link }}" class="app_link" target="_blank">uTorrent</a></h2>
{% for torrent in torrents%}

<div class="inner">
Expand Down

0 comments on commit 4e5785a

Please sign in to comment.