adds budget show to admin

This commit is contained in:
Juanjo Bazán
2016-07-29 14:52:37 +02:00
parent 49bc6533e8
commit 724ccf175c
6 changed files with 24 additions and 4 deletions

View File

@@ -8,6 +8,9 @@ class Admin::BudgetsController < Admin::BaseController
@budgets = Budget.send(@current_filter).order(created_at: :desc).page(params[:page])
end
def show
end
def new
@budget = Budget.new
end
@@ -15,7 +18,7 @@ class Admin::BudgetsController < Admin::BaseController
def create
@budget = Budget.new(budget_params)
if @budget.save
redirect_to admin_budgets_path, notice: t('admin.budgets.create.notice')
redirect_to admin_budget_path(@budget), notice: t('admin.budgets.create.notice')
else
render :new
end

View File

@@ -26,5 +26,4 @@
<input type="submit" value="<%= t("admin.budgets.new.create") %>" class="button success">
<% end %>
</div>
</div>
</div>

View File

@@ -0,0 +1,12 @@
<div class="row">
<div class="small-12 medium-9 column">
<h2><%= @budget.name %></h2>
<%= simple_format(text_with_links(@budget.description), {}, sanitize: false) %>
<p>
<strong><%= t('admin.budgets.show.phase') %>:</strong> <%= t("budget.phase.#{@budget.phase}") %> |
<strong><%= t('admin.budgets.show.currency') %>:</strong> <%= @budget.currency_symbol %>
</p>
</div>
</div>

View File

@@ -87,6 +87,9 @@ en:
table_heading: Heading
table_amount: Amount
table_geozone: Scope of operation
show:
phase: Current phase
currency: Currency
comments:
index:
filter: Filter

View File

@@ -87,6 +87,9 @@ es:
table_heading: Partida
table_amount: Cantidad
table_geozone: Ámbito de actuación
show:
phase: Fase actual
currency: Divisa
comments:
index:
filter: Filtro

View File

@@ -55,7 +55,6 @@ feature 'Admin budgets' do
expect(page).to_not have_content(budget5.name)
end
scenario 'Current filter is properly highlighted' do
filters_links = {'open' => 'Open', 'finished' => 'Finished'}
@@ -78,6 +77,7 @@ feature 'Admin budgets' do
end
context 'New' do
scenario 'Create budget' do
visit admin_budgets_path
click_link 'Create new'