Quantcast

How do I show other configuration entries only if the user have checked a checkbox (in config.jelly)?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How do I show other configuration entries only if the user have checked a checkbox (in config.jelly)?

Erik Ramfelt
I have a text field that I only want to show in the configuration page
if a check box is checked and I wonder how to do it. It should have
the samve functionality as the list of builders/publishers in the job
configuration page have, ie a publisher will only show its config
entries if the check box is checked.


Ive found the <optionalBlock> and it seems the job configuration
jeylly pages is using it, but I havent got it right yet. Does anyone
have any idea?


<f:optionalBlock name="clearcase.dynamicview" title="aaa" checked="false">
          <f:textbox name="clearcase.viewdrive"
value="${scm.viewDrive}" optional="true"/>
</f:optionalBlock>


Regards
//Erik

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I show other configuration entries only if the user have checked a checkbox (in config.jelly)?

Kohsuke Kawaguchi
Administrator
Erik Ramfelt wrote:

> I have a text field that I only want to show in the configuration page
> if a check box is checked and I wonder how to do it. It should have
> the samve functionality as the list of builders/publishers in the job
> configuration page have, ie a publisher will only show its config
> entries if the check box is checked.
>
>
> Ive found the <optionalBlock> and it seems the job configuration
> jeylly pages is using it, but I havent got it right yet. Does anyone
> have any idea?
>
>
> <f:optionalBlock name="clearcase.dynamicview" title="aaa" checked="false">
>           <f:textbox name="clearcase.viewdrive"
> value="${scm.viewDrive}" optional="true"/>
> </f:optionalBlock>

The following code is based on ClearCaseSCM/config.jelly and shows you
how to add foldable section.

You can use <f:nested> instead of <f:block> and they give you different
indentation.

> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
>
> <f:entry title="Config spec" help="/plugin/clearcase/configspec.html">
>     <textarea class="setting-input" name="clearcase.configspec"
>       rows="8" style="width:100%"
>       checkUrl="'${rootURL}/scm/ClearCaseSCM/configSpecCheck?value='+escape(this.value)"
>       >${scm.configSpec}</textarea>
>   </f:entry>
>  
>   <f:entry title="View name" help="/plugin/clearcase/localdir.html">
>   <f:textbox name="clearcase.viewname" value="${scm.ViewName}"
>   checkUrl="'${rootURL}/scm/ClearCaseSCM/viewNameCheck?value='+escape(this.value)"/>    
>     </f:entry>
>
> <f:entry title="Use update">
> <f:checkbox name="clearcase.useupdate" checked="${h.defaultToTrue(scm.useUpdate)}"/>
>       If checked, Hudson will use 'cleartool update' whenever possible, making the build faster.
>       But this causes the artifacts from the previous build to remain when a new build starts.
> </f:entry>
>
> <f:entry title="Branch" help="/plugin/clearcase/branch.html">
>  <f:textbox name="clearcase.branch" value="${scm.branch}"/>
> </f:entry>
>
>   <f:block>
>     <table>
>       <f:optionalBlock name="business" title="Book business class flight">
>         <f:entry title="Airline code">
>           <f:textbox name="code" value="${scm.branch}"/>
>         </f:entry>
>       </f:optionalBlock>
>     </table>
>   </f:block>
> </j:jelly>


--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I show other configuration entries only if the user have checked a checkbox (in config.jelly)?

Erik Ramfelt
Cant get it right when the optional block is "unchecked" at start, the
text area within the optional block is still displayed when the page
is loaded. When I check the optional block on/off, the text area is
shown/hidden as it should. Any ideas how to solve it?

Excerpt from config.jelly:
-----------------------------------------------
<f:block>
        <f:optionalBlock name="clearcase.usedynamicview" title="Use existing
dynamic view"
                        checked="${scm.useDynamicView}" help="/plugin/clearcase/dynamicview.html">
                <f:entry title="View drive" help="/plugin/clearcase/viewdrive.html">
                        <f:textbox name="clearcase.viewdrive" value="${scm.viewDrive}"/>
                </f:entry>
        </f:optionalBlock>
</f:block>
-----------------------------------------------

regards
//Erik

On Nov 10, 2007 3:57 AM, Kohsuke Kawaguchi <[hidden email]> wrote:

