You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by Apache Bloodhound <bl...@incubator.apache.org> on 2012/12/15 11:46:35 UTC

[Apache Bloodhound] #304: Default product is not the default option in the ticket quick create or newticket form

#304: Default product is not the default option in the ticket quick create or
newticket form
--------------------------+--------------------
 Reporter:  rjollos       |      Owner:  nobody
     Type:  defect        |     Status:  new
 Priority:  minor         |  Milestone:
Component:  multiproduct  |    Version:  0.3.0
 Keywords:                |
--------------------------+--------------------
 There are a few issues that result in the default product not being the
 initial value for the select on either the newticket form or the quick
 create ticket form.

  1. It appears that we need to at least pass the default value to
 `field_select`:
 {{{
 #!patch
 Index: bloodhound_theme/bhtheme/templates/bloodhound_theme.html
 ===================================================================
 --- bloodhound_theme/bhtheme/templates/bloodhound_theme.html    (revision
 1422215)
 +++ bloodhound_theme/bhtheme/templates/bloodhound_theme.html    (working
 copy)
 @@ -124,7 +124,7 @@
                  <py:if test="qct.fields.product">
                  <label class="control-label" for="field-
 product">Product</label>
                  <div class="controls">
 -                  ${field_select(qct.fields.product, None)}
 +                  ${field_select(qct.fields.product,
 opt.fields.product.value)}
                  </div>
                  </py:if>
                  <py:if test="qct.fields.version">
 }}}

 I also wonder, however, if we should modify `field_select` so that the
 default value doesn't need to be explicitly passed:
 {{{
 #!patch
 Index: bloodhound_theme/bhtheme/templates/bloodhound_theme.html
 ===================================================================
 --- bloodhound_theme/bhtheme/templates/bloodhound_theme.html    (revision
 1422215)
 +++ bloodhound_theme/bhtheme/templates/bloodhound_theme.html    (working
 copy)
 @@ -98,19 +98,19 @@
              </form>
            </div>
            <div class="span2">
 -            <py:def function="field_select(field, value)">
 +            <py:def function="field_select(field)">
                <select id="field-${field.name}" name="field_${field.name}"
                    class="input-medium" data-empty="true" data-
 field="${field.name}">
                  <option py:if="field.optional"></option>
                  <option py:for="option in field.options"
 -                        selected="${value == option or None}"
 +                        selected="${field.value == option or None}"
                          value = "$option"
                          py:content="option"></option>
                  <optgroup py:for="optgroup in field.optgroups"
                            py:if="optgroup.options"
                            label="${optgroup.label}">
                    <option py:for="option in optgroup.options"
 -                          selected="${value == option or None}"
 +                          selected="${field.value == option or None}"
                            value = "$option"
                            py:content="option"></option>
                  </optgroup>
 @@ -124,25 +124,25 @@
                  <py:if test="qct.fields.product">
                  <label class="control-label" for="field-
 product">Product</label>
                  <div class="controls">
 -                  ${field_select(qct.fields.product, None)}
 +                  ${field_select(qct.fields.product)}
                  </div>
                  </py:if>
                  <py:if test="qct.fields.version">
                  <label class="control-label" for="field-
 version">Version</label>
                  <div class="controls">
 -                  ${field_select(qct.fields.version, None)}
 +                  ${field_select(qct.fields.version)}
                  </div>
                  </py:if>
                  <py:if test="qct.fields.type">
                  <label class="control-label" for="field-
 type">Type</label>
                  <div class="controls">
 -                  ${field_select(qct.fields.type, None)}
 +                  ${field_select(qct.fields.type)}
                  </div>
                  </py:if>
                  <py:if test="qct.fields.component">
                  <label class="control-label" for="field-
 component">Component</label>
                  <div class="controls">
 -                  ${field_select(qct.fields.component, None)}
 +                  ${field_select(qct.fields.component)}
                  </div>
                  </py:if>
                </div>
 }}}

  2. The default values for selects are hard-coded in the `TicketSystem`
 class, so we either need some way to set them through the
 `ITicketFieldProvider` implementation, or hard code the product value as
 in the following patch (not idea, just for demonstration):
 {{{
 #!patch
 Index: trac/trac/ticket/api.py
 ===================================================================
 --- trac/trac/ticket/api.py     (revision 1422139)
 +++ trac/trac/ticket/api.py     (working copy)
 @@ -252,6 +252,8 @@
          """Default resolution for resolving (closing) tickets
          (''since 0.11'').""")

 +    default_product = Option('ticket', 'default_product', '')
 +
      def __init__(self):
          self.log.debug('action controllers for ticket workflow: %r' %
                  [c.__class__.__name__ for c in self.action_controllers])
 }}}

  3. The final issue I see is that value stored in `default_product` is the
 product `name`, whereas values in the select are the product `prefix`es.
 The `value` of the select element needs to be a product `prefix`. This is
 related to #303.

 Has anyone tried pushing `ITicketFieldProvider` to the Trac core?

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/304>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #304: Default product is not the default option in the ticket quick create or newticket form

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#304: Default product is not the default option in the ticket quick create or
newticket form
---------------------------+--------------------
  Reporter:  rjollos       |      Owner:  nobody
      Type:  defect        |     Status:  new
  Priority:  minor         |  Milestone:
 Component:  multiproduct  |    Version:  0.3.0
