Closed Bug 1055432 Opened 10 years ago Closed 6 years ago

[Calendar] Use TemplateLiterals for template markup

Categories

(Firefox OS Graveyard :: Gaia::Calendar, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: kgrandon, Unassigned)

Details

(Keywords: leave-open)

Attachments

(1 file)

We now have the ability to use TemplateLiterals in gaia, woohoo. Using this could clean up a lot of the multi-line templating that the calendar currently does in the js/templates/ folder.
Hi Miller, Evan - I was wondering if you guys could give this a review.

I think it would be nice to use Template Literals in calendar to clean some of the template code up. I wanted to kick us off with porting a single template, then I wanted to check to see if either (or both) of you would like to help port the rest of the templates to use them.

The work is mainly just tedious work, so if you don't have time to do this no worries - I can always find some spare time to tinker and port the rest. Thanks!
Attachment #8475646 - Flags: review?(mmedeiros)
Attachment #8475646 - Flags: review?(evanxd)
Comment on attachment 8475646 [details] [review]
Pull Request - Start using template literals in calendar

Looks good to me.

But Miller seems to have a plan to refactor the template things in Calendar in the future. Probably use requirejs and import html files as templates, so we could remove all js files in the template folder[1].

Miller, how do you think about Kevin's works?

[1] https://github.com/mozilla-b2g/gaia/tree/master/apps/calendar/js/templates
Attachment #8475646 - Flags: review?(evanxd) → feedback+
Kevin, nice work and suggestion!
(In reply to Evan Tseng [:evanxd][:愛聞插低] from comment #2)
> But Miller seems to have a plan to refactor the template things in Calendar
> in the future. Probably use requirejs and import html files as templates, so
> we could remove all js files in the template folder[1].

Do you guys have an ETA on that? I would hope to wait for ES6 modules, but in the meantime if we do this I think it should make the transition easier.
Comment on attachment 8475646 [details] [review]
Pull Request - Start using template literals in calendar

I started the migration to AMD some time ago [1] but never got the time to port all the tests.. I really liked the template literals and think we should "template ALL the strings!!" for now since the migration to the new structure should take a while and that will at least make it easier to update the existing templates. It would be great if we could land all changes for 2.1, that way we have the next weeks to catch regressions and it would be easier to uplift stuff from 2.2 if needed.

 [1] https://github.com/mozilla-b2g/gaia/pull/23091/files

PS: next week should be very busy for me and Gareth, so I don't know if we'll have time to do this for 2.1 S3 (29 Aug) without Evan or Kevin help.
Attachment #8475646 - Flags: review?(mmedeiros) → review+
Landed the first part: https://github.com/mozilla-b2g/gaia/commit/8931e4f5e905bd7c33209384b9ff0087a580df17

Adding leave-open to track the rest of the work here. Sounds like it's up to Evan and myself. I might get to some more of these next week.
Keywords: leave-open
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: