diff --git a/app/controllers/admin/budgets_controller.rb b/app/controllers/admin/budgets_controller.rb index 02894240e..2e8a28fe6 100644 --- a/app/controllers/admin/budgets_controller.rb +++ b/app/controllers/admin/budgets_controller.rb @@ -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 diff --git a/app/views/admin/budgets/new.html.erb b/app/views/admin/budgets/new.html.erb index c7985b98f..019ca460f 100644 --- a/app/views/admin/budgets/new.html.erb +++ b/app/views/admin/budgets/new.html.erb @@ -26,5 +26,4 @@ " class="button success"> <% end %> - - + \ No newline at end of file diff --git a/app/views/admin/budgets/show.html.erb b/app/views/admin/budgets/show.html.erb new file mode 100644 index 000000000..20185b2ba --- /dev/null +++ b/app/views/admin/budgets/show.html.erb @@ -0,0 +1,12 @@ +
+
+

<%= @budget.name %>

+ + <%= simple_format(text_with_links(@budget.description), {}, sanitize: false) %> + +

+ <%= t('admin.budgets.show.phase') %>: <%= t("budget.phase.#{@budget.phase}") %> | + <%= t('admin.budgets.show.currency') %>: <%= @budget.currency_symbol %> +

+
+
\ No newline at end of file diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index d55d24726..812e1a45c 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -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 diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 8ed57d4d8..1afc01ef2 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -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 diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb index c684d8a55..f38d2c9f5 100644 --- a/spec/features/admin/budgets_spec.rb +++ b/spec/features/admin/budgets_spec.rb @@ -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'