You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Nicolas Malin <ni...@nereide.fr> on 2014/11/04 13:48:12 UTC

Re: Add color field for stock list

You can use <alt-row-style use-when="" style=""/>
And add your style on a dedicate css file.

However the style attribute isn't parse by FlexibleStringExpender so you 
can't write a simple line like :

<alt-row-style use-when="product.featureColor != null" 
style="${product.featureColor}"/>

For that you need to improve the form renderer ;)

Nicolas

Le 31/10/2014 09:34, Julien NICOLAS a écrit :
> Hi,
>
> The first idea is to create new attributes like background-color and 
> font-color for image field.
> And add style in the macro rendering for image field.
>
> We start to add new attributes to image field (in widget-form.xsd) and 
> modify the macro rendering but this is not enough. Attributes are not 
> recognized... Why ?
>
> Another suggestion from Pierre G. was to use ftl file to create 
> specific dynamic css that we'll use with the attribute style of the 
> image field.
>
> The last idea is to create a new field color. Similar image field but 
> with auto-defined values and some attribute like... color that will be 
> include in style. The only problem is... if we don't success with the 
> first idea, it could be the same for this one...
>
> Is anybody have suggestions ? Help ?
>
> Thanks,
>
> Julien.
>
>
> Le 30/10/2014 16:40, Julien NICOLAS a écrit :
>> Hi all,
>>
>> All of my products have a feature with hexa number for color in abrev.
>>
>> I try to find a way to display color of my product in the stock list.
>>
>> Is anybody already do this kind of thing and what is the best way to 
>> do it ?
>>
>> Thank by advance,
>>
>> Julien.
>>
>>
>


Re: Add color field for stock list

Posted by Adrian Crum <ad...@sandglass-software.com>.
Like I said, your approach is not the best way.

You can create a template in the Content component to contain the HTML 
fragment that displays product-specific content.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 11/4/2014 1:53 PM, Julien NICOLAS wrote:
> Hi Adrian,
>
> Maybe I don't really understand what you mean but if it's :
> Add the color in a picture and attach it as a content to the product.
>
> It's not acceptable in my case because the color is a feature that
> contained color hexa code.
> With your suggestion it's really difficult to maintain (picture file
> creation, linked to the product, etc.)
>
> With a color field I just have to put the color code in field attribute
> and it will be displayed in the form.
> I have generated a patch that can explain it :
> https://issues.apache.org/jira/browse/OFBIZ-5849
>
> So to have my color in the form, simply add this :
>         <field name="couleur">
>             <color value="${productColor}"/>
>         </field>
>
> Then it will generate :
>
> <img src="/images/webapp/images/img/color-field.png"
> style="background-color=#DE2315"/>
>
> color-field.png is to have a square color field (25x25 px).
> Style will overload css file
>
> I think it's more flexible and easier. But maybe it's not the best way
> to add color feature linked to a product in table form.
> Any suggestions are welcome :)
>
> Regards,
>
> Julien.
>
> Le 04/11/2014 14:38, Adrian Crum a écrit :
>> Most likely such a change will not make it into the project. HTML
>> element styling is under the control of the visual theme.
>>
>> If you want to display product-specific content, then use the Content
>> application.
>>
>> Adrian Crum
>> Sandglass Software
>> www.sandglass-software.com
>>
>> On 11/4/2014 12:57 PM, Julien NICOLAS wrote:
>>> Hi Nicolas,
>>>
>>> Thanks for your answer, I feel less alone :)
>>>
>>> I was looking for this but create a specific css file for each color let
>>> me feel that it's not THE solution.
>>>
>>> We was working on something like that :
>>> custom-style="background-color=${product.featureColor}"
>>> But our source code failed (I think now I know why).
>>>
>>> So I start to improve form renderer by adding a color field that just
>>> display color.
>>> I think this is the best way but... I do it and my source code failed...
>>>
>>> I'm opening Jira to put my patch on and see if this improvement is
>>> interesting to be added. I hope to see some comment on why it's not
>>> working as well.
>>>
>>> Julien.
>>>
>>> Le 04/11/2014 13:48, Nicolas Malin a écrit :
>>>> You can use <alt-row-style use-when="" style=""/>
>>>> And add your style on a dedicate css file.
>>>>
>>>> However the style attribute isn't parse by FlexibleStringExpender so
>>>> you can't write a simple line like :
>>>>
>>>> <alt-row-style use-when="product.featureColor != null"
>>>> style="${product.featureColor}"/>
>>>>
>>>> For that you need to improve the form renderer ;)
>>>>
>>>> Nicolas
>>>>
>>>> Le 31/10/2014 09:34, Julien NICOLAS a écrit :
>>>>> Hi,
>>>>>
>>>>> The first idea is to create new attributes like background-color and
>>>>> font-color for image field.
>>>>> And add style in the macro rendering for image field.
>>>>>
>>>>> We start to add new attributes to image field (in widget-form.xsd)
>>>>> and modify the macro rendering but this is not enough. Attributes are
>>>>> not recognized... Why ?
>>>>>
>>>>> Another suggestion from Pierre G. was to use ftl file to create
>>>>> specific dynamic css that we'll use with the attribute style of the
>>>>> image field.
>>>>>
>>>>> The last idea is to create a new field color. Similar image field but
>>>>> with auto-defined values and some attribute like... color that will
>>>>> be include in style. The only problem is... if we don't success with
>>>>> the first idea, it could be the same for this one...
>>>>>
>>>>> Is anybody have suggestions ? Help ?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Julien.
>>>>>
>>>>>
>>>>> Le 30/10/2014 16:40, Julien NICOLAS a écrit :
>>>>>> Hi all,
>>>>>>
>>>>>> All of my products have a feature with hexa number for color in
>>>>>> abrev.
>>>>>>
>>>>>> I try to find a way to display color of my product in the stock list.
>>>>>>
>>>>>> Is anybody already do this kind of thing and what is the best way to
>>>>>> do it ?
>>>>>>
>>>>>> Thank by advance,
>>>>>>
>>>>>> Julien.
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>

