Current section
10 Versions
Jump to
Current section
10 Versions
Compare versions
4
files changed
+11
additions
-11
deletions
| @@ -18,23 +18,23 @@ Add `transponder` to your list of dependencies in `mix.exs`: | |
| 18 18 | ```elixir |
| 19 19 | def deps do |
| 20 20 | [ |
| 21 | - {:transponder, "~> 0.1.0"} |
| 21 | + {:transponder, "~> 0.2"} |
| 22 22 | ] |
| 23 23 | end |
| 24 24 | ``` |
| 25 25 | |
| 26 | - Add `use Transponder` to your controllers, and define actions with `action`: |
| 26 | + Add `use Transponder` to your controllers, and define actions with `defaction`: |
| 27 27 | |
| 28 28 | ```elixir |
| 29 29 | defmodule MyAppWeb.Admin.ProductsController do |
| 30 30 | use MyAppWeb, :controller |
| 31 31 | use Transponder, format: Transponder.JSON |
| 32 32 | |
| 33 | - action :index, &Catalog.list_products(&1.params) |
| 34 | - action :show, &Catalog.get_product(&1.params) |
| 35 | - action :create, &Catalog.create_product(&1.params["product"]) |
| 36 | - action :update, &Catalog.update_product(&1.params["id"], &1.params["product"]) |
| 37 | - action :delete, &Catalog.delete_product(&1.params["id"]) |
| 33 | + defaction :index, &Catalog.list_products(&1.params) |
| 34 | + defaction :show, &Catalog.get_product(&1.params) |
| 35 | + defaction :create, &Catalog.create_product(&1.params["product"]) |
| 36 | + defaction :update, &Catalog.update_product(&1.params["id"], &1.params["product"]) |
| 37 | + defaction :delete, &Catalog.delete_product(&1.params["id"]) |
| 38 38 | end |
| 39 39 | ``` |
| 40 40 | |
| @@ -71,7 +71,7 @@ defmodule MayAppWeb.Admin.ProductController do | |
| 71 71 | use MyAppWeb, :controller |
| 72 72 | use Transponder, format: Transponder.HTML |
| 73 73 | |
| 74 | - # action ... |
| 74 | + # defaction ... |
| 75 75 | end |
| 76 76 | ``` |
| @@ -31,4 +31,4 @@ | |
| 31 31 | {<<"optional">>,false}, |
| 32 32 | {<<"repository">>,<<"hexpm">>}, |
| 33 33 | {<<"requirement">>,<<"~> 1.2">>}]]}. |
| 34 | - {<<"version">>,<<"0.2.1">>}. |
| 34 | + {<<"version">>,<<"0.2.2">>}. |
| @@ -13,7 +13,7 @@ defmodule Transponder do | |
| 13 13 | end |
| 14 14 | end |
| 15 15 | |
| 16 | - defmacro action(name, fun) do |
| 16 | + defmacro defaction(name, fun) do |
| 17 17 | quote do |
| 18 18 | def unquote(name)(conn, params) do |
| 19 19 | data = %{conn: conn, params: params, assigns: conn.assigns} |
| @@ -4,7 +4,7 @@ defmodule Transponder.MixProject do | |
| 4 4 | def project do |
| 5 5 | [ |
| 6 6 | app: :transponder, |
| 7 | - version: "0.2.1", |
| 7 | + version: "0.2.2", |
| 8 8 | elixir: "~> 1.9", |
| 9 9 | start_permanent: Mix.env() == :prod, |
| 10 10 | description: "DSL for declarative Phoenix controllers", |