mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-24 08:43:13 +08:00
General dashboard layout
This commit is contained in:
parent
d0fd956600
commit
5c0a769f87
16 changed files with 115 additions and 0 deletions
|
@ -31,6 +31,7 @@
|
|||
@import "my_modules/results/*";
|
||||
@import "my_modules/*";
|
||||
@import "protocols/*";
|
||||
@import "dashboard/*";
|
||||
@import "repository/*";
|
||||
@import "repository_columns/*";
|
||||
@import "settings/*";
|
||||
|
|
11
app/assets/stylesheets/dashboard/calendar.scss
Normal file
11
app/assets/stylesheets/dashboard/calendar.scss
Normal 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;
|
||||
}
|
||||
}
|
11
app/assets/stylesheets/dashboard/current_tasks.scss
Normal file
11
app/assets/stylesheets/dashboard/current_tasks.scss
Normal 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;
|
||||
}
|
||||
}
|
11
app/assets/stylesheets/dashboard/quick_start.scss
Normal file
11
app/assets/stylesheets/dashboard/quick_start.scss
Normal 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;
|
||||
}
|
||||
}
|
17
app/assets/stylesheets/dashboard/recent_work.scss
Normal file
17
app/assets/stylesheets/dashboard/recent_work.scss
Normal 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;
|
||||
}
|
||||
}
|
24
app/assets/stylesheets/dashboard/show.scss
Normal file
24
app/assets/stylesheets/dashboard/show.scss
Normal 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;
|
||||
}
|
||||
}
|
5
app/controllers/dashboards_controller.rb
Normal file
5
app/controllers/dashboards_controller.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DashboardsController < ApplicationController
|
||||
def show; end
|
||||
end
|
|
@ -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
|
||||
|
|
2
app/views/dashboards/_calendar.html.erb
Normal file
2
app/views/dashboards/_calendar.html.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<div class="calendar-widget basic-widget">
|
||||
</div>
|
2
app/views/dashboards/_current_tasks.html.erb
Normal file
2
app/views/dashboards/_current_tasks.html.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<div class="current-tasks-widget basic-widget">
|
||||
</div>
|
2
app/views/dashboards/_quick_start.html.erb
Normal file
2
app/views/dashboards/_quick_start.html.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<div class="quick-start-widget basic-widget">
|
||||
</div>
|
2
app/views/dashboards/_recent_work.html.erb
Normal file
2
app/views/dashboards/_recent_work.html.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<div class="recent-work-widget basic-widget">
|
||||
</div>
|
6
app/views/dashboards/show.html.erb
Normal file
6
app/views/dashboards/show.html.erb
Normal file
|
@ -0,0 +1,6 @@
|
|||
<div class="dashboard-container">
|
||||
<%= render "calendar" %>
|
||||
<%= render "current_tasks" %>
|
||||
<%= render "recent_work" %>
|
||||
<%= render "quick_start" %>
|
||||
</div>
|
|
@ -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>
|
||||
|
|
|
@ -152,6 +152,7 @@ en:
|
|||
addon_versions: "Addon versions"
|
||||
|
||||
left_menu_bar:
|
||||
dashboard: "Overview"
|
||||
projects: "Projects"
|
||||
repositories: "Inventories"
|
||||
templates: "Protocols"
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue