mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Refactor record property (status, type)
update property route Fixed status Conflicts: lib/Alchemy/Phrasea/Controller/Prod/Record/Property.php
This commit is contained in:
148
templates/web/prod/actions/Property/index.html.twig
Normal file
148
templates/web/prod/actions/Property/index.html.twig
Normal file
@@ -0,0 +1,148 @@
|
||||
{% set nbReceivedDocuments = records.received().count() %}
|
||||
{% set nbEditableDocuments = records.count() %}
|
||||
|
||||
<div id='tabs-records-property'>
|
||||
<ul>
|
||||
<li><a href="#property-statut">{% trans 'Records Statut' %}</a></li>
|
||||
<li><a href="#property-type">{% trans 'Records type' %}</a></li>
|
||||
</ul>
|
||||
|
||||
<div id='property-statut'>
|
||||
<p class="header" style='text-align:center;'>
|
||||
<h4>
|
||||
{% trans %}
|
||||
You have selected one document.
|
||||
{% plural nbReceivedDocuments %}
|
||||
You have selected {{ nbReceivedDocuments }} documents.
|
||||
{% endtrans %}
|
||||
|
||||
{% if nbEditableDocuments < nbReceivedDocuments %}
|
||||
{% trans %}
|
||||
Only one document is editable.
|
||||
{% plural nbEditableDocuments %}
|
||||
Only {{ nbEditableDocuments }} documents are editable.
|
||||
{% endtrans %}
|
||||
{% endif %}
|
||||
</h4>
|
||||
</p>
|
||||
|
||||
<form style='padding:15px;' name="change-records-status" action="/prod/records/property/status/" method="POST">
|
||||
<input name="lst" type="hidden" value="{{ records.serializedList() }}"/>
|
||||
{% for databox in records.databoxes() %}
|
||||
{% set sbasId = databox.get_sbas_id() %}
|
||||
{% set nbItems = attribute(nRec, sbasId) %}
|
||||
{% set nbRecords = nbItems['records'] %}
|
||||
{% set nbStories = nbItems['stories'] %}
|
||||
<table style='width:auto;margin:0 auto'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="6">
|
||||
{{ databox.get_viewname()|title }}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="6" style='font-size:11px;'>
|
||||
{% if nbRecords == 0 and nbStories > 0 %}
|
||||
<i>({% trans %}Status edition of stories{% endtrans %})</i>
|
||||
{% elseif nbRecords > 0 and nbStories == 0 %}
|
||||
<i>({% trans %}Status edition of documents{% endtrans %})</i>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% set databoxStatus = attribute(statusBit, sbasId) %}
|
||||
{% for bit,values in databoxStatus %}
|
||||
{% set inverse = 0 %}
|
||||
|
||||
{% if values["status"] == "2" %}
|
||||
{% set inverse = 2 %}
|
||||
{% elseif values["status"] == "0" %}
|
||||
{% set inverse = 1 %}
|
||||
{% endif %}
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<h6>{{ values['name']|title }}</h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='text-align:right'>
|
||||
{% if values['img_off'] is not empty %}
|
||||
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-off'}}">
|
||||
<img src="{{ values['img_off'] }}" width="16" height="16" />
|
||||
</label>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style='text-align:right'>
|
||||
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-off'}}">
|
||||
{{ values['labeloff']|default('off') }}
|
||||
</label>
|
||||
</td>
|
||||
<td style='text-align:right'>
|
||||
<input id="status-radio-{{ sbasId ~ "-" ~ bit ~ '-off'}}" type="radio" name="status[{{ sbasId }}][{{ bit }}]" value="0" {% if inverse == 1 %}checked="checked"{% endif %}/>
|
||||
</td>
|
||||
<td style='text-align:left'>
|
||||
<input id="status-radio-{{ sbasId ~ "-" ~ bit ~ '-on'}}" type="radio" name="status[{{ sbasId }}][{{ bit }}]" value="1" {% if inverse == 0 %}checked="checked"{% endif %}/>
|
||||
</td>
|
||||
<td style='text-align:left'>
|
||||
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-on'}}">
|
||||
{{ values['labelon']|default('on') }}
|
||||
</label>
|
||||
</td>
|
||||
<td style='text-align:left'>
|
||||
{% if values['img_on'] is not empty %}
|
||||
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-on'}}">
|
||||
<img src="{{ values['img_on'] }}" width="16" height="16" />
|
||||
</label>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
{% if nbStories > 0 %}
|
||||
<tr>
|
||||
<td colspan="6"><input type="checkbox" name="apply_to_children[{{ sbasId }}]"/></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tfoot>
|
||||
</table>
|
||||
{% endfor %}
|
||||
<div class="form-actions">
|
||||
<button type="button" class="btn btn-primary submiter">{% trans "Apply changes" %}</button>
|
||||
<button type="button" class="btn">{% trans "Cancel" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id='property-type'>TODO</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("#tabs-records-property").tabs();
|
||||
var $dialog = p4.Dialog.get(1);
|
||||
var $dialogBox = $dialog.getDomElement();
|
||||
|
||||
var form = $("form[name=change-records-status]", $dialogBox);
|
||||
var button = $(".submiter", form);
|
||||
|
||||
button.bind("click", function(){
|
||||
$.ajax({
|
||||
type: form.attr("method"),
|
||||
url: form.attr("action"),
|
||||
data: form.serializeArray(),
|
||||
dataType: 'json',
|
||||
beforeSend:function(){
|
||||
button.attr("disabled", true);
|
||||
//@todo add loader
|
||||
},
|
||||
success: function(data){
|
||||
$dialog.Close(1);
|
||||
},
|
||||
complete: function(){
|
||||
button.attr("disabled", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user