Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show focused border on currency selector #1813

Merged
merged 1 commit into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Spree.Views.NumberWithCurrency = Backbone.View.extend({
},

initialize: function() {
this.$currencySelector = this.$('.number-with-currency-select select');
this.$currencySelector = this.$('.number-with-currency-select');
},

getCurrency: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ $custom-select-border-width: $input-btn-border-width !default;
$custom-select-border-color: $input-border-color !default;
$custom-select-border-radius: $border-radius !default;

$custom-select-focus-border-color: lighten($brand-primary, 25%) !default;
$custom-select-focus-border-color: $input-border-focus !default;
$custom-select-focus-box-shadow: inset 0 1px 2px rgba($black, .075), 0 0 5px rgba($custom-select-focus-border-color, .5) !default;

$custom-select-sm-padding-y: .2rem !default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@
text-align: left;
}

& &-select {
padding: 0;
background: $input-bg;
&-with-select {
.number-with-currency-amount {
border-right: 0;

select {
&:focus + .number-with-currency-select {
border-left-color: $input-border-focus;
}
}

.number-with-currency-select {
@extend .custom-select;

width: 100%;
height: $input-height;
border: 0;
cursor: pointer;
width: 5.5rem;

@include border-radius($border-radius);
@include border-left-radius(0);

&::-ms-expand {
// Required to see full text of selected value on IE11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
<% currency ||= nil %>
<% required ||= nil %>

<div class="input-group number-with-currency js-number-with-currency">
<div class="input-group number-with-currency <%= "number-with-currency-with-select" unless currency %> js-number-with-currency">
<div class="input-group-addon number-with-currency-symbol"></div>
<%= f.text_field amount_attr, value: number_to_currency(f.object.public_send(amount_attr), unit: ''), class: 'form-control number-with-currency-amount', required: required %>
<% if currency %>
<div class="input-group-addon number-with-currency-addon" data-currency="<%= currency %>">
<%= ::Money::Currency.find(currency).iso_code %>
</div>
<% else %>
<div class="input-group-addon number-with-currency-addon number-with-currency-select">
<%= f.select currency_attr, ::Money::Currency.all.map(&:iso_code), {include_blank: true}, {required: required} %>
</div>
<%= f.select currency_attr, ::Money::Currency.all.map(&:iso_code), {include_blank: true}, {required: required, class: 'number-with-currency-select'} %>
<% end %>
</div>