Merge pull request #2003 from Ducz0r/lm-remove-legacy-projects-views

Remove legacy projects archive HTML views
This commit is contained in:
Luka Murn 2019-08-21 17:08:27 +02:00 committed by GitHub
commit 5d3a0d7eea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 0 additions and 146 deletions

View file

@ -10,7 +10,6 @@ class ProjectsController < ApplicationController
delete_samples samples_index)
before_action :load_projects_tree, only: %i(sidebar show samples archive
experiment_archive)
before_action :load_archive_vars, only: :archive
before_action :check_view_permissions, only: %i(show reports notifications
samples experiment_archive
samples_index)
@ -82,10 +81,6 @@ class ProjectsController < ApplicationController
end
end
def archive
index
end
def new
@project = Project.new
end
@ -319,15 +314,6 @@ class ProjectsController < ApplicationController
end
end
def load_archive_vars
if current_user.teams.any?
@archived_projects_by_teams =
current_user.projects_by_teams(@current_team.id, @current_sort, true)
else
@archived_projects_by_teams = []
end
end
def check_view_permissions
render_403 unless can_read_project?(@project)
end

View file

@ -1,54 +0,0 @@
<% provide(:head_title, t("projects.archive.head_title")) %>
<%= render partial: "shared/sidebar", locals: { page: 'project' } %>
<%= render partial: "shared/secondary_navigation" %>
<div class="content-pane" id="project-archive">
<% if @archived_projects_by_teams.length > 0 %>
<div id="projects-toolbar">
<form class="form-inline" action="<%= projects_archive_path %>">
<div class="form-group">
<!-- project sort -->
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="sortMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="hidden-xs"><%= t'projects.index.sort' %></span>
<span class="visible-xs-inline"><i class="fas fa-sort"></i></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="sortMenu">
<% ["new", "old", "atoz", "ztoa"].each do |sort| %>
<% if @current_sort != sort %>
<li><a href="?<%= {team: @current_team.id, sort: sort}.reject{|k,v| v.to_s == "0"}.to_query %>"><%= t('projects.index.sort_' + sort) %></a></li>
<% else %>
<li class="disabled"><a href="#"><%= t('projects.index.sort_' + sort) %></a></li>
<% end %>
<% end %>
</ul>
</div>
</div>
</form>
</div>
<% @archived_projects_by_teams.each do |team, projects| %>
<%= render partial: 'projects/archive/team_projects',
locals: {team: team, projects: projects} %>
<% end %>
<% else %>
<div class="row">
<div class="col-xs-12">
<h4><%=t "projects.index.no_archived_projects" %></h4>
</div>
</div>
<div>
<div class="col-xs-12">
<%= link_to t("projects.index.back_to_projects_index"), projects_path %>
</div>
</div>
<!-- Some spacing... -->
<div class="row">
<div class="col-xs-12" style="height: 30px;"></div>
</div>
<% end %>
</div>

View file

@ -1,46 +0,0 @@
<div class="panel panel-default panel-project panel-archive">
<div class="panel-heading">
<% if can_restore_project?(project) %>
<div class="dropdown pull-right">
<button class="btn btn-link dropdown-toggle"
type="button"
id="dropdownMenu1"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="true">
<span class="caret"></span>
</button>
<% project_form = nil %>
<%= form_for project, method: :patch, format: :html do |f| %>
<% project_form = f %>
<%= f.hidden_field :archived, value: false %>
<% end %>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu1">
<li class="dropdown-header"><%= t('projects.index.options_header') %></li>
<li><a href="#"
class="form-submit-link"
data-turbolinks="false"
data-submit-form="<%= project_form.options[:html][:id] %>"><%= t 'projects.index.restore_option' %></a></li>
</ul>
</div>
<% end %>
<h3 class="panel-title">
<% if project.hidden? then %>
<span class="fas fa-eye-slash" aria-hidden="true" title="<%=t "projects.index.visibility_private" %>"></span>
<% else %>
<span class="fas fa-eye" aria-hidden="true" title="<%=t "projects.index.visibility_public" %>"></span>
<% end %>
<span><%= project.name %></span>
</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-6"><%= t('projects.index.start_date') %></div>
<div class="col-xs-6">
<%=l project.created_at, format: :full_date %>
</div>
</div>
</div>
</div>

View file

@ -1,16 +0,0 @@
<div class="row">
<% projects.each_index do |i| project = projects[i] %>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= render partial: "projects/archive/project", locals: { project: project } %>
</div>
<% if (i+1) % 4 == 0 %>
<div class="clearfix visible-lg-block"></div>
<% end %>
<% if (i+1) % 3 == 0 %>
<div class="clearfix visible-md-block"></div>
<% end %>
<% if (i+1) % 2 == 0 %>
<div class="clearfix visible-sm-block"></div>
<% end %>
<% end %>
</div>

View file

@ -281,8 +281,6 @@ en:
options_header: "Options"
comment_placeholder: "Your Message"
more_comments: "More Comments"
no_archived_projects: "No archived projects!"
back_to_projects_index: "Back to home"
modal_new_project:
modal_title: "Create new project"
create: "Create"
@ -331,7 +329,6 @@ en:
success_flash: "Project <strong>%{name}</strong> successfully updated."
error_flash: "Project <strong>%{name}</strong> not updated."
archive:
head_title: "Projects Archive"
success_flash: "Project <strong>%{name}</strong> successfully archived."
error_flash: "Project <strong>%{name}</strong> not archived."
restore:

View file

@ -225,7 +225,6 @@ Rails.application.routes.draw do
via: [:get, :post, :put, :patch]
end
get 'projects/archive', to: 'projects#archive', as: 'projects_archive'
post 'projects/index_dt', to: 'projects#index_dt', as: 'projects_index_dt'
get 'projects/sidebar', to: 'projects#sidebar', as: 'projects_sidebar'
get 'projects/dt_state_load', to: 'projects#dt_state_load',

View file

@ -90,18 +90,6 @@ describe ProjectsController, type: :controller do
end
end
describe '#archive' do
context 'in JSON format' do
let(:params) { { team: team.id, sort: 'atoz' } }
it 'returns success response' do
get :archive, params: params, format: :json
expect(response).to have_http_status(:success)
expect(response.content_type).to eq 'application/json'
end
end
end
describe 'POST create' do
context 'in JSON format' do
let(:params) do