From 0863fd869b6ef23501e5c67249f3be661af80e07 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Fri, 30 Oct 2015 14:33:46 +0100 Subject: Remove ajax code for adding songs/members. --- public/regform.js | 21 --------------------- registration.rb | 8 -------- 2 files changed, 29 deletions(-) delete mode 100644 public/regform.js diff --git a/public/regform.js b/public/regform.js deleted file mode 100644 index 197034e..0000000 --- a/public/regform.js +++ /dev/null @@ -1,21 +0,0 @@ -function fetch(url, id) { - var req = new XMLHttpRequest(); - req.onload = function() { - var element = document.getElementById(id); - var node = document.createElement("div"); - node.innerHTML = this.response; - element.appendChild(node); - }; - req.open("GET", url); - req.send(); -} - -window.onload = function() { - var num_songs = 0; - var add_song_button = document.getElementById('add-song-button'); - - add_song_button.onclick = function() { - num_songs += 1; - fetch(window.location + '/song/new/' + num_songs, 'form-songs'); - }; -}; diff --git a/registration.rb b/registration.rb index 009406a..e3bf571 100644 --- a/registration.rb +++ b/registration.rb @@ -15,14 +15,6 @@ class RegistrationApp < Sinatra::Base erb :index end - get '/member/new/:num' do - erb :member, :layout => false, :locals => { :member_number => params['num'], :member => Member.new } - end - - get '/song/new/:num' do - erb :song, :layout => false, :locals => { :song_number => params['num'], :song => Song.new } - end - post '/submit' do if request.form_data? @band = Band.new(request['band']) -- cgit v1.2.3