Skip to content

Commit

Permalink
Fixed bugs in many views
Browse files Browse the repository at this point in the history
  • Loading branch information
TaaviE committed Sep 26, 2019
1 parent f6d1aee commit b6f62ba
Show file tree
Hide file tree
Showing 12 changed files with 408 additions and 282 deletions.
8 changes: 4 additions & 4 deletions models/users_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,31 @@ class User(db.Model, UserMixin):

@property
def last_login_ip(self):
return self.last_login_ip
return

@last_login_ip.setter
def last_login_ip(self, value):
self.last_login_ip = value

@property
def last_login_at(self):
return self.last_login_at
return

@last_login_at.setter
def last_login_at(self, value):
self.last_login_at = value

@property
def current_login_at(self):
return self.current_login_at
return

@current_login_at.setter
def current_login_at(self, value):
self.current_login_at = value

@property
def current_login_ip(self):
return self.current_login_ip
return

@current_login_ip.setter
def current_login_ip(self, value):
Expand Down
2 changes: 1 addition & 1 deletion models/wishlist_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ArchivedWishlist(db.Model):
nullable=False)
purchased_by: int = Column(Integer, ForeignKey(User.id), nullable=True)
event_id: int = Column(Integer, ForeignKey(ShufflingEvent.id), nullable=False)
archived: datetime = Column(TIMESTAMP, nullable=False)
when: datetime = Column(TIMESTAMP, server_default=FetchedValue(), nullable=False)

def __init__(self, user_id: int, item: str, status: int = wishlist_status_to_id["default"],
purchased_by: int = None):
Expand Down
320 changes: 160 additions & 160 deletions resources/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 8 additions & 9 deletions templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2 class="custom-white-text mdl-card__title-text">{{ _("Create new...") }}</h2>
{% if id_connected %}disabled{% endif %}
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
{% if not id_connected %}
href="{{ url_for("main_page.log_user_in_with_cert") }}"
href="{{ url_for("login_page.log_user_in_with_cert") }}"
{% else %}
href="#"
{% endif %}>
Expand All @@ -79,7 +79,7 @@ <h2 class="custom-white-text mdl-card__title-text">{{ _("Create new...") }}</h2>
{% if google_connected %}disabled{% endif %}
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
{% if not google_connected %}
href="{{ url_for("main_page.google_login") }}"
href="{{ url_for("login_page.google_login") }}"
{% else %}
href="#"
{% endif %}>
Expand All @@ -101,7 +101,7 @@ <h2 class="custom-white-text mdl-card__title-text">{{ _("Create new...") }}</h2>
{% if github_connected %}disabled{% endif %}
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
{% if not github_connected %}
href="{{ url_for("main_page.github_login") }}"
href="{{ url_for("login_page.github_login") }}"
{% else %}
href="#"
{% endif %}>
Expand All @@ -124,7 +124,7 @@ <h2 class="custom-white-text mdl-card__title-text">{{ _("Create new...") }}</h2>
{% if facebook_connected %}disabled{% endif %}
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
{% if not facebook_connected %}
href="{{ url_for("main_page.facebook_login") }}"
href="{{ url_for("login_page.facebook_login") }}"
{% else %}
href="#"
{% endif %}>
Expand Down Expand Up @@ -186,18 +186,17 @@ <h2 class="custom-white-text mdl-card__title-text">{{ _("Create new...") }}</h2>
href="/editfam/{{ family[0] }}">{{ _("Change / Display") }}</a>
</td>
<td>
<form method="post" action="/editfam/{{ family[0] }}">
<form method="post"
action="{{ url_for("edit_page.editfam_with_action", family_id=family[0]) }}">
<input name="action" type="hidden" value="DELETEFAM">
<input name="extra_data" type="hidden" value="{{ family[0] }}">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect"
name="id" type="submit"
value="{{ family[0] }}">{{ _("Delete") }}</button>
name="id" type="submit">{{ _("Delete") }}</button>
</form>
</td>
{% else %}
<td>
<a class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
href="/editfam/{{ family[0] }}">{{ _("Display") }}</a>
href="{{ url_for("edit_page.editfamily", family_id=family[0]) }}">{{ _("Display") }}</a>
</td>
{% endif %}
</tr>
Expand Down
26 changes: 13 additions & 13 deletions templates/subtemplates/title_bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,36 @@
<div class="mdl-layout__drawer">
<nav class="mdl-navigation">
<div class="mdl-layout-spacer mdl-card__supporting-text">Shortcuts</div>
<a class="mdl-navigation__link" href="/notes">
<a class="mdl-navigation__link" href="{{ url_for("main_page.notes") }}">
<i class="material-icons" role="presentation">list</i> {{ _("My Wishlist") }}</a>
{% if target %}
<a class="mdl-navigation__link" href="/wishlist/{{ target["group_id"] }}/{{ target["user_id"] }}">
<i class="material-icons" role="presentation">list</i> {{ _("Receiver's Wishlist") }}</a>
<i class="material-icons" role="presentation">list</i> {{ _("Receiver's Wishlist") }}</a>
{% endif %}
<div class="mdl-layout-spacer mdl-card__supporting-text">Overview</div>
<a class="mdl-navigation__link" href="/shuffles">
<a class="mdl-navigation__link" href="{{ url_for("main_page.shuffles") }}">
<i class="material-icons" role="presentation">cached</i> {{ _("Shuffles") }}</a>
<a class="mdl-navigation__link" href="/families">
<a class="mdl-navigation__link" href="{{ url_for("main_page.families") }}">
<i class="material-icons" role="presentation">people</i> {{ _("Families") }}</a>
<a class="mdl-navigation__link" href="/groups">
<a class="mdl-navigation__link" href="{{ url_for("main_page.groups") }}">
<i class="material-icons" role="presentation">group_work</i> {{ _("Groups") }}</a>
<a class="mdl-navigation__link" href="/events">
<a class="mdl-navigation__link" href="{{ url_for("main_page.events") }}">
<i class="material-icons" role="presentation">event</i> {{ _("Events") }}</a>
<a class="mdl-navigation__link custom-disable-link" href="/reminders">
<a class="mdl-navigation__link custom-disable-link" href="{{ url_for("main_page.reminders") }}">
<i class="material-icons" role="presentation">alarm</i> {{ _("Reminders") }}</a>
<a class="mdl-navigation__link custom-disable-link" href="/notifications">
<a class="mdl-navigation__link" href="{{ url_for("main_page.notifications") }}">
<i class="material-icons" role="presentation">notification_important</i> {{ _("Notifications") }}</a>
<a class="mdl-navigation__link custom-disable-link" href="/subscriptions">
<a class="mdl-navigation__link custom-disable-link" href="{{ url_for("main_page.subscriptions") }}">
<i class="material-icons" role="presentation">attach_money</i> {{ _("Subscriptions") }}</a>
<div class="mdl-layout-spacer mdl-card__supporting-text">Personal</div>
<a class="mdl-navigation__link" href="/settings">
<a class="mdl-navigation__link" href="{{ url_for("main_page.settings") }}">
<i class="material-icons" role="presentation">settings</i> {{ _("Settings") }}</a>
<a class="mdl-navigation__link" href="/logout">
<a class="mdl-navigation__link" href="{{ url_for("login_page.logout") }}">
<i class="material-icons" role="presentation">exit_to_app</i> {{ _("Log out") }}</a>
<div class="mdl-layout-spacer mdl-card__supporting-text">Help & Support</div>
<a class="mdl-navigation__link custom-disable-link" href="/help">
<a class="mdl-navigation__link custom-disable-link" href="{{ url_for("static_page.help_page") }}">
<i class="material-icons" role="presentation">help</i> {{ _("Help") }}</a>
<a class="mdl-navigation__link" href="/feedback">
<a class="mdl-navigation__link" href="{{ url_for("static_page.feedback") }}">
<i class="material-icons" role="presentation">feedback</i> {{ _("Feedback") }}</a>
</nav>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/table_views/families.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<td>{{ family["name"] }}</td>
<td>
<a class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
href="/family/{% if group_id %}{{ group_id }}/{% endif %}{{ family["id"] }}">
href="/family/{% if group_id != None %}{{ group_id }}/{% endif %}{{ family["id"] }}">
{{ _("Display") }}</a>
</td>
</tr>
Expand Down
20 changes: 13 additions & 7 deletions templates/table_views/notes_private.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ <h2 class="custom-white-text mdl-card__title-text">{{ _("Options") }}</h2>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect"
href="/createnote">{{ _("Add new") }}</a>
href="{{ url_for("edit_page.createnote") }}">{{ _("Add new") }}</a>
{% if not archived %}
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect"
href="{{ url_for("main_page.archived_notes") }}">{{ _("View archive") }}</a>
{% else %}
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect"
href="{{ url_for("main_page.notes") }}">{{ _("View wishlist") }}</a>
{% endif %}
</div>
</div>
{% endblock %}
Expand All @@ -30,7 +37,7 @@ <h2 class="custom-white-text mdl-card__title-text">{{ _("Options") }}</h2>
<table class="custom-wrap mdl-card mdl-shadow--2dp mdl-data-table mdl-js-data-table mdl-shadow--2dp mdl-cell mdl-cell--12-col-desktop mdl-cell--8-col-tablet mdl-cell--6-col-phone">
<tbody>
<th class="mdl-data-table__cell--non-numeric mdl-textfield--full-width">{{ _("Description") }}</th>
{% if not empty %}
{% if not empty and not archived %}
<th class="mdl-data-table__cell--non-numeric">{{ _("Delete") }}</th>
<th class="mdl-data-table__cell--non-numeric">{{ _("Edit") }}</th>
{% else %}
Expand All @@ -41,21 +48,20 @@ <h2 class="custom-white-text mdl-card__title-text">{{ _("Options") }}</h2>
{% for item, id in list.items() %}
<tr>
<td class="custom-white-space mdl-data-table__cell--non-numeric">{{ item }}</td>
{% if not empty %}
{% if not empty and not archived %}
<td class="mdl-data-table__cell--non-numeric">
<form method="post" action="./removenote">
<form method="post" action="{{ url_for("edit_page.note_remove", request_id=id) }}">
<input name="action" type="hidden" value="DELETENOTE">
<input name="extra_data" type="hidden" value="{{ id }}">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect"
type="submit">{{ _("Delete") }}</button>
</form>
</td>
<td class="mdl-data-table__cell--non-numeric">
<a class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
href="./editnote?id={{ id }}">{{ _("Edit") }}</a>
href="{{ url_for("edit_page.note_edit_get", request_id=id) }}">{{ _("Edit") }}</a>
</td>
{% else %}
<td class="mdl-data-table__cell--non-numeric"></td>
<td class="mdl-data-table__cell--non-numeric">{{ _("There's no wishlist items here") }}</td>
<td class="mdl-data-table__cell--non-numeric"></td>
{% endif %}
</tr>
Expand Down
83 changes: 44 additions & 39 deletions templates/table_views/notes_public.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,54 @@
<th class="mdl-data-table__cell--non-numeric">{{ _("By whom") }}</th>
<th class="mdl-data-table__cell--non-numeric">{{ _("Action") }}</th>
{% endif %}
{% if notes|length > 1 %}
{% for note in notes %}
<tr>
<td class="custom-white-space mdl-data-table__cell--non-numeric">{{ note["item"] }}</td>

