Balise42 / saladgenerator

{Salad,pizza,risotto,pasta} generator
0 stars 0 forks source link

Moar, but no category #1

Open solevis opened 13 years ago

solevis commented 13 years ago

Hi,

It would be more ergonomic to prevent the utilisation of the button "+" (id moar) when there is no category selected. Currently saladgenerator add an empty select box.

You can check if catnames is empty in create_selector(),

if (catnames == null) {
    $("#no_cat").remove();
    $("body").append("<p id='no_cat'>Choose a category before</p>");
}

or choose a default category at start.

<input type="radio" name="type-o-dish" VALUE="salad" checked>Salad</input>

Best regards, Sylvain

Balise42 commented 13 years ago

Good catch :-) Comes from the fact that I decided to add categories as a late thought, and obviously I didn't think it through. Patching right now :)

Balise42 commented 13 years ago

Corrected with your second suggestion (and a redraw). Not very clean though, your first one is better IMO (because it addresses the real problem instead of having a work-around), but probably needs some tweaking and I'm too tired to think about it clearly :) Not closing for that reason.