mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Split display status & type property into two separate controllers
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
{% import 'common/thumbnail.html.twig' as thumbnail %}
|
||||
|
||||
{% set nbReceivedDocuments = records.received().count() %}
|
||||
{% set nbEditableDocuments = records.count() %}
|
||||
|
||||
<div id='tabs-records-property'>
|
||||
|
||||
{# This value is fetched when click on 2nd tab #}
|
||||
<input type="hidden" name='original_selection' value="{{ app.request.query.get('lst') }}">
|
||||
|
||||
<ul>
|
||||
<li><a href="#property-statut">{% trans 'Records Statut' %}</a></li>
|
||||
<li><a href="#property-type">{% trans 'Records type' %}</a></li>
|
||||
{# <span> </span> element is required for the jQuery loading spinner appears && disappears properly #}
|
||||
<li><a href="/prod/records/property/type/">{% trans 'Records type' %} <span> </span></a></li>
|
||||
</ul>
|
||||
|
||||
<div id='property-statut'>
|
||||
@@ -112,75 +116,28 @@
|
||||
{% 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>
|
||||
<button type="button" class="btn cancel">{% trans "Cancel" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id='property-type'>
|
||||
{% set typesEnum = [
|
||||
constant('\\Alchemy\\Phrasea\\Media\\Type\\Type::TYPE_AUDIO'),
|
||||
constant('\\Alchemy\\Phrasea\\Media\\Type\\Type::TYPE_VIDEO'),
|
||||
constant('\\Alchemy\\Phrasea\\Media\\Type\\Type::TYPE_DOCUMENT'),
|
||||
constant('\\Alchemy\\Phrasea\\Media\\Type\\Type::TYPE_FLASH'),
|
||||
constant('\\Alchemy\\Phrasea\\Media\\Type\\Type::TYPE_IMAGE')
|
||||
]
|
||||
%}
|
||||
|
||||
<form name="change-records-type" action="/prod/records/property/type/" method="POST">
|
||||
<div class='well-small 'style="text-align:center;">
|
||||
<select name='force_types' style="width:250px">
|
||||
<option value="">{% trans 'Apply to all selected documents' %}</option>
|
||||
{% for option in typesEnum %}
|
||||
<option value="{{ option }}">{{ option }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<input name="lst" type="hidden" value="{{ records.serializedList() }}"/>
|
||||
{% for sbasId,databoxTypes in recordsType %}
|
||||
<h2 style="text-align:center;" clas="header">{{ sbasId|sbas_names(app) }}</h2>
|
||||
{% for currentType, recordsByType in databoxTypes %}
|
||||
<ul class="thumbnails" style="margin:20px auto;">
|
||||
{% for record in recordsByType %}
|
||||
<li class="span2">
|
||||
<div class="thumbnail" style='min-height:205px'>
|
||||
{{ thumbnail.format(record.get_thumbnail(), 160, 120, '', false, false) }}
|
||||
<div class="caption">
|
||||
<h5>{{ record.get_title() }}</h5>
|
||||
<p>
|
||||
<select name="types[{{record.get_serialize_key()}}]" style='width:100%'>
|
||||
{% for option in typesEnum %}
|
||||
<option value="{{ option }}" {{ record.is_grouping() ? "disabled='disabled'": "" }} {{ option == record.get_type() ? "selected='selected'" : '' }}>{{ option }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
{% 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>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("#tabs-records-property").tabs();
|
||||
$("#tabs-records-property").tabs({
|
||||
ajaxOptions: {
|
||||
data : {
|
||||
lst: $("input[name=original_selection]", $(this)).val()
|
||||
}
|
||||
},
|
||||
cache: true //Load template only once
|
||||
});
|
||||
|
||||
var $dialog = p4.Dialog.get(1);
|
||||
var $dialogBox = $dialog.getDomElement();
|
||||
|
||||
var button = $(".submiter", $dialogBox);
|
||||
|
||||
button.bind("click", function(){
|
||||
|
||||
$("button.submiter", $dialogBox).bind("click", function(){
|
||||
var $this = $(this);
|
||||
var form = $(this).closest("form");
|
||||
|
||||
$.ajax({
|
||||
@@ -189,14 +146,14 @@
|
||||
data: form.serializeArray(),
|
||||
dataType: 'json',
|
||||
beforeSend:function(){
|
||||
button.attr("disabled", true);
|
||||
$this.attr("disabled", true);
|
||||
//@todo add loader
|
||||
},
|
||||
success: function(data){
|
||||
$dialog.Close(1);
|
||||
$dialog.Close();
|
||||
},
|
||||
complete: function(){
|
||||
button.attr("disabled", false);
|
||||
$this.attr("disabled", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user