#24 [GSoC] Proper naming in calendar
Merged 4 years ago by a2batic. Opened 4 years ago by manaswinidas.
manaswinidas/Fedora-app calendar  into  master

@@ -16,6 +16,20 @@ 

  const DATE_FORMAT = 'dddd, MMMM Do YYYY';

  const TIME_FORMAT = 'h:mm a z';

  

+ /*

+   Convert title to capital case, but skip special names like FESCo, FAmSCo, i18n

+ */

+ function calendarNameToDisplayName(name:string) :string {

+   switch(name) {

+     case 'i18n':

+       return 'i18n';

+     case 'fesco':

+       return 'FESCo';

+     default:

+       return /^[A-Z][^\d-]*.*$/.test(name) ? name : _.startCase(name);

+   }

+ 

+ }

  

  /*

    Generated class for the FedoCal provider.
@@ -44,7 +58,7 @@ 

            this.calendars = _.map(data.calendars, c => {

              return {

                real_name: c.calendar_name,

-               display_name: _.camelCase(c.calendar_name),

+               display_name: calendarNameToDisplayName(c.calendar_name),

                description: c.calendar_description,

                contact: c.calendar_contact,

              };
@@ -103,3 +117,4 @@ 

  function dateToMoment(date, time, timezone) {

    return moment.tz(date + 'T' + time + 'Z', timezone).tz('Etc/UTC');

  }

+  

Takes care of proper naming in calendar, converts title to Capital Case and also takes care of exceptions.
Fixes #18

Looks good to me. Also, please add a condition for 'FESCo' too.

@a2batic The condition for regular expression covers 'FESCo' I thought.

@manaswinidas, actually API is itself sending it as 'fesco', thats why regex is not handling it, but it should be displayed as 'FESCo'.

2 new commits added

  • [GSoC]Proper naming in calendar
  • [GSoC]Proper naming in calendar
4 years ago

rebased onto 96fee6f91682d6f8056d4a144ef7962660eb4dc4

4 years ago

rebased onto 08ffbac

4 years ago

I have made the necessary changes.

Pull-Request has been merged by a2batic

4 years ago
Metadata