Skip to content

Commit

Permalink
Merge pull request #242 from ontoportal-lirmm/feature/lookbook
Browse files Browse the repository at this point in the history
Feature: Add Lookbook to preview view components - fix the new version release
  • Loading branch information
syphax-bouazzouni authored May 8, 2023
2 parents 8bc6f5d + 91ef6dd commit 12817eb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ gem 'rest-client'
gem 'stackprof', require: false
gem 'thin'
gem 'view_component', '~> 2.72'
gem "lookbook"
gem 'turnout'
gem 'will_paginate', '~> 3.0'

Expand All @@ -85,7 +84,7 @@ group :staging, :production, :appliance do
end

group :development do
# Capistrano Deployment
# Capistrano Deployment
gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0', require: false # https://github.com/miloserdow/capistrano-deploy/issues/42
gem 'capistrano', '~> 3.11', require: false
gem 'capistrano-bundler', require: false
Expand All @@ -105,6 +104,7 @@ group :development do

# Use console on exceptions pages [https://github.com/rails/web-console]
gem 'web-console'
gem "lookbook", '~> 1.5.5'
end

group :test, :development do
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/component_preview.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= stylesheet_link_tag "application" %>
</head>
<body style="margin: 20px">
<body class="d-flex align-items-center justify-content-center w-100 h-100">

<%= yield %> <!-- rendered preview will be injected here -->

Expand Down
7 changes: 5 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@
get '/visualize' => 'ontologies#visualize', :as => :visualize_concept, :constraints => { ontology: /[^\/?]+/, id: /[^\/?]+/, ontologyid: /[^\/?]+/, conceptid: /[^\/?]+/ }

get '/exhibit/:ontology/:id' => 'concepts#exhibit'

mount Lookbook::Engine, at: "/lookbook"

if Rails.env.development?
mount Lookbook::Engine, at: "/lookbook"
end

end
12 changes: 12 additions & 0 deletions test/components/previews/alert_component_preview.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class AlertComponentPreview < ViewComponent::Preview

# @param message text
# @param type select [primary, danger, success, info, light]

def default(type: "success", message: "Here we can type a success or failure message to the user")
render AlertMessageComponent.new(id: '', type: type) do
message
end
end

end

0 comments on commit 12817eb

Please sign in to comment.