Adds bulma.css
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -12,3 +12,7 @@
|
||||
**/target
|
||||
**/*.rs.bk
|
||||
**/Cargo.lock
|
||||
|
||||
# Node.js
|
||||
**/node_modules
|
||||
**/package-lock.json
|
||||
|
||||
@@ -34,9 +34,7 @@ pub mod recipes {
|
||||
pub fn delete(conn: &SqliteConnection, recipe_id: i32) -> bool {
|
||||
use self::schema::recipes::dsl::*;
|
||||
|
||||
diesel::delete(
|
||||
recipes.filter(
|
||||
id.eq(recipe_id)))
|
||||
diesel::delete(recipes.filter(id.eq(recipe_id)))
|
||||
.execute(conn)
|
||||
.is_ok()
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ extern crate planner;
|
||||
|
||||
use self::cookbook::*;
|
||||
use self::cookbook::models::Recipe;
|
||||
use self::planner::solver::{Variables, Domain, Problem, Constraint};
|
||||
use self::planner::solver::{Variables, Domain, Problem};
|
||||
|
||||
/// We want a mapping of the week meals (matin, midi, soir)
|
||||
/// Breakfast => RecipeCategory::Breakfast
|
||||
@@ -29,11 +29,7 @@ impl Into<String> for Meals {
|
||||
}
|
||||
}
|
||||
}
|
||||
/// associated with filters for Domain, depending on recipes RecipeCategory
|
||||
enum RecipeCategory {
|
||||
Breakfast,
|
||||
MainCourse
|
||||
}
|
||||
|
||||
/// It may also contains an initial value for each variable
|
||||
fn generate_variables<V>(domain: &Domain<V>) -> Vec<(String, &Domain<V>, Option<&V>)> {
|
||||
let mut vars = Vec::new();
|
||||
|
||||
@@ -2,40 +2,51 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<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>
|
||||
<button @click="setActiveCategory(-1)"><< back</button>
|
||||
<p>{{ categories[active_category].name }}</p>
|
||||
<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(item.id)">{{ item.title }}</a>
|
||||
<a href="" @click.prevent="setActiveView(items.findIndex((i) => i.id ==item.id))">{{ item.title }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</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