Re: [Dev] [UUF] Convert a timestamp in long format to readable format in HBS.

2016-06-24 Thread Manuranga Perera
Hi Hemika,

Converting from long to string should happen on client side. Otherwise we
will display times in server time zone, which is not useful. You should
always record time in long UTC and send to the client in long. UTC to
current time-zone conversion should happen at client as follows.

var d = new Date(132433920);

Additionally if the time is close to the current date you can show the
difference for better UX [1]

[1] https://github.com/odyniec/tinyAgo-js/blob/master/tinyAgo.js

On Fri, Jun 24, 2016 at 1:50 AM, Rasika Perera  wrote:

> Hi Hemika,
>
> I have a list of java objects that I am returning from the server side JS
>> where the object has a timestamp property in long format(milliseconds), in
>> that case I will have to iterate the list and get the timestamp of each
>> object and store them in another list/map and return that separately.
>
> I think this is not specific to the UUF. Even when you are using JSPs you
> have to convert your data model into view model. You may also need to
> prettify data fields such as capitalising first letter etc.
>
> Is it the correct way to do ?
>
> I think you need to retrieve the list/map from the backend(data model) and
> iterate through the fields. When iterating If it is a map, you can make
> changes and store back in the same map and return it(view model) into the
> HBS context.
>
> Regards,
> Rasika
>
> On Fri, Jun 24, 2016 at 10:32 AM, Hemika Kodikara  wrote:
>
>> Hi Rasika,
>>
>> I have a list of java objects that I am returning from the server side JS
>> where the object has a timestamp property in long format(milliseconds), in
>> that case I will have to iterate the list and get the timestamp of each
>> object and store them in another list/map and return that separately.
>>
>> Is it the correct way to do ?
>>
>> Regards,
>> Hemika
>>
>>
>> Hemika Kodikara
>> Software Engineer
>> WSO2 Inc.
>> lean . enterprise . middleware
>> http://wso2.com
>>
>> Mobile : +9477762
>>
>> On Fri, Jun 24, 2016 at 7:01 AM, Rasika Perera  wrote:
>>
>>> Really ?
 Rasika/Sajith, did you guys implement a way to plug-in helpers?
 I don't believe we should have app specific custom helpers, it makes
 code hard to understand for someone who is not from that team. I believe we
 should use the 'toViewModel' function to do any rendering specific
 conversions. But if there are helpers that is used platform-wide they
 should be implemented/imported by UUF team.
>>>
>>> ​We did not expose handlebar environment into the
>>> controller(serversideJs). Thus, I don't think App developers can register
>>> their handlebar custom-helpers into ​HBS.
>>>
>>> You can process the timestamp in long format to readable format in js
 side and return that to display in hbs.
>>>
>>> ​+1. ​This is the recommended approach.
>>>
>>>
>>> On Fri, Jun 24, 2016 at 1:03 AM, Manuranga Perera  wrote:
>>>
 Yeah, there is a way to write custom helpers in HBS and we can use it
> by registering the helper in HBS.


 Really ?
 Rasika/Sajith, did you guys implement a way to plug-in helpers?

 I don't believe we should have app specific custom helpers, it makes
 code hard to understand for someone who is not from that team. I believe we
 should use the 'toViewModel' function to do any rendering specific
 conversions. But if there are helpers that is used platform-wide they
 should be implemented/imported by UUF team.

 --
 With regards,
 *Manu*ranga Perera.

 phone : 071 7 70 20 50
 mail : m...@wso2.com

>>>
>>>
>>>
>>> --
>>> With Regards,
>>>
>>> *Rasika Perera*
>>> Software Engineer
>>> M: +94 71 680 9060 E: rasi...@wso2.com
>>> LinkedIn: http://lk.linkedin.com/in/rasika90
>>>
>>> WSO2 Inc. www.wso2.com
>>> lean.enterprise.middleware
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>
>
> --
> With Regards,
>
> *Rasika Perera*
> Software Engineer
> M: +94 71 680 9060 E: rasi...@wso2.com
> LinkedIn: http://lk.linkedin.com/in/rasika90
>
> WSO2 Inc. www.wso2.com
> lean.enterprise.middleware
>



