Permalink
Browse files

Initial upload

  • Loading branch information...
0 parents commit 908451d51e9a96763a914252bf3bab8bffa94b8e @zachdunn zachdunn committed Jan 30, 2011
@@ -0,0 +1 @@
+.DS_Store
@@ -0,0 +1,13 @@
+# Drag-n-Drop Recipe Builder
+
+** Upcoming tutorial **
+
+A drag-n-drop powered recipe builder that uses AJAX to pull combinations from a database. Pretty much mirror's the mechanics behind the popular Doodle God game.
+
+## Getting Started
+
+Since this is a preliminary build, you'll have to do a little more legwork to get it up and running. Run the install.php script after plugging in your database info to get started. You can use the `add-recipe.php` script to add recipes. Only two ingredients ("Water Bottle" and "Newspaper") are included to start.
+
+The `recipes-builder.php` file loads the builder itself. Results will show up once you've plugged in some recipes to the database.
+
+** More Documentation Coming Soon**
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Recipe Manager</title>
+ <link rel="stylesheet" href="css/style.css" />
+ <link rel="stylesheet" href="css/add-form.css" />
+</head>
+<body>
+
+ <h1>Add a Question</h1>
+
+ <form method="post" action="ajax/add-recipe.php">
+
+ <fieldset>
+ <label for="recipe_title">Title</label>
+ <input type="text" name="recipe_title"/>
+ </fieldset>
+
+ <fieldset>
+ <label for="recipe_desc">Description</label>
+ <textarea name="recipe_desc" rows="6"></textarea>
+ </fieldset>
+
+ <fieldset>
+ <label for="recipe_image">Image URL</label>
+ <input type="text" name="recipe_image"/>
+ </fieldset>
+
+ <fieldset>
+ <label for="ingredient_1">Ingredient 1</label>
+ <input type="text" name="ingredient_1"/>
+ </fieldset>
+
+ <fieldset>
+ <label for="ingredient_2">Ingredient 2</label>
+ <input type="text" name="ingredient_2"/>
+ </fieldset>
+
+ <input type="submit" value="Save this recipe"/>
+
+ </form>
+
+</body>
+</html>
@@ -0,0 +1,31 @@
+<?php
+
+ /*
+ AJAX form handler for adding recipes
+ TO-DO: Call via jQuery AJAX instead of form action
+ */
+
+ //Error reporting (Debug only)
+ error_reporting(E_ALL);
+ ini_set("display_errors", 1);
+
+ //Prevent direct script access
+ /*if (!defined('BASEPATH') &&
+ strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest')
+ exit('No direct script access allowed.');*/
+
+ require_once '../includes/recipes.php';
+ $recipes = new Recipes();
+
+ //Make array of ingredients & implode
+
+ if($recipes->add_recipe($_POST)) :
+ $return['success'] = true;
+ echo 'Success';
+ else :
+ $return['success'] = false;
+ echo 'Failure';
+ endif;
+
+ //Strip slashes and convert to JSON
+ //echo stripslashes(json_encode($return));
@@ -0,0 +1,36 @@
+<?php
+ /*
+ Checks for combinations
+ and displays results via AJAX
+ */
+
+ //Error reporting (Debug only)
+ error_reporting(E_ALL);
+ ini_set("display_errors", 1);
+
+ //Prevent direct script access
+ if (!defined('BASEPATH') &&
+ strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest')
+ exit('No direct script access allowed.');
+
+ //Instantiate Recipes class
+ require_once '../includes/recipes.php';
+ $recipes = new Recipes();
+
+ //Make array of ingredients & implode
+ $ingredients = array();
+ array_push($ingredients, $_POST['ingredient1']);
+ array_push($ingredients, $_POST['ingredient2']);
+ $ingredients = implode(':', $ingredients);
+
+ //Check for combinations and return results
+ if($result = $recipes->combine_ingredients($ingredients)) :
+ $return['message'] = "You found a combination!";
+ $return['recipe'] = $result;
+ else :
+ $return['message'] = "Those items don't go together";
+ $return['recipe'] = false;
+ endif;
+
+ //Strip slashes and convert to JSON
+ echo stripslashes(json_encode($return));
@@ -0,0 +1,7 @@
+fieldset{
+ border:none;
+}
+
+label{float:left; width:130px;clear:left;text-align:right; padding-right:15px; font-size:.85em;}
+
+input[type="text"], textarea{border-radius:3px; border:none; font-size:.93em; padding: 3px 5px; outline:none; clear:right; width:300px;}
@@ -0,0 +1,78 @@
+/*
+ Recipe Builder
+ Fall 2010
+ Zach Dunn / One Mighty Roar (onemightyroar.com)
+*/
+
+body{
+ font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
+ background: #a3da62;
+ margin:0; padding:0;
+}
+
+#header{
+ background:#252525;
+ display:block; margin-bottom:20px;
+ border-bottom:20px #b4e778 solid;
+}
+
+ #header h1{color:#efefef; margin:0; padding: 15px 20px; font-weight:normal; font-size:1.2em; text-transform:uppercase;}
+
+#wrapper{
+ margin:0 auto;
+ width:960px;
+}
+
+ #ingredients{
+ display:block; clear:both; list-style:none; padding-left:0;
+ }
+ #ingredients li{
+ display:inline; float:left;
+ width:50px; height:50px;
+ background:#FFF;
+ margin-right:10px;
+ }
+
+ .dropzone{
+ background:#fff;
+ width:300px;
+ height:300px;
+ -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.2);
+ }
+ .dropzone img{width:280px; height:280px; margin:10px; background:#EFEFEF;}
+
+ #box1{float:left;}
+ #box2{float:right;}
+
+ #result{
+ display:block; clear:both;
+ width:690px; height:250px;
+ margin:30px auto 0 auto;
+ }
+ #result img{float:left; margin-right:10px;}
+ #result .desc{padding:15px 0 0 0;}
+
+ .desc{}
+ .desc span{font-size:.8em; text-transform:uppercase; color:#70a432; letter-spacing:1px; font-weight:bold;}
+ .desc h2{margin:0; padding-bottom:0; font-size:1.5em;}
+ .desc h2 + p{margin-top:0;}
+ .desc p{color:#526d33; font-size:.8em; line-height:1.4em;}
+#footer{
+ text-align:center;
+ clear:both;
+}
+ #footer p{font-size:.70em;}
+ #footer img{
+ opacity:.6;
+ -webkit-transition:all .5s ease;
+ -moz-transition:all .5s ease;
+ -o-transition:all .5s ease;
+ transition:all .5s ease;
+ }
+ #footer img:hover{opacity:1.0}
+
+/* UI Styles */
+.ui-state-hover{background:#FCCE02;}
+
+/* Helper Classes */
+.clear{clear:both; display:block; width:100%;}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 908451d

Please sign in to comment.