1
0

Test pass: test_index_options_add_exposure

This commit is contained in:
cryptogopher 2021-01-19 18:53:02 +01:00
parent 07eda42de4
commit 7d096748bf
7 changed files with 26 additions and 5 deletions

View File

@ -8,7 +8,7 @@ module Concerns::Finders
render_404
end
def find_goal_by_project_id
def find_binding_goal_by_project_id
@project = Project.find(params[:project_id])
@goal = @project.goals.binding
rescue ActiveRecord::RecordNotFound

View File

@ -0,0 +1,12 @@
class GoalsController < ApplicationController
include Concerns::Finders
before_action :find_goal, only: [:show, :edit]
before_action :authorize
def show
end
def edit
end
end

View File

@ -5,11 +5,13 @@ class TargetsController < ApplicationController
include Concerns::Finders
before_action :find_goal_by_project_id, only: [:index, :new, :edit]
before_action :find_binding_goal_by_project_id, only: [:index, :new, :edit]
before_action :find_project_by_project_id, only: [:create]
before_action :find_quantity_by_quantity_id, only: [:toggle_exposure]
#, if: ->{ params[:project_id].present? }
#before_action :find_goal, only: [:index, :new],
# unless: -> { @goal }
before_action :find_project_by_project_id, only: [:create]
before_action :find_goal, only: [:toggle_exposure]
before_action :authorize
#before_action :set_view_params

View File

@ -0,0 +1,6 @@
<%# case @view_params[:view] %>
<%# when :by_date %>
// $('#targets').html('<%#= j render partial: 'targets/by_effective_date' %>');
<%# else %>
$('#targets').html('<%= j render partial: 'targets/index' %>');
<%# end %>

View File

@ -0,0 +1 @@
$('#targets').html('<%= j render partial: 'targets/index' %>');

View File

@ -9,7 +9,7 @@ resources :projects, shallow: true do
end
resources :goals, only: [:show, :edit] do
member do
post 'toggle_exposure', to: 'goals#toggle_exposure'
post 'toggle_exposure', to: 'targets#toggle_exposure'
end
end
resources :targets, except: [:show, :edit] do

View File

@ -21,7 +21,7 @@ class TargetsTest < BodyTrackingSystemTestCase
assert_selector 'div#targets', visible: :yes, exact_text: t(:label_no_data)
end
def test_index_options_add_column
def test_index_options_add_exposure
visit project_targets_path(@project1)
assert_no_selector 'table#targets thead th', text: quantities(:quantities_proteins).name
within 'fieldset#options' do