Allow apostrophe in ingredient and separator names
This commit is contained in:
parent
c73ed0d98b
commit
f5987f9612
@ -24,6 +24,7 @@ use parent qw(ORB); # This class extends the ORB block class
|
|||||||
use experimental qw(smartmatch);
|
use experimental qw(smartmatch);
|
||||||
use v5.14;
|
use v5.14;
|
||||||
use JSON;
|
use JSON;
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
# How many ingredient rows should appear in the empty form?
|
# How many ingredient rows should appear in the empty form?
|
||||||
use constant DEFAULT_INGREDIENT_COUNT => 5;
|
use constant DEFAULT_INGREDIENT_COUNT => 5;
|
||||||
@ -347,6 +348,8 @@ sub _validate_ingredients {
|
|||||||
return $self -> {"template"} -> load_template("error/error_item.tem", { "%(error)s" => "{L_ERR_JSONFORMAT}: $@" })
|
return $self -> {"template"} -> load_template("error/error_item.tem", { "%(error)s" => "{L_ERR_JSONFORMAT}: $@" })
|
||||||
if($@);
|
if($@);
|
||||||
|
|
||||||
|
print STDERR "Got ingdata ".Dumper($ingdata);
|
||||||
|
|
||||||
foreach my $ingred (@{$ingdata -> {"ingredients"}}) {
|
foreach my $ingred (@{$ingdata -> {"ingredients"}}) {
|
||||||
if($ingred -> {"separator"}) {
|
if($ingred -> {"separator"}) {
|
||||||
$errors .= $self -> _validate_separator($args, $ingred);
|
$errors .= $self -> _validate_separator($args, $ingred);
|
||||||
|
@ -77,8 +77,8 @@ sub new {
|
|||||||
"recipename" => '^[-\w,.\' ]+$',
|
"recipename" => '^[-\w,.\' ]+$',
|
||||||
"tags" => '^[-\w ]+$',
|
"tags" => '^[-\w ]+$',
|
||||||
"quantity" => '^[\d\w./]+$',
|
"quantity" => '^[\d\w./]+$',
|
||||||
"sepname" => '^[-\w,.:()&;#*\ ]{1,255}$',
|
"sepname" => '^[-\w,.:()&;#*\ \']{1,255}$',
|
||||||
"ingredient" => '^[-\w,.:()&;#*\ ]{1,255}$',
|
"ingredient" => '^[-\w,.:()&;#*\ \']{1,255}$',
|
||||||
"notes" => '^[-()\w,."!\'\\/£$%;:@#?><* ]{1,255}$',
|
"notes" => '^[-()\w,."!\'\\/£$%;:@#?><* ]{1,255}$',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-3 cell">
|
<div class="small-3 cell">
|
||||||
<input type="text" class="ingredient" pattern="[-\w,.:()\x26;#*\\ ]+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_ING_PH}" />
|
<input type="text" class="ingredient" pattern="[\-\w,.:\(\)&#\*\\ ']+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_ING_PH}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="small-3 cell">
|
<div class="small-3 cell">
|
||||||
<input type="text" class="notes" placeholder="{L_RECIPE_ING_NOTE_PH}" />
|
<input type="text" class="notes" placeholder="{L_RECIPE_ING_NOTE_PH}" />
|
||||||
@ -139,7 +139,7 @@
|
|||||||
<li class="separator">
|
<li class="separator">
|
||||||
<div class="grid-x">
|
<div class="grid-x">
|
||||||
<div class="small-11 cell">
|
<div class="small-11 cell">
|
||||||
<input type="text" class="separator" pattern="[-\w,.:()\x26;#*\\ ]+" title="{L_RECIPE_ING_FORMAT}" placeholder="Separator text">
|
<input type="text" class="separator" pattern="[\-\w,.:\(\)&#\*\\ ']+" title="{L_RECIPE_ING_FORMAT}" placeholder="Separator text">
|
||||||
</div>
|
</div>
|
||||||
<div class="small-1 cell">
|
<div class="small-1 cell">
|
||||||
<button class="button alert deletectrl" type="button" title="Delete"><i class="fa fa-trash" aria-hidden="true"></i></button>
|
<button class="button alert deletectrl" type="button" title="Delete"><i class="fa fa-trash" aria-hidden="true"></i></button>
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-3 cell">
|
<div class="small-3 cell">
|
||||||
<input type="text" class="ingredient" pattern="[-\w,.:()\x26;#*\\ ]+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_ING_PH}" />
|
<input type="text" class="ingredient" pattern="[\-\w,.:\(\)&#\*\\ ']+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_ING_PH}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="small-3 cell">
|
<div class="small-3 cell">
|
||||||
<input type="text" class="notes" placeholder="{L_RECIPE_ING_NOTE_PH}" />
|
<input type="text" class="notes" placeholder="{L_RECIPE_ING_NOTE_PH}" />
|
||||||
@ -139,7 +139,7 @@
|
|||||||
<li class="separator">
|
<li class="separator">
|
||||||
<div class="grid-x">
|
<div class="grid-x">
|
||||||
<div class="small-11 cell">
|
<div class="small-11 cell">
|
||||||
<input type="text" class="separator" pattern="[-\w,.:()\x26;#*\\ ]+" title="{L_RECIPE_ING_FORMAT}" placeholder="Separator text">
|
<input type="text" class="separator" pattern="[\-\w,.:\(\)&#\*\\ ']+" title="{L_RECIPE_ING_FORMAT}" placeholder="Separator text">
|
||||||
</div>
|
</div>
|
||||||
<div class="small-1 cell">
|
<div class="small-1 cell">
|
||||||
<button class="button alert deletectrl" type="button" title="Delete"><i class="fa fa-trash" aria-hidden="true"></i></button>
|
<button class="button alert deletectrl" type="button" title="Delete"><i class="fa fa-trash" aria-hidden="true"></i></button>
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-3 cell">
|
<div class="small-3 cell">
|
||||||
<input type="text" class="ingredient" pattern="[-\w,.:()\x26;#*\\ ]+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_ING_PH}" />
|
<input type="text" class="ingredient" pattern="[\-\w,.:\(\)&#\*\\ ']+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_ING_PH}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="small-3 cell">
|
<div class="small-3 cell">
|
||||||
<input type="text" class="notes" placeholder="{L_RECIPE_ING_NOTE_PH}" />
|
<input type="text" class="notes" placeholder="{L_RECIPE_ING_NOTE_PH}" />
|
||||||
@ -139,7 +139,7 @@
|
|||||||
<li class="separator">
|
<li class="separator">
|
||||||
<div class="grid-x">
|
<div class="grid-x">
|
||||||
<div class="small-11 cell">
|
<div class="small-11 cell">
|
||||||
<input type="text" class="separator" pattern="[-\w,.:()\x26;#*\\ ]+" title="{L_RECIPE_ING_FORMAT}" placeholder="Separator text">
|
<input type="text" class="separator" pattern="[\-\w,.:\(\)&#\*\\ ']+" title="{L_RECIPE_ING_FORMAT}" placeholder="Separator text">
|
||||||
</div>
|
</div>
|
||||||
<div class="small-1 cell">
|
<div class="small-1 cell">
|
||||||
<button class="button alert deletectrl" type="button" title="Delete"><i class="fa fa-trash" aria-hidden="true"></i></button>
|
<button class="button alert deletectrl" type="button" title="Delete"><i class="fa fa-trash" aria-hidden="true"></i></button>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-3 cell">
|
<div class="small-3 cell">
|
||||||
<input type="text" class="ingredient" pattern="[-\w,.:()\x26;#*\\ ]+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_ING_PH}" value="%(name)s" />
|
<input type="text" class="ingredient" pattern="[\-\w,.:\(\)&#\*\\ ']+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_ING_PH}" value="%(name)s" />
|
||||||
</div>
|
</div>
|
||||||
<div class="small-3 cell">
|
<div class="small-3 cell">
|
||||||
<input type="text" class="notes" placeholder="{L_RECIPE_ING_NOTE_PH}" value="%(notes)s" />
|
<input type="text" class="notes" placeholder="{L_RECIPE_ING_NOTE_PH}" value="%(notes)s" />
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<li class="separator">
|
<li class="separator">
|
||||||
<div class="grid-x">
|
<div class="grid-x">
|
||||||
<div class="small-11 cell">
|
<div class="small-11 cell">
|
||||||
<input type="text" class="separator" pattern="[-\w,.:()\x26;#*\\ ]+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_SEP_PH}" value="%(name)s" />
|
<input type="text" class="separator" pattern="[\-\w,.:\(\)&#\*\\ ']+" title="{L_RECIPE_ING_FORMAT}" placeholder="{L_RECIPE_ING_SEP_PH}" value="%(name)s" />
|
||||||
</div>
|
</div>
|
||||||
<div class="small-1 cell">
|
<div class="small-1 cell">
|
||||||
<button class="button alert deletectrl" type="button" title="{L_RECIPE_ING_DELETE}"><i class="fa fa-trash" aria-hidden="true"></i></button>
|
<button class="button alert deletectrl" type="button" title="{L_RECIPE_ING_DELETE}"><i class="fa fa-trash" aria-hidden="true"></i></button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user