• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Add ability for dropdowns in style properties

Russ

Well-known member
#1
I'd love the ability to add drop downs in the style properties, could add some really nifty things to them and organize my properties quite a bit too.

Not really much else to say... I hope it's considered (y)

UPDATE: So via admin templates it's possible but considering I want to use dropdown via style properties in styles I release to the public, it's not. Suggesiton either let you export admin templates with a style, or simply get the example provided below to work on normal styles.
 
Last edited:

Chris D

XenForo developer
Staff member
#4
Pretty sure it's possible with a named template. I'll do an example for you when not on my phone.

The trick is probably getting the name attribute of the select box right so it saves the data correctly.
 

Chris D

XenForo developer
Staff member
#5
Yeah this is already possible using a named template:

upload_2014-3-24_21-58-19.png


upload_2014-3-24_21-59-3.png


Example template:

Code:
<input type="hidden" name="checkboxes[]" value="{$property.property_definition_id}" />
<xen:selectunit name="properties[{$property.property_definition_id}]" value="{$property.propertyValueScalar}" label="{$property.title}">    
    <xen:hint>Pick a colour</xen:hint>
    <xen:option value="" label="" />
    <xen:option value="red" label="Red" />
    <xen:option value="blue" label="Blue" />
    <xen:option value="pink" label="Pink" />
    <xen:option value="green" label="Green" />
    <xen:option value="yellow" label="Yellow" />
    <xen:explain>{$property.description}</xen:explain>
    <xen:html><xen:include template="style_property_unit_extra"><xen:set var="$reset">{xen:phrase reset}</xen:set></xen:include></xen:html>
</xen:selectunit>
The bits in red, you probably should include in each new template you create. Also, only one style property per template. It's unlikely you'd get multi select lists or checkboxes working because they would require the value to be stored as an array but they're stored as a scalar value instead.

And the definition is set up like this:

upload_2014-3-24_22-4-30.png

style_property_russ is the template name.
 

Russ

Well-known member
#7
Sorry to bug @Chris D

But I'm a little confused or am missing the obvious.

When attempting to do this, I'm getting an error every time I try creating a template.

I copied directly from your code, and assumed all the "property_definition_id" and other property_ect were simply placeholders to pull text from the style property itself.

When creating though I'm getting this:

ignorance.jpg
 

Chris D

XenForo developer
Staff member
#8
You need to create it as an admin template...

And therein lies the problem I've just realised... You can't export Admin Templates with a style, can you?
 

Chris D

XenForo developer
Staff member
#10
Not really, because what you suggested is already possible.

The suggestion would have to be the ability to export admin templates with a style.
 

Russ

Well-known member
#11
Not really, because what you suggested is already possible.

The suggestion would have to be the ability to export admin templates with a style.
Or... the ability to do the exact process without touching admin templates would be the suggestion? Either way I hope they address the ability to do either your method(export admin templates with a style) or even better... make the process work without admin templates.