Resolution:                |   Keywords:
---------------------------+--------------------

Comment (by rjollos):

 Replying to [comment:1 olemis]:
 > Nope . It's been there since quite long time ago btw .

 The "there" is not the Trac core though, right? By comparing against the
 latest Trac trunk, it appears that `ITicketFieldProvider` is a patch to
 Trac.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/304#comment:2>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #304: Default product is not the default option in the ticket quick create or newticket form

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#304: Default product is not the default option in the ticket quick create or
newticket form
---------------------------+--------------------
  Reporter:  rjollos       |      Owner:  nobody
      Type:  defect        |     Status:  new
  Priority:  minor         |  Milestone:
 Component:  multiproduct  |    Version:  0.3.0
Resolution:                |   Keywords:
---------------------------+--------------------

Comment (by olemis):

 Replying to [ticket:304 rjollos]:
 >
 [...]
 >
 > Has anyone tried pushing `ITicketFieldProvider` to the Trac core?

 Nope . It's been there since quite long time ago btw .

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/304#comment:1>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #304: Default product is not the default option in the ticket quick create or newticket form

Posted by Olemis Lang <ol...@gmail.com>.
On 12/18/12, Ryan Ollos <ry...@wandisco.com> wrote:
> On Mon, Dec 17, 2012 at 12:52 AM, Andrej Golcov <an...@digiverse.si>
> wrote:
>
[...]
>
>> As far as I understand, in multiproduct environment ticket product
>> will be defined by property in current environment?
>>
>
> I was thinking that the Quick Create Ticket and New Ticket forms will still
> be at global scope,

+1

> and therefore a product will need to be selected in the
> form for both cases.

yes, but if displayed in product scope then corresponding product
should be selected by default ;)

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:

Re: [Apache Bloodhound] #304: Default product is not the default option in the ticket quick create or newticket form

Posted by Ryan Ollos <ry...@wandisco.com>.
On Mon, Dec 17, 2012 at 12:52 AM, Andrej Golcov <an...@digiverse.si> wrote:

> Is this ticket intercepted with BEP-0003 (MultiProduct)?
>

It could be fixed as part of the BEP-0003 implementation, or the ticket
could be completely irrelevant if this part of the current multi-product
implementation is thrown out and replaced in the course of  implementing
BEP-0003. I raised the ticket because it is a broken feature in the current
bloodhound release, and the current ITicketFieldProvider would most likely
need to be extended in order to fix it.


> As far as I understand, in multiproduct environment ticket product
> will be defined by property in current environment?
>

I was thinking that the Quick Create Ticket and New Ticket forms will still
be at global scope, and therefore a product will need to be selected in the
form for both cases. I've only skimmed over BEP-0003 though, so I wouldn't
be surprised if I missed something that spoke to this.

Re: [Apache Bloodhound] #304: Default product is not the default option in the ticket quick create or newticket form

Posted by Andrej Golcov <an...@digiverse.si>.
Is this ticket intercepted with BEP-0003 (MultiProduct)?
As far as I understand, in multiproduct environment ticket product
will be defined by property in current environment?

Regards, Andrej

Re: [Apache Bloodhound] #304: Default product is not the default option in the ticket quick create or newticket form

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#304: Default product is not the default option in the ticket quick create or
newticket form
---------------------------+--------------------
  Reporter:  rjollos       |      Owner:  nobody
      Type:  defect        |     Status:  new
  Priority:  minor         |  Milestone:
 Component:  multiproduct  |    Version:  0.3.0
Resolution:                |   Keywords:
---------------------------+--------------------

Comment (by olemis):

 Replying to [comment:2 rjollos]:
 > Replying to [comment:1 olemis]:
 > > Nope . It's been there since quite long time ago btw .
 >
 > The "there" is not the Trac core though, right?

 Now I notice my previous answer was ambiguous . I should have said .

   No, it's not been proposed upstream . It's been here in Bloodhound since
 quite long time ago btw .

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/304#comment:3>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker