1
0

Visual changes

This commit is contained in:
cryptogopher 2020-04-18 20:36:09 +02:00
parent 50b89de904
commit 923df9c8b2
3 changed files with 13 additions and 11 deletions

View File

@ -6,10 +6,10 @@ module MealsHelper
end
def adjust_ingredient_links(i)
[-10, -1, 0, 1, 10].map do |v|
if v != 0
link_to "%+d" % v, adjust_ingredient_path(i, adjustment: v),
{remote: true, method: :post, class: "button #{v>0 ? 'green' : 'red'}"}
{'- -' => -10, '-' => -1, nil => 0, '+' => 1, '++' => 10}.map do |text, value|
if text
link_to text, adjust_ingredient_path(i, adjustment: value),
{remote: true, method: :post, class: "button #{value>0 ? 'green' : 'red'}"}
else
yield.to_s
end

View File

@ -23,7 +23,7 @@
</td>
</tr>
<% m.ingredients.each do |i| %>
<tr id="ingredient-<%= i.id %>" class="ingredient project idnt idnt-1">
<tr id="ingredient-<%= i.id %>" class="ingredient project idnt idnt-1 buttonable">
<td class="name unwrappable" style="width: 5%;">
<%= i.food.name %>
</td>

View File

@ -17,6 +17,7 @@ table.list .ellipsible {
white-space: nowrap;
max-width: 1px;
}
table.list .buttonable {line-height: 1.8em;}
table.list td.form {
padding-right: 2px;
@ -28,18 +29,19 @@ fieldset#filters table.filter td {padding-left: 8px;}
a.icon:not(.icon-move) {margin-left: 0.3em;}
a.button {
margin: 0 0.2em;
border: 0.1em solid;
border-radius: 0.2em;
border: 0.1em solid silver;
border-radius: 0.3em;
text-align: center;
text-decoration: none;
font-size: 0.8em;
font-weight: bold;
display: inline-block;
width: 2.6em;
}
a.button.green {border-color: green; color: green;}
a.button.green:hover {background-color: green; color: white;}
a.button.red {border-color: firebrick; color: firebrick;}
a.button.red:hover {background-color: firebrick; color: white;}
a.button.green {color: #458a45;}
a.button.green:hover {border-color: #458a45; background-color: #458a45; color: white;}
a.button.red {color: #c43c35;}
a.button.red:hover {border-color: #c43c35; background-color: #c43c35; color: white;}
.icon-move-left { background-image: url(../images/1leftarrow.png); }