Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated templates & controllers for Craft

  • Loading branch information...
commit a553a9e5f2660e3c1950432741707086724b1761 1 parent df41ccb
@benjamindavid benjamindavid authored
View
2  CocktailRecipesPlugin.php
@@ -36,7 +36,7 @@ public function hookRegisterCpRoutes()
{
return array(
'cocktailrecipes\/ingredients\/new' => 'cocktailrecipes/ingredients/_edit',
- 'cocktailrecipes\/ingredients\/(?P<recipeId>\d+)' => 'cocktailrecipes/ingredients/_edit',
+ 'cocktailrecipes\/ingredients\/(?P<ingredientId>\d+)' => 'cocktailrecipes/ingredients/_edit',
);
}
View
2  controllers/CocktailRecipes_IngredientsController.php
@@ -34,7 +34,7 @@ public function actionSaveIngredient()
} else {
craft()->userSession->setError(Craft::t("Couldn't save ingredient."));
- return $this->renderRequestedTemplate(array('ingredient' => $model));
+ craft()->urlManager->setRouteVariables(array('ingredient' => $model));
}
}
View
6 templates/index.html
@@ -1,13 +1,9 @@
{% extends "_layouts/cp" %}
{% set centered = true %}
-{% set ingredients = blx.cocktailrecipes.getAllIngredients %}
+{% set ingredients = craft.cocktailrecipes.getAllIngredients %}
{% set title = "Cocktail Ingredients"|t %}
-{% set header %}
- <h1>{{ title }}</h1>
-{% endset %}
-
{% set content %}
{{ "hi there, test sentence!"|shake }}
View
11 templates/ingredients/_edit.html
@@ -5,7 +5,7 @@
{% if ingredientId is not defined %}{% set ingredientId = null %}{% endif %}
{% if ingredient is not defined %}
{% if ingredientId %}
- {% set ingredient = blx.cocktailrecipes.getIngredientById(ingredientId) %}
+ {% set ingredient = craft.cocktailrecipes.getIngredientById(ingredientId) %}
{% if not ingredient %}{% exit 404 %}{% endif %}
{% else %}
{% set ingredient = null %}
@@ -14,12 +14,9 @@
{% set title = ingredient ? ingredient.name : "New Ingredient"|t %}
-{% set header %}
- <h1>{{ title }}</h1>
- <ul class="left">
- <li><a href="{{ url('cocktailrecipes') }}" class="backbtn">{{ "Cocktail Ingredients"|t }}</a></li>
- </ul>
-{% endset %}
+{% set crumbs = [
+ { label: "Cocktail Ingredients"|t, url: url('cocktailrecipes') }
+] %}
{% set content %}
Please sign in to comment.
Something went wrong with that request. Please try again.