Commit f1858eaa authored by Priit Laes's avatar Priit Laes

Replace Chosen by Select2

parent cf3b226c
...@@ -41,7 +41,7 @@ var AdminFilters = function(element, filters_element, operations, options, types ...@@ -41,7 +41,7 @@ var AdminFilters = function(element, filters_element, operations, options, types
$select.append($('<option/>').attr('value', this[0]).text(this[1])); $select.append($('<option/>').attr('value', this[0]).text(this[1]));
}); });
$select.chosen(); $select.select2();
var optId = op[0][0]; var optId = op[0][0];
...@@ -58,7 +58,7 @@ var AdminFilters = function(element, filters_element, operations, options, types ...@@ -58,7 +58,7 @@ var AdminFilters = function(element, filters_element, operations, options, types
.appendTo($el); .appendTo($el);
}); });
$field.chosen(); $field.select2();
} else } else
{ {
$field = $('<input type="text" class="filter-val" />') $field = $('<input type="text" class="filter-val" />')
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
this.applyStyle = function(el, name) { this.applyStyle = function(el, name) {
switch (name) { switch (name) {
case 'chosen': case 'chosen':
$(el).chosen(); $(el).select2();
break; break;
case 'chosenblank': case 'chosenblank':
$(el).chosen({allow_single_deselect: true}); $(el).select2({allowClear: true});
break; break;
case 'datepicker': case 'datepicker':
$(el).datepicker(); $(el).datepicker();
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
}; };
this.applyGlobalStyles = function(parent) { this.applyGlobalStyles = function(parent) {
$('[data-role=chosen]', parent).chosen(); $('[data-role=chosen]', parent).select2();
$('[data-role=chosenblank]', parent).chosen({allow_single_deselect: true}); $('[data-role=chosenblank]', parent).select2({allowClear: true});
$('[data-role=datepicker]', parent).datepicker(); $('[data-role=datepicker]', parent).datepicker();
$('[data-role=datetimepicker]', parent).datepicker({displayTime: true}); $('[data-role=datetimepicker]', parent).datepicker({displayTime: true});
}; };
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="{{ url_for('admin.static', filename='bootstrap/js/bootstrap.min.js') }}" type="text/javascript"></script> <script src="{{ url_for('admin.static', filename='bootstrap/js/bootstrap.min.js') }}" type="text/javascript"></script>
<script src="{{ url_for('admin.static', filename='chosen/chosen.jquery.min.js') }}" type="text/javascript"></script> <script src="{{ url_for('admin.static', filename='select2/select2.min.js') }}" type="text/javascript"></script>
{% block tail %} {% block tail %}
{% endblock %} {% endblock %}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% import 'admin/lib.html' as lib with context %} {% import 'admin/lib.html' as lib with context %}
{% block head %} {% block head %}
<link href="{{ url_for('admin.static', filename='chosen/chosen.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='select2/select2.css') }}" rel="stylesheet">
<link href="{{ url_for('admin.static', filename='css/datepicker.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='css/datepicker.css') }}" rel="stylesheet">
{% endblock %} {% endblock %}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% import 'admin/lib.html' as lib with context %} {% import 'admin/lib.html' as lib with context %}
{% block head %} {% block head %}
<link href="{{ url_for('admin.static', filename='chosen/chosen.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='select2/select2.css') }}" rel="stylesheet">
<link href="{{ url_for('admin.static', filename='css/datepicker.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='css/datepicker.css') }}" rel="stylesheet">
{% endblock %} {% endblock %}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{% import 'admin/actions.html' as actionlib with context %} {% import 'admin/actions.html' as actionlib with context %}
{% block head %} {% block head %}
<link href="{{ url_for('admin.static', filename='chosen/chosen.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='select2/select2.css') }}" rel="stylesheet">
<link href="{{ url_for('admin.static', filename='css/datepicker.css') }}" rel="stylesheet"> <link href="{{ url_for('admin.static', filename='css/datepicker.css') }}" rel="stylesheet">
{% endblock %} {% endblock %}
......
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 to comment