Adds bulma.css
This commit is contained in:
@@ -2,40 +2,51 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.22/dist/vue.js"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Hello Bulma!</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.22/dist/vue.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<h1>Cook Assistant</h1>
|
||||
<div class="hero hero-body">
|
||||
<h1 class="title">Cook Assistant</h1>
|
||||
<h2 class="subtitle">Recettes</h2>
|
||||
</div>
|
||||
<!-- Details View -->
|
||||
<section v-if="active_view > -1">
|
||||
<button @click="closeActiveView">X close</button>
|
||||
<h4>{{ items[active_view].title }}</h4>
|
||||
<h6>{{ categories[items[active_view].category].name }}</h6>
|
||||
<section v-if="active_view > -1" class="section has-background-grey-lighter">
|
||||
<div class="box">
|
||||
<button @click="closeActiveView" class="button is-pulled-right">X close</button>
|
||||
<h4 class="title">{{ items[active_view].title }}</h4>
|
||||
<h6 class="subtitle">{{ categories[items[active_view].category].name }}</h6>
|
||||
<p><strong>{{ items[active_view].ingredients }}</strong></p>
|
||||
<button @click="deleteRecipe(active_view + 1)">DELETE !</button>
|
||||
<button @click="deleteRecipe(active_view + 1)" class="button is-danger is-pulled-right">DELETE !</button>
|
||||
</div>
|
||||
</section>
|
||||
<!-- Category List View -->
|
||||
<section v-else>
|
||||
<div v-if="active_category == -1">
|
||||
<div v-for="c in categories" :key="c.id">
|
||||
<button @click="setActiveCategory(c.id)">{{ c.name }}</button>
|
||||
<section v-else class="section has-background-grey-lighter">
|
||||
<div class="container">
|
||||
<div v-if="active_category == -1" class="columns">
|
||||
<div v-for="c in categories" :key="c.id" class="column">
|
||||
<button @click="setActiveCategory(c.id)" class="button is-large is-primary has-text-dark">{{ c.name }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="box">
|
||||
<button @click="setActiveCategory(-1)" class="button is-pulled-left"><< back</button>
|
||||
<h2 class="subtitle">{{ categories[active_category].name }}</h2>
|
||||
<ul>
|
||||
<li v-for="item in displayed" :key="item.id">
|
||||
<a href="" @click.prevent="setActiveView(items.findIndex((i) => i.id ==item.id))">{{ item.title }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<button @click="setActiveCategory(-1)"><< back</button>
|
||||
<p>{{ categories[active_category].name }}</p>
|
||||
<ul>
|
||||
<li v-for="item in displayed" :key="item.id">
|
||||
<a href="" @click.prevent="setActiveView(item.id)">{{ item.title }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
|
||||
// TODO: Must find a viable use of Recipe.id instead of active_view !
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data () {
|
||||
@@ -55,8 +66,8 @@
|
||||
setActiveCategory: function(id) {
|
||||
this.active_category = id;
|
||||
},
|
||||
setActiveView: function(id) {
|
||||
this.active_view = id - 1;
|
||||
setActiveView: function(idx) {
|
||||
this.active_view = idx;
|
||||
},
|
||||
closeActiveView: function() {
|
||||
this.active_view = -1;
|
||||
|
||||
Reference in New Issue
Block a user