{% for note in notes %}
<tr>
<td class="custom-white-space mdl-data-table__cell--non-numeric">{{ note["item"] }}</td>

{% if not invalid %}
<form action="" method="post">
<td class="mdl-data-table__cell--non-numeric">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
{% if note["status_modifyable"] %}
<select class="mdl-textfield__input" id="status" name="status">
{% for status in note["statuses"] %}
<option value="{{ status[1] }}">{{ _(status[0].capitalize()) }}</option>
{% endfor %}
{% else %}
<select disabled class="mdl-textfield__input" id="status" name="status">
<option value="{{ note["statuses"][0][1] }}">{{ _(note["statuses"][0][0].capitalize()) }}</option>
{% endif %}
</select>
<label class="mdl-textfield__label" for="status"></label>
</div>
</td>

<td class="mdl-data-table__cell--non-numeric custom-large-text">{{ note["buyer"] }}</td>

{% if note["status_modifyable"] %}
<td class="mdl-data-table__cell--non-numeric">
<input type="hidden" name="id" value="{{ note["id"] }}">
<input id="submit" type="submit"
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
value="{{ _("Save") }}"/>
</td>
{% else %}
{% if not invalid %}
<form action="" method="post">
<td class="mdl-data-table__cell--non-numeric">
<input title="{{ _("Bought!") }}"
class="disabled mdl-button--disabled mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
value="{{ _("Bought!") }}"/>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
{% if note["status_modifyable"] %}
<select class="mdl-textfield__input" id="status" name="status">
{% for status in note["statuses"] %}
<option value="{{ status[1] }}">{{ _(status[0].capitalize()) }}</option>
{% endfor %}
{% else %}
<select disabled class="mdl-textfield__input" id="status" name="status">
<option value="{{ note["statuses"][0][1] }}">{{ _(note["statuses"][0][0].capitalize()) }}</option>
{% endif %}
</select>
<label class="mdl-textfield__label" for="status"></label>
</div>
</td>
{% endif %}
</form>
{% endif %}

<td class="mdl-data-table__cell--non-numeric custom-large-text">{{ note["buyer"] }}</td>

{% if note["status_modifyable"] %}
<td class="mdl-data-table__cell--non-numeric">
<input type="hidden" name="id" value="{{ note["id"] }}">
<input id="submit" type="submit"
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
value="{{ _("Save") }}"/>
</td>
{% else %}
<td class="mdl-data-table__cell--non-numeric">
<input title="{{ _("Bought!") }}"
class="disabled mdl-button--disabled mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"
value="{{ _("Bought!") }}"/>
</td>
{% endif %}
</form>
{% endif %}
</tr>
{% endfor %}
{% else %}
<tr>
<td class="custom-white-space mdl-data-table__cell--non-numeric">{{ _("There are no items in this wishlist") }}</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
{% endblock %}
Loading

0 comments on commit b6f62ba

Please sign in to comment.