element_summary.erl 1.4 KB

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