package com.sb.elsinore.html;

import java.io.IOException;

import com.sb.elsinore.BrewServer;
import org.rendersnake.HtmlCanvas;
import org.rendersnake.Renderable;

import static org.rendersnake.HtmlAttributesFactory.*;

public class RightBar implements Renderable {

    @Override
    public void renderOn(HtmlCanvas html) throws IOException {
        html.div(class_("col-md-2 text-center"))
            .div(class_("breweryImage"))
                .img(class_("center-block").height("200").width("200").id("brewerylogo").src(" "))
            ._div()
            .span(class_("btn btn-default btn-file")).write("Upload Logo")
                .input(type("file").id("logo").add("data-url", "uploadImage"))
            ._span()

            .div(class_("recipe"))
            ._div()
            .span(class_("btn btn-default btn-file")).write("Upload BeerXML")
                .input(type("file").id("beerxml").add("data-url", "uploadbeerxml"))
            ._span();

        if (BrewServer.getRecipeList() != null && BrewServer.getRecipeList().size() > 1) {
            html.select(name("selectRecipe").class_("holo-spinner")
                .onSelect("chooseRecipe(this);"));
            html.option(value("").selected_if(true))
                    .write("Select Recipe")
                    ._option();
            for (String entry: BrewServer.getRecipeList()) {
                html.option(value(entry))
                        .write(entry)
                        ._option();
            }
            html._select();
        }
        html._div();

    }

}

@@ -88,16 +88,49 @@
 Server;%0A
+import com.sb.elsinore.Messages;%0A
 import o
@@ -156,16 +156,16 @@
 Canvas;%0A
-
 import o
@@ -645,21 +645,28 @@
 ite(
-%22Upload Logo%22
+Messages.UPLOAD_LOGO
 )%0A  
@@ -883,24 +883,31 @@
 ite(
-%22Upload Beer
+Messages.UPLOAD_BEER
 XML
-%22
 )%0A  
@@ -1130,12 +1130,10 @@
 ect(
-name
+id
 (%22se
@@ -1199,14 +1199,12 @@
 ct(%22
-choose
+show
 Reci
@@ -1529,32 +1529,32 @@
 ;%0A            %7D%0A
-
             html
@@ -1566,32 +1566,268 @@
 ect();%0A        %7D
+%0A%0A        if (BrewServer.getCurrentRecipe() != null) %7B%0A            html.span(id(%22showCurrentRecipe%22).class_(%22btn btn-default%22)%0A                    .onClick(%22showRecipe(this)%22)).write(Messages.SHOW_RECIPE)%0A            ._span();%0A        %7D
 %0A        html._d

Add spans for the buttons to show the recipe details.