diff --git a/cps/static/js/get_meta.js b/cps/static/js/get_meta.js index f2b8fda3..2ee182bc 100644 --- a/cps/static/js/get_meta.js +++ b/cps/static/js/get_meta.js @@ -6,6 +6,7 @@ */ $(document).ready(function () { + var msg = i18n_msg; var douban = 'https://api.douban.com'; var db_search = '/v2/book/search'; var db_get_info = '/v2/book/'; @@ -74,7 +75,7 @@ $(document).ready(function () { } do_search = function (keyword) { show_flag = 0; - $('#meta-info').text('Loading...'); + $('#meta-info').text(msg.loading); var keyword = $('#keyword').val(); if (keyword) { db_search_book(keyword); @@ -93,7 +94,7 @@ $(document).ready(function () { db_results = data.books; }, error: function () { - $('#meta-info').html('

Search error!

'); + $('#meta-info').html('

'+ msg.search_error+'!

'); }, complete: function () { db_done = true; @@ -108,8 +109,8 @@ $(document).ready(function () { $('#meta-info').html(''); } if (gg_done && db_done) { - if (gg_results.length < 1 && db_results.length < 1) { - $('#meta-info').html('

No Result! Please try anonther keyword.

'); + if (!gg_results || !db_results) { + $('#meta-info').html('

'+ msg.no_result +'

'); return; } } @@ -129,10 +130,10 @@ $(document).ready(function () { '
' + '

' + book.volumeInfo.title + '

' + - '

Author:' + book.volumeInfo.authors + '

' + - '

Publisher:' + book.volumeInfo.publisher + '

' + - '

Description:' + book.volumeInfo.description + '

' + - '

Source:Google Books

' + + '

'+ msg.author +':' + book.volumeInfo.authors + '

' + + '

'+ msg.publisher + ':' + book.volumeInfo.publisher + '

' + + '

'+ msg.description + ':' + book.volumeInfo.description + '

' + + '

'+ msg.source + ':Google Books

' + '
' + ''; $("#book-list").append(book_html); @@ -149,10 +150,10 @@ $(document).ready(function () { '
' + '

' + book.title + '

' + - '

Author:' + book.author + '

' + - '

Publisher:' + book.publisher + '

' + - '

Description:' + book.summary + '

' + - '

Source:Douban Books

' + + '

' + msg.author + ':' + book.author + '

' + + '

' + msg.publisher + ':' + book.publisher + '

' + + '

' + msg.description + ':' + book.summary + '

' + + '

' + msg.source + ':Douban Books

' + '
' + ''; $("#book-list").append(book_html); diff --git a/cps/templates/book_edit.html b/cps/templates/book_edit.html index 3db04558..d35812e6 100644 --- a/cps/templates/book_edit.html +++ b/cps/templates/book_edit.html @@ -1,9 +1,13 @@ -{% extends "layout.html" %} {% block body %} {% if book %} +{% extends "layout.html" %} +{% block body %} +{% if book %}
{% if book.has_cover %} - {% else %} - {% endif %} + + {% else %} + + {% endif %}
@@ -25,43 +29,54 @@
-
- - -
-
- - -
-
- - -
-
- - -
- +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
- - {% if cc|length > 0 %} {% for c in cc %} -
- {% if c.datatype == 'bool' %} - - {% endif %} {% if c.datatype in ['text', 'series'] and not c.is_multiple %} - 0 %} value="{{ book['custom_column_' ~ c.id][0].value }}" {% endif %}> {% endif %} {% if c.datatype - in ['text', 'series'] and c.is_multiple %} - 0 %} value="{% for column in book['custom_column_' ~ c.id] %}{{ column.value.strip() }}{% if - not loop.last %}, {% endif %}{% endfor %}"{% endif %}> {% endif %} {% if c.datatype == 'enumeration' %} - + {% endif %} + {% if c.datatype in ['text', 'series'] and not c.is_multiple %} + 0 %} + value="{{ book['custom_column_' ~ c.id][0].value }}" + {% endif %}> + {% endif %} + + {% if c.datatype in ['text', 'series'] and c.is_multiple %} + 0 %} + value="{% for column in book['custom_column_' ~ c.id] %}{{ column.value.strip() }}{% if not loop.last %}, {% endif %}{% endfor %}"{% endif %}> + {% endif %} + + {% if c.datatype == 'enumeration' %} + {% endif %} {% if c.datatype == 'rating' %} - 0 %} value="{{ '%d' % (book['custom_column_' ~ c.id][0].value / - 2) }}" {% endif %}> {% endif %} -
- {% endfor %} {% endif %} - + + {% endif %} + {% if c.datatype == 'rating' %} + 0 %} + value="{{ '%d' % (book['custom_column_' ~ c.id][0].value / 2) }}" + {% endif %}> + {% endif %} + + {% endfor %} + {% endif %} + +
- {{_('Get Meta Data')}} + {{_('Get Metadata')}} {{_('Back')}} @@ -94,14 +115,14 @@ -{% endblock %} +{% endblock %} {% block js %} + -{% endblock %} +{% endblock %} {% block header %} - -{% endblock %} \ No newline at end of file + +{% endblock %}