# HG changeset patch # User Michiel Broek # Date 1537783060 -7200 # Node ID 6749482267770d35bf5db5aff3e2d7413c50145d # Parent 5d5c67818d11e8ed17b55b08a7144d1d81ae0a21 Changed profile styles editor a bit. Fermentable inline editor sets precentage and adjust_to_total_100 when a row is added. diff -r 5d5c67818d11 -r 674948226777 www/js/profile_styles.js --- a/www/js/profile_styles.js Sun Sep 23 22:49:45 2018 +0200 +++ b/www/js/profile_styles.js Mon Sep 24 11:57:40 2018 +0200 @@ -168,7 +168,7 @@ // add new row. addButton.click(function (event) { editrow = -1; - $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); + $("#popupWindow").jqxWindow({ position: { x: 130, y: 20 } }); $("#name").val(''); $("#category").val(''); $("#category_number").val(''); @@ -216,7 +216,7 @@ }, buttonclick: function (row) { // open the popup window when the user clicks a button. editrow = row; - $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); + $("#popupWindow").jqxWindow({ position: { x: 130, y: 20 } }); // get the clicked row's data and initialize the input fields. var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); $("#name").val(dataRecord.name); @@ -249,7 +249,7 @@ }); // initialize the popup window and buttons. $("#popupWindow").jqxWindow({ - width: 860, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40 + width: 960, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40 }); $("#popupWindow").on('open', function () { $("#name").jqxInput('selectAll'); diff -r 5d5c67818d11 -r 674948226777 www/js/recipes.js --- a/www/js/recipes.js Sun Sep 23 22:49:45 2018 +0200 +++ b/www/js/recipes.js Mon Sep 24 11:57:40 2018 +0200 @@ -246,6 +246,7 @@ }); $("#faddrowbutton").on('select', function (event) { if (event.args) { + var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; var index = event.args.index; var datarecord = fermentablelist.records[index]; var row = {}; @@ -271,8 +272,14 @@ row["f_dissolved_protein"] = 0; row["f_recommend_mash"] = datarecord.recommend_mash; row["f_add_after_boil"] = datarecord.add_after_boil; - row["f_adjust_to_total_100"] = 0; - row["f_percentage"] = 0; + if (rowscount == 0) { + // The first fermentable + row["f_adjust_to_total_100"] = 1; + row["f_percentage"] = 100; + } else { + row["f_adjust_to_total_100"] = 0; + row["f_percentage"] = 0; + } row["f_di_ph"] = datarecord.di_ph; var commit = $("#fermentableGrid").jqxGrid('addrow', null, row); } diff -r 5d5c67818d11 -r 674948226777 www/profile_styles.php --- a/www/profile_styles.php Sun Sep 23 22:49:45 2018 +0200 +++ b/www/profile_styles.php Mon Sep 24 11:57:40 2018 +0200 @@ -38,7 +38,7 @@ - Ninimum start SG: + Minimum start SG: Minimum kleur EBC: