Commit 578bd7d6 authored by Willard's avatar Willard

Restyle stall info page, make edit stall and new stall use the same template

parent 24f3da91
......@@ -45,8 +45,8 @@ class OwnerRegisterForm(FlaskForm):
return True
class StallRegisterForm(FlaskForm):
name = StringField('Name', [DataRequired()])
description = TextAreaField('Description', [DataRequired()])
name = StringField('Name', [DataRequired()], render_kw={'placeholder': 'Name'})
description = TextAreaField('Description', [DataRequired()], render_kw={'placeholder': 'Describe your stall'})
image = FileField('Image')
location = SelectField(coerce=int)
editing = False
......
......@@ -21,7 +21,7 @@ class NewStallView(FormView):
db.session.commit()
return redirect(url_for('view_stall', stall_id=self.stall.id))
def render_get(self):
return render_template('newstall.html', form=self.get_form())
return render_template('stallinfo.html', form=self.get_form(), title='Register Stall', form_action=url_for('new_stall'), submit_label='Submit')
def get_form(self):
form = StallRegisterForm()
form.location.choices = [(loc.id, loc.name) for loc in Location.query.all()]
......@@ -51,7 +51,7 @@ class EditStallView(FormView):
form.name.data = self.stall.name
form.description.data = self.stall.description
form.location.data = self.stall.location_id
return render_template('editstall.html', form=form, stall=self.stall)
return render_template('stallinfo.html', form=form, stall=self.stall, title='Edit Info', form_action=url_for('view_stall', stall_id=self.stall.id), submit_label='Edit')
def get_form(self):
form = StallRegisterForm()
form.location.choices = [(loc.id, loc.name) for loc in Location.query.all()]
......
{% extends "base.html" %}
{% block title %}Register your Stall{% endblock %}
{% block content %}
<h1>Stall Info</h1>
<form action="{{url_for('new_stall')}}" method="POST">
{{ form.csrf_token }}
<div id="form">
<div class="form-input">
<div class="input-row">
{{ form.name.label(class_="field-label") }} {{ form.name(class_="text-field") }}
</div>
<div class="input-row">
{{ form.description.label(class_="field-label") }} {{ form.description(class_="text-area", rows=6, cols=32) }}
</div>
<div class="input-row">
{{ form.location.label(class_="field-label") }} {{ form.location(class_="text-field") }}
</div>
</div>
<div class="dashboard-row">
<button type="submit">Add</button>
<a href="{{url_for('stalls')}}"><button type="button" class="link-button">Back</button></a>
</div>
</div>
</form>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1>Stall Info</h1>
</div>
</div>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<form action="{{ form_action }}" method="POST">
{{ form.csrf_token }}
<div class="form-group form-group-lg col-sm-8">
{{ form.name(class_="form-control") }}
</div>
<div class="form-group form-group-lg col-sm-12">
{{ form.description(class_="form-control", rows=16) }}
</div>
<div class="form-group form-group-lg col-sm-12">
{{ form.location.label(class_="col-sm-6 control-label") }} {{ form.location(class_="form-control") }}
</div>
<div class="form-group form-group-lg">
<div class="col-sm-6">
<button class="btn btn-primary btn-block btn-lg" type="submit">{{ submit_label }}</button>
</div>
<div class="col-sm-6">
<a href="{{url_for('stalls')}}"><button class="btn btn-default btn-block btn-lg" type="button">Back</button></a>
</div>
</div>
</form>
</div>
</div>
{% endblock %}
\ No newline at end of file
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