-- 
With regards,
*Manu*ranga Perera.

phone : 071 7 70 20 50
mail : m...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF] Convert a timestamp in long format to readable format in HBS.

2016-06-23 Thread Rasika Perera
Hi Hemika,

I have a list of java objects that I am returning from the server side JS
> where the object has a timestamp property in long format(milliseconds), in
> that case I will have to iterate the list and get the timestamp of each
> object and store them in another list/map and return that separately.

I think this is not specific to the UUF. Even when you are using JSPs you
have to convert your data model into view model. You may also need to
prettify data fields such as capitalising first letter etc.

Is it the correct way to do ?

I think you need to retrieve the list/map from the backend(data model) and
iterate through the fields. When iterating If it is a map, you can make
changes and store back in the same map and return it(view model) into the
HBS context.

Regards,
Rasika

On Fri, Jun 24, 2016 at 10:32 AM, Hemika Kodikara  wrote:

> Hi Rasika,
>
> I have a list of java objects that I am returning from the server side JS
> where the object has a timestamp property in long format(milliseconds), in
> that case I will have to iterate the list and get the timestamp of each
> object and store them in another list/map and return that separately.
>
> Is it the correct way to do ?
>
> Regards,
> Hemika
>
>
> Hemika Kodikara
> Software Engineer
> WSO2 Inc.
> lean . enterprise . middleware
> http://wso2.com
>
> Mobile : +9477762
>
> On Fri, Jun 24, 2016 at 7:01 AM, Rasika Perera  wrote:
>
>> Really ?
>>> Rasika/Sajith, did you guys implement a way to plug-in helpers?
>>> I don't believe we should have app specific custom helpers, it makes
>>> code hard to understand for someone who is not from that team. I believe we
>>> should use the 'toViewModel' function to do any rendering specific
>>> conversions. But if there are helpers that is used platform-wide they
>>> should be implemented/imported by UUF team.
>>
>> ​We did not expose handlebar environment into the
>> controller(serversideJs). Thus, I don't think App developers can register
>> their handlebar custom-helpers into ​HBS.
>>
>> You can process the timestamp in long format to readable format in js
>>> side and return that to display in hbs.
>>
>> ​+1. ​This is the recommended approach.
>>
>>
>> On Fri, Jun 24, 2016 at 1:03 AM, Manuranga Perera  wrote:
>>
>>> Yeah, there is a way to write custom helpers in HBS and we can use it by
 registering the helper in HBS.
>>>
>>>
>>> Really ?
>>> Rasika/Sajith, did you guys implement a way to plug-in helpers?
>>>
>>> I don't believe we should have app specific custom helpers, it makes
>>> code hard to understand for someone who is not from that team. I believe we
>>> should use the 'toViewModel' function to do any rendering specific
>>> conversions. But if there are helpers that is used platform-wide they
>>> should be implemented/imported by UUF team.
>>>
>>> --
>>> With regards,
>>> *Manu*ranga Perera.
>>>
>>> phone : 071 7 70 20 50
>>> mail : m...@wso2.com
>>>
>>
>>
>>
>> --
>> With Regards,
>>
>> *Rasika Perera*
>> Software Engineer
>> M: +94 71 680 9060 E: rasi...@wso2.com
>> LinkedIn: http://lk.linkedin.com/in/rasika90
>>
>> WSO2 Inc. www.wso2.com
>> lean.enterprise.middleware
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>


-- 
With Regards,

*Rasika Perera*
Software Engineer
M: +94 71 680 9060 E: rasi...@wso2.com
LinkedIn: http://lk.linkedin.com/in/rasika90

WSO2 Inc. www.wso2.com
lean.enterprise.middleware
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF] Convert a timestamp in long format to readable format in HBS.

2016-06-23 Thread Hemika Kodikara
Hi Rasika,

I have a list of java objects that I am returning from the server side JS
where the object has a timestamp property in long format(milliseconds), in
that case I will have to iterate the list and get the timestamp of each
object and store them in another list/map and return that separately.

Is it the correct way to do ?

Regards,
Hemika


Hemika Kodikara
Software Engineer
WSO2 Inc.
lean . enterprise . middleware
http://wso2.com

Mobile : +9477762

On Fri, Jun 24, 2016 at 7:01 AM, Rasika Perera  wrote:

> Really ?
>> Rasika/Sajith, did you guys implement a way to plug-in helpers?
>> I don't believe we should have app specific custom helpers, it makes code
>> hard to understand for someone who is not from that team. I believe we
>> should use the 'toViewModel' function to do any rendering specific
>> conversions. But if there are helpers that is used platform-wide they
>> should be implemented/imported by UUF team.
>
> ​We did not expose handlebar environment into the
> controller(serversideJs). Thus, I don't think App developers can register
> their handlebar custom-helpers into ​HBS.
>
> You can process the timestamp in long format to readable format in js side
>> and return that to display in hbs.
>
> ​+1. ​This is the recommended approach.
>
>
> On Fri, Jun 24, 2016 at 1:03 AM, Manuranga Perera  wrote:
>
>> Yeah, there is a way to write custom helpers in HBS and we can use it by
>>> registering the helper in HBS.
>>
>>
>> Really ?
>> Rasika/Sajith, did you guys implement a way to plug-in helpers?
>>
>> I don't believe we should have app specific custom helpers, it makes code
>> hard to understand for someone who is not from that team. I believe we
>> should use the 'toViewModel' function to do any rendering specific
>> conversions. But if there are helpers that is used platform-wide they
>> should be implemented/imported by UUF team.
>>
>> --
>> With regards,
>> *Manu*ranga Perera.
>>
>> phone : 071 7 70 20 50
>> mail : m...@wso2.com
>>
>
>
>
> --
> With Regards,
>
> *Rasika Perera*
> Software Engineer
> M: +94 71 680 9060 E: rasi...@wso2.com
> LinkedIn: http://lk.linkedin.com/in/rasika90
>
> WSO2 Inc. www.wso2.com
> lean.enterprise.middleware
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF] Convert a timestamp in long format to readable format in HBS.

2016-06-23 Thread Rasika Perera
>
> Really ?
> Rasika/Sajith, did you guys implement a way to plug-in helpers?
> I don't believe we should have app specific custom helpers, it makes code
> hard to understand for someone who is not from that team. I believe we
> should use the 'toViewModel' function to do any rendering specific
> conversions. But if there are helpers that is used platform-wide they
> should be implemented/imported by UUF team.

​We did not expose handlebar environment into the controller(serversideJs).
Thus, I don't think App developers can register their handlebar
custom-helpers into ​HBS.

You can process the timestamp in long format to readable format in js side
> and return that to display in hbs.

​+1. ​This is the recommended approach.


On Fri, Jun 24, 2016 at 1:03 AM, Manuranga Perera  wrote:

> Yeah, there is a way to write custom helpers in HBS and we can use it by
>> registering the helper in HBS.
>
>
> Really ?
> Rasika/Sajith, did you guys implement a way to plug-in helpers?
>
> I don't believe we should have app specific custom helpers, it makes code
> hard to understand for someone who is not from that team. I believe we
> should use the 'toViewModel' function to do any rendering specific
> conversions. But if there are helpers that is used platform-wide they
> should be implemented/imported by UUF team.
>
> --
> With regards,
> *Manu*ranga Perera.
>
> phone : 071 7 70 20 50
> mail : m...@wso2.com
>



-- 
With Regards,

*Rasika Perera*
Software Engineer
M: +94 71 680 9060 E: rasi...@wso2.com
LinkedIn: http://lk.linkedin.com/in/rasika90

WSO2 Inc. www.wso2.com
lean.enterprise.middleware
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF] Convert a timestamp in long format to readable format in HBS.

2016-06-23 Thread Manuranga Perera
>
> Yeah, there is a way to write custom helpers in HBS and we can use it by
> registering the helper in HBS.


