]> git.aero2k.de Git - sirius.git/commitdiff
prettifying overview page
authorMatt Webb <matt@interconnected.org>
Sun, 1 Mar 2015 13:29:46 +0000 (13:29 +0000)
committerMatt Webb <matt@interconnected.org>
Sun, 1 Mar 2015 13:29:46 +0000 (13:29 +0000)
sirius/web/landing.py
sirius/web/templates/overview.html

index ba5382bc49a6dab2b7f04ba28529af37430251b9..af655cbc4de84de84fc645796ce1ebc000598387 100644 (file)
@@ -61,9 +61,9 @@ def overview():
         'overview.html',
         form=form,
         my_printers=my_printers,
-        signed_up_friends=signed_up_friends,
+        signed_up_friends=list(signed_up_friends),
         friends=friends,
-        friends_printers=friends_printers,
+        friends_printers=list(friends_printers),
         seconds_to_next_refresh=user.twitter_oauth.seconds_to_next_refresh(),
         last_friend_refresh=user.twitter_oauth.last_friend_refresh,
     )
index 6f35a0745a1f1d70e167bbf30c1ae70532e7d572..0792ffa01ace1a7b611cecda3e7c23ab2152fcbe 100644 (file)
@@ -3,79 +3,86 @@
 {% block title %}Overview{% endblock %}
 
 {% block page_content %}
-<h1>My printers</h1>
-{% if not my_printers %}
-<div>
-       No printers yet -
-       <a href="{{ url_for('landing.claim',
-                         user_id=current_user.id,
-                         username=current_user.username) }}">
-               claim one here
-       </a>.
-</div>
-{% else %}
-{% for printer in my_printers %}
-<ul>
-       <li>
-               <a href="{{ url_for('printer_overview.printer_overview',
-                               user_id=current_user.id,
-                               username=current_user.username,
-                               printer_id=printer.id) }}">
-                       {{ printer.name }}</a>
-       </li>
-</ul>
-{% endfor %}
-
-<div>
-       <a href="{{ url_for('landing.claim',
-                         user_id=current_user.id,
-                         username=current_user.username) }}">
-               Claim another printer
-       </a>
-</div>
+<div class="row">
+       <div class="col-md-8">
 
-<h2>Friends' printers</h2>
-<ul>
-{% for x in friends_printers %}
-<li>
-       {{ x.owner.username }} - {{ x.name }}
+               <h1>Printers</h1>
+               
+               {% if not my_printers and not friends_printers %}
+               <p><em class="bg-warning">None available</em></p>
+               {% endif %}
+               
+               <ul>
 
-       (<a href="{{ url_for('printer_print.printer_print',
-                 user_id=current_user.id,
-                 username=current_user.username,
-                 printer_id=x.id) }}">send message</a>)
-</li>
-{% else %}
-<li>No printers yet.</li>
-{% endfor %}
-</ul>
+               {% for p in my_printers %}
+               <li>{{ p.name }} (owned by you)
+                       <a class="btn btn-default btn-xs" href="{{
+                                                       url_for('printer_overview.printer_overview',
+                                                                       user_id=current_user.id,
+                                                                       username=current_user.username,
+                                                                       printer_id=p.id) }}">Overview</a>
+                       <a class="btn btn-default btn-xs" href="{{
+                                                       url_for('printer_overview.printer_print',
+                                                                       user_id=current_user.id,
+                                                                       username=current_user.username,
+                                                                       printer_id=p.id) }}">Send message</a>
+               </li>
+               {% endfor %}
+               
+               {% for p in friends_printers %}
+               <li>{{ p.name }} (owned by @{{ p.owner.username }})
+                       <a class="btn btn-default btn-xs" href="{{
+                                                       url_for('printer_print.printer_print',
+                                                               user_id=current_user.id,
+                                                               username=current_user.username,
+                                                               printer_id=p.id) }}">Send message</a>
+               </li>
+               {% endfor %}
 
-{% endif %}
-<h2>People who can print on my printers</h2>
-<ul>
-{% for x in signed_up_friends %}
-<li>{{ x.username }}</li>
-{% else %}
-<li>No one yet</li>
-{% endfor %}
-</ul>
-<p>
-       The above list is the {{ friends|length }} people you follow on Twitter who also have accounts here.
-</p>
-<p>
-       The list of people you folow was last refreshed on {{ last_friend_refresh }}.
-</p>
-<p>
-       <form method="POST" action="{{ url_for('landing.twitter_friend_refresh',
-                                   user_id=current_user.id,
-                                   username=current_user.username) }}">
+               </ul>
+               
+               <p>
+               <a class="btn btn-default" href="{{ url_for('landing.claim',
+                                                                               user_id=current_user.id,
+                                                                               username=current_user.username) }}">
+                       Claim a printer
+               </a>
+               </p>
+               <p>
+               (You need the claim code from a new or reset Little Printer to do this. <strong>Important:</strong> Your Berg Cloud Bridge must be configured to connect to <em>alpha.littleprinter.com</em> otherwise this won't work.)
+               </p>
+               
+               
+               <h1>Messaging permissions</h1>
+               
+               <p>Anybody you follow on Twitter can send a message to any of your printers. These are the {{ friends|length }} account(s) you follow who also have accounts here:</p>
+               
+               {% if signed_up_friends %}
+                       <ul>
+                       {% for f in signed_up_friends %}
+                       <li>@{{ f.username }}</li>
+                       {% endfor %}
+                       </ul>
+               {% else %}
+                       <p><em class="bg-warning">No-one yet</em></p>
+               {% endif %}
+               
+               <form method="POST" action="{{ url_for('landing.twitter_friend_refresh',
+                                                                               user_id=current_user.id,
+                                                                               username=current_user.username) }}">
                {{ form.csrf_token }}
+               <p>
                {% if seconds_to_next_refresh > 0 %}
-               <button disabled>Please wait {{ "%d"|format(seconds_to_next_refresh // 60) }} minutes</button>
+               <button class="btn btn-default" disabled="disabled">Please wait {{ "%d"|format(seconds_to_next_refresh // 60) }} minutes to refresh</button>
                {% else %}
-               <button>Refresh now</button>
+               <button class="btn btn-default" type="submit">Refresh messaging permissions</button>
                {% endif %}
+               </p>
+               <p>
+               (The list of people you follow on Twitter was last refreshed on {{ last_friend_refresh }}.)
+               </p>
+               </form>
 
-       </form>
-</p>
+       </div>
+</div>
 {% endblock %}