Lato
Basic engine for all Lato projects.
Installation
Add required dependencies to your application's Gemfile:
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails" # NOTE: Probably already installed in default rails 7 project
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails", "1.3.3" # NOTE: Probably already installed in default rails 7 project | lock it to 1.3.3
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails" # NOTE: Probably already installed in default rails 7 project
# Use Kredis as Redis interface [https://github.com/rails/kredis]
# NOTE: Installation -> https://github.com/rails/kredis#installation
gem "kredis"
# Use Sass to process CSS
gem "sassc-rails"
# Use lato as application panel
gem "lato"
Install gem and run required tasks:
$ bundle
$ rails active_storage:install
$ rails lato:install:application
$ rails lato:install:migrations
$ rails db:migrate
Mount lato routes on the config/routes.rb file:
Rails.application.routes.draw do
mount Lato::Engine => "/lato"
# ....
end
Import Lato Scss on app/assets/stylesheets/application.scss file:
@import 'lato/application';
// ....
Import Lato Js on app/javascript/application.js file:
import "lato/application";
// ....
Setup I18n on the config/application.rb file:
module MyApplication
class Application < Rails::Application
config.i18n.available_locales = [:it, :en]
config.i18n.default_locale = :it
# ...
end
end
Development
Be sure to have Redis locally installed and running.
Clone repository, install dependencies, run migrations and start:
$ git clone https://github.com/Lato-GAM/lato
$ cd lato
$ bundle
$ rails db:migrate
$ rails db:seed
$ foreman start -f Procfile.dev
Publish
$ ruby ./bin/publish.rb
License
The gem is available as open source under the terms of the MIT License.
Problems with turbo-rails 1.4.0
There is an issue with turbo-rails >= 1.4.0 related to the usage of redirects from a request with a turbo_frame not present on the redirect page.
Problem: https://github.com/hotwired/turbo-rails/issues/440 Possible solution: https://github.com/hotwired/turbo-rails/pull/367