Really ?
Rasika/Sajith, did you guys implement a way to plug-in helpers?

I don't believe we should have app specific custom helpers, it makes code
hard to understand for someone who is not from that team. I believe we
should use the 'toViewModel' function to do any rendering specific
conversions. But if there are helpers that is used platform-wide they
should be implemented/imported by UUF team.

-- 
With regards,
*Manu*ranga Perera.

phone : 071 7 70 20 50
mail : m...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF] Convert a timestamp in long format to readable format in HBS.

2016-06-23 Thread Sudharma Subasinghe
Yeah, there is a way to write custom helpers in HBS and we can use it by
registering the helper in HBS.

On Thu, Jun 23, 2016 at 3:56 PM, Hemika Kodikara  wrote:

> *Also is there a way to plug custom helpers ?
>
> Hemika Kodikara
> Software Engineer
> WSO2 Inc.
> lean . enterprise . middleware
> http://wso2.com
>
> Mobile : +9477762
>
> On Thu, Jun 23, 2016 at 3:06 PM, Hemika Kodikara  wrote:
>
>> Hi All,
>>
>> Is there a way to do $subject ?
>>
>> Also is there to plug custom helpers ? and also can we add all the
>> supported helpers to [1] including the ones coming from jnack.
>>
>> [1] - https://docs.wso2.com/display/UUF100/Helpers
>>
>> Regards,
>> Hemika
>>
>> Hemika Kodikara
>> Software Engineer
>> WSO2 Inc.
>> lean . enterprise . middleware
>> http://wso2.com
>>
>> Mobile : +9477762
>>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sudharma Subasinghe,
Software Engineer,
WSO2 Inc.
Email: sudhar...@wso2.com 
Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF] Convert a timestamp in long format to readable format in HBS.

2016-06-23 Thread Hemika Kodikara
*Also is there a way to plug custom helpers ?

Hemika Kodikara
Software Engineer
WSO2 Inc.
lean . enterprise . middleware
http://wso2.com

Mobile : +9477762

On Thu, Jun 23, 2016 at 3:06 PM, Hemika Kodikara  wrote:

> Hi All,
>
> Is there a way to do $subject ?
>
> Also is there to plug custom helpers ? and also can we add all the
> supported helpers to [1] including the ones coming from jnack.
>
> [1] - https://docs.wso2.com/display/UUF100/Helpers
>
> Regards,
> Hemika
>
> Hemika Kodikara
> Software Engineer
> WSO2 Inc.
> lean . enterprise . middleware
> http://wso2.com
>
> Mobile : +9477762
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF] Convert a timestamp in long format to readable format in HBS.

2016-06-23 Thread Sudharma Subasinghe
Hi Hemika,

You can process the timestamp in long format to readable format in js side
and return that to display in hbs.

Thanks
Sudharma



On Thu, Jun 23, 2016 at 3:06 PM, Hemika Kodikara  wrote:

> Hi All,
>
> Is there a way to do $subject ?
>
> Also is there to plug custom helpers ? and also can we add all the
> supported helpers to [1] including the ones coming from jnack.
>
> [1] - https://docs.wso2.com/display/UUF100/Helpers
>
> Regards,
> Hemika
>
> Hemika Kodikara
> Software Engineer
> WSO2 Inc.
> lean . enterprise . middleware
> http://wso2.com
>
> Mobile : +9477762
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sudharma Subasinghe,
Software Engineer,
WSO2 Inc.
Email: sudhar...@wso2.com 
Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [UUF] Convert a timestamp in long format to readable format in HBS.

2016-06-23 Thread Hemika Kodikara
Hi All,

Is there a way to do $subject ?

Also is there to plug custom helpers ? and also can we add all the
supported helpers to [1] including the ones coming from jnack.

[1] - https://docs.wso2.com/display/UUF100/Helpers

Regards,
Hemika

Hemika Kodikara
Software Engineer
WSO2 Inc.
lean . enterprise . middleware
http://wso2.com

Mobile : +9477762
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev