mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-03 11:13:06 +08:00
removes archived projects from index page [fixes SCI-585]
This commit is contained in:
parent
d255e12f90
commit
4c086a6fc1
3 changed files with 20 additions and 11 deletions
app
|
@ -29,13 +29,19 @@ class ProjectsController < ApplicationController
|
|||
.find_by_id(params[:organization]))
|
||||
end
|
||||
|
||||
@current_organization_id = current_organization.id
|
||||
@current_sort = params[:sort].to_s
|
||||
@projects_by_orgs = current_user.projects_by_orgs(@current_organization_id,
|
||||
@current_sort,
|
||||
@filter_by_archived)
|
||||
if current_user.organizations.any?
|
||||
@current_organization_id = current_organization.id
|
||||
@organization_projects = current_organization.active_project
|
||||
@current_sort = params[:sort].to_s
|
||||
@projects_by_orgs = current_user
|
||||
.projects_by_orgs(@current_organization_id,
|
||||
@current_sort,
|
||||
@filter_by_archived)
|
||||
end
|
||||
|
||||
@organizations = current_user.organizations
|
||||
|
||||
|
||||
# New project for create new project modal
|
||||
@project = Project.new
|
||||
end
|
||||
|
|
|
@ -305,4 +305,8 @@ class Organization < ActiveRecord::Base
|
|||
def protocol_keywords_list
|
||||
ProtocolKeyword.where(organization: self).pluck(:name)
|
||||
end
|
||||
|
||||
def active_project
|
||||
projects.where(archived: false)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -111,12 +111,11 @@
|
|||
</div>
|
||||
<% else %>
|
||||
<h2 class="page-header"><%= current_organization.name %></h2>
|
||||
<% end %>
|
||||
|
||||
<% if current_organization.projects.length > 0 %>
|
||||
<%= render partial: "projects/index/org_projects",
|
||||
locals: { org: current_organization,
|
||||
projects: current_organization.projects } %>
|
||||
<% if @organization_projects.any? %>
|
||||
<%= render partial: "projects/index/org_projects",
|
||||
locals: { org: current_organization,
|
||||
projects: @organization_projects } %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= javascript_include_tag "projects/index", "data-turbolinks-track" => true %>
|
||||
|
|
Loading…
Reference in a new issue