Re: Add color field for stock list

Posted by Julien NICOLAS <ju...@nomaka.fr>.
Hi Adrian,

Maybe I don't really understand what you mean but if it's :
Add the color in a picture and attach it as a content to the product.

It's not acceptable in my case because the color is a feature that 
contained color hexa code.
With your suggestion it's really difficult to maintain (picture file 
creation, linked to the product, etc.)

With a color field I just have to put the color code in field attribute 
and it will be displayed in the form.
I have generated a patch that can explain it : 
https://issues.apache.org/jira/browse/OFBIZ-5849

So to have my color in the form, simply add this :
        <field name="couleur">
            <color value="${productColor}"/>
        </field>

Then it will generate :

<img src="/images/webapp/images/img/color-field.png" 
style="background-color=#DE2315"/>

color-field.png is to have a square color field (25x25 px).
Style will overload css file

I think it's more flexible and easier. But maybe it's not the best way 
to add color feature linked to a product in table form.
Any suggestions are welcome :)

Regards,

Julien.

Le 04/11/2014 14:38, Adrian Crum a écrit :
> Most likely such a change will not make it into the project. HTML 
> element styling is under the control of the visual theme.
>
> If you want to display product-specific content, then use the Content 
> application.
>
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
>
> On 11/4/2014 12:57 PM, Julien NICOLAS wrote:
>> Hi Nicolas,
>>
>> Thanks for your answer, I feel less alone :)
>>
>> I was looking for this but create a specific css file for each color let
>> me feel that it's not THE solution.
>>
>> We was working on something like that :
>> custom-style="background-color=${product.featureColor}"
>> But our source code failed (I think now I know why).
>>
>> So I start to improve form renderer by adding a color field that just
>> display color.
>> I think this is the best way but... I do it and my source code failed...
>>
>> I'm opening Jira to put my patch on and see if this improvement is
>> interesting to be added. I hope to see some comment on why it's not
>> working as well.
>>
>> Julien.
>>
>> Le 04/11/2014 13:48, Nicolas Malin a écrit :
>>> You can use <alt-row-style use-when="" style=""/>
>>> And add your style on a dedicate css file.
>>>
>>> However the style attribute isn't parse by FlexibleStringExpender so
>>> you can't write a simple line like :
>>>
>>> <alt-row-style use-when="product.featureColor != null"
>>> style="${product.featureColor}"/>
>>>
>>> For that you need to improve the form renderer ;)
>>>
>>> Nicolas
>>>
>>> Le 31/10/2014 09:34, Julien NICOLAS a écrit :
>>>> Hi,
>>>>
>>>> The first idea is to create new attributes like background-color and
>>>> font-color for image field.
>>>> And add style in the macro rendering for image field.
>>>>
>>>> We start to add new attributes to image field (in widget-form.xsd)
>>>> and modify the macro rendering but this is not enough. Attributes are
>>>> not recognized... Why ?
>>>>
>>>> Another suggestion from Pierre G. was to use ftl file to create
>>>> specific dynamic css that we'll use with the attribute style of the
>>>> image field.
>>>>
>>>> The last idea is to create a new field color. Similar image field but
>>>> with auto-defined values and some attribute like... color that will
>>>> be include in style. The only problem is... if we don't success with
>>>> the first idea, it could be the same for this one...
>>>>
>>>> Is anybody have suggestions ? Help ?
>>>>
>>>> Thanks,
>>>>
>>>> Julien.
>>>>
>>>>
>>>> Le 30/10/2014 16:40, Julien NICOLAS a écrit :
>>>>> Hi all,
>>>>>
>>>>> All of my products have a feature with hexa number for color in 
>>>>> abrev.
>>>>>
>>>>> I try to find a way to display color of my product in the stock list.
>>>>>
>>>>> Is anybody already do this kind of thing and what is the best way to
>>>>> do it ?
>>>>>
>>>>> Thank by advance,
>>>>>
>>>>> Julien.
>>>>>
>>>>>
>>>>
>>>
>>


Re: Add color field for stock list

