diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNWeb/TableOpts.pm | 5 | ||||
-rw-r--r-- | lib/VNWeb/ULists/List.pm | 8 | ||||
-rw-r--r-- | lib/VNWeb/VN/List.pm | 5 |
3 files changed, 16 insertions, 2 deletions
diff --git a/lib/VNWeb/TableOpts.pm b/lib/VNWeb/TableOpts.pm index 8d0af29a..795dcae0 100644 --- a/lib/VNWeb/TableOpts.pm +++ b/lib/VNWeb/TableOpts.pm @@ -31,6 +31,7 @@ package VNWeb::TableOpts; # # may include '?o' placeholder that will be replaced with selected ASC/DESC, # # or '!o' as placeholder for the opposite. # # If no placeholders are present, the ASC/DESC will be added automatically. +# sort_num => 0/1, # Whether this is a numeric field, used in the UI to display "1→9" instead of "A→Z". # sort_default => 'asc', # Set to 'asc' or 'desc' if this column should be sorted on by default. # }, # popularity => { @@ -208,7 +209,7 @@ my $FORM_OUT = form_compile any => { views => { type => 'array', values => { uint => 1 } }, default => { uint => 1 }, value => { uint => 1 }, - sorts => { aoh => { id => { uint => 1 }, name => {} } }, + sorts => { aoh => { id => { uint => 1 }, name => {}, num => { anybool => 1 } } }, vis => { aoh => { id => { uint => 1 }, name => {} } }, }; @@ -230,7 +231,7 @@ sub elm_ { views => $o->{views}, default => $o->{default}, value => $v, - sorts => [ map +{ id => $_->{sort_id}, name => $_->{name} }, grep defined $_->{sort_id}, values $o->{col_order}->@* ], + sorts => [ map +{ id => $_->{sort_id}, name => $_->{name}, num => $_->{sort_num}||0 }, grep defined $_->{sort_id}, values $o->{col_order}->@* ], vis => [ map +{ id => $_->{vis_id}, name => $_->{name} }, grep defined $_->{vis_id}, values $o->{col_order}->@* ], }, sub { TUWF::XML::div_ @_, sub { diff --git a/lib/VNWeb/ULists/List.pm b/lib/VNWeb/ULists/List.pm index 2e7c0837..9d27c679 100644 --- a/lib/VNWeb/ULists/List.pm +++ b/lib/VNWeb/ULists/List.pm @@ -17,6 +17,7 @@ my $TABLEOPTS = tableopts name => 'Vote date', sort_sql => 'uv.vote_date', sort_id => 1, + sort_num => 1, vis_id => 0, compat => 'voted' }, @@ -24,6 +25,7 @@ my $TABLEOPTS = tableopts name => 'Vote', sort_sql => 'uv.vote', sort_id => 2, + sort_num => 1, vis_id => 1, compat => 'vote' }, @@ -31,6 +33,7 @@ my $TABLEOPTS = tableopts name => 'Rating', sort_sql => 'v.c_rating', sort_id => 3, + sort_num => 1, vis_id => 2, compat => 'rating' }, @@ -45,6 +48,7 @@ my $TABLEOPTS = tableopts name => 'Added', sort_sql => 'uv.added', sort_id => 5, + sort_num => 1, vis_id => 4, compat => 'added' }, @@ -52,6 +56,7 @@ my $TABLEOPTS = tableopts name => 'Modified', sort_sql => 'uv.lastmod', sort_id => 6, + sort_num => 1, vis_id => 5, compat => 'modified' }, @@ -59,6 +64,7 @@ my $TABLEOPTS = tableopts name => 'Start date', sort_sql => 'uv.started', sort_id => 7, + sort_num => 1, vis_id => 6, compat => 'started' }, @@ -66,6 +72,7 @@ my $TABLEOPTS = tableopts name => 'Finish date', sort_sql => 'uv.finished', sort_id => 8, + sort_num => 1, vis_id => 7, compat => 'finished' }, @@ -73,6 +80,7 @@ my $TABLEOPTS = tableopts name => 'Release date', sort_sql => 'v.c_released', sort_id => 9, + sort_num => 1, vis_id => 8, compat => 'rel' }; diff --git a/lib/VNWeb/VN/List.pm b/lib/VNWeb/VN/List.pm index f1380cbf..7c72f6d8 100644 --- a/lib/VNWeb/VN/List.pm +++ b/lib/VNWeb/VN/List.pm @@ -31,6 +31,7 @@ sub TABLEOPTS { compat => 'rel', sort_id => 2, sort_sql => 'v.c_released ?o, v.title', + sort_num => 1, }, length => { name => 'Length', @@ -45,6 +46,7 @@ sub TABLEOPTS { compat => 'pop', sort_id => 3, sort_sql => 'v.c_pop_rank !o, v.sorttitle', + sort_num => 1, vis_id => 0, vis_default => 1, }, @@ -53,6 +55,7 @@ sub TABLEOPTS { compat => 'rating', sort_id => 4, sort_sql => 'v.c_rat_rank !o NULLS LAST, v.sorttitle', + sort_num => 1, vis_id => 1, vis_default => 1, }, @@ -60,12 +63,14 @@ sub TABLEOPTS { name => 'Vote average', sort_id => 5, sort_sql => 'v.c_average ?o NULLS LAST, v.sorttitle', + sort_num => 1, vis_id => 3, }, votes => { name => 'Number of votes', sort_id => 6, sort_sql => 'v.c_votecount ?o, v.sorttitle', + sort_num => 1, } } |