latin: hardcoded tetromino block cascades
[sheet.git] / writer.plp
index fe538ddb5bbe4fc8145f531050084f9480f18541..c6d5898b77a93870ba9e3f1fbace448b44c13e89 100644 (file)
@@ -105,7 +105,7 @@ my %wordcol = (
        thumb   => {-label => 'Convert options', -multiple => 1, -src => sub {
                return "data/word/en/$_[0]->{id}.jpg";
        }},
-       story   => {-label => 'Story', type => 'textarea'},
+       story   => {-label => 'Story', type => 'textarea', hidden => 'hidden'},
 );
 
 if (my $search = $fields{q}) {
@@ -202,7 +202,10 @@ elsif (defined $post{form}) {{
        if ($reimage) {
                eval {
                        $image->convert($wordcol{thumb}->{-src}->($row), $row->{thumb});
-               } or Alert([ "Thumbnail image not generated", $@->[0] ], $@->[1]);
+               } or do {
+                       my ($warn, @details) = ref $@ ? @{$@} : $@;
+                       Alert([ "Thumbnail image not generated", $warn ], @details);
+               };
        }
 }}
 else {
@@ -225,6 +228,7 @@ bless $row, 'Shiar_Sheet::FormRow';
 for my $col (@wordcols) {
        my $info = $wordcol{$col} or next;
        my ($attr, @span) = ref $info eq 'ARRAY' ? @{$info} : $info;
+       next if delete $attr->{hidden} and not $row->{$col};
        my $title = ref $attr ? delete $attr->{-label} : $attr;
        printf '<li><label for="%s">%s</label><p>', $col, $title;
                printf '<span class=inline>';