Skip to content
Browse files

Add Nitrogen v2.x element module template

  • Loading branch information...
1 parent 7defeb2 commit a170d0d9665815e906c3c796dc61e09a7e7b65b6 @mbbx6spp committed Feb 13, 2011
Showing with 38 additions and 0 deletions.
  1. +30 −0 nitroelem.erl
  2. +8 −0 nitroelem.template
View
30 nitroelem.erl
@@ -0,0 +1,30 @@
+%%%' HEADER
+%%% @author {{author_name}} <{{author_email}}>
+%%% @copyright {{copyright_year}} {{author_name}}
+%%% @doc Nitrogen element: {{description}}
+%%% @end
+-module({{app_name}}_{{name}}_element).
+-author('{{author_name}} <{{author_email}}>').
+
+-include_lib("nitrogen_core/include/wf.hrl").
+-export(reflect/0, render_element/1).
+
+%% TODO: Make sure to add record definition to your app's header file.
+
+%%%.
+%%%' NITROGEN CALLBACKS
+
+%% @hidden
+reflect() -> record_info(fields, {{app_name}}_{{name}}_element).
+
+%% @hidden
+render_element(Record) ->
+ wf_tags:emit_tag('div', "", [{class, [{{name}}]}]).
+
+%%%.
+%%%' PRIVATE FUNCTIONS
+
+%% TODO: Add private functions for element module here.
+
+%%%.
+%%% vim: set filetype=erlang tabstop=2 foldmarker=%%%',%%%. foldmethod=marker:
View
8 nitroelem.template
@@ -0,0 +1,8 @@
+{variables, [
+ {name, "elementname"},
+ {app_name, "app_name"},
+ {copyright_year, "2011"},
+ {author_name, "Susan Potter"},
+ {author_email,"me@susanpotter.net"}
+]}.
+{template, "nitroelem.erl", "src/{{app_name}}_{{name}}_element.erl"}.

0 comments on commit a170d0d

Please sign in to comment.
Something went wrong with that request. Please try again.