Commit aa42d0ba authored by Daniel W Bond's avatar Daniel W Bond
Browse files

cancel buttons on all forms

parent 0af82a72
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset, HTML, Field
from crispy_forms.layout import Button, Submit, Layout, Fieldset, HTML, Field
from crispy_forms.bootstrap import FormActions
from lookouts.models import Lookout
......@@ -21,7 +21,9 @@ class LookoutForm( forms.ModelForm ):
'owner',
Field('isbn', placeholder='0801884039'),
HTML("""<hr/ >"""),
FormActions(Submit('submit', 'Submit', css_class='btn-primary'))
FormActions(
Submit('submit', 'Submit', css_class='btn-primary'),
Button('cancel', 'Never Mind', css_class="btn-default", onclick="history.back()")),
),
)
......
......@@ -14,6 +14,7 @@ SRCT Bookshare &bull; Delete Lookout
<form action="" method="post">{% csrf_token %}
<h3>Are you sure you want to delete your lookout for <em>{{ lookout.isbn|isbn_name }}</em>?</h3>
<input type="submit" value="Confirm" class="btn btn-danger btn-sm" />
<input type="cancel" value="Never Mind" class="btn btn-default btn-sm" onclick="history.back()"/>
</form>
</div>
......
......@@ -33,7 +33,11 @@ class ListingForm( forms.ModelForm ):
'photo',
Field('description', placeholder='I would be willing to exchange this textbook for one that I need next semester.'),
HTML("""<hr/ >"""),
FormActions(Submit('submit', 'Create', css_class='btn-primary')),
FormActions(
Submit('submit', 'Create', css_class='btn-primary'),
Button('cancel', 'Never Mind', css_class='btn-default', onclick="history.back()")),
),
)
......
......@@ -12,6 +12,7 @@ SRCT Bookshare &bull; {{ flag.listing.title }} &bull; Remove Flag
<form action="" method="post">{% csrf_token %}
<h3>Are you sure you want to remove your flag for {{ flag.listing.seller.user.get_full_name }}'s listing <em>{{ flag.listing.title }}</em>?</h3>
<input type="submit" value="Confirm" class="btn btn-danger btn-sm" />
<input type="submit" value="Never Mind" class="btn btn-default btn-sm" onclick="history.back()" />
</form>
</div>
......
......@@ -22,6 +22,7 @@ SRCT Bookshare &bull; {{ listing.title }} &bull; Edit
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Update" class="btn btn-primary" />
<input type="cancel" value="Never Mind" class="btn btn-default" onclick="history.back()"/>
</form>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment