mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
CS Book Details: Show date fields
This commit is contained in:
parent
7cb180b9e2
commit
58be0c575b
@ -16,7 +16,7 @@ from calibre.srv.ajax import get_db, search_result
|
||||
from calibre.srv.errors import HTTPNotFound, HTTPBadRequest
|
||||
from calibre.srv.metadata import book_as_json, categories_as_json, icon_map
|
||||
from calibre.srv.routes import endpoint, json
|
||||
from calibre.utils.config import prefs
|
||||
from calibre.utils.config import prefs, tweaks
|
||||
from calibre.utils.icu import sort_key
|
||||
from calibre.utils.search_query_parser import ParseException
|
||||
|
||||
@ -94,7 +94,14 @@ def interface_data(ctx, rd):
|
||||
Optional: ?num=50&sort=timestamp.desc&library_id=<default library>
|
||||
&search=''&extra_books=''
|
||||
'''
|
||||
ans = {'username':rd.username, 'output_format':prefs['output_format'].upper(), 'input_formats':{x.upper():True for x in available_input_formats()}}
|
||||
ans = {
|
||||
'username':rd.username,
|
||||
'output_format':prefs['output_format'].upper(),
|
||||
'input_formats':{x.upper():True for x in available_input_formats()},
|
||||
'gui_pubdate_display_format':tweaks['gui_pubdate_display_format'],
|
||||
'gui_timestamp_display_format':tweaks['gui_timestamp_display_format'],
|
||||
'gui_last_modified_display_format':tweaks['gui_last_modified_display_format'],
|
||||
}
|
||||
ans['library_map'], ans['default_library'] = ctx.library_map
|
||||
ud = {}
|
||||
if rd.username:
|
||||
|
@ -10,6 +10,7 @@ from gettext import gettext as _
|
||||
from book_list.globals import get_boss
|
||||
from modals import error_dialog
|
||||
from widgets import create_spinner, create_button
|
||||
from date import format_date
|
||||
|
||||
bd_counter = 0
|
||||
|
||||
@ -45,7 +46,7 @@ def allowed_fields(field):
|
||||
return False
|
||||
return True
|
||||
|
||||
default_sort = {f:i+1 for i, f in enumerate(('title', 'title_sort', 'authors', 'author_sort', 'series', 'rating', 'pubdate', 'tags', 'identifiers', 'languages', 'publisher'))}
|
||||
default_sort = {f:i+1 for i, f in enumerate(('title', 'title_sort', 'authors', 'author_sort', 'series', 'rating', 'pubdate', 'tags', 'timestamp', 'pubdate', 'identifiers', 'languages', 'publisher', 'last_modified'))}
|
||||
default_sort['formats'] = 999
|
||||
|
||||
def field_sorter(field_metadata):
|
||||
@ -168,6 +169,11 @@ def render_metadata(mi, interface_data, table, field_list=None):
|
||||
if k is not val[-1]:
|
||||
td.appendChild(document.createTextNode(', '))
|
||||
|
||||
def process_datetime(field, fm, name, val):
|
||||
if val:
|
||||
fmt = interface_data['gui_' + field + '_display_format'] or (fm['display'] or {}).date_format
|
||||
add_row(name, format_date(val, fmt))
|
||||
|
||||
def process_field(field, fm):
|
||||
name = fm.name or field
|
||||
datatype = fm.datatype
|
||||
@ -190,6 +196,8 @@ def render_metadata(mi, interface_data, table, field_list=None):
|
||||
func = process_publisher
|
||||
elif field == 'languages':
|
||||
func = process_languages
|
||||
elif datatype == 'datetime':
|
||||
func = process_datetime
|
||||
if func:
|
||||
func(field, fm, name, val)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user