Fix admin price UI

#475
This commit is contained in:
Artur Beljajev 2017-04-27 16:51:47 +03:00
parent b775555c00
commit 9530fd939d
7 changed files with 28 additions and 17 deletions

View file

@ -1,15 +1,8 @@
<tr>
<td><%= price.zone_name %></td>
<td><%= link_to price.zone_name, edit_admin_price_path(price), id: 'admin-edit-price-btn' %></td>
<td><%= price.duration.sub('mons', 'months') %></td>
<td><%= price.operation_category %></td>
<td><%= number_to_currency price.price %></td>
<td><%= l price.valid_from, format: :date %></td>
<td><%= l price.valid_to, format: :date %></td>
<td>
<%= link_to t('.edit_btn'), edit_admin_price_path(price), class: 'btn btn-xs btn-primary' %>
<%= link_to(t('.delete_btn'), admin_price_path(price),
method: :delete,
data: { confirm: t('.delete_btn_confirm') },
class: 'btn btn-xs btn-danger') %>
</td>
</tr>

View file

@ -3,7 +3,18 @@
</ol>
<div class="page-header">
<div class="row">
<div class="col-sm-10">
<h1><%= t '.title' %></h1>
</div>
<div class="col-sm-2 text-right">
<%= link_to(t('.delete_btn'), admin_price_path(@price),
method: :delete,
data: { confirm: t('.delete_btn_confirm') },
class: 'btn btn-danger') %>
</div>
</div>
</div>
<% if @price.persisted? && @price.errors.none? %>

View file

@ -20,7 +20,6 @@
<th><%= sort_link(@q, 'price', t(:price)) %></th>
<th><%= sort_link(@q, 'valid_from', t(:valid_from)) %></th>
<th><%= sort_link(@q, 'valid_to', t(:valid_to)) %></th>
<th></th>
</tr>
</thead>

View file

@ -15,6 +15,8 @@ en:
edit:
title: Edit price
delete_btn: Delete
delete_btn_confirm: Are you sure you want to delete price?
update:
updated: Price has been updated
@ -25,8 +27,3 @@ en:
form:
create_btn: Create price
update_btn: Update price
price:
edit_btn: Edit
delete_btn: Delete
delete_btn_confirm: Are you sure you want to delete price?

View file

@ -9,8 +9,15 @@ RSpec.feature 'Deleting price in admin area', settings: false do
scenario 'deletes price' do
visit admin_prices_url
click_link_or_button t('admin.billing.prices.price.delete_btn')
open_form
click_link_or_button t('admin.billing.prices.edit.delete_btn')
expect(page).to have_text(t('admin.billing.prices.destroy.destroyed'))
end
private
def open_form
click_link_or_button 'admin-edit-price-btn'
end
end

View file

@ -15,8 +15,10 @@ RSpec.feature 'Editing price in admin area', settings: false do
expect(page).to have_text(t('admin.billing.prices.update.updated'))
end
private
def open_form
click_link_or_button t('admin.billing.prices.price.edit_btn')
click_link_or_button 'admin-edit-price-btn'
end
def submit_form

View file

@ -16,6 +16,8 @@ RSpec.feature 'New price in admin area', settings: false do
expect(page).to have_text(t('admin.billing.prices.create.created'))
end
private
def open_list
click_link_or_button t('admin.menu.prices')
end