Create the general layout for shareable links [SCI-8749] (#5699)

This commit is contained in:
Soufiane 2023-07-06 09:19:29 +02:00 committed by GitHub
parent 836d1b6be1
commit 94ead579e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 2 deletions

View file

@ -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,

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta data-hook="head-js">
<title><%=t "head.title", title: (yield :head_title) %></title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<%= 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 %>
</head>
<body class="">
<div class="sci--sl-layout">
<div class="w-80 h-screen px-4 py-6 flex flex-col
border-0 border-r border-solid border-sn-sleepy-grey">
<%= render "shareable_links/left_navigation" %>
</div>
<div class="sci--sl-layout-content">
<%= yield :content %>
</div>
</div>
<%= javascript_include_tag 'prism' %>
</body>
</html>

View file

@ -0,0 +1,22 @@
<div class="block pl-2 pb-6 object-contain border-0 border-b border-solid border-sn-light-grey">
<%= image_tag "scinote_logo.svg" %>
</div>
<h3 class="my-4">
<%= t("shareable_links.left_navigation.welcome")%>
</h3>
<div class="flex flex-col p-6 bg-sn-super-light-blue gap-4">
<span class="font-bold">
<%= t("shareable_links.left_navigation.title")%>
</span>
<span class="text-[.75rem]">
<%= t("shareable_links.left_navigation.description_1")%>
</span>
<span class="text-[.75rem]">
<%= t("shareable_links.left_navigation.description_2")%>
</span>
<ul class="text-[.75rem]">
<li><%= t("shareable_links.left_navigation.description_3.bullet_point_1")%></li>
<li><%= t("shareable_links.left_navigation.description_3.bullet_point_2")%></li>
<li><%= t("shareable_links.left_navigation.description_3.bullet_point_3")%></li>
</ul>
</div>

View file

@ -1604,6 +1604,16 @@ en:
no_active_modules: "This experiment has no active tasks."
no_active_modules_archived_branch: "This experiment is archived and cant 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"

View file

@ -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