Skip to content

Commit

Permalink
revert to using sprockets instead of importmap
Browse files Browse the repository at this point in the history
  • Loading branch information
amtuannguyen committed Jan 18, 2025
1 parent e58e499 commit a57c4a4
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 38 deletions.
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ gem 'puma'
## DATABASES ##
gem 'mysql2'

## JAVASCRIPT AND JSON
gem "importmap-rails"

## CSS ##
## JAVASCRIPT/CSS ##
gem 'bootstrap'
gem "sassc-rails"
gem 'sprockets-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'

## TOOLS AND UTILITIES
gem 'simple_form'
Expand Down
14 changes: 9 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ GEM
rack (>= 2.0, < 4)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
importmap-rails (2.0.3)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (7.0.0)
railties (>= 3.2.16)
json (2.8.2)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
Expand Down Expand Up @@ -359,7 +361,8 @@ DEPENDENCIES
factory_bot_rails
guard-minitest
httparty
importmap-rails
jquery-rails
jquery-ui-rails
listen
mimemagic
minitest
Expand All @@ -375,6 +378,7 @@ DEPENDENCIES
shoulda-matchers
simple_form
sinatra
sprockets-rails
sqlite3 (~> 1.4)
sucker_punch (~> 2.0)
tzinfo-data
Expand Down
4 changes: 2 additions & 2 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
//= link_directory ../stylesheets .scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
import "bootstrap";
import "jquery";
import "datepicker";
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery3
//= require popper
//= require bootstrap
//= require rails-ujs
//= require jquery-ui
//= require_self

import Rails from '@rails/ujs';
Rails.start();

$(document).ready(function () {
$('.datepicker').datepicker();
$('.datepicker').datepicker({ dateFormat: 'yy-mm-dd' });

if ($('#overview_fees_container').length > 0) {
$.ajax({
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/_datepicker.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "jquery-ui/datepicker.css";
6 changes: 2 additions & 4 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
*= require_tree .
*= require_self
*/

@import "_theme_variables";
@import "bootstrap";

@import "_navbar";
@import "_login";

body {
background: #fffefe;
}
Expand All @@ -42,4 +40,4 @@ body {
a:hover {
text-decoration: none;
}
}
}
8 changes: 4 additions & 4 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<html lang="en-CA">
<head>
<title><%= content_for?(:page_title) ? yield(:page_title) : "Pay YUL" %></title>

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-datepicker.min.css">
<%= javascript_include_tag "application" %>
</head>

<body>
Expand Down
4 changes: 2 additions & 2 deletions app/views/reports/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
</div>
<div class="col">
<%= f.input :from, required: false,
input_html: { value: @from, class: 'form-control mb-3 datepicker', "data-date-format": "yyyy-mm-dd" } %>
input_html: { value: @from, class: 'form-control mb-3 datepicker'} %>
</div>
<div class="col">
<%= f.input :to, required: false,
input_html: { value: @to, class: 'form-control mb-3 datepicker', "data-date-format": "yyyy-mm-dd" } %>
input_html: { value: @to, class: 'form-control mb-3 datepicker'} %>
</div>
</div>
<%= f.submit "Generate", class: "btn btn-primary" %>
Expand Down
5 changes: 5 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ class Application < Rails::Application

# Using sucker punch to proccess logs and emails later
config.active_job.queue_adapter = :sucker_punch

# set delivery method to :smtp, :sendmail or :test
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: ENV['SMTP_HOST'], port: ENV['SMTP_PORT'] }
config.action_mailer.default_url_options = { host: ENV['HOST'] }
end
end
8 changes: 0 additions & 8 deletions config/importmap.rb

This file was deleted.

3 changes: 1 addition & 2 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')
#Rails.application.config.assets.paths << Rails.root.join('node_modules')

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
Rails.application.config.assets.precompile += %w( bootstrap.min.js popper.js)

0 comments on commit a57c4a4

Please sign in to comment.