Glad that it mostly works for you.

It's better not to inject JavaScript there, but rather to provide
JavaScript methods through a TemplateHook or as part of a JSExtension's
constructor.

Christian

On Mon, Jan 29, 2018 at 3:58 AM, Meng-Zhe Zhang <mengzhezh...@gmail.com>
wrote:

> Hi, Christian. Thank you for your reply.
>
> I add format_html() to as_html, and it worked as expected for regular text
> areas.
>
>
> PS:
> Actually, I injected some javascript into as_html() on purpose, and this
> does not work well with format_html().
>
> I need to exchange information between RB & Jenkins site, and couldn't get
> webhook to work due to authentication issues.
>
> So I just installed jenkinsapi package in python , and handled everything
> in as_html() to return dynamically-generated javascript.
>
> Now I have to find another way to do this...
>
>
> But still, format_html() works well. Thanks.
>
>
> MZZ
>
> Meng-Zhe Zhang於 2018年1月25日星期四 UTC+8下午11時51分18秒寫道:
>
>> Hi all.
>>
>> I wrote an extension to add custom links on review pages by overwriting
>> the as_html() method of BaseReviewRequestField object:
>>
>>
>> class JenkinsLinkField(BaseReviewRequestField):
>>     field_id = 'jenkins_link'
>>     label = 'link'
>>
>>     def as_html(self):
>>         # example code
>>         return "<a href=%s>link</a>" % some_url
>>
>>
>> and this works fine on version 2.5.7.
>>
>> After upgrading to 3.0.1, it seems that the html content are now rendered
>> as plain text, and the links no longer work.
>>
>> I compared the implementation of BaseReviewRequestField in different
>> versions, but have no clue which part to look at.
>>
>>
>> My questions are:
>>
>> 1. Which property of the BaseReviewRequestField object should I adjust so
>> it can be rendered as html, not plain text?
>>
>> 2. Or, is there any other ways to add content-related links on review
>> pages?
>>
>>
>>
>> Thanks for your answer.
>>
>> MZZ
>> 2018/01/25
>>
> --
> Supercharge your Review Board with Power Pack:
> https://www.reviewboard.org/powerpack/
> Want us to host Review Board for you? Check out RBCommons:
> https://rbcommons.com/
> Happy user? Let us know! https://www.reviewboard.org/users/
> ---
> You received this message because you are subscribed to the Google Groups
> "Review Board Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Christian Hammond
President/CEO of Beanbag <https://www.beanbaginc.com/>
Makers of Review Board <https://www.reviewboard.org/>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to