Posted by Adrian Crum <ad...@sandglass-software.com>.
Most likely such a change will not make it into the project. HTML 
element styling is under the control of the visual theme.

If you want to display product-specific content, then use the Content 
application.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 11/4/2014 12:57 PM, Julien NICOLAS wrote:
> Hi Nicolas,
>
> Thanks for your answer, I feel less alone :)
>
> I was looking for this but create a specific css file for each color let
> me feel that it's not THE solution.
>
> We was working on something like that :
> custom-style="background-color=${product.featureColor}"
> But our source code failed (I think now I know why).
>
> So I start to improve form renderer by adding a color field that just
> display color.
> I think this is the best way but... I do it and my source code failed...
>
> I'm opening Jira to put my patch on and see if this improvement is
> interesting to be added. I hope to see some comment on why it's not
> working as well.
>
> Julien.
>
> Le 04/11/2014 13:48, Nicolas Malin a écrit :
>> You can use <alt-row-style use-when="" style=""/>
>> And add your style on a dedicate css file.
>>
>> However the style attribute isn't parse by FlexibleStringExpender so
>> you can't write a simple line like :
>>
>> <alt-row-style use-when="product.featureColor != null"
>> style="${product.featureColor}"/>
>>
>> For that you need to improve the form renderer ;)
>>
>> Nicolas
>>
>> Le 31/10/2014 09:34, Julien NICOLAS a écrit :
>>> Hi,
>>>
>>> The first idea is to create new attributes like background-color and
>>> font-color for image field.
>>> And add style in the macro rendering for image field.
>>>
>>> We start to add new attributes to image field (in widget-form.xsd)
>>> and modify the macro rendering but this is not enough. Attributes are
>>> not recognized... Why ?
>>>
>>> Another suggestion from Pierre G. was to use ftl file to create
>>> specific dynamic css that we'll use with the attribute style of the
>>> image field.
>>>
>>> The last idea is to create a new field color. Similar image field but
>>> with auto-defined values and some attribute like... color that will
>>> be include in style. The only problem is... if we don't success with
>>> the first idea, it could be the same for this one...
>>>
>>> Is anybody have suggestions ? Help ?
>>>
>>> Thanks,
>>>
>>> Julien.
>>>
>>>
>>> Le 30/10/2014 16:40, Julien NICOLAS a écrit :
>>>> Hi all,
>>>>
>>>> All of my products have a feature with hexa number for color in abrev.
>>>>
>>>> I try to find a way to display color of my product in the stock list.
>>>>
>>>> Is anybody already do this kind of thing and what is the best way to
>>>> do it ?
>>>>
>>>> Thank by advance,
>>>>
>>>> Julien.
>>>>
>>>>
>>>
>>
>

Re: Add color field for stock list

Posted by Julien NICOLAS <ju...@nomaka.fr>.
Hi Nicolas,

Thanks for your answer, I feel less alone :)

I was looking for this but create a specific css file for each color let 
me feel that it's not THE solution.

We was working on something like that : 
custom-style="background-color=${product.featureColor}"
But our source code failed (I think now I know why).

So I start to improve form renderer by adding a color field that just 
display color.
I think this is the best way but... I do it and my source code failed...

I'm opening Jira to put my patch on and see if this improvement is 
interesting to be added. I hope to see some comment on why it's not 
working as well.

Julien.

Le 04/11/2014 13:48, Nicolas Malin a écrit :
> You can use <alt-row-style use-when="" style=""/>
> And add your style on a dedicate css file.
>
> However the style attribute isn't parse by FlexibleStringExpender so 
> you can't write a simple line like :
>
> <alt-row-style use-when="product.featureColor != null" 
> style="${product.featureColor}"/>
>
> For that you need to improve the form renderer ;)
>
> Nicolas
>
> Le 31/10/2014 09:34, Julien NICOLAS a écrit :
>> Hi,
>>
>> The first idea is to create new attributes like background-color and 
>> font-color for image field.
>> And add style in the macro rendering for image field.
>>
>> We start to add new attributes to image field (in widget-form.xsd) 
>> and modify the macro rendering but this is not enough. Attributes are 
>> not recognized... Why ?
>>
>> Another suggestion from Pierre G. was to use ftl file to create 
>> specific dynamic css that we'll use with the attribute style of the 
>> image field.
>>
>> The last idea is to create a new field color. Similar image field but 
>> with auto-defined values and some attribute like... color that will 
>> be include in style. The only problem is... if we don't success with 
>> the first idea, it could be the same for this one...
>>
>> Is anybody have suggestions ? Help ?
>>
>> Thanks,
>>
>> Julien.
>>
>>
>> Le 30/10/2014 16:40, Julien NICOLAS a écrit :
>>> Hi all,
>>>
>>> All of my products have a feature with hexa number for color in abrev.
>>>
>>> I try to find a way to display color of my product in the stock list.
>>>
>>> Is anybody already do this kind of thing and what is the best way to 
>>> do it ?
>>>
>>> Thank by advance,
>>>
>>> Julien.
>>>
>>>
>>
>