Never mind - got it working. I needed to specify *ng-true-value* and 
*ng-false-value* to strings that Java's *Boolean.parseBoolean()* can 
understand.

Now the only thing left is fixing the issue that my *number* input is not 
set to the value from the XML (although it is being saved correctly) when 
opening the task config view. It's always empty (showing the placeholder) 
instead of displaying the value from the XML config.


Best regards,
~ Joel

On Wednesday, December 2, 2020 at 5:00:27 PM UTC+1 Joel Bodenmann wrote:

> Aravind,
>
> I've come across that piece of documentation when starting to look at the 
> possibility of creating my own Task plugin. In my opinion the documentation 
> does a good job at giving a quick overview but I found that some more 
> advanced/complex examples might be helpful.
> Once I gathered the necessary experience to finish my first plugin I'll 
> look into providing a PR extending the documentation.
>
> I am not a web developer so please forgive me if I should really not ask 
> this here but: I managed to get everything working so far. I've a task 
> plugin with the HTML config view that uses HTML input fields of type 
> *text *and *number * to configure my task. So far so good.
> Next I wanted to add a checkbox for some conditional task behavior. 
> However, I can't manage to get the checkbox to save to the XML. I've copied 
> the fragments of my other *text* and *number* fields and simply changed 
> the type to *checkbox* and adjusted the *ng-model* attribute to "link" to 
> the new boolean setting.
>
> Is there anything special about getting back the checked/unchecked state 
> of a checkbox?
>
> This is my HTML fragment for the checkbox:
>
>     <div class="form_item_block">
>           <input type="checkbox" ng-model="perform_build" ng-required
> ="false"/>
>           <label>Enable</label>
>       </div>
>
> If I look at the config form using the inspector I can see that my *text* and 
> *number* input fields still have the *ng-** attributes but the checkbox 
> in question has been stripped of the *ng-model* and *ng-required*
>  attribute.
>
> I'd appreciate it a lot if somebody could help out an embedded C++ 
> developer here not accustomed to work with AngularJS.
>
>
> Best regards,
> ~ Joel
> On Wednesday, December 2, 2020 at 3:09:31 PM UTC+1 Aravind SV wrote:
>
>> Agree!
>>
>> The source of the current documentation is:
>>
>> https://github.com/gocd/plugin-api.go.cd/blob/master/source/includes/shared/_angular-templates.md
>>
>> It looks like this:
>> https://plugin-api.gocd.org/current/tasks/
>>
>> Pull requests are always welcome. Not just from Joel. :) But, for anyone 
>> who finds that the documentation can be improved.
>>
>> Cheers,
>> Aravind
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/e316992e-3e4a-44c9-aa4c-6c5cb36e6733n%40googlegroups.com.

Reply via email to