0001-pricing-add-js-css-for-ordering-formset-65440.patch
.gitignore | ||
---|---|---|
14 | 14 |
junit*xml |
15 | 15 |
pylint.out |
16 | 16 |
*.swp |
17 |
lingo/manager/static/css/style.css |
lingo/manager/static/css/style.scss | ||
---|---|---|
1 |
div.paragraph { |
|
2 |
background: white; |
|
3 |
box-sizing: border-box; |
|
4 |
border: 1px solid #386ede; |
|
5 |
border-radius: 3px; |
|
6 |
max-width: 100%; |
|
7 |
padding: 5px 15px; |
|
8 |
margin-bottom: 1rem; |
|
9 |
h4 { |
|
10 |
margin-top: 5px; |
|
11 |
border-bottom: none; |
|
12 |
} |
|
13 |
} |
|
14 | ||
15 |
.sortable { |
|
16 |
span.handle { |
|
17 |
cursor: move; |
|
18 |
display: inline-block; |
|
19 |
padding: 0.5ex; |
|
20 |
text-align: center; |
|
21 |
width: 2em; |
|
22 |
height: 100%; |
|
23 |
box-sizing: border-box; |
|
24 |
font-weight: normal; |
|
25 |
} |
|
26 |
} |
|
27 | ||
28 |
ul.objects-list.sortable { |
|
29 |
li { |
|
30 |
position: relative; |
|
31 |
& > a { |
|
32 |
display: inline-block; |
|
33 |
} |
|
34 |
} |
|
35 |
} |
lingo/manager/static/js/lingo.manager.js | ||
---|---|---|
1 |
$(function() { |
|
2 |
$(document).on('click', '#add-pricing-variable-form', function() { |
|
3 |
if (typeof property_forms === "undefined") {var property_forms = $('.pricing-variable-form');} |
|
4 |
if (typeof total_forms === "undefined") {var total_form = $('#id_form-TOTAL_FORMS');} |
|
5 |
if (typeof form_num === "undefined") {var form_num = property_forms.length - 1;} |
|
6 |
var new_form = $(property_forms[0]).clone(); |
|
7 |
var form_regex = RegExp(`form-(\\d){1}-`,'g'); |
|
8 |
form_num++; |
|
9 |
new_form.html(new_form.html().replace(form_regex, `form-${form_num}-`)); |
|
10 |
new_form.appendTo('#pricing-variable-forms tbody'); |
|
11 |
$('#id_form-' + form_num + '-key').val(''); |
|
12 |
$('#id_form-' + form_num + '-value').val(''); |
|
13 |
total_form.val(form_num + 1); |
|
14 |
}) |
|
15 | ||
16 |
$('.sortable').sortable({ |
|
17 |
handle: '.handle', |
|
18 |
items: '.sortable-item', |
|
19 |
update : function(event, ui) { |
|
20 |
var new_order = ''; |
|
21 |
$(this).find('.sortable-item').each(function(i, x) { |
|
22 |
var item_id = $(x).data('item-id'); |
|
23 |
if (new_order) { |
|
24 |
new_order += ','; |
|
25 |
} |
|
26 |
new_order += item_id; |
|
27 |
}); |
|
28 |
$.ajax({ |
|
29 |
url: $(this).data('order-url'), |
|
30 |
data: {'new-order': new_order} |
|
31 |
}); |
|
32 |
} |
|
33 |
}); |
|
34 |
}); |
lingo/manager/templates/lingo/manager_base.html | ||
---|---|---|
1 | 1 |
{% extends "lingo/base.html" %} |
2 |
{% load static %} |
|
3 | ||
4 |
{% block extrascripts %} |
|
5 |
{{ block.super }} |
|
6 |
<script src="{% static 'js/lingo.manager.js' %}"></script> |
|
7 |
{% endblock %} |
setup.py | ||
---|---|---|
130 | 130 | |
131 | 131 | |
132 | 132 |
class build(_build): |
133 |
sub_commands = [('compile_translations', None)] + _build.sub_commands |
|
133 |
sub_commands = [('compile_translations', None), ('compile_scss', None)] + _build.sub_commands
|
|
134 | 134 | |
135 | 135 | |
136 | 136 |
class install_lib(_install_lib): |
... | ... | |
169 | 169 |
zip_safe=False, |
170 | 170 |
cmdclass={ |
171 | 171 |
'build': build, |
172 |
'compile_scss': compile_scss, |
|
172 | 173 |
'compile_translations': compile_translations, |
173 | 174 |
'install_lib': install_lib, |
174 | 175 |
'sdist': eo_sdist, |
175 |
- |