Add euro symbol to amount field
This commit is contained in:
parent
f5d3a58bbb
commit
d215b31739
5 changed files with 32 additions and 8 deletions
|
@ -43,3 +43,23 @@
|
||||||
background-color: rgb(83, 180, 79);
|
background-color: rgb(83, 180, 79);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fieldset.pure-group-inline {
|
||||||
|
display: inline-block;
|
||||||
|
.pure-group-addon {
|
||||||
|
padding: .5em .6em;
|
||||||
|
box-shadow: inset 0 1px 3px #ddd;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
white-space: nowrap;
|
||||||
|
border-collapse: separate;
|
||||||
|
margin-left: -4px;
|
||||||
|
&:last-child {
|
||||||
|
border-radius: 0 4px 4px 0;
|
||||||
|
}
|
||||||
|
&:first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
border-radius: 4px 0 0 4px;
|
||||||
|
border-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,6 @@
|
||||||
// Place all the styles related to the transactions controller here.
|
// Place all the styles related to the transactions controller here.
|
||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
|
.price {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
// Place all the styles related to the users controller here.
|
// Place all the styles related to the users controller here.
|
||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
|
.euro:before { content:"\20AC"; }
|
|
@ -11,19 +11,16 @@ class TransactionsController < ApplicationController
|
||||||
@transactions = Transaction.all
|
@transactions = Transaction.all
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
|
||||||
@transaction = Transaction.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@transaction = Transaction.new(transaction_params)
|
@transaction = Transaction.new(transaction_params)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
|
@user = current_user
|
||||||
if @transaction.save
|
if @transaction.save
|
||||||
flash[:success] = "Transaction created"
|
flash[:success] = "Transaction created"
|
||||||
redirect_to new_transaction_path
|
redirect_to current_user
|
||||||
else
|
else
|
||||||
render 'new'
|
render "users/show"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
= f.select :creditor,
|
= f.select :creditor,
|
||||||
options_from_collection_for_select(User.all.order(:name), :name, :name),
|
options_from_collection_for_select(User.all.order(:name), :name, :name),
|
||||||
{ include_blank: true },
|
{ include_blank: true },
|
||||||
{ class: 'select2-selector', size: 50 }
|
{ class: 'select2-selector', size: 50, required: true }
|
||||||
= f.text_field :message, required: true, placeholder: "Message", size: 75
|
= f.text_field :message, required: true, placeholder: "Message", size: 75
|
||||||
= f.number_field :euros, value: (@transaction.amount.zero? ? nil : @transaction.amount/100), placeholder: "Bedrag", step: 0.01, min: 0.01
|
%fieldset.pure-group-inline
|
||||||
|
%span.euro.pure-group-addon
|
||||||
|
= f.number_field :euros, value: (@transaction.amount.zero? ? nil : @transaction.amount/100),
|
||||||
|
placeholder: "Bedrag", step: 0.01, min: 0.01, class: "pure-group-addon price", size: 20, required: true
|
||||||
= f.submit "Send it!", class: "pure-button pure-button-primary"
|
= f.submit "Send it!", class: "pure-button pure-button-primary"
|
||||||
|
|
Loading…
Reference in a new issue