Hides question menu on budget poll and changes redirect when create
This commit is contained in:
@@ -22,7 +22,12 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
|||||||
def create
|
def create
|
||||||
@poll = Poll.new(poll_params.merge(author: current_user))
|
@poll = Poll.new(poll_params.merge(author: current_user))
|
||||||
if @poll.save
|
if @poll.save
|
||||||
redirect_to [:admin, @poll], notice: t("flash.actions.create.poll")
|
notice = t("flash.actions.create.poll")
|
||||||
|
if @poll.budget.present?
|
||||||
|
redirect_to admin_poll_booth_assignments_path(@poll), notice: notice
|
||||||
|
else
|
||||||
|
redirect_to [:admin, @poll], notice: notice
|
||||||
|
end
|
||||||
else
|
else
|
||||||
render :new
|
render :new
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -114,4 +114,7 @@ class Poll < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def budget_poll?
|
||||||
|
budget.present?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="small">
|
<td class="small">
|
||||||
<% if budget.poll.present? %>
|
<% if budget.poll.present? %>
|
||||||
<%= link_to t("admin.budgets.index.admin_ballots"), admin_poll_path(budget.poll) %>
|
<%= link_to t("admin.budgets.index.admin_ballots"), admin_poll_booth_assignments_path(budget.poll) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to_create_budget_poll(budget) %>
|
<%= link_to_create_budget_poll(budget) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<ul class="menu simple clear" id="assigned-resources-tabs">
|
<ul class="menu simple clear" id="assigned-resources-tabs">
|
||||||
|
<% unless @poll.budget_poll? %>
|
||||||
<% if controller_name == "polls" %>
|
<% if controller_name == "polls" %>
|
||||||
<li class="is-active">
|
<li class="is-active">
|
||||||
<h2>
|
<h2>
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if controller_name == "booth_assignments" %>
|
<% if controller_name == "booth_assignments" %>
|
||||||
<li class="is-active">
|
<li class="is-active">
|
||||||
|
|||||||
Reference in New Issue
Block a user