diff --git a/bookwyrm/static/css/format.css b/bookwyrm/static/css/format.css index 72b435bd9..f10549eda 100644 --- a/bookwyrm/static/css/format.css +++ b/bookwyrm/static/css/format.css @@ -23,7 +23,7 @@ } .hidden { - display: none; + display: none !important; } /* --- STARS --- */ diff --git a/bookwyrm/static/js/shared.js b/bookwyrm/static/js/shared.js index d95e77064..55a5c1b20 100644 --- a/bookwyrm/static/js/shared.js +++ b/bookwyrm/static/js/shared.js @@ -27,8 +27,20 @@ window.onload = function() { // update localstorage Array.from(document.getElementsByClassName('set-display')) .forEach(t => t.onclick = updateDisplay); + + // hidden submit button in a form + document.querySelectorAll('.hidden-form input') + .forEach(t => t.onchange = revealForm); }; +function revealForm(e) { + var hidden = e.currentTarget.closest('.hidden-form').getElementsByClassName('hidden')[0]; + if (hidden) { + removeClass(hidden, 'hidden'); + } +} + + function updateDisplay(e) { // used in set reading goal var key = e.target.getAttribute('data-id'); diff --git a/bookwyrm/templates/snippets/privacy_select.html b/bookwyrm/templates/snippets/privacy_select.html index d648ce8b1..a771c3d6d 100644 --- a/bookwyrm/templates/snippets/privacy_select.html +++ b/bookwyrm/templates/snippets/privacy_select.html @@ -1,5 +1,5 @@ {% load bookwyrm_tags %} -
+
{% with 0|uuid as uuid %} {% if not no_label %} diff --git a/bookwyrm/templates/snippets/rate_action.html b/bookwyrm/templates/snippets/rate_action.html index b5a599b1d..2a376f50d 100644 --- a/bookwyrm/templates/snippets/rate_action.html +++ b/bookwyrm/templates/snippets/rate_action.html @@ -1,18 +1,33 @@ {% load bookwyrm_tags %} {% if request.user.is_authenticated %} Leave a rating -
- {% for i in '12345'|make_list %} -
+
+ {% csrf_token %} - + +
+ + + {% for i in '12345'|make_list %} + + + {% endfor %} +
+ + - {% endfor %}
{% endif %} diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index a55e33ff9..a624c806d 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -21,7 +21,7 @@ from .helpers import is_api_request, is_bookworm_request, object_visible_to_user # pylint: disable= no-self-use class Status(View): - ''' the view for *posting* ''' + ''' get posting ''' def get(self, request, username, status_id): ''' display a particular status (and replies, etc) ''' try: @@ -52,10 +52,11 @@ class Status(View): @method_decorator(login_required, name='dispatch') class CreateStatus(View): - ''' get posting ''' + ''' the view for *posting* ''' def post(self, request, status_type): ''' create status of whatever type ''' status_type = status_type[0].upper() + status_type[1:] + try: form = getattr(forms, '%sForm' % status_type)(request.POST) except AttributeError: