1
0

Fix targets#create

This commit is contained in:
cryptogopher
2021-03-07 15:07:45 +01:00
parent 406eabaccc
commit 5b73e9e7fd
11 changed files with 33 additions and 40 deletions

View File

@@ -1,5 +1,4 @@
<% if User.current.allowed_to?(:manage_body_trackers, @project) %>
<%= link_to t(".link_new_target"),
new_project_target_path(@project, @view_params),
<%= link_to t(".link_new_target"), new_goal_target_path(@goal, @view_params),
{remote: true, class: 'icon icon-add'} %>
<% end %>

View File

@@ -1,7 +1,7 @@
<h2><%= t ".heading_new_target" %></h2>
<%# url: project_targets_path(@project, @view_params), %>
<%= labelled_form_for @goal, remote: true,
<%= labelled_form_for @goal, url: goal_targets_path(@goal), method: :post, remote: true,
html: {id: 'new-target-form', name: 'new-target-form'} do |goal_f| %>
<%= error_messages_for *@targets %>

View File

@@ -8,7 +8,7 @@
{include_blank: parent_id.nil? ? false : '.', required: true, no_label: true},
{autocomplete: 'off',
onchange: "$.ajax({
url: '#{subthresholds_goal_targets_path(@goal, parent_id: parent_id)}',
url: '#{project_subthresholds_path(@project, parent_id: parent_id)}',
data: 'quantity_id=' + $(this).val(),
dataType: 'html',
success: function(data) {