Permalink
Browse files

Restructure code to be usable as an erlang lib out-of-the-box.

  • Loading branch information...
1 parent 6347ae7 commit d86fae03be8d91b1ab58e1a61bb5237074c5004b @kaos kaos committed May 30, 2009
View
4 .gitignore
@@ -0,0 +1,4 @@
+*.beam
+*~
+\#*\#
+test/logs/*
View
8 Emakefile
@@ -0,0 +1,8 @@
+{'src/*', [
+ {i, "include"},
+ {outdir, 'ebin'}
+ ]}.
+{'src/element_tabs/*.erl', [
+ {i, 'include'},
+ {outdir, 'ebin'}
+ ]}.
View
2 Makefile
@@ -0,0 +1,2 @@
+all:
+ erl -make
View
2 README
@@ -1,2 +0,0 @@
-* in order to use the elements, take out the record definition and put it into your .hrl file.
-
View
7 README.md
@@ -0,0 +1,7 @@
+# Nitrogen Elements #
+
+The simpler elements may be used as-is when nitrogen-elements is installed as an erlang lib (i.e. in the erlang libs path).
+
+The tabs control needs some additional changes to the javascript and css code.
+For the time being, these changes needs to be applied manually.
+
View
0 ebin/.keep
No changes.
View
23 include/nitrogen_elements.hrl
@@ -0,0 +1,23 @@
+
+-include_lib("nitrogen/include/wf.inc").
+
+%% Elements
+-record(force_reload_on_back_button, {?ELEMENT_BASE(element_force_reload_on_back_button)}).
+-record(image_x, {?ELEMENT_BASE(element_image_x), image, alt, width, height, usemap}).
+-record(textarea_x, {?ELEMENT_BASE(element_textarea_x), text="", html_encode=true, rows=2, columns=20}).
+-record(tabs, {?ELEMENT_BASE(element_tabs), tabs=[], options=[], tag}).
+-record(tab, {id=wf:temp_id(), title="No Title", body=[], tag, url}).
+
+%% Actions
+-record(tab_destroy, {?ACTION_BASE(action_tabs_methods)}).
+-record(tab_disable, {?ACTION_BASE(action_tabs_methods), tab=-1}).
+-record(tab_enable, {?ACTION_BASE(action_tabs_methods), tab=-1}).
+-record(tab_option, {?ACTION_BASE(action_tabs_methods), key, value}).
+-record(tab_add, {?ACTION_BASE(action_tabs_methods), url, label, index}).
+-record(tab_remove, {?ACTION_BASE(action_tabs_methods), tab}).
+-record(tab_select, {?ACTION_BASE(action_tabs_methods), tab}).
+-record(tab_load, {?ACTION_BASE(action_tabs_methods), tab}).
+-record(tab_url, {?ACTION_BASE(action_tabs_methods), tab, url}).
+%-record(tab_length, {?ACTION_BASE(action_tabs_methods)}).
+-record(tab_abort, {?ACTION_BASE(action_tabs_methods)}).
+-record(tab_rotate, {?ACTION_BASE(action_tabs_methods), ms, continuing=false}).
View
4 element_force_reload_on_back_button.erl → src/element_force_reload_on_back_button.erl
@@ -1,8 +1,8 @@
-module(element_force_reload_on_back_button).
-compile(export_all).
--include_lib("lib/nitrogen/include/wf.inc").
--record(force_reload_on_back_button, {?ELEMENT_BASE(element_force_reload_on_back_button)}).
+-include("nitrogen_elements.hrl").
+% -record(force_reload_on_back_button, {?ELEMENT_BASE(element_force_reload_on_back_button)}).
reflect() -> record_info(fields, force_reload_on_back_button).
View
4 element_image_x.erl → src/element_image_x.erl
@@ -1,8 +1,8 @@
-module(element_image_x).
-compile(export_all).
--include_lib("lib/nitrogen/include/wf.inc").
--record(image_x, {?ELEMENT_BASE(element_image_x), image, alt, width, height, usemap}).
+-include("nitrogen_elements.hrl").
+%% -record(image_x, {?ELEMENT_BASE(element_image_x), image, alt, width, height, usemap}).
% desc: this enhance the basic image element, mostly for using 'usemap' tag
% it also allow adding inline width/height to the iamge
View
0 element_tabs/README → src/element_tabs/README
File renamed without changes.
View
2 element_tabs/action_tabs_methods.erl → src/element_tabs/action_tabs_methods.erl
@@ -3,7 +3,7 @@
% See MIT-LICENSE for licensing information.
-module(action_tabs_methods).
--include("wf.inc").
+-include("nitrogen_elements.hrl").
-compile(export_all).
render_action(_TriggerPath, TargetPath, Record) ->
View
0 element_tabs/diff.patch → src/element_tabs/diff.patch
File renamed without changes.
View
2 element_tabs/element_tabs.erl → src/element_tabs/element_tabs.erl
@@ -3,7 +3,7 @@
% See MIT-LICENSE for licensing information.
-module (element_tabs).
--include ("wf.inc").
+-include ("nitrogen_elements.hrl").
-compile(export_all).
reflect() -> record_info(fields, tabs).
View
0 element_tabs/elements.css → src/element_tabs/elements.css
File renamed without changes.
View
0 element_tabs/nitrogen.js → src/element_tabs/nitrogen.js
File renamed without changes.
View
0 element_tabs/style.css → src/element_tabs/style.css
File renamed without changes.
View
0 element_tabs/tabs.txt → src/element_tabs/tabs.txt
File renamed without changes.
View
0 element_tabs/web_samples_tabs.erl → src/element_tabs/web_samples_tabs.erl
File renamed without changes.
View
4 element_textarea_x.erl → src/element_textarea_x.erl
@@ -1,8 +1,8 @@
-module(element_textarea_x).
-compile(export_all).
--include_lib("lib/nitrogen/include/wf.inc").
--record(textarea_x, {?ELEMENT_BASE(element_textarea_x), text="", html_encode=true, rows=2, columns=20}).
+-include("nitrogen_elements.hrl").
+%% -record(textarea_x, {?ELEMENT_BASE(element_textarea_x), text="", html_encode=true, rows=2, columns=20}).
% desc: enhance the basic textarea with inline cols/rows values

0 comments on commit d86fae0

Please sign in to comment.