Fix subdef template

This commit is contained in:
Romain Neutron
2012-04-25 13:55:15 +02:00
parent 5ae07ef80a
commit 657856a55a

View File

@@ -267,8 +267,8 @@
<select onchange="select_mediatype('{{subdefgroup}}{{subdefname}}', this);" name="{{subdefgroup}}_{{subdefname}}_mediatype"> <select onchange="select_mediatype('{{subdefgroup}}{{subdefname}}', this);" name="{{subdefgroup}}_{{subdefname}}_mediatype">
<option>{% trans 'Choisir' %}</option> <option>{% trans 'Choisir' %}</option>
{% for mediatype, options in subdef.get_mediatype_options() %} {% for subdefType in subdef.getAvailableSubdefTypes() %}
<option value="{{mediatype}}" {% if subdef.get_mediatype() == mediatype %}selected="selected"{% endif %}>{{mediatype}}</option> <option value="{{ subdefType.getType() }}" {% if subdef.getSubdefType.getType() == subdefType.getType() %}selected="selected"{% endif %}>{{ subdefType.getType() }}</option>
{% endfor %} {% endfor %}
</select> </select>
</td> </td>
@@ -276,49 +276,49 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
{% for mediatype, options in subdef.get_mediatype_options() %} {% for subdefType in subdef.getAvailableSubdefTypes() %}
<div id="box{{subdefgroup}}{{subdefname}}{{mediatype}}" class="{{subdefgroup}}{{subdefname}}" {% if subdef.get_mediatype() != mediatype %}style="display:none;"{% endif %}> <div id="box{{subdefgroup}}{{subdefname}}{{ subdefType.getType() }}" class="{{subdefgroup}}{{subdefname}}" {% if subdef.getSubdefType.getType() != subdefType.getType() %}style="display:none;"{% endif %}>
<table cellspacing="0" cellpading="0" border="0" style="width:500px;"> <table cellspacing="0" cellpading="0" border="0" style="width:500px;">
{% for optionname, option in options%} {% for option in subdefType.getOptions() %}
{% set varname = subdefgroup~'_'~subdefname~'_'~mediatype~'['~optionname~']' %} {% set varname = subdefgroup~'_'~subdefname~'_'~subdefType.getType()~'['~ option.getName() ~']' %}
<tr> <tr>
<td style="width:120px;"> <td style="width:120px;">
{{optionname}} {{option.getName()}}
</td> </td>
<td style="width:250px;"> <td style="width:250px;">
{% set extradata = '' %} {% set extradata = '' %}
{% if option.type == 'range' %} {% if option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_RANGE') %}
<div style="width:250px;" id="slider{{subdefgroup}}{{subdefname}}{{mediatype}}{{optionname}}"></div> <div style="width:250px;" id="slider{{subdefgroup}}{{subdefname}}{{subdefType.getType()}}{{ option.getName() }}"></div>
<script type="text/javascript"> <script type="text/javascript">
$('#slider{{subdefgroup}}{{subdefname}}{{mediatype}}{{optionname}}').slider({ $('#slider{{subdefgroup}}{{subdefname}}{{subdefType.getType()}}{{ option.getName() }}').slider({
value:{% if option.value %}{{option.value}}{% else %}{{option.default}}{% endif %}, value:{{ option.getValue }},
min: {{option.min}}, min: {{ option.getMinValue() }},
max: {{option.max}}, max: {{ option.getMaxValue() }},
{% if option.step is not empty %}step : {{option.step}},{% endif %} {% if option.getStep() is not empty %}step : {{ option.getStep() }},{% endif %}
slide: function( event, ui ) { slide: function( event, ui ) {
$( "#slidervalue{{subdefgroup}}{{subdefname}}{{mediatype}}{{optionname}}" ).val( ui.value ); $( "#slidervalue{{subdefgroup}}{{subdefname}}{{ subdefType.getType() }}{{ option.getName() }}" ).val( ui.value );
} }
}); });
</script> </script>
{% elseif option.type == 'enum' %} {% elseif option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_ENUM') %}
<select name="{{varname}}"> <select name="{{varname}}">
<option>{% trans 'Choisir' %}</option> <option>{% trans 'Choisir' %}</option>
{% for pot_value in option.values %} {% for pot_value in option.getAvailableValues() %}
<option value="{{pot_value}}" {% if pot_value == option.value %}selected="selected"{% endif %}>{{pot_value}}</option> <option value="{{ pot_value }}" {% if pot_value == option.getValue() %}selected="selected"{% endif %}>{{ pot_value }}</option>
{% endfor %} {% endfor %}
</select> </select>
{% elseif option.type == 'boolean' %} {% elseif option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_BOOLEAN') %}
<input name="{{varname}}" type="radio" value="yes" {% if option.value %}checked="checked"{% endif %} /> {% trans 'yes' %} <input name="{{varname}}" type="radio" value="yes" {% if option.getValue() %}checked="checked"{% endif %} /> {% trans 'yes' %}
<input name="{{varname}}" type="radio" value="no" {% if option.value is empty %}checked="checked"{% endif %}/> {% trans 'no' %} <input name="{{varname}}" type="radio" value="no" {% if option.getValue() is empty %}checked="checked"{% endif %}/> {% trans 'no' %}
{% else %} {% else %}
<input name="{{varname}}" type="text" value="{{option.value}}"/>{{option.type}} <input name="{{varname}}" type="text" value="{{ option.getValue() }}"/>
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% if option.type == 'range' %} {% if option.type == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_RANGE') %}
<input style="width:35px;" readonly value="{{option.value}}" id="slidervalue{{subdefgroup}}{{subdefname}}{{mediatype}}{{optionname}}" name="{{varname}}" /> <input style="width:35px;" readonly value="{{option.value}}" id="slidervalue{{subdefgroup}}{{subdefname}}{{subdefType.getType()}}{{ option.getName() }}" name="{{varname}}" />
{% endif %} {% endif %}
</td> </td>
</tr> </tr>