mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
wip: remove prod js modules dependencies
This commit is contained in:
@@ -10,55 +10,3 @@
|
||||
{{ 'Ajouter ma selection courrante' | trans }}
|
||||
</label>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
var $dialog = dialogModule.dialog.get(1);
|
||||
var $dialogBox = $dialog.getDomElement();
|
||||
|
||||
$('input[name="lst"]', $dialogBox).val(p4.Results.Selection.serialize());
|
||||
|
||||
var buttons = $dialog.getOption('buttons');
|
||||
|
||||
buttons[language.create] = function(){
|
||||
$('form', $dialogBox).trigger('submit')
|
||||
};
|
||||
|
||||
$dialog.setOption('buttons', buttons);
|
||||
|
||||
$('form', $dialogBox).bind('submit', function(event){
|
||||
|
||||
var $form = $(this);
|
||||
var dialog = $dialogBox.closest('.ui-dialog');
|
||||
var buttonPanel = dialog.find('.ui-dialog-buttonpane');
|
||||
|
||||
$.ajax({
|
||||
type: $form.attr('method'),
|
||||
url: $form.attr('action'),
|
||||
data: $form.serializeArray(),
|
||||
dataType: 'json',
|
||||
beforeSend:function(){
|
||||
$(":button:contains('" + language.create + "')", buttonPanel)
|
||||
.attr("disabled", true).addClass("ui-state-disabled");
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
p4.WorkZone.refresh(data.basket.id);
|
||||
dialogModule.dialog.close(1);
|
||||
|
||||
return;
|
||||
},
|
||||
error: function(){
|
||||
$(":button:contains('" + language.create + "')", buttonPanel)
|
||||
.attr("disabled", false).removeClass("ui-state-disabled");
|
||||
},
|
||||
timeout: function(){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@@ -34,187 +34,3 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var container = $('#reorder_box');
|
||||
|
||||
$('button.autoorder', container).bind('click', function(){
|
||||
autoorder();
|
||||
return false;
|
||||
});
|
||||
$('button.reverseorder', container).bind('click', function(){
|
||||
reverse_order();
|
||||
return false;
|
||||
});
|
||||
|
||||
function autoorder()
|
||||
{
|
||||
var val = $.trim($('#auto_order').val());
|
||||
|
||||
if(val == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
var diapos = [];
|
||||
$('#reorder_box .diapo form').each(function(i,n){
|
||||
diapos.push({
|
||||
"title": $('input[name=title]',n).val(),
|
||||
"order" : parseInt($('input[name=default]',n).val()),
|
||||
"id" : $('input[name=id]',n).val()
|
||||
});
|
||||
});
|
||||
|
||||
var sorterCallback;
|
||||
|
||||
if (val === "default") {
|
||||
sorterCallback = function(diapo) {return diapo.order;};
|
||||
} else {
|
||||
sorterCallback = function(diapo) {return diapo.title;};
|
||||
}
|
||||
|
||||
var elements = [];
|
||||
|
||||
_.chain(diapos)
|
||||
.sortBy(sorterCallback)
|
||||
.each(function(diapo) {
|
||||
elements.push($('#ORDER_'+ diapo.id));
|
||||
});
|
||||
|
||||
$('#reorder_box .elements').append(elements);
|
||||
}
|
||||
|
||||
function reverse_order() {
|
||||
var $container = $('#reorder_box .elements');
|
||||
$('#reorder_box .diapo').each(function() {
|
||||
$(this).prependTo($container);
|
||||
});
|
||||
}
|
||||
|
||||
$('.elements', container).sortable({
|
||||
appendTo : container,
|
||||
placeholder: 'diapo ui-sortable-placeholder',
|
||||
distance:20,
|
||||
cursorAt: {
|
||||
top:10,
|
||||
left:-20
|
||||
},
|
||||
items:'div.diapo',
|
||||
scroll:true,
|
||||
scrollSensitivity:40,
|
||||
scrollSpeed:30,
|
||||
start:function(event, ui){
|
||||
var selected = $('.selected',container);
|
||||
|
||||
selected.each(function(i,n){
|
||||
$(n).attr('position',i);
|
||||
});
|
||||
|
||||
var n = selected.length - 1;
|
||||
|
||||
$('.selected:visible', container).hide();
|
||||
|
||||
while(n > 0){
|
||||
$('<div style="height:130px;" class="diapo ui-sortable-placeholderfollow"></div>').after($('.diapo.ui-sortable-placeholder', container));
|
||||
n--;
|
||||
}
|
||||
},
|
||||
stop:function(event, ui){
|
||||
|
||||
$('.diapo.ui-sortable-placeholderfollow', container).remove();
|
||||
|
||||
var main_id = $(ui.item[0]).attr('id');
|
||||
|
||||
var selected = $('.selected',container);
|
||||
var sorter = new Array();
|
||||
|
||||
|
||||
selected.each(function(i,n){
|
||||
|
||||
var position = parseInt($(n).attr('position'));
|
||||
|
||||
if(position !== '') {
|
||||
sorter[position] = $(n);
|
||||
}
|
||||
|
||||
var id = $(n).attr('id');
|
||||
if(id == main_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var before = true;
|
||||
var last_moved = $(ui.item[0]);
|
||||
$(sorter).each(function(i,n){
|
||||
$(n).show().removeAttr('position');
|
||||
if($(n).attr('id') == main_id){
|
||||
before = false;
|
||||
} else {
|
||||
if(before){
|
||||
$(n).before($(ui.item[0]));
|
||||
} else{
|
||||
$(n).after($(last_moved));
|
||||
}
|
||||
|
||||
}
|
||||
last_moved = sorter[i];
|
||||
});
|
||||
|
||||
},
|
||||
change:function(){
|
||||
$('.diapo.ui-sortable-placeholderfollow', container).remove();
|
||||
|
||||
var n = OrderSelection.length() - 1 ;
|
||||
while(n > 0) {
|
||||
$('<div style="height:130px;" class="diapo ui-sortable-placeholderfollow"></div>').after($('.diapo.ui-sortable-placeholder', container));
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
}).disableSelection();
|
||||
|
||||
var OrderSelection = new Selectable($('.elements', container), {
|
||||
selector : '.CHIM'
|
||||
});
|
||||
|
||||
$('form[name="reorder"]', container).bind('submit', function(event){
|
||||
|
||||
//$this.SetLoader(true);
|
||||
var $form = $(this);
|
||||
|
||||
$('.elements form', container).each(function(i, el){
|
||||
var id = $('input[name="id"]', $(el)).val();
|
||||
|
||||
$('input[name="element[' + id + ']"]', $form).val(i+1);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: $form.attr('method'),
|
||||
url: $form.attr('action'),
|
||||
data: $form.serializeArray(),
|
||||
dataType: 'json',
|
||||
beforeSend:function(){
|
||||
|
||||
},
|
||||
success: function(data){
|
||||
if(!data.success) {
|
||||
alert(data.message);
|
||||
}
|
||||
p4.WorkZone.refresh('current');
|
||||
dialogModule.dialog.get(1).close();
|
||||
|
||||
return;
|
||||
},
|
||||
error: function(){
|
||||
|
||||
},
|
||||
timeout: function(){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@@ -6,48 +6,4 @@
|
||||
<textarea style="width:98%;height:120px;" name="description">{{ basket.getDescription() }}</textarea>
|
||||
<button type='button' class="btn btn-inverse" style="margin: 5px 40%;">{{ 'boutton::valider' | trans }}</button>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('form[name="basket-rename-box"]').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
onSubmitRenameForm(event);
|
||||
});
|
||||
|
||||
$('#basket-rename-box button').on('click', function(event){
|
||||
event.preventDefault();
|
||||
onSubmitRenameForm(event);
|
||||
});
|
||||
|
||||
var onSubmitRenameForm = function(event) {
|
||||
var $form = $(event.currentTarget).closest('form');
|
||||
$.ajax({
|
||||
type: $form.attr('method'),
|
||||
url: $form.attr('action'),
|
||||
dataType: 'json',
|
||||
data: $form.serializeArray(),
|
||||
beforeSend:function(){
|
||||
|
||||
},
|
||||
success: function(data){
|
||||
$dialog = dialogModule.dialog.get(1).close();
|
||||
if(data.success) {
|
||||
humane.info(data.message);
|
||||
return p4.WorkZone.refresh(data.basket.id);
|
||||
} else {
|
||||
humane.error(data.message);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
|
||||
},
|
||||
timeout: function(){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user