123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- -module(element_input_time).
- %%-author('Vladimir Galunshchikov').
- -include_lib("nitro/include/nitro.hrl").
- -export([
- render_element/1
- ]).
- render_element(Record) ->
- Id = case Record#input_time.postback of
- undefined -> Record#input_time.id;
- Postback ->
- ID0 = case Record#input_time.id of
- undefined -> nitro:temp_id();
- I -> I
- end,
- nitro:wire( #event{type = click, postback = Postback, target = ID0,
- source = Record#input_time.source, delegate = Record#input_time.delegate} ),
- ID0
- end,
- List = [
- %% global
- {<<"accesskey">>, Record#input_time.accesskey},
- {<<"class">>, Record#input_time.class},
- {<<"contenteditable">>,
- case Record#input_time.contenteditable of
- true -> "true";
- false -> "false";
- _ -> undefined
- end},
-
- {<<"contextmenu">>, Record#input_time.contextmenu},
- {<<"dir">>,
- case Record#input_time.dir of
- "ltr" -> "ltr";
- "rtl" -> "rtl";
- "auto" -> "auto";
- _ -> undefined
- end},
-
- {<<"draggable">>,
- case Record#input_time.draggable of
- true -> "true";
- false -> "false";
- _ -> undefined
- end},
-
- {<<"dropzone">>, Record#input_time.dropzone},
- {<<"hidden">>,
- case Record#input_time.hidden of
- "hidden" -> "hidden";
- _ -> undefined
- end},
-
- {<<"id">>, Id},
- {<<"lang">>, Record#input_time.lang},
- {<<"spellcheck">>,
- case Record#input_time.spellcheck of
- true -> "true";
- false -> "false";
- _ -> undefined
- end},
-
- {<<"style">>, Record#input_time.style},
- {<<"tabindex">>, Record#input_time.tabindex},
- {<<"title">>, Record#input_time.title},
- {<<"translate">>,
- case Record#input_time.contenteditable of
- "yes" -> "yes";
- "no" -> "no";
- _ -> undefined
- end},
-
- %% spec
- {<<"autocomplete">>,
- case Record#input_time.autocomplete of
- true -> "on";
- false -> "off";
- _ -> undefined
- end},
-
- {<<"autofocus">>,
- case Record#input_time.autofocus of
- true -> "autofocus";
- _ -> undefined
- end},
-
- {<<"disabled">>,
- case Record#input_time.disabled of
- true -> "disabled";
- _ -> undefined
- end},
-
- {<<"form">>, Record#input_time.form},
- {<<"list">>, Record#input_time.list},
- {<<"max">>, Record#input_time.max},
- {<<"min">>, Record#input_time.min},
- {<<"name">>, Record#input_time.name},
- {<<"readonly">>,
- case Record#input_time.readonly of
- true -> "readonly";
- _ -> undefined
- end},
-
- {<<"required">>,
- case Record#input_time.required of
- true -> "required";
- _ -> undefined
- end},
-
- {<<"step">>, Record#input_time.step},
- {<<"type">>, <<"time">>},
- {<<"value">>, Record#input_time.value} | Record#input_time.data_fields
- ],
-
- wf_tags:emit_tag(<<"input">>, nitro:render(Record#input_time.body), List).
|