element_summary.erl 1.4 KB

12345678910111213141516171819202122232425
  1. -module(element_summary).
  2. -author('Vladimir Galunshchikov').
  3. -include_lib("nitro/include/nitro.hrl").
  4. -compile(export_all).
  5. render_element(Record) ->
  6. List = [
  7. %global
  8. {<<"accesskey">>, Record#summary.accesskey},
  9. {<<"class">>, Record#summary.class},
  10. {<<"contenteditable">>, case Record#summary.contenteditable of true -> "true"; false -> "false"; _ -> undefined end},
  11. {<<"contextmenu">>, Record#summary.contextmenu},
  12. {<<"dir">>, case Record#summary.dir of "ltr" -> "ltr"; "rtl" -> "rtl"; "auto" -> "auto"; _ -> undefined end},
  13. {<<"draggable">>, case Record#summary.draggable of true -> "true"; false -> "false"; _ -> undefined end},
  14. {<<"dropzone">>, Record#summary.dropzone},
  15. {<<"hidden">>, case Record#summary.hidden of "hidden" -> "hidden"; _ -> undefined end},
  16. {<<"id">>, Record#summary.id},
  17. {<<"lang">>, Record#summary.lang},
  18. {<<"spellcheck">>, case Record#summary.spellcheck of true -> "true"; false -> "false"; _ -> undefined end},
  19. {<<"style">>, Record#summary.style},
  20. {<<"tabindex">>, Record#summary.tabindex},
  21. {<<"title">>, Record#summary.title},
  22. {<<"translate">>, case Record#summary.contenteditable of "yes" -> "yes"; "no" -> "no"; _ -> undefined end} | Record#summary.data_fields
  23. ],
  24. wf_tags:emit_tag(<<"summary">>, nitro:render(case Record#summary.body of undefined -> []; B -> B end), List).