Commit 18a06e4a authored by OzzieIsaacs's avatar OzzieIsaacs

Fixed typeahead with reverse proxy

fixed marking of tags in advanced search
seperated js and html
parent d5a64baf
This diff is collapsed.
...@@ -25,6 +25,39 @@ $(function() { ...@@ -25,6 +25,39 @@ $(function() {
$this.text('Please wait...'); $this.text('Please wait...');
$this.addClass('disabled'); $this.addClass('disabled');
}); });
$("#restart").click(function() {
$.ajax({
dataType: 'json',
url: window.location.pathname+"/../../shutdown",
data: {"parameter":0},
success: function(data) {
return alert(data.text);}
});
});
$("#shutdown").click(function() {
$.ajax({
dataType: 'json',
url: window.location.pathname+"/../../shutdown",
data: {"parameter":1},
success: function(data) {
return alert(data.text);}
});
});
$("#check_for_update").click(function() {
var button_text = $("#check_for_update").html();
$("#check_for_update").html('Checking...');
$.ajax({
dataType: 'json',
url: window.location.pathname+"/../../get_update_status",
success: function(data) {
if (data.status == true) {
$("#check_for_update").addClass('hidden');
$("#perform_update").removeClass('hidden');
}else{
$("#check_for_update").html(button_text);
};}
});
});
}); });
......
...@@ -115,40 +115,3 @@ ...@@ -115,40 +115,3 @@
</div> </div>
{% endblock %} {% endblock %}
{% block js %}
<script type="text/javascript">
$("#restart").click(function() {
$.ajax({
dataType: 'json',
url: "{{url_for('shutdown')}}",
data: {"parameter":0},
//data: data,
success: function(data) {
return alert(data.text);}
});
});
$("#shutdown").click(function() {
$.ajax({
dataType: 'json',
url: "{{url_for('shutdown')}}",
data: {"parameter":1},
success: function(data) {
return alert(data.text);}
});
});
$("#check_for_update").click(function() {
$("#check_for_update").html('Checking...');
$.ajax({
dataType: 'json',
url: "{{url_for('get_update_status')}}",
success: function(data) {
if (data.status == true) {
$("#check_for_update").addClass('hidden');
$("#perform_update").removeClass('hidden');
}else{
$("#check_for_update").html('{{_('Check for update')}}');
};}
});
});
</script>
{% endblock %}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="col-sm-3 col-lg-3 col-xs-12"> <div class="col-sm-3 col-lg-3 col-xs-12">
<div class="cover"> <div class="cover">
{% if book.has_cover %} {% if book.has_cover %}
<img src="{{ url_for('get_cover', cover_path=book.path) }}" /> <img src="{{ url_for('get_cover', cover_path=book.path.replace('\\','/')) }}" />
{% else %} {% else %}
<img src="{{ url_for('static', filename='generic_cover.jpg') }}" /> <img src="{{ url_for('static', filename='generic_cover.jpg') }}" />
{% endif %} {% endif %}
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<label for="Tags">{{_('Exclude Series')}}</label> <label for="Series">{{_('Exclude Series')}}</label>
<div class="form-group"> <div class="form-group">
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons"> <div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
{% for serie in series %} {% for serie in series %}
...@@ -81,21 +81,6 @@ ...@@ -81,21 +81,6 @@
<script src="{{ url_for('static', filename='js/typeahead.bundle.js') }}"></script> <script src="{{ url_for('static', filename='js/typeahead.bundle.js') }}"></script>
<script src="{{ url_for('static', filename='js/edit_books.js') }}"></script> <script src="{{ url_for('static', filename='js/edit_books.js') }}"></script>
<script> <script>
$('form')}}.on('change input typeahead:selected', function() {
form = $('form')}}.serialize();
$.getJSON( "{{ url_for('get_matching_tags') }}", form, function( data ) {
$('.tags_click').each(function() {
if ($.inArray(parseInt($(this).children('input').first().val(), 10), data.tags) == -1 ) {
if (!($(this).hasClass('active'))) {
$(this).addClass('disabled');
}
}
else {
$(this).removeClass('disabled');
}
});
});
});
</script> </script>
{% endblock %} {% endblock %}
{% block header %} {% block header %}
......
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