Commit 5fe2e959 by Kálmán Viktor

circle: collect autocomplete js too

- also remove that static include and move them to js
- change css order so bootstrap-theme is not overriden
parent ea14f0c3
...@@ -178,14 +178,15 @@ PIPELINE_DISABLE_WRAPPER = True ...@@ -178,14 +178,15 @@ PIPELINE_DISABLE_WRAPPER = True
PIPELINE_LESS_ARGUMENTS = u'--include-path={}'.format(':'.join(STATICFILES_DIRS)) PIPELINE_LESS_ARGUMENTS = u'--include-path={}'.format(':'.join(STATICFILES_DIRS))
PIPELINE_CSS = { PIPELINE_CSS = {
"all": {"source_filenames": ( "all": {"source_filenames": (
"compile_bootstrap.less",
"bootstrap/dist/css/bootstrap-theme.css",
"fontawesome/css/font-awesome.css", "fontawesome/css/font-awesome.css",
"jquery-simple-slider/css/simple-slider.css", "jquery-simple-slider/css/simple-slider.css",
"bootstrap-tour/build/css/bootstrap-tour.css", "bootstrap-tour/build/css/bootstrap-tour.css",
"template.less", "template.less",
"dashboard/dashboard.less", "dashboard/dashboard.less",
"network/network.less", "network/network.less",
"compile_bootstrap.less", "autocomplete_light/style.css",
"bootstrap/dist/css/bootstrap-theme.css",
), ),
"output_filename": "all.css", "output_filename": "all.css",
} }
...@@ -201,7 +202,7 @@ PIPELINE_JS = { ...@@ -201,7 +202,7 @@ PIPELINE_JS = {
"dashboard/dashboard.js", "dashboard/dashboard.js",
"dashboard/group-details.js", "dashboard/group-details.js",
"dashboard/group-list.js", "dashboard/group-list.js",
"dashboard/js/stupidtable.min.js", "dashboard/js/stupidtable.min.js", # no bower file
"dashboard/node-create.js", "dashboard/node-create.js",
"dashboard/node-details.js", "dashboard/node-details.js",
"dashboard/node-list.js", "dashboard/node-list.js",
...@@ -214,6 +215,11 @@ PIPELINE_JS = { ...@@ -214,6 +215,11 @@ PIPELINE_JS = {
"js/host.js", "js/host.js",
"js/network.js", "js/network.js",
"js/switch-port.js", "js/switch-port.js",
"autocomplete_light/autocomplete.js",
"autocomplete_light/widget.js",
"autocomplete_light/addanother.js",
"autocomplete_light/text_widget.js",
"autocomplete_light/remote.js",
), ),
"output_filename": "all.js", "output_filename": "all.js",
}, },
......
...@@ -609,6 +609,29 @@ function clientInstalledAction(location) { ...@@ -609,6 +609,29 @@ function clientInstalledAction(location) {
$('#confirmation-modal').modal("hide"); $('#confirmation-modal').modal("hide");
} }
function setCookie(name, value, seconds, path) {
if (seconds!=null) {
var today = new Date();
var expire = new Date();
expire.setTime(today.getTime() + seconds);
}
document.cookie = name+"="+escape(value)+"; expires="+expire.toUTCString()+"; path="+path;
}
/* no js compatibility */
function noJS() {
$('.no-js-hidden').show();
$('.js-hidden').hide();
}
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
// for AJAX calls // for AJAX calls
/** /**
* Getter for user cookies * Getter for user cookies
...@@ -631,25 +654,21 @@ function getCookie(name) { ...@@ -631,25 +654,21 @@ function getCookie(name) {
return cookieValue; return cookieValue;
} }
function setCookie(name, value, seconds, path) { function csrfSafeMethod(method) {
if (seconds!=null) { // these HTTP methods do not require CSRF protection
var today = new Date(); return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
var expire = new Date();
expire.setTime(today.getTime() + seconds);
}
document.cookie = name+"="+escape(value)+"; expires="+expire.toUTCString()+"; path="+path;
}
/* no js compatibility */
function noJS() {
$('.no-js-hidden').show();
$('.js-hidden').hide();
} }
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", getCookie("csrftoken"));
}
}
});
/* for autocomplete */
function getParameterByName(name) { $(function() {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); yourlabs.TextWidget.prototype.getValue = function(choice) {
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), return choice.children().html();
results = regex.exec(location.search); }
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); });
}
...@@ -67,9 +67,8 @@ ...@@ -67,9 +67,8 @@
</body> </body>
<script src="{% static "jquery/dist/jquery.min.js" %}"></script> <script src="{% static "jquery/dist/jquery.min.js" %}"></script>
{% compressed_js 'all' %}
<script src="{{ STATIC_URL }}jsi18n/{{ LANGUAGE_CODE }}/djangojs.js"></script> <script src="{{ STATIC_URL }}jsi18n/{{ LANGUAGE_CODE }}/djangojs.js"></script>
{% include 'autocomplete_light/static.html' %} {% compressed_js 'all' %}
{% block extra_script %} {% block extra_script %}
{% endblock %} {% endblock %}
...@@ -79,11 +78,4 @@ ...@@ -79,11 +78,4 @@
{% block extra_etc %} {% block extra_etc %}
{% endblock %} {% endblock %}
<script>
yourlabs.TextWidget.prototype.getValue = function(choice) {
return choice.children().html();
}
</script>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment