Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS123-Canteeneo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Willard Torres
CS123-Canteeneo
Commits
121466d5
Commit
121466d5
authored
Nov 10, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add individual dish controller/view
parent
1bf797d9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
1 deletion
+52
-1
dish_views.py
canteeneo/dish_views.py
+6
-1
viewdish.html
canteeneo/templates/viewdish.html
+46
-0
No files found.
canteeneo/dish_views.py
View file @
121466d5
...
...
@@ -4,7 +4,6 @@ from canteeneo import app, db
from
canteeneo.models
import
Stall
,
Dish
from
canteeneo.forms
import
DishRegisterForm
from
canteeneo.views
import
flash_form_errors
,
stall_validate
,
dish_validate
from
flask
import
render_template
,
redirect
,
url_for
,
request
from
flask_login
import
login_required
from
werkzeug.utils
import
secure_filename
...
...
@@ -29,6 +28,12 @@ def new_dish(stall_id):
else
:
return
render_template
(
'newdish.html'
,
form
=
form
,
stall
=
stall
)
@
app
.
route
(
'/stalls/<int:stall_id>/dishes/<int:dish_id>'
,
methods
=
[
"GET"
])
@
login_required
@
dish_validate
def
dish
(
stall_id
,
dish_id
):
return
render_template
(
'viewdish.html'
,
stall
=
Stall
.
query
.
get
(
stall_id
),
dish
=
Dish
.
query
.
get
(
dish_id
))
@
app
.
route
(
'/stalls/<int:stall_id>/dishes/<int:dish_id>/edit'
,
methods
=
[
'GET'
,
'POST'
])
@
login_required
@
dish_validate
...
...
canteeneo/templates/viewdish.html
0 → 100644
View file @
121466d5
{% extends "base.html" %} {% block title %} {{stall.name}} - {{dish.name}}{% endblock %} {% block content %}
<div
class=
"dashboard-container"
>
<!--
<div class="dashboard-row">
<span style="font-size: 32pt; flex-grow: 2;">
{{stall.name}}
</span>
<a href="{{ url_for('new_dish', stall_id=stall.id) }}"><button class="link-button" style="flex-grow: 1;">Add Dish</button></a>
<a href="{{ url_for('edit_stall', stall_id=stall.id) }}"><button class="link-button" style="flex-grow: 1;">Edit Info</button></a>
</div>
<div class="dashboard-row">
<div class="list">
{% if dishes|length > 0 %} {% for dish in dishes %}
<div class="list-item">
<div class="list-image">
<img width="200px" height="200px" src="{{url_for('static', filename='uploads/'+dish.image_path)}}" alt="">
</div>
<div class="list-info">
<span class="list-name">{{dish.name}}</span>
<span class="list-price">Php{{dish.price}}</span>
<div>
<a href="{{ url_for('edit_dish', stall_id=stall.id, dish_id=dish.id) }}"><button class="list-button">Edit</button></a>
<form action="{{ url_for('delete_dish', stall_id=stall.id, dish_id=dish.id) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete {{dish.name}}')">
<button type="submit" class="list-button button-delete">Delete</button></a>
</form>
</div>
</div>
</div>
{% endfor %} {% endif %}
</div>
</div>
<div class="dashboard-row">
<a href="{{ url_for('stalls') }}"><button class="link-button">Dashboard</button></a>
</div>
-->
Name: {{dish.name}}
<br>
Description: {{dish.description}}
<br>
Price: {{dish.price}}
<br>
{{dish.favorites|length}} favorites
<br>
Reviews
<br>
{% for review in dish.reviews %}
Title: {{review.title}}
<br>
Body: {{review.body}}
{% endfor %}
</div>
{% endblock %}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment