mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix #776 : Add check on thumbtitle / business fields
This commit is contained in:
@@ -574,6 +574,10 @@ class databox_field implements cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$this->Business = ! ! $boolean;
|
$this->Business = ! ! $boolean;
|
||||||
|
|
||||||
|
if($this->Business) {
|
||||||
|
$this->thumbtitle = '0';
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,6 +670,10 @@ class databox_field implements cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$this->thumbtitle = $value;
|
$this->thumbtitle = $value;
|
||||||
|
|
||||||
|
if($this->thumbtitle != '0') {
|
||||||
|
$this->Business = false;
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -150,12 +150,12 @@
|
|||||||
<input class="metafield_{{ field.get_id() }}" {{ disabled }} name="report_{{ field.get_id() }}" type="checkbox" {% if field.is_report() %}checked="checked"{% endif %}/>
|
<input class="metafield_{{ field.get_id() }}" {{ disabled }} name="report_{{ field.get_id() }}" type="checkbox" {% if field.is_report() %}checked="checked"{% endif %}/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="metafield_{{ field.get_id() }}" {{ disabled }} name="thumbtitle_{{ field.get_id() }}">
|
<select class="thumbtitle metafield_{{ field.get_id() }}" {{ disabled }} name="thumbtitle_{{ field.get_id() }}">
|
||||||
{{ _self.thumbtitle_selector(field.get_thumbtitle()) }}
|
{{ _self.thumbtitle_selector(field.get_thumbtitle()) }}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="metafield_{{ field.get_id() }}" {{ disabled }} name="business_{{ field.get_id() }}" type="checkbox" {% if field.isBusiness() %}checked="checked"{% endif %}/>
|
<input class="business metafield_{{ field.get_id() }}" {{ disabled }} name="business_{{ field.get_id() }}" type="checkbox" {% if field.isBusiness() %}checked="checked"{% endif %}/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -224,6 +224,34 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('select.thumbtitle', container).bind('change', function(){
|
||||||
|
if($(this).val() == '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var id = $(this).attr('name').split('_').pop();
|
||||||
|
var business = $('input[name="business_' + id + '"]');
|
||||||
|
|
||||||
|
if(business.attr('checked')) {
|
||||||
|
$(this).val('0');
|
||||||
|
alert('{% trans 'A field can not be set both as title and business field. Remove business field flag before setting title' %}');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input.business', container).bind('change', function(){
|
||||||
|
if(!$(this).attr('checked')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var id = $(this).attr('name').split('_').pop();
|
||||||
|
var thumbtitle = $('select[name="thumbtitle_' + id + '"]');
|
||||||
|
|
||||||
|
if(thumbtitle.val() != '0') {
|
||||||
|
$(this).removeAttr('checked');
|
||||||
|
alert('{% trans 'A field can not be set both as title and business field. Remove the title before setting the business flag' %}');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$("#field_chooser").autocomplete({
|
$("#field_chooser").autocomplete({
|
||||||
source: "/admin/description/metadatas/search/",
|
source: "/admin/description/metadatas/search/",
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
|
Reference in New Issue
Block a user