Permalink
Browse files

Adapt elements to new lib structure.

  • Loading branch information...
1 parent 70891dd commit 4fefd20c9285c808090dbd89988d52a712a02507 @kaos kaos committed May 31, 2009
Showing with 30 additions and 0 deletions.
  1. +30 −0 src/element_tabs/element_link_x.erl
@@ -0,0 +1,30 @@
+% Nitrogen Web Framework for Erlang
+% Copyright (c) 2008-2009 Rusty Klophaus
+% See MIT-LICENSE for licensing information.
+
+%% This element is only needed until the title attribute is supported by nitrogens #link
+
+-module (element_link_x).
+-include ("nitrogen_elements.hrl").
+-compile(export_all).
+
+reflect() -> record_info(fields, link).
+
+render(ControlID, Record) ->
+ case Record#link_x.postback of
+ undefined -> ok;
+ Postback -> wf:wire(ControlID, #event { type=click, postback=Postback })
+ end,
+
+ Content = [
+ wf:html_encode(Record#link_x.text, Record#link_x.html_encode),
+ wf:render(Record#link_x.body)
+ ],
+
+ wf_tags:emit_tag(a, Content, [
+ {id, ControlID},
+ {href, Record#link_x.url},
+ {class, [link, Record#link_x.class]},
+ {style, Record#link_x.style},
+ {title, wf:html_encode(Record#link_x.title, Record#link_x.html_encode)}
+ ]).

0 comments on commit 4fefd20

Please sign in to comment.