PHRAS-778 - deactivable documents type permalinks in tools modal

This commit is contained in:
Florian BLOUET
2015-10-21 10:46:35 +02:00
committed by Benoît Burnichon
parent a52cfd0d0c
commit 18f9542098
7 changed files with 183 additions and 12 deletions

View File

@@ -20,7 +20,7 @@
<div id='prod-tool-box' class="PNB10">
{# jquery Tabs #}
<div id="tool-tabs">
<div id="tool-tabs" class="tabs">
{# jquery menu #}
<div>
<ul>
@@ -59,6 +59,15 @@
</a>
</li>
{% endif %}
{% if selectionLength == 1%}
{% if recordSubdefs %}
<li>
<a href="#tools-sharing">
{{ "Document Type Sharing" | trans }}
</a>
</li>
{% endif %}
{% endif %}
</ul>
</div>
{# subdef section #}
@@ -299,6 +308,37 @@
</div>
{% endfor %}
{% endif %}
{% if selectionLength == 1%}
{% if recordSubdefs %}
<div id="tools-sharing" class="tabBox">
<div class="well-large">
{% for subdef in recordSubdefs %}
<div class="row-fluid">
<div class="span6">
<span class="status-marker {% if subdef.state %}status-active{% else %}status-inactive
{% endif %}"></span>{{ subdef.name }}
</div>
<div class="span6">
<p class="text-right">
{% if subdef.state %}
<button type="button"
class="stateChange_button btn btn-inverse text-right"
data-name="{{ subdef.name }}"
data-state="{{ subdef.state }}">{{ "Disable document type sharing" | trans }}</button>
{% else %}
<button type="button" class="stateChange_button btn btn-inverse text-right"
data-name="{{ subdef.name }}"
data-state="{{ subdef.state }}">{{ "Enable document type sharing" | trans }}</button>
{% endif %}
</p>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}
</div>
{# hidden iframe to handle upload #}
@@ -315,10 +355,9 @@
$(document).ready(function(){
var scope = $("#prod-tool-box");
var tabs = $("#tool-tabs", scope).tabs();
var width = 0;
$("#tool-tabs", scope).tabs();
$(".iframe_submiter", scope).bind("click", function(){
var form = $(this).closest("form");
form.submit();
@@ -585,5 +624,30 @@ $(document).ready(function(){
//not supported
$("#thumbExtractor").empty().append(language.browserFeatureSupport);
}
{% if selectionLength == 1%}
$('#tools-sharing .stateChange_button').bind('click',function(event){
var $btn = $(event.currentTarget),
state = true;
// inverse state
if( $btn.data('state') == 1) {
state = false;
}
// submit changes
$.post('tools/sharing-editor/{{record.get_base_id}}/{{record.get_record_id}}/', {
name: $btn.data('name'),
state: state
}).done(function(data) {
// self reload tab with current active tab:
var activeTab = tabs.tabs('option', 'active');
toolREFACTOR($dialog.getOption('contextArgs'), activeTab);
}).error(function(err) {
alert('forbidden action')
});
return false;
});
{% endif %}
});
</script>