>
> Erik Ramfelt wrote:
> > I have a text field that I only want to show in the configuration page
> > if a check box is checked and I wonder how to do it. It should have
> > the samve functionality as the list of builders/publishers in the job
> > configuration page have, ie a publisher will only show its config
> > entries if the check box is checked.
> >
> >
> > Ive found the <optionalBlock> and it seems the job configuration
> > jeylly pages is using it, but I havent got it right yet. Does anyone
> > have any idea?
> >
> >
> > <f:optionalBlock name="clearcase.dynamicview" title="aaa" checked="false">
> >           <f:textbox name="clearcase.viewdrive"
> > value="${scm.viewDrive}" optional="true"/>
> > </f:optionalBlock>
>
>
> The following code is based on ClearCaseSCM/config.jelly and shows you
> how to add foldable section.
>
> You can use <f:nested> instead of <f:block> and they give you different
> indentation.
>
> > <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
> >
> >       <f:entry title="Config spec" help="/plugin/clearcase/configspec.html">
> >       <textarea class="setting-input" name="clearcase.configspec"
> >                       rows="8" style="width:100%"
> >                       checkUrl="'${rootURL}/scm/ClearCaseSCM/configSpecCheck?value='+escape(this.value)"
> >                       >${scm.configSpec}</textarea>
> >       </f:entry>
> >
> >       <f:entry title="View name" help="/plugin/clearcase/localdir.html">
> >               <f:textbox name="clearcase.viewname" value="${scm.ViewName}"
> >                       checkUrl="'${rootURL}/scm/ClearCaseSCM/viewNameCheck?value='+escape(this.value)"/>
> >     </f:entry>
> >
> >       <f:entry title="Use update">
> >               <f:checkbox name="clearcase.useupdate" checked="${h.defaultToTrue(scm.useUpdate)}"/>
> >                       If checked, Hudson will use 'cleartool update' whenever possible, making the build faster.
> >                       But this causes the artifacts from the previous build to remain when a new build starts.
> >       </f:entry>
> >
> >       <f:entry title="Branch" help="/plugin/clearcase/branch.html">
> >         <f:textbox name="clearcase.branch" value="${scm.branch}"/>
> >       </f:entry>
> >
> >   <f:block>
> >     <table>
> >       <f:optionalBlock name="business" title="Book business class flight">
> >         <f:entry title="Airline code">
> >           <f:textbox name="code" value="${scm.branch}"/>
> >         </f:entry>
> >       </f:optionalBlock>
> >     </table>
> >   </f:block>
> > </j:jelly>
>
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems                   [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I show other configuration entries only if the user have checked a checkbox (in config.jelly)?

Kohsuke Kawaguchi
Administrator
Erik Ramfelt wrote:

> Cant get it right when the optional block is "unchecked" at start, the
> text area within the optional block is still displayed when the page
> is loaded. When I check the optional block on/off, the text area is
> shown/hidden as it should. Any ideas how to solve it?
>
> Excerpt from config.jelly:
> -----------------------------------------------
> <f:block>
> <f:optionalBlock name="clearcase.usedynamicview" title="Use existing
> dynamic view"
> checked="${scm.useDynamicView}" help="/plugin/clearcase/dynamicview.html">
> <f:entry title="View drive" help="/plugin/clearcase/viewdrive.html">
> <f:textbox name="clearcase.viewdrive" value="${scm.viewDrive}"/>
> </f:entry>
> </f:optionalBlock>
> </f:block>
> -----------------------------------------------
It was missing <table> tag. I committed the change for you.


--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I show other configuration entries only if the user have checked a checkbox (in config.jelly)?

Erik Ramfelt
On Nov 14, 2007 3:25 AM, Kohsuke Kawaguchi <[hidden email]> wrote:
> Erik Ramfelt wrote:
> > Cant get it right when the optional block is "unchecked" at start, the
> > text area within the optional block is still displayed when the page
> > is loaded. When I check the optional block on/off, the text area is
> > shown/hidden as it should. Any ideas how to solve it?
> >
>
> It was missing <table> tag. I committed the change for you.

Oh, thanks for committing! Is there any documentation about the jelly
widgets/controls that can be used when writing the gui? Are the
widgets in hudson/main/core/src/main/resources/lib/form/ specific for
the Hudson project?

Regards
//Erik

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I show other configuration entries only if the user have checked a checkbox (in config.jelly)?

Kohsuke Kawaguchi
Administrator
Erik Ramfelt wrote:
> Oh, thanks for committing! Is there any documentation about the jelly
> widgets/controls that can be used when writing the gui?

It's another good topic for Wiki, I guess.

 > Are the
> widgets in hudson/main/core/src/main/resources/lib/form/ specific for
> the Hudson project?

I'm sure it's somewhat reusable. The problem is that some of it depends
on JavaScript behaviors and CSS, and I think I put them all in one
JavaScript/CSS. So if we are to actually reuse this for another project,
then someone would have to pull them apart.

Are you thinking about reusing? Or maybe you are just saying that the
isolation/compartmentalization would make it easier for people to
understand this.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I show other configuration entries only if the user have checked a checkbox (in config.jelly)?

Erik Ramfelt
On Nov 15, 2007 3:47 AM, Kohsuke Kawaguchi <[hidden email]> wrote:

> Erik Ramfelt wrote:
> > Oh, thanks for committing! Is there any documentation about the jelly
> > widgets/controls that can be used when writing the gui?
>
> It's another good topic for Wiki, I guess.
>
>  > Are the
> > widgets in hudson/main/core/src/main/resources/lib/form/ specific for
> > the Hudson project?
>
> I'm sure it's somewhat reusable. The problem is that some of it depends
> on JavaScript behaviors and CSS, and I think I put them all in one
> JavaScript/CSS. So if we are to actually reuse this for another project,
> then someone would have to pull them apart.
>
> Are you thinking about reusing? Or maybe you are just saying that the
> isolation/compartmentalization would make it easier for people to
> understand this.

No, I was just thinking if the jelly controls were documented
somewehere else. Ive added a wiki page for info about jelly controls.
http://hudson.gotdns.com/wiki/display/HUDSON/Jelly+form+controls

//Erik

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...