1
0

Parametrize Target routes with :date

This commit is contained in:
cryptogopher
2021-04-25 15:25:41 +02:00
parent d4398e5b75
commit bbc1467965
6 changed files with 19 additions and 17 deletions

View File

@@ -5,9 +5,9 @@ class TargetsController < ApplicationController
include Concerns::Finders
before_action :find_goal_by_goal_id,
only: [:index, :new, :create, :edit, :update, :toggle_exposure]
before_action :find_quantity_by_quantity_id, only: [:toggle_exposure, :subthresholds]
before_action :find_goal_by_goal_id, only: [:index, :new, :create, :edit, :update]
before_action :find_goal, only: [:toggle_exposure]
before_action :authorize
#before_action :set_view_params

View File

@@ -1,9 +1,9 @@
module TargetsHelper
def action_links(date)
link_to(l(:button_reapply), reapply_goal_targets_path(@goal, date, @view_params),
link_to(l(:button_reapply), reapply_goal_target_path(@goal, date, @view_params),
{remote: true, class: "icon icon-reload"}) +
link_to(l(:button_edit), edit_goal_targets_path(@goal, date, @view_params),
link_to(l(:button_edit), edit_goal_target_path(@goal, date, @view_params),
{remote: true, class: "icon icon-edit"}) +
delete_link(target_path(date), {remote: true, data: {}})
delete_link(goal_target_path(@goal, date), {remote: true, data: {}})
end
end

View File

@@ -37,7 +37,7 @@
<% else %>
<% button_classes += ' icon-bullet-closed' %>
<% end %>
<%= link_to '', toggle_exposure_goal_path(@goal, quantity_id: q.id),
<%= link_to '', goal_toggle_exposure_path(@goal, quantity_id: q.id),
{class: button_classes, method: :post, remote: true} %>
</div>
<%= q.name %>

View File

@@ -1,7 +1,7 @@
<fieldset id="options" class="collapsible">
<legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend>
<div>
<%= form_tag toggle_exposure_goal_path(@goal, @view_params),
<%= form_tag goal_toggle_exposure_path(@goal, @view_params),
id: 'toggle-exposure-form', name: 'toggle-exposure-form',
method: :post, remote: true do %>