Test pass: test_index_options_add_exposure
This commit is contained in:
parent
07eda42de4
commit
7d096748bf
@ -8,7 +8,7 @@ module Concerns::Finders
|
|||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_goal_by_project_id
|
def find_binding_goal_by_project_id
|
||||||
@project = Project.find(params[:project_id])
|
@project = Project.find(params[:project_id])
|
||||||
@goal = @project.goals.binding
|
@goal = @project.goals.binding
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
12
app/controllers/goals_controller.rb
Normal file
12
app/controllers/goals_controller.rb
Normal 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
|
@ -5,11 +5,13 @@ class TargetsController < ApplicationController
|
|||||||
|
|
||||||
include Concerns::Finders
|
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? }
|
#, if: ->{ params[:project_id].present? }
|
||||||
#before_action :find_goal, only: [:index, :new],
|
#before_action :find_goal, only: [:index, :new],
|
||||||
# unless: -> { @goal }
|
# unless: -> { @goal }
|
||||||
before_action :find_project_by_project_id, only: [:create]
|
before_action :find_goal, only: [:toggle_exposure]
|
||||||
before_action :authorize
|
before_action :authorize
|
||||||
#before_action :set_view_params
|
#before_action :set_view_params
|
||||||
|
|
||||||
|
6
app/views/targets/index.js.erb
Normal file
6
app/views/targets/index.js.erb
Normal 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 %>
|
1
app/views/targets/toggle_exposure.js.erb
Normal file
1
app/views/targets/toggle_exposure.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
$('#targets').html('<%= j render partial: 'targets/index' %>');
|
@ -9,7 +9,7 @@ resources :projects, shallow: true do
|
|||||||
end
|
end
|
||||||
resources :goals, only: [:show, :edit] do
|
resources :goals, only: [:show, :edit] do
|
||||||
member do
|
member do
|
||||||
post 'toggle_exposure', to: 'goals#toggle_exposure'
|
post 'toggle_exposure', to: 'targets#toggle_exposure'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :targets, except: [:show, :edit] do
|
resources :targets, except: [:show, :edit] do
|
||||||
|
@ -21,7 +21,7 @@ class TargetsTest < BodyTrackingSystemTestCase
|
|||||||
assert_selector 'div#targets', visible: :yes, exact_text: t(:label_no_data)
|
assert_selector 'div#targets', visible: :yes, exact_text: t(:label_no_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_options_add_column
|
def test_index_options_add_exposure
|
||||||
visit project_targets_path(@project1)
|
visit project_targets_path(@project1)
|
||||||
assert_no_selector 'table#targets thead th', text: quantities(:quantities_proteins).name
|
assert_no_selector 'table#targets thead th', text: quantities(:quantities_proteins).name
|
||||||
within 'fieldset#options' do
|
within 'fieldset#options' do
|
||||||
|
Reference in New Issue
Block a user