Skip to content

Commit

Permalink
Merge pull request #542 from ita-social-projects/fix/importmap_compile
Browse files Browse the repository at this point in the history
Fix/importmap_compile
  • Loading branch information
loqimean authored Oct 6, 2023
2 parents 0f6eda7 + f61eb90 commit f62bbf1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 47 deletions.
4 changes: 2 additions & 2 deletions app/controllers/account/calculators_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def create
if @calculator.save
redirect_to account_calculators_path, notice: t("notifications.calculator_created")
else
render action: "new"
render :new, status: :unprocessable_entity
end
end

Expand All @@ -28,7 +28,7 @@ def update
else
collect_fields_for_form

render action: "edit"
render :edit, status: :unprocessable_entity
end
end

Expand Down
44 changes: 6 additions & 38 deletions app/javascript/application.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,9 @@
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
import "controllers"
import "@hotwired/turbo-rails"

import "controllers";
import "channels";
import "jquery"

import "@fortawesome/fontawesome-free"

// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.

import Rails from "@rails/ujs";
import * as ActiveStorage from "@rails/activestorage";
import "../channels";
import "@rails/request.js";

require("jquery");
require("@nathanvda/cocoon");

import "../ajax/checkbox";
import "plugins/flatpickr";

import "@hotwired/turbo-rails";
import "bootstrap";
import "popper"

import "../js/calculators/edit";
import "../controllers/stimulus_application";

global.toastr = require("toastr");

Rails.start();
Turbo.start();
ActiveStorage.start();

$("document").ready(function () {
setTimeout(function () {
$(".alert").slideUp();
}, 10000);
});
import "@fortawesome/fontawesome-free";
import "@nathanvda/cocoon";
import "@rails/request.js";
3 changes: 3 additions & 0 deletions app/javascript/controllers/application.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Application } from "@hotwired/stimulus"
import toastr from "toastr";

window.toastr = toastr

const application = Application.start()

Expand Down
1 change: 0 additions & 1 deletion app/javascript/controllers/input_child_info_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default class extends Controller {

// Save the previous month value before updating
const previousMonthValue = this.monthTarget.value;
console.log(`VALUE = ${previousMonthValue}`)

// Clear old options from the month selection list
this.monthTarget.innerHTML = '';
Expand Down
13 changes: 7 additions & 6 deletions config/importmap.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Pin npm packages by running ./bin/importmap

pin "application", preload: true
pin "jquery", to: "https://ga.jspm.io/npm:[email protected]/dist/jquery.js"
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
pin "jquery", to: "https://ga.jspm.io/npm:[email protected]/dist/jquery.js"
pin_all_from "app/javascript/controllers", under: "controllers"
pin "bootstrap", to: "https://ga.jspm.io/npm:[email protected]/dist/js/bootstrap.esm.js"
pin "@popperjs/core", to: "https://ga.jspm.io/npm:@popperjs/[email protected]/lib/index.js"
pin "toastr", to: "https://ga.jspm.io/npm:[email protected]/toastr.js"
pin_all_from "app/javascript/channels", under: "channels"
pin "bootstrap", to: "https://ga.jspm.io/npm:[email protected]/dist/js/bootstrap.esm.js", preload: true
pin "@nathanvda/cocoon", to: "https://ga.jspm.io/npm:@nathanvda/[email protected]/cocoon.js"
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
pin "@fortawesome/fontawesome-free", to: "https://ga.jspm.io/npm:@fortawesome/[email protected]/js/all.js"
pin "@fortawesome/fontawesome-free", to: "https://ga.jspm.io/npm:@fortawesome/[email protected]/js/all.js", preload: true
pin "toastr", to: "https://ga.jspm.io/npm:[email protected]/toastr.js", preload: true
pin "@popperjs/core", to: "https://ga.jspm.io/npm:@popperjs/[email protected]/lib/index.js", preload: true

0 comments on commit f62bbf1

Please sign in to comment.