From ed2a54229a4e01bbbc3bfc934577130bff0a9718 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 19 Jan 2024 10:52:07 +0100 Subject: [PATCH] Add design page --- app/controllers/design_elements_controller.rb | 4 ++++ app/javascript/vue/shared/modal_mixin.js | 17 +++++++++++++++++ app/views/design_elements/index.html.erb | 0 config/routes.rb | 4 ++++ 4 files changed, 25 insertions(+) create mode 100644 app/controllers/design_elements_controller.rb create mode 100644 app/javascript/vue/shared/modal_mixin.js create mode 100644 app/views/design_elements/index.html.erb diff --git a/app/controllers/design_elements_controller.rb b/app/controllers/design_elements_controller.rb new file mode 100644 index 000000000..075f85974 --- /dev/null +++ b/app/controllers/design_elements_controller.rb @@ -0,0 +1,4 @@ +class DesignElementsController < ApplicationController + def index + end +end diff --git a/app/javascript/vue/shared/modal_mixin.js b/app/javascript/vue/shared/modal_mixin.js new file mode 100644 index 000000000..9eaa3fdfc --- /dev/null +++ b/app/javascript/vue/shared/modal_mixin.js @@ -0,0 +1,17 @@ +export default { + mounted() { + $(this.$refs.modal).modal('show'); + $(this.$refs.modal).on('hidden.bs.modal', () => { + this.$emit('close'); + }); + }, + beforeUnmount() { + $(this.$refs.modal).modal('hide'); + }, + methods: { + close() { + this.$emit('close'); + $(this.$refs.modal).modal('hide'); + } + }, +} diff --git a/app/views/design_elements/index.html.erb b/app/views/design_elements/index.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/config/routes.rb b/config/routes.rb index d7e93847c..274455551 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1018,4 +1018,8 @@ Rails.application.routes.draw do end resources :gene_sequence_assets, only: %i(new create edit update) + + if Rails.env.development? || ENV['ENABLE_DESIGN_ELEMENTS'] == 'true' + resources :design_elements, only: %i(index) + end end