antosdk-apps/Blogger/tags.coffee

63 lines
1.9 KiB
CoffeeScript
Raw Normal View History

2020-05-23 20:09:01 +02:00
Ant = this
2020-06-05 17:45:07 +02:00
class CVSectionListItemTag extends this.OS.GUI.tag.ListViewItemTag
constructor: () ->
super()
2020-05-23 20:09:01 +02:00
2020-06-05 17:45:07 +02:00
ondatachange: () ->
return unless @data
v = @data
2020-05-23 20:09:01 +02:00
nativel = ["content", "start", "end" ]
2020-06-05 17:45:07 +02:00
@closable = v.closable
2020-05-23 20:09:01 +02:00
for k, el of @refs
if v[k] and v[k] isnt ""
if nativel.includes k
$(el).text v[k]
else
2020-06-05 17:45:07 +02:00
el.text = v[k]
reload: () ->
init:() ->
2020-05-23 20:09:01 +02:00
itemlayout: () ->
{ el: "div", children: [
{ el: "afx-label", ref: "title", class: "afx-cv-sec-title" },
{ el: "afx-label", ref: "subtitle", class: "afx-cv-sec-subtitle" },
{ el: "p", ref: "content", class: "afx-cv-sec-content" },
{ el: "p", class: "afx-cv-sec-period", children: [
{ el: "i", ref: "start" },
{ el: "i", ref: "end", class: "period-end" }
] },
{ el: "afx-label", ref: "location", class: "afx-cv-sec-loc" }
] }
2020-06-05 17:45:07 +02:00
this.OS.GUI.tag.define "afx-blogger-cvsection-item", CVSectionListItemTag
2020-05-23 20:09:01 +02:00
2020-06-05 17:45:07 +02:00
class BlogPostListItemTag extends this.OS.GUI.tag.ListViewItemTag
constructor: () ->
super()
2020-05-23 20:09:01 +02:00
2020-06-05 17:45:07 +02:00
ondatachange: (v) ->
return unless @data
v = @data
2020-05-23 20:09:01 +02:00
v.closable = true
2020-06-05 17:45:07 +02:00
@closable = v.closable
@refs.title.text = v.title
@refs.ctimestr.text = __("Created: {0}", v.ctimestr)
@refs.utimestr.text = __("Updated: {0}", v.utimestr)
reload: () ->
init:() ->
2020-05-23 20:09:01 +02:00
itemlayout: () ->
{ el: "div", children: [
{ el: "afx-label", ref: "title", class: "afx-blogpost-title" },
{ el: "afx-label", ref: "ctimestr", class: "blog-dates" },
{ el: "afx-label", ref: "utimestr", class: "blog-dates" },
] }
2020-06-05 17:45:07 +02:00
this.OS.GUI.tag.define "afx-blogger-post-item", BlogPostListItemTag