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

View File

@ -23,7 +23,7 @@
</td> </td>
</tr> </tr>
<% m.ingredients.each do |i| %> <% 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%;"> <td class="name unwrappable" style="width: 5%;">
<%= i.food.name %> <%= i.food.name %>
</td> </td>

View File

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