")
@login_required
def get_sorted_entry(field, bookid):
- if field == 'title' or field == 'authors':
+ if field in ['title', 'authors', 'sort', 'author_sort']:
book = calibre_db.get_filtered_book(bookid)
if book:
if field == 'title':
return json.dumps({'sort': book.sort})
elif field == 'authors':
return json.dumps({'author_sort': book.author_sort})
+ if field == 'sort':
+ return json.dumps({'sort': book.title})
+ if field == 'author_sort':
+ return json.dumps({'author_sort': book.author})
return ""
diff --git a/cps/helper.py b/cps/helper.py
index d7be6dfe..f5e57e02 100644
--- a/cps/helper.py
+++ b/cps/helper.py
@@ -498,6 +498,7 @@ def generate_random_password():
def uniq(inpt):
output = []
+ inpt = [ " ".join(inp.split()) for inp in inpt]
for x in inpt:
if x not in output:
output.append(x)
diff --git a/cps/isoLanguages.py b/cps/isoLanguages.py
index e447a623..35d9f0a7 100644
--- a/cps/isoLanguages.py
+++ b/cps/isoLanguages.py
@@ -63,7 +63,7 @@ def get_language_codes(locale, language_names, remainder=None):
if v in language_names:
lang.append(k)
language_names.remove(v)
- if remainder is not None:
+ if remainder is not None and language_names:
remainder.extend(language_names)
return lang
diff --git a/cps/static/js/table.js b/cps/static/js/table.js
index 0982f374..6eed51f0 100644
--- a/cps/static/js/table.js
+++ b/cps/static/js/table.js
@@ -95,17 +95,22 @@ $(function() {
mode: "inline",
emptytext: "",
success: function (response, __) {
- if(!response.success) return response.msg;
+ if (!response.success) return response.msg;
return {newValue: response.newValue};
+ },
+ params: function (params) {
+ params.checkA = $('#autoupdate_authorsort').prop('checked');
+ params.checkT = $('#autoupdate_titlesort').prop('checked');
+ return params
}
}
};
- }
- var validateText = $(this).attr("data-edit-validate");
- if (validateText) {
- element.editable.validate = function (value) {
- if ($.trim(value) === "") return validateText;
- };
+ var validateText = $(this).attr("data-edit-validate");
+ if (validateText) {
+ element.editable.validate = function (value) {
+ if ($.trim(value) === "") return validateText;
+ };
+ }
}
column.push(element);
});
@@ -132,7 +137,8 @@ $(function() {
},
// eslint-disable-next-line no-unused-vars
onEditableSave: function (field, row, oldvalue, $el) {
- if (field === "title" || field === "authors") {
+ if ($.inArray(field, [ "title", "sort" ]) !== -1 && $('#autoupdate_titlesort').prop('checked')
+ || $.inArray(field, [ "authors", "author_sort" ]) !== -1 && $('#autoupdate_authorsort').prop('checked')) {
$.ajax({
method:"get",
dataType: "json",
@@ -561,7 +567,10 @@ function TableActions (value, row) {
].join("");
}
-
+function editEntry(param)
+{
+ console.log(param);
+}
/* Function for deleting domain restrictions */
function RestrictionActions (value, row) {
return [
@@ -598,7 +607,7 @@ function responseHandler(res) {
}
function singleUserFormatter(value, row) {
- return ''
+ return '' + this.buttontext + ''
}
function checkboxFormatter(value, row, index){
diff --git a/cps/templates/book_table.html b/cps/templates/book_table.html
index ecd840b5..6a31c235 100644
--- a/cps/templates/book_table.html
+++ b/cps/templates/book_table.html
@@ -30,8 +30,8 @@
-
-
+
+
@@ -53,7 +53,7 @@
{{ text_table_row('languages', _('Enter Languages'),_('Languages'), false) }}
{{ text_table_row('publishers', _('Enter Publishers'),_('Publishers'), false) }}
- {% if g.user.role_edit() %}
+ {% if g.user.role_delete_books() and g.user.role_edit()%}
{{_('Delete')}} |
{% endif %}
@@ -94,6 +94,4 @@
-
{% endblock %}
diff --git a/cps/templates/user_table.html b/cps/templates/user_table.html
index 9817faa6..318f873a 100644
--- a/cps/templates/user_table.html
+++ b/cps/templates/user_table.html
@@ -12,7 +12,7 @@
{% endif %}
{% if validate %}data-edit-validate="{{ _('This Field is Required') }}"{% endif %}>
{% if button %}
-
+
{% endif %}
{{ show_text }}
diff --git a/cps/translations/de/LC_MESSAGES/messages.po b/cps/translations/de/LC_MESSAGES/messages.po
index 29f42ad1..603cd586 100644
--- a/cps/translations/de/LC_MESSAGES/messages.po
+++ b/cps/translations/de/LC_MESSAGES/messages.po
@@ -1693,7 +1693,7 @@ msgstr "Speicherort der Calibre-Datenbank"
#: cps/templates/config_edit.html:29
msgid "To activate serverside filepicker start Calibre-Web with -f option"
-msgstr "Calibre-Web mit -f Option starten um die serverseitige Dateiauswahl zu aktivieren"
+msgstr "Calibre-Web mit -f Option starten, um die serverseitige Dateiauswahl zu aktivieren"
#: cps/templates/config_edit.html:35
msgid "Use Google Drive?"