Skip to content

Commit

Permalink
Style cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pppontusw committed May 19, 2019
1 parent 13ce67e commit 65c3485
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
1 change: 0 additions & 1 deletion app/auth/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def validate_email(self, email):

def validate_username(self, username):
user = User.query.filter_by(username=username.data.lower()).first()
print(user == current_user)
if user is not None and user != current_user:
raise ValidationError('Please use a different username.')

Expand Down
2 changes: 0 additions & 2 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ def get_users_with_access(self):
return [i.user for i in self.users]

def get_non_owners(self):
print("nonowner", [i.user for i in self.users if i.permission_level == 'rw'])
return [i.user for i in self.users if i.permission_level == 'rw']

def get_owners(self):
print("owner", [i.user for i in self.users if i.permission_level == 'owner'])
return [i.user for i in self.users if i.permission_level == 'owner']

def get_days(self, start=0, end=7):
Expand Down
15 changes: 0 additions & 15 deletions app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,6 @@
</div>

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
{% if not current_user.is_anonymous %}
{% if current_user.get_lists() %}
<li class="dropdown">
<a href="{{ url_for('main.get_lists') }}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">Lists <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for list_ in current_user.get_lists() %}
<li><a href="{{ url_for('main.get_list', list_id=list_.id) }}">{{list_.name}}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if current_user.is_admin %}
<li><a href="{{ url_for('admin.index') }}">Admin</a></li>
Expand Down
11 changes: 6 additions & 5 deletions app/templates/list.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{% extends 'base.html' %}
{% block app_content %}
<div class="col-md-8">
<div class="row">
<h3>{{list_.name}}</h3>
<a class="btn btn-default pull-right" href="{{url_for('main.settings', list_id=list_.id)}}"><span class="glyphicon glyphicon-cog"></span> Settings</a>
</div>
<br>

<div class="row">
<table class="table table-bordered">
{% for day in days %}
Expand All @@ -22,6 +18,11 @@ <h3>{{list_.name}}</h3>
{% endfor %}
</table>
</div>
<div class="row">
<a class="btn btn-default pull-right" href="{{url_for('main.settings', list_id=list_.id)}}"><span
class="glyphicon glyphicon-cog"></span> List Settings</a>
</div>
<br>
</div>
{% endblock %}
{% block scripts %}
Expand Down
14 changes: 12 additions & 2 deletions app/templates/settings.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends 'base.html' %}
{% block app_content %}
<div class="col-md-6">

<div class="col-md-8">

<div class="row">
<a class="btn btn-default pull-right" href="{{url_for('main.get_list', list_id=list_.id)}}">Back</a>

<ul class="nav nav-tabs">
<li role="presentation" id="ListSettings"><a href="{{url_for('main.list_settings', list_id=list_.id)}}">View</a></li>
<li role="presentation" id="Foods" class="disabled"><a>Foods</a></li>
Expand All @@ -15,5 +17,13 @@
<br>
{% block settings %}
{% endblock %}
<hr>
<div class="row">
<a class="btn btn-default" href="{{url_for('main.get_list', list_id=list_.id)}}">Back</a>
{% if current_user in list_.get_owners() %}
<a class="btn btn-danger pull-right" href="{{url_for('main.delete_list', list_id=list_.id)}}">Delete List</a>
{% endif %}
</div>
<br>
</div>
{% endblock %}
9 changes: 2 additions & 7 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,6 @@ def test_list_view(self):
rsp = self.test_client.get('/list/' + str(l.id))
html = rsp.get_data(as_text=True)
self.assertEqual(rsp.status, '200 OK')
self.assertTrue(
'TestyList' in html)
self.assertTrue('Monday' in html)
self.assertTrue('Wednesday' in html)
self.assertTrue('Friday' in html)
Expand Down Expand Up @@ -476,7 +474,6 @@ def test_shared_lists_access(self):
rsp = self.test_client.get('/list/' + str(x.id))
self.assertEqual(rsp.status, '200 OK')


def test_list_settings(self):
u = push_dummy_user()
l = push_dummy_list(u, 'TestyList')
Expand Down Expand Up @@ -515,8 +512,7 @@ def test_list_shares(self):
html = rsp.get_data(as_text=True)
self.assertTrue(v.username in html)
rsp = self.test_client.get('/list/' + str(l.id))
html = rsp.get_data(as_text=True)
self.assertTrue(l.name in html)
self.assertEqual(rsp.status, '200 OK')
rsp = self.test_client.get('/list_shares/' + str(l.id))
html = rsp.get_data(as_text=True)
self.assertTrue(v.username in html)
Expand All @@ -527,8 +523,7 @@ def test_list_shares(self):
daysToDisplay="15",
startDayOfTheWeek="2"))
rsp = self.test_client.get('/list/' + str(l.id))
html = rsp.get_data(as_text=True)
self.assertTrue(l.name in html)
self.assertEqual(rsp.status, '200 OK')
rsp = self.test_client.get('/list_shares/' + str(l.id))
html = rsp.get_data(as_text=True)
self.assertTrue(u.username in html)
Expand Down

0 comments on commit 65c3485

Please sign in to comment.