forked from mbbx6spp/rebar-templates
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Nitrogen action Rebar template
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"}. |