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]) @budgets = Budget.send(@current_filter).order(created_at: :desc).page(params[:page])
end end
def show
end
def new def new
@budget = Budget.new @budget = Budget.new
end end
@@ -15,7 +18,7 @@ class Admin::BudgetsController < Admin::BaseController
def create def create
@budget = Budget.new(budget_params) @budget = Budget.new(budget_params)
if @budget.save 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 else
render :new render :new
end end

View File

@@ -26,5 +26,4 @@
<input type="submit" value="<%= t("admin.budgets.new.create") %>" class="button success"> <input type="submit" value="<%= t("admin.budgets.new.create") %>" class="button success">
<% end %> <% end %>
</div> </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_heading: Heading
table_amount: Amount table_amount: Amount
table_geozone: Scope of operation table_geozone: Scope of operation
show:
phase: Current phase
currency: Currency
comments: comments:
index: index:
filter: Filter filter: Filter

View File

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

View File

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