Add missing javascript dependencies to package.json. Move javascripts files to app/javascript. Add first javascript test. Change test mode

This commit is contained in:
rebuilt 2021-10-15 23:47:12 +02:00
parent 414eb83f6d
commit 7ba020d04d
13 changed files with 83 additions and 54 deletions

View file

@ -1,15 +0,0 @@
// 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 any plugin's vendor/assets/javascripts directory 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
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require bootstrap
//= require turbolinks
//= require_tree .

View file

@ -1,13 +0,0 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the rails generate channel command.
//
//= require action_cable
//= require_self
//= require_tree ./channels
(function() {
this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
}).call(this);

View file

@ -1,12 +0,0 @@
document.addEventListener("turbolinks:load", function() {
const schoolDropdown = document.querySelector('#select-school');
if (schoolDropdown) {
document.querySelector('#select-school').addEventListener('change', (event) => {
window.location = event.target.value;
});
document.querySelector('#select-district').addEventListener('change', (event) => {
window.location = event.target.value;
});
}
});

View file

@ -1,25 +0,0 @@
document.addEventListener('DOMContentLoaded', () => {
const districtDropdown = document.querySelector('#district-dropdown');
if (districtDropdown) {
districtDropdown.addEventListener('change', event => {
const schoolDropdown = document.querySelector('#school-dropdown');
const districtId = Number(event.target.value);
const schoolsInDistrict = window.schools.filter(school => school.district_id === districtId);
schoolsInDistrict.forEach(school => {
const optionElem = document.createElement('option');
optionElem.setAttribute('value', school.url);
const schoolNameNode = document.createTextNode(school.name);
optionElem.appendChild(schoolNameNode);
schoolDropdown.appendChild(optionElem);
});
});
document.querySelector('button[data-id="go-to-school"]').addEventListener('click', event => {
const selectedSchoolURL = document.querySelector('#school-dropdown').value;
window.location = selectedSchoolURL;
});
}
});

View file

@ -1,7 +0,0 @@
export default class Jester {
constructor(){}
hello(){
return "Hello"
}
}