12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- -module(element_command).
- %%-author('Vladimir Galunshchikov').
- -include_lib("nitro/include/nitro.hrl").
- -export([
- render_element/1
- ]).
- render_element(Record) ->
- List = [
- %% global
- {<<"accesskey">>, Record#command.accesskey},
- {<<"class">>, Record#command.class},
- {<<"contenteditable">>,
- case Record#command.contenteditable of
- true -> "true";
- false -> "false";
- _ -> undefined
- end},
-
- {<<"contextmenu">>, Record#command.contextmenu},
- {<<"dir">>,
- case Record#command.dir of
- "ltr" -> "ltr";
- "rtl" -> "rtl";
- "auto" -> "auto";
- _ -> undefined
- end},
-
- {<<"draggable">>,
- case Record#command.draggable of
- true -> "true";
- false -> "false";
- _ -> undefined
- end},
-
- {<<"dropzone">>, Record#command.dropzone},
- {<<"hidden">>,
- case Record#command.hidden of
- "hidden" -> "hidden";
- _ -> undefined
- end},
-
- {<<"id">>, Record#command.id},
- {<<"lang">>, Record#command.lang},
- {<<"spellcheck">>,
- case Record#command.spellcheck of
- true -> "true";
- false -> "false";
- _ -> undefined
- end},
-
- {<<"style">>, Record#command.style},
- {<<"tabindex">>, Record#command.tabindex},
- {<<"title">>, Record#command.title},
- {<<"translate">>,
- case Record#command.contenteditable of
- "yes" -> "yes";
- "no" -> "no";
- _ -> undefined
- end},
-
- %% spec
- {<<"disabled">>,
- case Record#command.disabled of
- true -> "disabled";
- _ -> undefined
- end},
-
- {<<"icon">>, Record#command.icon},
- {<<"label">>, Record#command.label},
- {<<"radiogroup">>, Record#command.radiogroup},
- {<<"type">>,
- case Record#command.type of
- "command" -> "command";
- "radio" -> "radio";
- "checkbox" -> "checkbox";
- _ -> undefined
- end} | Record#command.data_fields
- ],
-
- wf_tags:emit_tag(<<"command">>, List).
|