Browse files

Initial Nitrogen action Rebar template

  • Loading branch information...
1 parent ab35cd4 commit 9acdb11da723d93cf93d1183a4c31a76502aa33f @mbbx6spp committed Apr 29, 2011
Showing with 38 additions and 0 deletions.
  1. +30 −0 nitroaction.erl
  2. +8 −0 nitroaction.template
View
30 nitroaction.erl
@@ -0,0 +1,30 @@
+%%%' HEADER
+%%% @author {{author_name}} <{{author_email}}>
+%%% @copyright {{copyright_year}} {{author_name}}
+%%% @doc Nitrogen action: {{description}}
+%%% @end
+-module({{app_name}}_{{name}}_action).
+-author('{{author_name}} <{{author_email}}>').
+
+-include_lib("nitrogen_core/include/wf.hrl").
+-export([render_action/1]).
+
+%% TODO: Make sure to add record definition to your app's header file.
+
+%%%.
+%%%' NITROGEN CALLBACKS
+
+%% @hidden
+render_action(Record) ->
+ Target = Record#{{name}}_action.target,
+ % TODO change script below to something you want JS to do.
+ Script = "toString()",
+ [wf:f("objs('~s').", [Target], Script)].
+
+%%%.
+%%%' PRIVATE FUNCTIONS
+
+%% TODO: Add private functions for element module here.
+
+%%%.
+%%% vim: set filetype=erlang tabstop=2 foldmarker=%%%',%%%. foldmethod=marker:
View
8 nitroaction.template
@@ -0,0 +1,8 @@
+{variables, [
+ {name, "actionname"},
+ {app_name, "app_name"},
+ {copyright_year, "2011"},
+ {author_name, "Susan Potter"},
+ {author_email,"me@susanpotter.net"}
+]}.
+{template, "nitroaction.erl", "src/{{app_name}}_{{name}}_action.erl"}.

0 comments on commit 9acdb11

Please sign in to comment.