mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +02:00
parent
0734eb7ff3
commit
2886cb582d
4 changed files with 9 additions and 8 deletions
|
@ -8,11 +8,15 @@ module Admin
|
|||
helper_method :durations
|
||||
helper_method :statuses
|
||||
|
||||
def self.default_status
|
||||
'effective'
|
||||
end
|
||||
|
||||
def index
|
||||
@search = OpenStruct.new(search_params)
|
||||
|
||||
unless @search.status
|
||||
@search.status = default_status
|
||||
@search.status = self.class.default_status
|
||||
end
|
||||
|
||||
prices = ::Billing::Price.all
|
||||
|
@ -105,11 +109,7 @@ module Admin
|
|||
end
|
||||
|
||||
def statuses
|
||||
::Billing::Price.statuses
|
||||
end
|
||||
|
||||
def default_status
|
||||
'effective'
|
||||
::Billing::Price.statuses.map { |status| [status.capitalize, status] }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<%= f.label :status, class: 'col-sm-2 control-label' %>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<%= f.select :status, options_for_select(statuses, search.status), { include_blank: true },
|
||||
<%= f.select :status, options_for_select(statuses, search.status), { include_blank: t('.any') },
|
||||
class: 'form-control' %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -29,5 +29,6 @@ en:
|
|||
update_btn: Update price
|
||||
|
||||
search_form:
|
||||
any: Any
|
||||
search_btn: Search
|
||||
reset_btn: Reset
|
||||
|
|
|
@ -19,7 +19,7 @@ RSpec.feature 'Viewing prices in admin area', settings: false do
|
|||
context 'when status is given' do
|
||||
scenario 'filters by given status' do
|
||||
visit admin_prices_path
|
||||
select 'effective', from: 'search_status'
|
||||
select Admin::Billing::PricesController.default_status.capitalize, from: 'search_status'
|
||||
submit_search_form
|
||||
|
||||
expect(page).to have_css('.price', count: 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue