Skip to content

Commit

Permalink
updated templates & controllers for Craft
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamindavid committed Mar 12, 2013
1 parent df41ccb commit a553a9e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CocktailRecipesPlugin.php
Expand Up @@ -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',
);
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/CocktailRecipes_IngredientsController.php
Expand Up @@ -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));
}
}

Expand Down
6 changes: 1 addition & 5 deletions 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 }}
Expand Down
11 changes: 4 additions & 7 deletions templates/ingredients/_edit.html
Expand Up @@ -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 %}
Expand All @@ -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 %}

Expand Down

0 comments on commit a553a9e

Please sign in to comment.