mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 02:54:20 +00:00
Improve file popup
This commit is contained in:
parent
66fdf6cbf7
commit
d4f87e7581
@ -167,7 +167,7 @@ class OperationCreateView(CanCreateMixin, CreateView):
|
|||||||
form_class = modelform_factory(Operation,
|
form_class = modelform_factory(Operation,
|
||||||
fields=['amount', 'label', 'remark', 'journal', 'target_type', 'target_id', 'target_label', 'date', 'mode',
|
fields=['amount', 'label', 'remark', 'journal', 'target_type', 'target_id', 'target_label', 'date', 'mode',
|
||||||
'cheque_number', 'invoice', 'accounting_type', 'done'],
|
'cheque_number', 'invoice', 'accounting_type', 'done'],
|
||||||
widgets={'journal': HiddenInput, 'date': SelectDate})
|
widgets={'journal': HiddenInput, 'date': SelectDate, 'invoice': SelectFile})
|
||||||
template_name = 'core/create.jinja'
|
template_name = 'core/create.jinja'
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
|
@ -6,24 +6,37 @@ $( function() {
|
|||||||
popups.dialog({
|
popups.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
width: "80%",
|
width: "90%",
|
||||||
minHeight: "300",
|
create: function (event) {
|
||||||
buttons: {
|
target = $(event.target);
|
||||||
"Choose": function() {
|
target.parent().css({
|
||||||
|
'position': 'fixed',
|
||||||
|
'top': '5%',
|
||||||
|
'bottom': '5%',
|
||||||
|
});
|
||||||
|
target.css("height", "300px");
|
||||||
|
console.log(target);
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: "Choose",
|
||||||
|
click: function() {
|
||||||
console.log($("#file_id"));
|
console.log($("#file_id"));
|
||||||
$("input[name="+$(this).attr('name')+"]").attr('value', $("#file_id").attr('value'));
|
$("input[name="+$(this).attr('name')+"]").attr('value', $("#file_id").attr('value'));
|
||||||
$( this ).dialog( "close" );
|
$( this ).dialog( "close" );
|
||||||
|
},
|
||||||
|
disabled: true,
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
|
});
|
||||||
|
$( ".choose_file_button" ).button().on( "click", function() {
|
||||||
|
popup = popups.filter("[name="+$(this).attr('name')+"]");
|
||||||
|
console.log(popup);
|
||||||
|
popup.html('<iframe src="/file/popup" width="100%" height="95%"></iframe><div id="file_id" value="null" />');
|
||||||
|
popup.dialog({title: $(this).text()}).dialog( "open" );
|
||||||
});
|
});
|
||||||
$('.select_date').datepicker({
|
$('.select_date').datepicker({
|
||||||
changeMonth: true,
|
changeMonth: true,
|
||||||
changeYear: true
|
changeYear: true
|
||||||
});
|
});
|
||||||
$( ".choose_file_button" ).button().on( "click", function() {
|
|
||||||
popup = popups.filter("[name="+$(this).attr('name')+"]");
|
|
||||||
console.log(popup);
|
|
||||||
popup.html('<iframe src="/file/popup" width="95%"></iframe><span id="file_id" value="null" />');
|
|
||||||
popup.dialog({title: $(this).attr('name')}).dialog( "open" );
|
|
||||||
});
|
|
||||||
} );
|
} );
|
||||||
|
@ -156,6 +156,11 @@ tbody>tr:hover {
|
|||||||
float: right;
|
float: right;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
#user_info {
|
||||||
|
width: 40%;
|
||||||
|
margin: 0px auto;
|
||||||
|
background: lightgrey;
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------USER PROFILE----------------------------*/
|
/*-----------------------------USER PROFILE----------------------------*/
|
||||||
#user_profile {
|
#user_profile {
|
||||||
@ -213,7 +218,12 @@ footer{
|
|||||||
|
|
||||||
/*--------------------------------MODALE-------------------------------*/
|
/*--------------------------------MODALE-------------------------------*/
|
||||||
.choose_file_widget {
|
.choose_file_widget {
|
||||||
display: inline;
|
display: none;
|
||||||
|
}
|
||||||
|
.ui-dialog .ui-dialog-buttonpane {
|
||||||
|
bottom: 0px;
|
||||||
|
position: absolute;
|
||||||
|
width: 97%;
|
||||||
}
|
}
|
||||||
.form-wrapper {
|
.form-wrapper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
<title>{% block title %}{% trans %}Welcome!{% endtrans %}{% endblock %}</title>
|
<title>{% block title %}{% trans %}Welcome!{% endtrans %}{% endblock %}</title>
|
||||||
<link rel="stylesheet" href="{{ static('core/base.css') }}">
|
<link rel="stylesheet" href="{{ static('core/base.css') }}">
|
||||||
<link rel="stylesheet" href="{{ static('core/form.css') }}">
|
<link rel="stylesheet" href="{{ static('core/form.css') }}">
|
||||||
<link rel="stylesheet" href="{{ static('core/style.css') }}">
|
|
||||||
<link rel="stylesheet" href="{{ static('core/multiple-select.css') }}">
|
<link rel="stylesheet" href="{{ static('core/multiple-select.css') }}">
|
||||||
<link rel="stylesheet" href="{{ static('core/js/ui/jquery-ui.min.css') }}">
|
<link rel="stylesheet" href="{{ static('core/js/ui/jquery-ui.min.css') }}">
|
||||||
|
<link rel="stylesheet" href="{{ static('core/style.css') }}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -50,11 +50,13 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if not popup %}
|
||||||
<footer>
|
<footer>
|
||||||
{% block footer %}
|
{% block footer %}
|
||||||
{% trans %}Site made by good people{% endtrans %}
|
{% trans %}Site made by good people{% endtrans %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</footer>
|
</footer>
|
||||||
|
{% endif %}
|
||||||
<!--
|
<!--
|
||||||
{% block tests %}
|
{% block tests %}
|
||||||
{{ tests }}
|
{{ tests }}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
{% extends "core/base.jinja" %}
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans name=form.instance.__class__._meta.verbose_name %}Create {{ name }}{% endtrans %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans name=form.instance.__class__._meta.verbose_name %}Create {{ name }}{% endtrans %}</h2>
|
<h2>{% trans name=form.instance.__class__._meta.verbose_name %}Create {{ name }}{% endtrans %}</h2>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
|
@ -50,4 +50,13 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% block script %}
|
||||||
|
{{ super() }}
|
||||||
|
{% if popup %}
|
||||||
|
<script>
|
||||||
|
parent.$(".choose_file_widget").css("height", "75%");
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -48,11 +48,12 @@
|
|||||||
|
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% if popup and file.is_file %}
|
|
||||||
<script>
|
<script>
|
||||||
parent.$("#file_id").replaceWith('<span id="file_id" value="{{ file.id }}">{{ file.name }}</span>');
|
{% if popup and file.is_file %}
|
||||||
</script>
|
parent.$("#file_id").replaceWith('<div id="file_id" value="{{ file.id }}">{{ file.name }}</div>');
|
||||||
|
parent.$(".ui-dialog-buttonpane button").button("option", "disabled", false);
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user