- Add tom-select to Rails app
yarn add tom-select- Add to 'app/javascript/stylesheets/application.scss'
@import "tom-select/dist/css/tom-select.bootstrap5";yarn add tom-select@import "tom-select/dist/css/tom-select.bootstrap5";| require 'aws-sdk-s3' | |
| # Create s3 instance | |
| ==================== | |
| s3 = Aws::S3::Resource.new(access_key_id: Rails.application.credentials.dig(:aws, :access_key_id), | |
| secret_access_key: Rails.application.credentials.dig(:aws, :secret_access_key), | |
| region: 'us-east-1' ) | |
| # Create client instance | |
| ======================== | |
| client = Aws::S3::Client.new(access_key_id: Rails.application.credentials.dig(:aws, :access_key_id), |
| Quick guide to add gem invisible_captcha (https://github.com/markets/invisible_captcha) to your devise registrations. | |
| ------- for model User --------- | |
| 1) gemfile: | |
| ============ | |
| gem 'invisible_captcha' | |
| 2) console: | |
| =========== | |
| bundle |
| 1) Local terminal | |
| ================= | |
| yarn add @fortawesome/fontawesome-free | |
| 2) javascript/packs/application.js | |
| ================================== | |
| import "@fortawesome/fontawesome-free/css/all" |
| html section (erb) | |
| ================== | |
| <div class="wrapper"> | |
| <h3 class='text-center mt-3 mb-4'><%= t('.edit_profile') %></h3> | |
| <input type="radio" name="slider" checked id="home"> | |
| <input type="radio" name="slider" id="code"> | |
| <input type="radio" name="slider" id="about"> | |
| <nav class='mx-auto mb-4'> | |
| <!-- Icon and name Tab 1 ('Main') --> |
| 1) Create: | |
| ========== | |
| app/javascript/utilities/preview_avatar.js | |
| ------------------------------------------ | |
| document.addEventListener("turbolinks:load", function(event) { | |
| function readURL(input) { | |
| if (input.files && input.files[0]) { | |
| var reader = new FileReader() | |
| reader.onload = function (e) { | |
| document.getElementById(input.id + "_medium").setAttribute('src', e.target.result) |
| -------------------- model Recipe + Favorites ----------------------- | |
| 1. Add pagination: | |
| =============== | |
| Gemfile | |
| ------- | |
| gem 'pagy' | |
| $bundle |
| ================= | |
| 1. Add to Gemfile | |
| ================= | |
| gem 'omniauth' | |
| gem 'omniauth-facebook' | |
| gem 'omniauth-github' | |
| gem 'omniauth-google-oauth2' | |
| gem 'activerecord-session_store' | |
| gem 'omniauth-rails_csrf_protection' |
| -------- model Recipe ----------- | |
| Before: Stimulus must be installed -> rails webpacker:install:stimulus (yarn add stimulus) | |
| 1) Gemfile: | |
| =========== | |
| gem 'pg_search' # По желанию (Optional) | |
| 2) touch app/views/shared/_search_form.html.erb | |
| ================================================ |