From 2cca9584fec535075ec10d0922ba01e79fe07eda Mon Sep 17 00:00:00 2001 From: "Joshua Marsh (icub3d)" Date: Sat, 9 Feb 2013 17:24:00 -0700 Subject: [PATCH 1/6] better alignment and ability to delete items. --- dev/css/main.css | 9 +++++-- dev/js/recipes/view.js | 18 +++++++++++++ dev/recipes/view.html | 58 +++++++++++++++++++++++++++++------------- 3 files changed, 65 insertions(+), 20 deletions(-) diff --git a/dev/css/main.css b/dev/css/main.css index 7818da8..b98a990 100644 --- a/dev/css/main.css +++ b/dev/css/main.css @@ -46,6 +46,11 @@ and buttons and the list items. */ } /* The drag icon is slightly off, so we move it up a bit. */ -.drag-icon { +.drag-icon, .remove-icon { margin-top: -5px; -} \ No newline at end of file +} + +/* This is used to align the add button with the other buttons on the recipe page. */ +.padding8 { + padding: 8px; +} diff --git a/dev/js/recipes/view.js b/dev/js/recipes/view.js index 4c09195..1cb69ae 100644 --- a/dev/js/recipes/view.js +++ b/dev/js/recipes/view.js @@ -67,6 +67,11 @@ function RecipesViewCtrl($scope, $routeParams, $timeout, }); }; + // delete removes the given item from the list. + $scope.delete = function(type, index) { + $scope[type].splice(index, 1); + $scope.dirty = true; + }; // Save saves changes to the recipe back to the datastore. $scope.save = function() { @@ -170,9 +175,15 @@ function RecipesViewCtrl($scope, $routeParams, $timeout, }); }); + + $scope.togglecleanup = function() { + $scope.cleanup = !$scope.cleanup; + }; + // We start out not editing any recipe. $scope.editingtype = ""; $scope.editing = -1; + $scope.cleanup = false; // The recipe should start clean. $scope.dirty = false; @@ -180,5 +191,12 @@ function RecipesViewCtrl($scope, $routeParams, $timeout, "Ingredients": "", "Directions": "" }; + + // Add shit+enter to save for the direction box. + $('#newdirection').on('keyup', function (event) { + if (event.which == 13 && event.shiftKey) { + $scope.$apply($scope.add('Directions')); + } + }); } RecipesViewCtrl.$inject = ['$scope', '$routeParams', '$timeout', '$location', 'Recipes', 'Lists']; diff --git a/dev/recipes/view.html b/dev/recipes/view.html index 60140a9..19e03e7 100644 --- a/dev/recipes/view.html +++ b/dev/recipes/view.html @@ -6,10 +6,13 @@

{{recipe.Name}}

+ data-ng-click="edit(-2, 'title')" + data-ng-hide="editing == -2 && editingtype == 'title'"> + {{recipe.Name}} + -
@@ -26,6 +29,12 @@ > Add To List +
@@ -69,20 +84,20 @@

Ingredients

-
    +
    • - +
      -
    @@ -98,14 +113,20 @@

    Directions

    +
     
    +
    - + Directions
-
    +
    • - +
      @@ -93,8 +93,8 @@

      Ingredients

      name="newingredient" placeholder="Add an ingedient" type="text" data-ng-model="toadd['Ingredients']" required>
      @@ -116,7 +116,7 @@

      Directions

       
      @@ -158,7 +158,7 @@

      Directions

      + pressed. --> - From f32463a3bc97561bb8668c6edbc488a59ac4869a Mon Sep 17 00:00:00 2001 From: "Joshua Marsh (icub3d)" Date: Sat, 9 Feb 2013 17:57:04 -0700 Subject: [PATCH 3/6] fixed some bugs on mobile browsers. --- dev/index.html | 4 ++-- dev/js/lists/view.js | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dev/index.html b/dev/index.html index 353af77..69aadb2 100644 --- a/dev/index.html +++ b/dev/index.html @@ -29,6 +29,8 @@ + + @@ -47,8 +49,6 @@ - -
      diff --git a/dev/js/lists/view.js b/dev/js/lists/view.js index 9567662..5768fb1 100644 --- a/dev/js/lists/view.js +++ b/dev/js/lists/view.js @@ -130,9 +130,6 @@ function ListsViewCtrl($scope, $routeParams, $timeout, Lists) { }); }); - // Start out with cursor in the add text box. - $('#newitem').focus(); - // We start out not editing any list. $scope.editing = -1; From b85b7121c68d3b2107ded82a54d2e6dec55d1574 Mon Sep 17 00:00:00 2001 From: "Joshua Marsh (icub3d)" Date: Thu, 14 Feb 2013 10:54:51 -0700 Subject: [PATCH 4/6] updated to lastest version of libraries. --- dev/index.html | 5 +++-- dev/lists/all.html | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dev/index.html b/dev/index.html index 69aadb2..166c25b 100644 --- a/dev/index.html +++ b/dev/index.html @@ -27,10 +27,10 @@ - + - + @@ -46,6 +46,7 @@ + diff --git a/dev/lists/all.html b/dev/lists/all.html index 8575236..e0ad411 100644 --- a/dev/lists/all.html +++ b/dev/lists/all.html @@ -54,7 +54,7 @@

      Lists

      pressed. -->