Skip to content

Commit

Permalink
Implement review notes
Browse files Browse the repository at this point in the history
  • Loading branch information
jimchamp committed Apr 22, 2022
1 parent c6654d1 commit 6402233
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions openlibrary/macros/EditButtons.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$def with (comment=None)
$def with (comment=None, submit_markup='')

<div class="formElement">
<div class="label">
Expand All @@ -14,7 +14,7 @@
</div>

<div class="formElement collapse" style="position:relative;">
<button type="submit" class="larger" name="_save" title="$_('Save')">$_("Save")</button>
$:submit_markup
&nbsp;
<a href="javascript:history.go(-1);" class="small red">$_('Cancel')</a>
</div>
11 changes: 9 additions & 2 deletions openlibrary/templates/books/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
$var title: $this_title
$putctx("robots", "noindex,nofollow")

$def render_submit_button(hidden=False):
$if hidden:
<button type="submit" class="hidden" name="_save" form="addWork" tabindex="-1"></button>
$else:
<button type="submit" class="larger" name="_save" title="$_('Save')">$_("Save")</button>

<div id="contentHead" class="editFormHead">
$code:
def find_mode():
Expand Down Expand Up @@ -34,7 +40,8 @@
note = ""
<h2 class="editFormTitle">$:title</h2>
$if ctx.user and (ctx.user.is_admin() or ctx.user.is_librarian()):
<button type="submit" class="hidden" name="_save" form="addWork" tabindex="-1"></button>
$# Hidden submission button prevents delete button from triggering on "enter" key press
$:render_submit_button(hidden=True)
<span class="adminOnly right"><button type="submit" value="$_('Delete Record')" name="_delete" title="$_('Delete Record')" id="delete" form="addWork">$_("Delete Record")</button></span>
$if not ctx.user:
$:render_template("lib/not_logged")
Expand Down Expand Up @@ -122,7 +129,7 @@ <h3 class="editFormBookAuthors">$all_authors[:-1]</h3>
<div class="g-recaptcha" data-sitekey="$:recaptcha.public_key"></div>
</div>

$:macros.EditButtons(comment=work.comment_)
$:macros.EditButtons(comment=work.comment_, submit_markup=render_submit_button())

</form>
$if edition:
Expand Down

0 comments on commit 6402233

Please sign in to comment.