diff --git a/BrainPortal/app/assets/stylesheets/neurohub.scss.erb b/BrainPortal/app/assets/stylesheets/neurohub.scss.erb index ef6aeab25..06bbb5a3b 100644 --- a/BrainPortal/app/assets/stylesheets/neurohub.scss.erb +++ b/BrainPortal/app/assets/stylesheets/neurohub.scss.erb @@ -3421,3 +3421,61 @@ $DASHBOARD_CARD_MIN_WIDTH: 25; } } } + +/* +============================================================= +| component/projects categories +============================================================= +/* Subprojects, components of Neurohub grid */ + +.neurohub-tool { + height: $BAR_HEIGHT + rem; // patch that sets height for link_to element that does not return a link + display: flex; + padding: 10px; + padding-right: 15px; + justify-content: center; + + width: 90%; + object-fit: contain; + flex-direction: column; + + a { + object-fit: contain; + @extend .btn-text; + + @extend .external; + @include text("xs"); + padding: 0; + height: 100%; + text-decoration: none; + padding: 3px; + } + + img { + object-fit: contain; + } + + .mini-logo { + height: 3.5em; + } +} + +.card_category_description { + @include p(5); + padding: 5px; + /*flex: 1 1 5rem;*/ + overflow: hidden; + position: relative; + &::after { + // overflow gradient + content: ""; + background: linear-gradient(rgba(255, 255, 255, 0), $DEFAULT_BG); + width: 100%; + height: 0.1rem; + position: absolute; + bottom: 0; + left: 0; + } +} + + diff --git a/BrainPortal/app/controllers/neurohub_portal_controller.rb b/BrainPortal/app/controllers/neurohub_portal_controller.rb index 61c797ded..844046c49 100644 --- a/BrainPortal/app/controllers/neurohub_portal_controller.rb +++ b/BrainPortal/app/controllers/neurohub_portal_controller.rb @@ -2,7 +2,7 @@ # # NeuroHub Project # -# Copyright (C) 2020 +# Copyright (C) 2020-2023 # The Royal Institution for the Advancement of Learning # McGill University # @@ -28,7 +28,7 @@ class NeurohubPortalController < NeurohubApplicationController before_action :login_required # Main welcome/dashboard page - def welcome #:nodoc: + def news #:nodoc: @username = current_user.login bourreau_ids = Bourreau.find_all_accessible_by_user(current_user).raw_first_column("remote_resources.id") user_ids = current_user.available_users.raw_first_column(:id) @@ -41,6 +41,11 @@ def welcome #:nodoc: .select { |m| m.expiry.nil? || m.expiry > Time.now } end + def welcome + @username = current_user.login + end + + # This action searches among all sorts of models for IDs or strings, # and reports links to the matches found. def search diff --git a/BrainPortal/app/views/layouts/_neurohub_navbar.html.erb b/BrainPortal/app/views/layouts/_neurohub_navbar.html.erb index 75c7817c8..e718a75e6 100644 --- a/BrainPortal/app/views/layouts/_neurohub_navbar.html.erb +++ b/BrainPortal/app/views/layouts/_neurohub_navbar.html.erb @@ -39,8 +39,7 @@
<%= link_to 'Dashboard', neurohub_path, { :class => "btn-nav secondary", "data-active"=> request.path_info.include?('welcome') || action_name==="welcome" } %> - <%= link_to 'Projects', nh_projects_path, { :class => "btn-nav secondary", "data-active"=> request.path_info.include?('nh_projects') && action_name==="index" } %> - <%= link_to "Storage", nh_storages_path, { :class => "btn-nav secondary", "data-active"=> request.path_info.include?('nh_storages') && action_name==="index" } %> + <%= link_to 'News', nh_news_path, { :class => "btn-nav secondary", "data-active"=> request.path_info.include?('welcome') && action_name==="news" } %> <% if @nh_invites_count > 0 %> <%= link_to 'Invitations', nh_invitations_path, { :class => "btn-nav secondary badge", "data-badge"=> @nh_new_invites_count > 0 ? @nh_new_invites_count : nil, "data-active"=> request.path_info.include?('nh_invitations') && action_name==="index" } %> <% end %> diff --git a/BrainPortal/app/views/neurohub_portal/news.html.erb b/BrainPortal/app/views/neurohub_portal/news.html.erb new file mode 100644 index 000000000..450829638 --- /dev/null +++ b/BrainPortal/app/views/neurohub_portal/news.html.erb @@ -0,0 +1,208 @@ +<%- +# +# NeuroHub Project +# +# Copyright (C) 2020 +# The Royal Institution for the Advancement of Learning +# McGill University +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +-%> + +<% + new_invites = Invitation.where(user_id: current_user.id, active: true, read: false).all || [] +%> + + +<% title("Dashboard", '') %> + +
+
+
+ <% if new_invites.count > 0 %> +
+
+

New Notifications

+ <% new_invites.each do |invitation| %> +
+
+

<%= invitation.header.html_safe %>

+
+
+ <%= button_to 'Accept', nh_invitation_path(invitation.id), :method => :put, :class => "btn-solid primary btn" %> + <%= button_to 'Decline', nh_invitation_path(invitation.id), :method => :delete, :class => "btn-solid secondary wash btn" %> + <%= button_to 'Save for Later', nh_invitation_path(invitation.id, :read => true), :method => :put, :class => "btn-solid primary wash btn" %> +
+
+ <% end %> +
+
+ <% end %> + +
+
+ neurohub-logo + NeuroHub News +
+ + <% @dashboard_messages.each do |message| %> +
+
+

<%= message.header %>

+
+
+ (Posted: <%= message.created_at.strftime("%B %e, %Y") %>)
+ <%= (message.description.presence || "").html_safe %> +
+
+ <% end %> + +
+
+ +
+
+ <%= + scope_link('

Latest Tasks

'.html_safe, + 'tasks#index', { :order => [{ :a => 'updated_at', :d => 'desc' }], }, + url: { :controller => :tasks, :action => :index }, + link: { :target => "_blank" } + ) + %> + <% if @tasks.size > 0 %> +
+ <% for task in @tasks %> +
+
+
+
<%= nh_icon_task %>
+ <%= link_to_task_if_accessible(task, nil, :name_method => :name_and_bourreau, :html_options => { :target => "_blank" }) %> +
+
+
<%= nh_icon_user %>
+
+ <%= link_to_user_if_accessible(task.user, nil, :html_options => { :target => "_blank" })%> +
+
+
+
+ <%= colored_status(task.status) %> +
+
+
+
+
+
<%= nh_icon_project %>
+
+ <%= link_to task.group.name, {:controller => :nh_projects, :action => :show, :id => task.group.id}, :method => :get %> +
+
+ +
+
+ <%= to_localtime(task.updated_at,:date) %> + <%= to_localtime(task.updated_at,:time) %> +
+
+
+
+ <% end %> +
+ <% else %> + <%- # empty state -%> +
+
+
+
+
+ <%= nh_empty_tasks %> +
+

No tasks have been updated lately.

+
+
+
+
+ <% end %> +
+
+ <%= + scope_link('

Latest Updated Files

'.html_safe, + 'userfiles#index', { :order => [{ :a => 'updated_at', :d => 'desc' }], }, + url: { :controller => :userfiles, :action => :index }, + link: { :target => "_blank" } + ) + %> + <% if @files.size > 0 %> +
+ <% for file in @files %> +
+
+
+
<%= nh_icon_file %>
+
+ <%= link_to_userfile_if_accessible(file, nil, :html_options => { :target => "_blank" }) %> +
+
+
+
<%= nh_icon_user %>
+
+ <%= link_to_user_if_accessible(file.user, nil, :html_options => { :target => "_blank" }) %> +
+
+
+
+ <%= colored_pretty_size(file.size) %> +
+
+
+
+
+
<%= nh_icon_project %>
+
+ <%= link_to(file.group.name,{:controller => :nh_projects, :action => :show, :id => file.group.id}, :method => :get) %> +
+
+
+
+ <%= to_localtime(file.updated_at,:date) %> + <%= to_localtime(file.updated_at,:time) %> +
+
+
+ +
+ <% end %> +
+ <% else %> + <%- # empty state -%> +
+
+
+
+
+ <%= nh_empty_files %> +
+

No files have been updated lately.

+
+
+
+
+ <% end %> +
+
+ +
+ +
diff --git a/BrainPortal/app/views/neurohub_portal/welcome.html.erb b/BrainPortal/app/views/neurohub_portal/welcome.html.erb index 450829638..86c6e8717 100644 --- a/BrainPortal/app/views/neurohub_portal/welcome.html.erb +++ b/BrainPortal/app/views/neurohub_portal/welcome.html.erb @@ -2,7 +2,7 @@ # # NeuroHub Project # -# Copyright (C) 2020 +# Copyright (C) 2020-2023 # The Royal Institution for the Advancement of Learning # McGill University # @@ -21,188 +21,73 @@ # -%> -<% - new_invites = Invitation.where(user_id: current_user.id, active: true, read: false).all || [] -%> +<% cache('categorical_welcome_grid_v_1', expires_in: 30.minutes ) do %> + <% + # The info about neurohub collection of data framework is extracted from a spreadsheet + # so can be adjusted without CBRAIN reboot + # Once the the collection is more stable, can be moved into model/controller -<% title("Dashboard", '') %> + require 'csv' + require 'ostruct' + csv_text = File.read('public/neurohub_components/soft.csv') + csv = CSV.parse(csv_text, :headers => true) + hashes = csv.map {|row| row.to_hash.stringify_keys.transform_keys(&:downcase)} # rows to chashes + grouped_hashes = hashes.group_by {|h| h['boxid']} # software components are grouped by categories -
-
-
- <% if new_invites.count > 0 %> -
-
-

New Notifications

- <% new_invites.each do |invitation| %> -
-
-

<%= invitation.header.html_safe %>

-
-
- <%= button_to 'Accept', nh_invitation_path(invitation.id), :method => :put, :class => "btn-solid primary btn" %> - <%= button_to 'Decline', nh_invitation_path(invitation.id), :method => :delete, :class => "btn-solid secondary wash btn" %> - <%= button_to 'Save for Later', nh_invitation_path(invitation.id, :read => true), :method => :put, :class => "btn-solid primary wash btn" %> -
-
- <% end %> -
-
- <% end %> + categories = grouped_hashes.values.map do |category| # areas/categories + args = category.first + args['subtitles'] = category.pluck('subtitle') # specific tools or framework names + args['urls'] = category.pluck('url') # links to sign up/login/landing page + args['images'] = category.pluck('image') # logos + OpenStruct.new(args) + end + %> -
-
- neurohub-logo - NeuroHub News -
- <% @dashboard_messages.each do |message| %> -
-
-

<%= message.header %>

-
-
- (Posted: <%= message.created_at.strftime("%B %e, %Y") %>)
- <%= (message.description.presence || "").html_safe %> -
-
- <% end %> + <% title("Dashboard", '') %> -
-
+
+
+
-
-
- <%= - scope_link('

Latest Tasks

'.html_safe, - 'tasks#index', { :order => [{ :a => 'updated_at', :d => 'desc' }], }, - url: { :controller => :tasks, :action => :index }, - link: { :target => "_blank" } - ) - %> - <% if @tasks.size > 0 %> -
- <% for task in @tasks %> -
-
-
-
<%= nh_icon_task %>
- <%= link_to_task_if_accessible(task, nil, :name_method => :name_and_bourreau, :html_options => { :target => "_blank" }) %> -
-
-
<%= nh_icon_user %>
-
- <%= link_to_user_if_accessible(task.user, nil, :html_options => { :target => "_blank" })%> -
-
-
-
- <%= colored_status(task.status) %> -
-
-
-
-
-
<%= nh_icon_project %>
-
- <%= link_to task.group.name, {:controller => :nh_projects, :action => :show, :id => task.group.id}, :method => :get %> -
-
+ <%# Neurohub subcomponents grid -%> -
-
- <%= to_localtime(task.updated_at,:date) %> - <%= to_localtime(task.updated_at,:time) %> -
-
-
+
+ <% categories.each do |category| %> +
+
+ style="color: <%= category.color %>;>" + <% end %> + > + <%= category.title %>
- <% end %> -
- <% else %> - <%- # empty state -%> -
-
-
-
-
- <%= nh_empty_tasks %> -
-

No tasks have been updated lately.

-
-
-
-
- <% end %> -
-
- <%= - scope_link('

Latest Updated Files

'.html_safe, - 'userfiles#index', { :order => [{ :a => 'updated_at', :d => 'desc' }], }, - url: { :controller => :userfiles, :action => :index }, - link: { :target => "_blank" } - ) - %> - <% if @files.size > 0 %> -
- <% for file in @files %> -
-
-
-
<%= nh_icon_file %>
-
- <%= link_to_userfile_if_accessible(file, nil, :html_options => { :target => "_blank" }) %> -
-
-
-
<%= nh_icon_user %>
-
- <%= link_to_user_if_accessible(file.user, nil, :html_options => { :target => "_blank" }) %> -
-
-
-
- <%= colored_pretty_size(file.size) %> -
-
-
-
-
-
<%= nh_icon_project %>
-
- <%= link_to(file.group.name,{:controller => :nh_projects, :action => :show, :id => file.group.id}, :method => :get) %> -
-
-
-
- <%= to_localtime(file.updated_at,:date) %> - <%= to_localtime(file.updated_at,:time) %> -
-
-
-
- <% end %> -
- <% else %> - <%- # empty state -%> -
-
-
-
-
- <%= nh_empty_files %> -
-

No files have been updated lately.

+ <% category.urls.each_with_index do |url, i| %> +
+ <% if url.present? %> + + <%= link_to image_tag("/neurohub_components/" + category.images[i], + class: "mini-logo"), + url if category.images[i].present? %> + <%= link_to category.subtitles[i], url if category.subtitles[i].present? %> + + <% else %> + <%# if no url provided just put image and text%> + image_tag("/neurohub_components/logos/" + category.images[i]) + <%= category.subtitles[i] %> + <% end %>
-
+ <% end %> + +
+ <%= category.description.presence %>
<% end %> +
>
-
- -
+<% end %> diff --git a/BrainPortal/config/routes.rb b/BrainPortal/config/routes.rb index 1a283d135..9f65547d4 100644 --- a/BrainPortal/config/routes.rb +++ b/BrainPortal/config/routes.rb @@ -272,6 +272,7 @@ # Special named routes get '/neurohub' => 'neurohub_portal#welcome' + get '/nh_news' => 'neurohub_portal#news' get '/styleguide' => 'neurohub_portal#styleguide' get '/nh_search' => 'neurohub_portal#search' get '/signin' => 'nh_sessions#new' diff --git a/BrainPortal/public/neurohub_components/appertureneuro.png b/BrainPortal/public/neurohub_components/appertureneuro.png new file mode 100644 index 000000000..cc4cef8b4 Binary files /dev/null and b/BrainPortal/public/neurohub_components/appertureneuro.png differ diff --git a/BrainPortal/public/neurohub_components/c-big.png b/BrainPortal/public/neurohub_components/c-big.png new file mode 100644 index 000000000..d8947309c Binary files /dev/null and b/BrainPortal/public/neurohub_components/c-big.png differ diff --git a/BrainPortal/public/neurohub_components/cbrain.png b/BrainPortal/public/neurohub_components/cbrain.png new file mode 100644 index 000000000..27431348e Binary files /dev/null and b/BrainPortal/public/neurohub_components/cbrain.png differ diff --git a/BrainPortal/public/neurohub_components/conp.png b/BrainPortal/public/neurohub_components/conp.png new file mode 100644 index 000000000..27b074490 Binary files /dev/null and b/BrainPortal/public/neurohub_components/conp.png differ diff --git a/BrainPortal/public/neurohub_components/jupyterhub.png b/BrainPortal/public/neurohub_components/jupyterhub.png new file mode 100644 index 000000000..65d231abc Binary files /dev/null and b/BrainPortal/public/neurohub_components/jupyterhub.png differ diff --git a/BrainPortal/public/neurohub_components/loris.png b/BrainPortal/public/neurohub_components/loris.png new file mode 100644 index 000000000..b2c853ec8 Binary files /dev/null and b/BrainPortal/public/neurohub_components/loris.png differ diff --git a/BrainPortal/public/neurohub_components/mtsviewer.png b/BrainPortal/public/neurohub_components/mtsviewer.png new file mode 100644 index 000000000..c7c4e7265 Binary files /dev/null and b/BrainPortal/public/neurohub_components/mtsviewer.png differ diff --git a/BrainPortal/public/neurohub_components/neurolibre.svg b/BrainPortal/public/neurohub_components/neurolibre.svg new file mode 100644 index 000000000..cfc5c1ee3 --- /dev/null +++ b/BrainPortal/public/neurohub_components/neurolibre.svg @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BrainPortal/public/neurohub_components/neurolibre_2.svg b/BrainPortal/public/neurohub_components/neurolibre_2.svg new file mode 100644 index 000000000..cfc5c1ee3 --- /dev/null +++ b/BrainPortal/public/neurohub_components/neurolibre_2.svg @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BrainPortal/public/neurohub_components/newloris.jpg b/BrainPortal/public/neurohub_components/newloris.jpg new file mode 100644 index 000000000..d3fbf0f98 Binary files /dev/null and b/BrainPortal/public/neurohub_components/newloris.jpg differ diff --git a/BrainPortal/public/neurohub_components/open_science_framework_black.2400x2400.jpeg b/BrainPortal/public/neurohub_components/open_science_framework_black.2400x2400.jpeg new file mode 100644 index 000000000..20e1a7c57 Binary files /dev/null and b/BrainPortal/public/neurohub_components/open_science_framework_black.2400x2400.jpeg differ diff --git a/BrainPortal/public/neurohub_components/openneuro.png b/BrainPortal/public/neurohub_components/openneuro.png new file mode 100644 index 000000000..7dcca21d1 Binary files /dev/null and b/BrainPortal/public/neurohub_components/openneuro.png differ diff --git a/BrainPortal/public/neurohub_components/openneuro.svg b/BrainPortal/public/neurohub_components/openneuro.svg new file mode 100644 index 000000000..d106cc584 --- /dev/null +++ b/BrainPortal/public/neurohub_components/openneuro.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/BrainPortal/public/neurohub_components/osf.png b/BrainPortal/public/neurohub_components/osf.png new file mode 100644 index 000000000..1559e522a Binary files /dev/null and b/BrainPortal/public/neurohub_components/osf.png differ diff --git a/BrainPortal/public/neurohub_components/osf_black.jpeg b/BrainPortal/public/neurohub_components/osf_black.jpeg new file mode 100644 index 000000000..8b1779956 Binary files /dev/null and b/BrainPortal/public/neurohub_components/osf_black.jpeg differ diff --git a/BrainPortal/public/neurohub_components/seqr.png b/BrainPortal/public/neurohub_components/seqr.png new file mode 100644 index 000000000..4b20df168 Binary files /dev/null and b/BrainPortal/public/neurohub_components/seqr.png differ diff --git a/BrainPortal/public/neurohub_components/soft.csv b/BrainPortal/public/neurohub_components/soft.csv new file mode 100644 index 000000000..775997500 --- /dev/null +++ b/BrainPortal/public/neurohub_components/soft.csv @@ -0,0 +1,17 @@ +Title,Subtitle,logo,rectangle,url,image,group,color,boxid,infopage,description +Big Data Processing,,,,home,cbrain.png,,#05A3D6,1,,"Web app streamlining collaborative massive parallel data processing on computer clusters, cornerstone of NeuroHub" +C-Big,,,,https://cbigr.loris.ca,loris.png,,gray,2,,LORIS-powered internal and public beta collections of neurological data of patients and healthy subjects +C-Big,,,,https://www.mcgill.ca/neuro/research/c-big-repository/resources-researchers,c-big.png,,gray,2,, +UKBB Data Query,,,,https://ukbb.loris.ca/,loris.png,,gray,3,,"Records of participants having imaging data in UK Biobank, one of largest biomedical data collection" +UKBB Data Query,,,,https://ukbb.loris.ca/,ukbiobank.webp,,gray,3,, +Upcoming LORIS managed Datasets,,,,https://loris.ca,newloris.jpg,,gray,4,, +Data Exploration,,,,https://jupyterhub.beluga.alliancecan.ca,jupyterhub.png,,SteelBlue,5,https://docs.alliancecan.ca/wiki/JupyterHub, +Data Sharing,,,,https://zenodo.org/communities/conp_pcno,zenodo.png,,black,6,, +Data Sharing,,,,https://osf.io,osf_black.jpeg,,black,6,, +Open Publishing,,,,https://neurolibre.org,neurolibre.svg,,DarkSlateGray,7,,A zero-fee notebook preprint and affordable high-quality journal services +Open Publishing,Apperture Neuro,,,https://apertureneuro.org/,appertureneuro.png,,DarkSlateGray,7,,"Low cost, open-access Journal for brain imaging and neuroscience" +Open Data,,,,https://conp.ca,conp.png,,DarkSlateblue,8,, +Open Data,,,,https://openneuro.org,openneuro.png,,DarkSlateblue,8,, +Upcoming,,,,https://neurobioinfo.github.io/MTSvieweR,mtsviewer.png,,gainsboro,9,, +Upcoming,SERQ,,,https://seqr.broadinstitute.org/,seqr.png,,gainsboro,9,, +Coming sooner than latter,Brain-Heart Interconnectome (McGill – OttawaU),,,https://www.uottawa.ca/research-innovation/brain-heart-interconnectome,,,gainsboro,9,, diff --git a/BrainPortal/public/neurohub_components/ukbbloris.jpg b/BrainPortal/public/neurohub_components/ukbbloris.jpg new file mode 100644 index 000000000..d3fbf0f98 Binary files /dev/null and b/BrainPortal/public/neurohub_components/ukbbloris.jpg differ diff --git a/BrainPortal/public/neurohub_components/ukbiobank.webp b/BrainPortal/public/neurohub_components/ukbiobank.webp new file mode 100644 index 000000000..014fcc4d9 Binary files /dev/null and b/BrainPortal/public/neurohub_components/ukbiobank.webp differ diff --git a/BrainPortal/public/neurohub_components/zenodo.png b/BrainPortal/public/neurohub_components/zenodo.png new file mode 100644 index 000000000..b00acc8f0 Binary files /dev/null and b/BrainPortal/public/neurohub_components/zenodo.png differ diff --git a/BrainPortal/public/neurohub_components/zenodo.svg b/BrainPortal/public/neurohub_components/zenodo.svg new file mode 100644 index 000000000..08be1a8af --- /dev/null +++ b/BrainPortal/public/neurohub_components/zenodo.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + +