diff --git a/Gemfile b/Gemfile index b8a1687..7e4c5b1 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 035e926..698806d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -359,7 +361,8 @@ DEPENDENCIES factory_bot_rails guard-minitest httparty - importmap-rails + jquery-rails + jquery-ui-rails listen mimemagic minitest @@ -375,6 +378,7 @@ DEPENDENCIES shoulda-matchers simple_form sinatra + sprockets-rails sqlite3 (~> 1.4) sucker_punch (~> 2.0) tzinfo-data diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index ddd546a..a6ea8c1 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -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 diff --git a/app/javascript/application.js b/app/assets/javascripts/application.js similarity index 53% rename from app/javascript/application.js rename to app/assets/javascripts/application.js index 722cfc8..da4506b 100644 --- a/app/javascript/application.js +++ b/app/assets/javascripts/application.js @@ -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({ diff --git a/app/assets/stylesheets/_datepicker.scss b/app/assets/stylesheets/_datepicker.scss new file mode 100644 index 0000000..9547ffc --- /dev/null +++ b/app/assets/stylesheets/_datepicker.scss @@ -0,0 +1 @@ +@import "jquery-ui/datepicker.css"; diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 36c18c5..3528521 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -13,12 +13,10 @@ *= require_tree . *= require_self */ + @import "_theme_variables"; @import "bootstrap"; -@import "_navbar"; -@import "_login"; - body { background: #fffefe; } @@ -42,4 +40,4 @@ body { a:hover { text-decoration: none; } -} \ No newline at end of file +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 64ed717..7584e6e 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,13 +2,13 @@ <%= content_for?(:page_title) ? yield(:page_title) : "Pay YUL" %> + + + <%= csrf_meta_tags %> <%= csp_meta_tag %> - <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> - <%= javascript_importmap_tags %> - - + <%= javascript_include_tag "application" %> diff --git a/app/views/reports/index.html.erb b/app/views/reports/index.html.erb index f479cde..89dbd2c 100644 --- a/app/views/reports/index.html.erb +++ b/app/views/reports/index.html.erb @@ -14,11 +14,11 @@
<%= 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'} %>
<%= 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'} %>
<%= f.submit "Generate", class: "btn btn-primary" %> diff --git a/config/application.rb b/config/application.rb index 852554b..02481b3 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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 diff --git a/config/importmap.rb b/config/importmap.rb deleted file mode 100644 index 5065c67..0000000 --- a/config/importmap.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Pin npm packages by running ./bin/importmap - -pin "application", preload: true -pin "popper", to: 'popper.js', preload: true -pin "bootstrap", to: 'bootstrap.min.js', preload: true -pin "jquery", to: "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.js" -pin "datepicker", to: "https://cdn.jsdelivr.net/npm/bootstrap-datepicker@1.9.0/dist/js/bootstrap-datepicker.min.js" -pin "@rails/ujs", to: "https://cdn.skypack.dev/@rails/ujs" diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index bd85931..288fcfb 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -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)