removes archived projects from index page [fixes SCI-585]

This commit is contained in:
zmagod 2016-10-20 13:13:44 +02:00
parent d255e12f90
commit 4c086a6fc1
3 changed files with 20 additions and 11 deletions

View file

@ -29,13 +29,19 @@ class ProjectsController < ApplicationController
.find_by_id(params[:organization]))
end
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,
@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

View file

@ -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

View file

@ -111,12 +111,11 @@
</div>
<% else %>
<h2 class="page-header"><%= current_organization.name %></h2>
<% end %>
<% if current_organization.projects.length > 0 %>
<% if @organization_projects.any? %>
<%= render partial: "projects/index/org_projects",
locals: { org: current_organization,
projects: current_organization.projects } %>
projects: @organization_projects } %>
<% end %>
<% end %>
<%= javascript_include_tag "projects/index", "data-turbolinks-track" => true %>