code logic cleanup

This commit is contained in:
Giga Chubinidze 2022-12-12 17:51:05 +04:00
parent c9a6af8de4
commit 477066f85e
2 changed files with 7 additions and 10 deletions

View file

@ -94,8 +94,11 @@ class ExperimentsController < ApplicationController
@current_sort = view_state.state.dig('my_modules', view_mode, 'sort') || 'atoz'
@project = @experiment.project
@archived_modules = @experiment.my_modules.archived.order(:name)
@active_modules = @experiment.my_modules.active.order(:name)
if params[:view_mode] == 'archived'
@my_modules = @experiment.my_modules.archived.order(:name)
else
@my_modules = @experiment.my_modules.active.order(:name)
end
end
def load_table

View file

@ -3,14 +3,8 @@
<% provide(:sidebar_url, sidebar_experiment_path(@experiment)) %>
<% provide(:container_class, 'no-second-nav-container') %>
<% if params[:view_mode] == "archived" %>
<%= content_for :sidebar do %>
<%= render partial: 'shared/sidebar/archived_my_modules.html.erb', locals: { experiment: @experiment, my_modules: @archived_modules } %>
<% end %>
<% else %>
<%= content_for :sidebar do %>
<%= render partial: 'shared/sidebar/my_modules.html.erb', locals: { experiment: @experiment, my_modules: @active_modules } %>
<% end %>
<%= content_for :sidebar do %>
<%= render partial: 'shared/sidebar/my_modules.html.erb', locals: { experiment: @experiment, my_modules: @my_modules } %>
<% end %>
<div class="content-pane flexible experiment-new-my_module <%= params[:view_mode] %>" id="experimentTable">