General dashboard layout

This commit is contained in:
aignatov-bio 2020-02-13 13:50:29 +01:00
parent d0fd956600
commit 5c0a769f87
16 changed files with 115 additions and 0 deletions

View file

@ -31,6 +31,7 @@
@import "my_modules/results/*";
@import "my_modules/*";
@import "protocols/*";
@import "dashboard/*";
@import "repository/*";
@import "repository_columns/*";
@import "settings/*";

View file

@ -0,0 +1,11 @@
.dashboard-container .calendar-widget {
grid-column: 10 / span 3;
grid-row: 1 / span 6;
}
@media (max-width: 900px) {
.dashboard-container .calendar-widget {
grid-column: 1 / span 6;
grid-row: 5 / span 4;
}
}

View file

@ -0,0 +1,11 @@
.dashboard-container .current-tasks-widget {
grid-column: 1 / span 9;
grid-row: 1 / span 6;
}
@media (max-width: 900px) {
.dashboard-container .current-tasks-widget {
grid-column: 1 / span 12;
grid-row: 1 / span 4;
}
}

View file

@ -0,0 +1,11 @@
.dashboard-container .quick-start-widget {
grid-column: 1 / span 3;
grid-row: 7 / span 6;
}
@media (max-width: 900px) {
.dashboard-container .quick-start-widget {
grid-column: 7 / span 6;
grid-row: 5 / span 4;
}
}

View file

@ -0,0 +1,17 @@
.dashboard-container .recent-work-widget {
grid-column: 4 / span 6;
grid-row: 7 / span 6;
}
@media (max-width: 1300px) {
.dashboard-container .recent-work-widget {
grid-column: 4 / span 9;
}
}
@media (max-width: 900px) {
.dashboard-container .recent-work-widget {
grid-column: 1 / span 12;
grid-row: 9 / span 4;
}
}

View file

@ -0,0 +1,24 @@
.dashboard-container {
--dashboard-widgets-gap: 30px;
display: grid;
grid-column-gap: var(--dashboard-widgets-gap);
grid-row-gap: var(--dashboard-widgets-gap);
grid-template-columns: repeat(12, 1fr);
grid-template-rows: repeat(12, 1fr);
min-height: calc(100vh - 51px);
padding: var(--dashboard-widgets-gap) calc(var(--dashboard-widgets-gap) - 15px);
width: 100%;
.basic-widget {
border-radius: $border-radius-modal;
box-shadow: $flyout-shadow;
position: relative;
}
}
@media (max-width: 1300px) {
.dashboard-container {
--dashboard-widgets-gap: 16px;
}
}

View file

@ -0,0 +1,5 @@
# frozen_string_literal: true
class DashboardsController < ApplicationController
def show; end
end

View file

@ -1,4 +1,9 @@
module LeftMenuBarHelper
def dashboard_are_selected?
controller_name == 'dashboards'
end
def projects_are_selected?
controller_name.in? %w(projects experiments my_modules)
end

View file

@ -0,0 +1,2 @@
<div class="calendar-widget basic-widget">
</div>

View file

@ -0,0 +1,2 @@
<div class="current-tasks-widget basic-widget">
</div>

View file

@ -0,0 +1,2 @@
<div class="quick-start-widget basic-widget">
</div>

View file

@ -0,0 +1,2 @@
<div class="recent-work-widget basic-widget">
</div>

View file

@ -0,0 +1,6 @@
<div class="dashboard-container">
<%= render "calendar" %>
<%= render "current_tasks" %>
<%= render "recent_work" %>
<%= render "quick_start" %>
</div>

View file

@ -2,6 +2,12 @@
<div class="scroll-wrapper">
<ul class="nav">
<% if current_user.teams.empty? %>
<li class="disabled">
<span>
<span class="fas fa-thumbtack"></span>
<span><%= t('left_menu_bar.dashboard') %></span>
</span>
</li>
<li class="disabled">
<span>
<span class="fas fa-folder"></span>
@ -27,6 +33,12 @@
</span>
</li>
<% else %>
<li class="<%= "active" if dashboard_are_selected? %>">
<%= link_to dashboard_path, id: "dashboard-link", title: t('left_menu_bar.dashboard') do %>
<span class="fas fa-thumbtack"></span>
<span><%= t('left_menu_bar.dashboard') %></span>
<% end %>
</li>
<li class="<%= "active" if projects_are_selected? %>">
<%= link_to projects_path, id: "projects-link", title: t('left_menu_bar.projects') do %>
<span class="fas fa-folder"></span>

View file

@ -152,6 +152,7 @@ en:
addon_versions: "Addon versions"
left_menu_bar:
dashboard: "Overview"
projects: "Projects"
repositories: "Inventories"
templates: "Protocols"

View file

@ -240,6 +240,9 @@ Rails.application.routes.draw do
defaults: { format: 'json' }
post 'reports/destroy', to: 'reports#destroy'
resource :dashboard, only: :show do
end
resources :projects, except: [:new, :destroy] do
resources :user_projects, path: '/users',
only: [:create, :index, :update, :destroy]