From 94ead579e6ec948de6cbc8656cb84b62beb4ad89 Mon Sep 17 00:00:00 2001 From: Soufiane Date: Thu, 6 Jul 2023 09:19:29 +0200 Subject: [PATCH] Create the general layout for shareable links [SCI-8749] (#5699) --- .../my_module_shareable_links_controller.rb | 14 ++++++- app/views/layouts/shareable_links.html.erb | 37 +++++++++++++++++++ .../shareable_links/_left_navigation.html.erb | 22 +++++++++++ .../my_module_protocol_show.html.erb | 0 config/locales/en.yml | 10 +++++ config/routes.rb | 2 + 6 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 app/views/layouts/shareable_links.html.erb create mode 100644 app/views/shareable_links/_left_navigation.html.erb create mode 100644 app/views/shareable_links/my_module_protocol_show.html.erb diff --git a/app/controllers/my_module_shareable_links_controller.rb b/app/controllers/my_module_shareable_links_controller.rb index 539dcde8b..b56564c52 100644 --- a/app/controllers/my_module_shareable_links_controller.rb +++ b/app/controllers/my_module_shareable_links_controller.rb @@ -1,15 +1,25 @@ # frozen_string_literal: true class MyModuleShareableLinksController < ApplicationController - before_action :load_my_module + before_action :load_my_module, except: %i(my_module_protocol_show) before_action :load_shareable_link, only: %i(update destroy) before_action :check_view_permissions, only: :show - before_action :check_manage_permissions, except: :show + before_action :check_manage_permissions, except: %i(show my_module_protocol_show) + skip_before_action :authenticate_user!, only: %(my_module_protocol_show) def show render json: @my_module.shareable_link end + def my_module_protocol_show + shareable_link = ShareableLink.find_by(uuid: params[:uuid]) + + return render_403 if shareable_link.blank? + + @my_module = shareable_link.shareable + render 'shareable_links/my_module_protocol_show', layout: 'shareable_links' + end + def create @my_module.create_shareable_link( uuid: @my_module.signed_id, diff --git a/app/views/layouts/shareable_links.html.erb b/app/views/layouts/shareable_links.html.erb new file mode 100644 index 000000000..3a9e649ea --- /dev/null +++ b/app/views/layouts/shareable_links.html.erb @@ -0,0 +1,37 @@ + + + + + <%=t "head.title", title: (yield :head_title) %> + + <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> + <%= stylesheet_link_tag 'application', media: 'all' %> + <%= csp_meta_tag %> + <%= javascript_include_tag 'jquery_bundle' %> + <%= javascript_include_tag 'application' %> + <%= javascript_include_tag 'application_pack' %> + + <%= favicon_link_tag "favicon.ico" %> + <%= favicon_link_tag "favicon-16.png", type: "image/png", size: "16x16" %> + <%= favicon_link_tag "favicon-32.png", type: "image/png", size: "32x32" %> + <%= favicon_link_tag "favicon-48.png", type: "image/png", size: "48x48" %> + <%= stylesheet_link_tag 'fontawesome' %> + + <%= stylesheet_link_tag 'prism' %> + + <%= csrf_meta_tags %> + + +
+
+ <%= render "shareable_links/left_navigation" %> +
+
+ <%= yield :content %> +
+
+ + <%= javascript_include_tag 'prism' %> + + diff --git a/app/views/shareable_links/_left_navigation.html.erb b/app/views/shareable_links/_left_navigation.html.erb new file mode 100644 index 000000000..9cd989bea --- /dev/null +++ b/app/views/shareable_links/_left_navigation.html.erb @@ -0,0 +1,22 @@ +
+ <%= image_tag "scinote_logo.svg" %> +
+

+ <%= t("shareable_links.left_navigation.welcome")%> +

+
+ + <%= t("shareable_links.left_navigation.title")%> + + + <%= t("shareable_links.left_navigation.description_1")%> + + + <%= t("shareable_links.left_navigation.description_2")%> + + +
diff --git a/app/views/shareable_links/my_module_protocol_show.html.erb b/app/views/shareable_links/my_module_protocol_show.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/config/locales/en.yml b/config/locales/en.yml index 210153b35..f94272ab7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1604,6 +1604,16 @@ en: no_active_modules: "This experiment has no active tasks." no_active_modules_archived_branch: "This experiment is archived and can’t have active tasks." + shareable_links: + left_navigation: + welcome: "Welcome to SciNote!" + title: "SciNote Electronic Lab Notebook (ELN) Software" + description_1: "SciNote is a leading ELN with inventory, compliance and team management tools, used by the FDA, USDA and over 100K scientific professionals." + description_2: "What do our users like the most?" + description_3: + bullet_point_1: "Ease of use" + bullet_point_2: "Quality of support" + bullet_point_3: "Ease of setup" tags: new: head_title: "Create tag" diff --git a/config/routes.rb b/config/routes.rb index fae43bb14..3249c0723 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -961,6 +961,8 @@ Rails.application.routes.draw do end end + get '/shared_tasks/:uuid/protocol', to: 'my_module_shareable_links#my_module_protocol_show' + resources :marvin_js_assets, only: %i(create update destroy show) do collection do get :team_sketches