From 4eb3d7b54c9119d79a878dc89623a8e032f1ea3d Mon Sep 17 00:00:00 2001 From: kd00506 <kd00506@surrey.ac.uk> Date: Sat, 12 Dec 2020 15:08:42 +0000 Subject: [PATCH] Fixed weird jquery errors --- .idea/.generators | 8 -- .idea/.rakeTasks | 7 -- .idea/Lab4.iml | 85 +++++++++++++++++++- .idea/inspectionProfiles/Project_Default.xml | 21 ----- Gemfile.lock | 7 +- app/assets/javascripts/HomePage.js | 2 +- app/assets/javascripts/LoginPage.js | 8 +- app/assets/javascripts/application.js | 3 +- app/controllers/home_controller.rb | 5 +- app/controllers/listview_controller.rb | 10 ++- app/views/home/homepage.html.haml | 1 + app/views/layouts/application.html.haml | 5 +- app/views/listview/listview.html.haml | 1 - 13 files changed, 109 insertions(+), 54 deletions(-) delete mode 100644 .idea/.generators delete mode 100644 .idea/.rakeTasks delete mode 100644 .idea/inspectionProfiles/Project_Default.xml diff --git a/.idea/.generators b/.idea/.generators deleted file mode 100644 index 8e70c27..0000000 --- a/.idea/.generators +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Settings><!--This file was automatically generated by Ruby plugin. -You are allowed to: -1. Reorder generators -2. Remove generators -3. Add installed generators -To add new installed generators automatically delete this file and reload the project. ---><GeneratorsGroup><Generator name="active_record:application_record" /><Generator name="application_record" /><Generator name="assets" /><Generator name="channel" /><Generator name="coffee:assets" /><Generator name="controller" /><Generator name="erb:controller" /><Generator name="erb:mailer" /><Generator name="erb:scaffold" /><Generator name="generator" /><Generator name="haml:application_layout" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jbuilder" /><Generator name="job" /><Generator name="js:assets" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="resource" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="system_test" /><Generator name="task" /><Generator name="test_unit:generator" /><Generator name="test_unit:plugin" /></GeneratorsGroup></Settings> diff --git a/.idea/.rakeTasks b/.idea/.rakeTasks deleted file mode 100644 index 73e9c0d..0000000 --- a/.idea/.rakeTasks +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Settings><!--This file was automatically generated by Ruby plugin. -You are allowed to: -1. Remove rake task -2. Add existing rake tasks -To add existing rake tasks automatically delete this file and reload the project. ---><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="List versions of all Rails frameworks and the environment" fullCmd="about" taksId="about" /><RakeGroup description="" fullCmd="" taksId="active_storage"><RakeTask description="Copy over the migration needed to the application" fullCmd="active_storage:install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="" fullCmd="active_storage:install:migrations" taksId="migrations" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="app"><RakeTask description="Applies the template supplied by LOCATION=(/path/to/template) or URL" fullCmd="app:template" taksId="template" /><RakeTask description="Update configs and some other initially generated files (or use just update:configs or update:bin)" fullCmd="app:update" taksId="update" /><RakeGroup description="" fullCmd="" taksId="templates"><RakeTask description="" fullCmd="app:templates:copy" taksId="copy" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="update"><RakeTask description="" fullCmd="app:update:bin" taksId="bin" /><RakeTask description="" fullCmd="app:update:configs" taksId="configs" /><RakeTask description="" fullCmd="app:update:upgrade_guide_info" taksId="upgrade_guide_info" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="assets"><RakeTask description="Remove old compiled assets" fullCmd="assets:clean[keep]" taksId="clean[keep]" /><RakeTask description="Remove compiled assets" fullCmd="assets:clobber" taksId="clobber" /><RakeTask description="Load asset compile environment" fullCmd="assets:environment" taksId="environment" /><RakeTask description="Compile all the assets named in config.assets.precompile" fullCmd="assets:precompile" taksId="precompile" /><RakeTask description="" fullCmd="assets:clean" taksId="clean" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="cache_digests"><RakeTask description="Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)" fullCmd="cache_digests:dependencies" taksId="dependencies" /><RakeTask description="Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)" fullCmd="cache_digests:nested_dependencies" taksId="nested_dependencies" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="db"><RakeTask description="Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to creating the development and test databases" fullCmd="db:create" taksId="create" /><RakeTask description="Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to dropping the development and test databases" fullCmd="db:drop" taksId="drop" /><RakeGroup description="" fullCmd="" taksId="environment"><RakeTask description="Set the environment value for the database" fullCmd="db:environment:set" taksId="set" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="fixtures"><RakeTask description="Loads fixtures into the current environment's database" fullCmd="db:fixtures:load" taksId="load" /><RakeTask description="" fullCmd="db:fixtures:identify" taksId="identify" /></RakeGroup><RakeTask description="Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)" fullCmd="db:migrate" taksId="migrate" /><RakeGroup description="" fullCmd="" taksId="migrate"><RakeTask description="Display status of migrations" fullCmd="db:migrate:status" taksId="status" /><RakeTask description="" fullCmd="db:migrate:down" taksId="down" /><RakeTask description="" fullCmd="db:migrate:redo" taksId="redo" /><RakeTask description="" fullCmd="db:migrate:reset" taksId="reset" /><RakeTask description="" fullCmd="db:migrate:up" taksId="up" /></RakeGroup><RakeTask description="Rolls the schema back to the previous version (specify steps w/ STEP=n)" fullCmd="db:rollback" taksId="rollback" /><RakeGroup description="" fullCmd="" taksId="schema"><RakeGroup description="" fullCmd="" taksId="cache"><RakeTask description="Clears a db/schema_cache.yml file" fullCmd="db:schema:cache:clear" taksId="clear" /><RakeTask description="Creates a db/schema_cache.yml file" fullCmd="db:schema:cache:dump" taksId="dump" /></RakeGroup><RakeTask description="Creates a db/schema.rb file that is portable against any DB supported by Active Record" fullCmd="db:schema:dump" taksId="dump" /><RakeTask description="Loads a schema.rb file into the database" fullCmd="db:schema:load" taksId="load" /><RakeTask description="" fullCmd="db:schema:load_if_ruby" taksId="load_if_ruby" /></RakeGroup><RakeTask description="Loads the seed data from db/seeds.rb" fullCmd="db:seed" taksId="seed" /><RakeTask description="Creates the database, loads the schema, and initializes with the seed data (use db:reset to also drop the database first)" fullCmd="db:setup" taksId="setup" /><RakeGroup description="" fullCmd="" taksId="structure"><RakeTask description="Dumps the database structure to db/structure.sql" fullCmd="db:structure:dump" taksId="dump" /><RakeTask description="Recreates the databases from the structure.sql file" fullCmd="db:structure:load" taksId="load" /><RakeTask description="" fullCmd="db:structure:load_if_sql" taksId="load_if_sql" /></RakeGroup><RakeTask description="Retrieves the current schema version number" fullCmd="db:version" taksId="version" /><RakeTask description="" fullCmd="db:_dump" taksId="_dump" /><RakeTask description="" fullCmd="db:abort_if_pending_migrations" taksId="abort_if_pending_migrations" /><RakeTask description="" fullCmd="db:charset" taksId="charset" /><RakeTask description="" fullCmd="db:check_protected_environments" taksId="check_protected_environments" /><RakeTask description="" fullCmd="db:collation" taksId="collation" /><RakeGroup description="" fullCmd="" taksId="create"><RakeTask description="" fullCmd="db:create:all" taksId="all" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="drop"><RakeTask description="" fullCmd="db:drop:_unsafe" taksId="_unsafe" /><RakeTask description="" fullCmd="db:drop:all" taksId="all" /></RakeGroup><RakeTask description="" fullCmd="db:forward" taksId="forward" /><RakeTask description="" fullCmd="db:load_config" taksId="load_config" /><RakeTask description="" fullCmd="db:purge" taksId="purge" /><RakeGroup description="" fullCmd="" taksId="purge"><RakeTask description="" fullCmd="db:purge:all" taksId="all" /></RakeGroup><RakeTask description="" fullCmd="db:reset" taksId="reset" /><RakeGroup description="" fullCmd="" taksId="test"><RakeTask description="" fullCmd="db:test:load" taksId="load" /><RakeTask description="" fullCmd="db:test:load_schema" taksId="load_schema" /><RakeTask description="" fullCmd="db:test:load_structure" taksId="load_structure" /><RakeTask description="" fullCmd="db:test:prepare" taksId="prepare" /><RakeTask description="" fullCmd="db:test:purge" taksId="purge" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="dev"><RakeTask description="Toggle development mode caching on/off" fullCmd="dev:cache" taksId="cache" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="haml"><RakeTask description="Convert html.erb to html.haml each file in app/views" fullCmd="haml:erb2haml" taksId="erb2haml" /></RakeGroup><RakeTask description="Print out all defined initializers in the order they are invoked by Rails" fullCmd="initializers" taksId="initializers" /><RakeGroup description="" fullCmd="" taksId="log"><RakeTask description="Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)" fullCmd="log:clear" taksId="clear" /></RakeGroup><RakeTask description="Prints out your Rack middleware stack" fullCmd="middleware" taksId="middleware" /><RakeTask description="Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)" fullCmd="notes" taksId="notes" /><RakeGroup description="" fullCmd="" taksId="notes"><RakeTask description="Enumerate a custom annotation, specify with ANNOTATION=CUSTOM" fullCmd="notes:custom" taksId="custom" /><RakeTask description="" fullCmd="notes:fixme" taksId="fixme" /><RakeTask description="" fullCmd="notes:optimize" taksId="optimize" /><RakeTask description="" fullCmd="notes:todo" taksId="todo" /></RakeGroup><RakeTask description="Restart app by touching tmp/restart.txt" fullCmd="restart" taksId="restart" /><RakeTask description="Print out all defined routes in match order, with names" fullCmd="routes" taksId="routes" /><RakeTask description="Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)" fullCmd="secret" taksId="secret" /><RakeTask description="Report code statistics (KLOCs, etc) from the application or engine" fullCmd="stats" taksId="stats" /><RakeTask description="Runs all tests in test folder except system ones" fullCmd="test" taksId="test" /><RakeGroup description="" fullCmd="" taksId="test"><RakeTask description="Run tests quickly, but also reset db" fullCmd="test:db" taksId="db" /><RakeTask description="Run system tests only" fullCmd="test:system" taksId="system" /><RakeTask description="" fullCmd="test:controllers" taksId="controllers" /><RakeTask description="" fullCmd="test:functionals" taksId="functionals" /><RakeTask description="" fullCmd="test:generators" taksId="generators" /><RakeTask description="" fullCmd="test:helpers" taksId="helpers" /><RakeTask description="" fullCmd="test:integration" taksId="integration" /><RakeTask description="" fullCmd="test:jobs" taksId="jobs" /><RakeTask description="" fullCmd="test:mailers" taksId="mailers" /><RakeTask description="" fullCmd="test:models" taksId="models" /><RakeTask description="" fullCmd="test:prepare" taksId="prepare" /><RakeTask description="" fullCmd="test:run" taksId="run" /><RakeTask description="" fullCmd="test:units" taksId="units" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="time"><RakeTask description="List all time zones, list by two-letter country code (`rails time:zones[US]`), or list by UTC offset (`rails time:zones[-8]`)" fullCmd="time:zones[country_or_offset]" taksId="zones[country_or_offset]" /><RakeTask description="" fullCmd="time:zones" taksId="zones" /><RakeGroup description="" fullCmd="" taksId="zones"><RakeTask description="" fullCmd="time:zones:all" taksId="all" /><RakeTask description="" fullCmd="time:zones:local" taksId="local" /><RakeTask description="" fullCmd="time:zones:us" taksId="us" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="tmp"><RakeTask description="Clear cache, socket and screenshot files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear, tmp:screenshots:clear)" fullCmd="tmp:clear" taksId="clear" /><RakeTask description="Creates tmp directories for cache, sockets, and pids" fullCmd="tmp:create" taksId="create" /><RakeGroup description="" fullCmd="" taksId="cache"><RakeTask description="" fullCmd="tmp:cache:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="pids"><RakeTask description="" fullCmd="tmp:pids:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="screenshots"><RakeTask description="" fullCmd="tmp:screenshots:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="sockets"><RakeTask description="" fullCmd="tmp:sockets:clear" taksId="clear" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="yarn"><RakeTask description="Install all JavaScript dependencies as specified via Yarn" fullCmd="yarn:install" taksId="install" /></RakeGroup><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="environment" taksId="environment" /><RakeGroup description="" fullCmd="" taksId="railties"><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="" fullCmd="railties:install:migrations" taksId="migrations" /></RakeGroup></RakeGroup><RakeTask description="" fullCmd="tmp" taksId="tmp" /><RakeTask description="" fullCmd="tmp/cache" taksId="tmp/cache" /><RakeTask description="" fullCmd="tmp/cache/assets" taksId="tmp/cache/assets" /><RakeTask description="" fullCmd="tmp/pids" taksId="tmp/pids" /><RakeTask description="" fullCmd="tmp/sockets" taksId="tmp/sockets" /><RakeGroup description="" fullCmd="" taksId="webdrivers"><RakeGroup description="" fullCmd="" taksId="chromedriver"><RakeTask description="" fullCmd="webdrivers:chromedriver:remove" taksId="remove" /><RakeTask description="" fullCmd="webdrivers:chromedriver:update" taksId="update" /><RakeTask description="" fullCmd="webdrivers:chromedriver:version" taksId="version" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="edgedriver"><RakeTask description="" fullCmd="webdrivers:edgedriver:remove" taksId="remove" /><RakeTask description="" fullCmd="webdrivers:edgedriver:update" taksId="update" /><RakeTask description="" fullCmd="webdrivers:edgedriver:version" taksId="version" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="geckodriver"><RakeTask description="" fullCmd="webdrivers:geckodriver:remove" taksId="remove" /><RakeTask description="" fullCmd="webdrivers:geckodriver:update" taksId="update" /><RakeTask description="" fullCmd="webdrivers:geckodriver:version" taksId="version" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="iedriver"><RakeTask description="" fullCmd="webdrivers:iedriver:remove" taksId="remove" /><RakeTask description="" fullCmd="webdrivers:iedriver:update" taksId="update" /><RakeTask description="" fullCmd="webdrivers:iedriver:version" taksId="version" /></RakeGroup></RakeGroup></RakeGroup></Settings> diff --git a/.idea/Lab4.iml b/.idea/Lab4.iml index 824c5d4..c81bcd1 100644 --- a/.idea/Lab4.iml +++ b/.idea/Lab4.iml @@ -26,7 +26,7 @@ <excludeFolder url="file://$MODULE_DIR$/vendor/bundle" /> <excludeFolder url="file://$MODULE_DIR$/vendor/cache" /> </content> - <orderEntry type="inheritedJdk" /> + <orderEntry type="jdk" jdkName="ruby-2.5.8-p224" jdkType="RUBY_SDK" /> <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="library" scope="PROVIDED" name="actioncable (v5.2.4.4, ruby-2.5.8-p224) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="actionmailer (v5.2.4.4, ruby-2.5.8-p224) [gem]" level="application" /> @@ -44,7 +44,7 @@ <orderEntry type="library" scope="PROVIDED" name="bootsnap (v1.4.8, ruby-2.5.8-p224) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="bootstrap-sass (v3.3.7, ruby-2.5.8-p224) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, ruby-2.5.8-p224) [gem]" level="application" /> - <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, ruby-2.5.8-p224) [gem]" level="application" /> + <orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.0, ruby-2.5.8-p224) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="byebug (v11.1.3, ruby-2.5.8-p224) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="capybara (v3.33.0, ruby-2.5.8-p224) [gem]" level="application" /> <orderEntry type="library" scope="PROVIDED" name="childprocess (v3.0.0, ruby-2.5.8-p224) [gem]" level="application" /> @@ -118,4 +118,85 @@ <LOAD_PATH number="0" /> <I18N_FOLDERS number="1" string0="$MODULE_DIR$/config/locales" /> </component> + <component name="RailsGeneratorsCache"> + <option name="generators"> + <list> + <option value="active_record:migration" /> + <option value="active_record:model" /> + <option value="active_record:observer" /> + <option value="active_record:session_migration" /> + <option value="controller" /> + <option value="erb:controller" /> + <option value="erb:mailer" /> + <option value="erb:scaffold" /> + <option value="generator" /> + <option value="helper" /> + <option value="integration_test" /> + <option value="mailer" /> + <option value="metal" /> + <option value="migration" /> + <option value="model" /> + <option value="model_subclass" /> + <option value="observer" /> + <option value="performance_test" /> + <option value="plugin" /> + <option value="resource" /> + <option value="scaffold" /> + <option value="scaffold_controller" /> + <option value="session_migration" /> + <option value="stylesheets" /> + <option value="test_unit:controller" /> + <option value="test_unit:helper" /> + <option value="test_unit:integration" /> + <option value="test_unit:mailer" /> + <option value="test_unit:model" /> + <option value="test_unit:observer" /> + <option value="test_unit:performance" /> + <option value="test_unit:plugin" /> + <option value="test_unit:scaffold" /> + </list> + </option> + <option name="myGenerators"> + <list> + <option value="active_record:migration" /> + <option value="active_record:model" /> + <option value="active_record:observer" /> + <option value="active_record:session_migration" /> + <option value="controller" /> + <option value="erb:controller" /> + <option value="erb:mailer" /> + <option value="erb:scaffold" /> + <option value="generator" /> + <option value="helper" /> + <option value="integration_test" /> + <option value="mailer" /> + <option value="metal" /> + <option value="migration" /> + <option value="model" /> + <option value="model_subclass" /> + <option value="observer" /> + <option value="performance_test" /> + <option value="plugin" /> + <option value="resource" /> + <option value="scaffold" /> + <option value="scaffold_controller" /> + <option value="session_migration" /> + <option value="stylesheets" /> + <option value="test_unit:controller" /> + <option value="test_unit:helper" /> + <option value="test_unit:integration" /> + <option value="test_unit:mailer" /> + <option value="test_unit:model" /> + <option value="test_unit:observer" /> + <option value="test_unit:performance" /> + <option value="test_unit:plugin" /> + <option value="test_unit:scaffold" /> + </list> + </option> + </component> + <component name="RakeTasksCache"> + <option name="myRootTask"> + <RakeTaskImpl id="rake" /> + </option> + </component> </module> \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 8a190e3..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,21 +0,0 @@ -<component name="InspectionProjectProfileManager"> - <profile version="1.0"> - <option name="myName" value="Project Default" /> - <inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true"> - <option name="myValues"> - <value> - <list size="7"> - <item index="0" class="java.lang.String" itemvalue="nobr" /> - <item index="1" class="java.lang.String" itemvalue="noembed" /> - <item index="2" class="java.lang.String" itemvalue="comment" /> - <item index="3" class="java.lang.String" itemvalue="noscript" /> - <item index="4" class="java.lang.String" itemvalue="embed" /> - <item index="5" class="java.lang.String" itemvalue="script" /> - <item index="6" class="java.lang.String" itemvalue="inputtext" /> - </list> - </value> - </option> - <option name="myCustomValuesEnabled" value="true" /> - </inspection_tool> - </profile> -</component> \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index c4f86db..405f8aa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -78,6 +78,7 @@ GEM erubis (2.7.0) execjs (2.7.0) ffi (1.13.1-x64-mingw32) + ffi (1.13.1-x86-mingw32) globalid (0.4.2) activesupport (>= 4.2.0) haml (5.2.0) @@ -116,9 +117,12 @@ GEM minitest (5.14.2) modernizr-rails (2.7.1) msgpack (1.3.3-x64-mingw32) + msgpack (1.3.3-x86-mingw32) nio4r (2.5.4) nokogiri (1.10.10-x64-mingw32) mini_portile2 (~> 2.4.0) + nokogiri (1.10.10-x86-mingw32) + mini_portile2 (~> 2.4.0) public_suffix (4.0.6) puma (3.12.6) rack (2.2.3) @@ -209,6 +213,7 @@ GEM PLATFORMS x64-mingw32 + x86-mingw32 DEPENDENCIES bootsnap (>= 1.1.0) @@ -236,4 +241,4 @@ RUBY VERSION ruby 2.5.8p224 BUNDLED WITH - 2.1.4 + 2.2.0 diff --git a/app/assets/javascripts/HomePage.js b/app/assets/javascripts/HomePage.js index a1bd08e..12bce24 100644 --- a/app/assets/javascripts/HomePage.js +++ b/app/assets/javascripts/HomePage.js @@ -9,5 +9,5 @@ function removeProd(id, elem) { // Method for removing a product } function newListCheck(elem) { // Method to disable the new list button depending on whether a text field is empty - $("#newListSubmit").disabled = elem.value.length === 0; + $("#newListSubmit").prop('disabled', elem.value.length === 0); } \ No newline at end of file diff --git a/app/assets/javascripts/LoginPage.js b/app/assets/javascripts/LoginPage.js index 0204d95..4a82c39 100644 --- a/app/assets/javascripts/LoginPage.js +++ b/app/assets/javascripts/LoginPage.js @@ -1,9 +1,9 @@ function showLoginForm() { // Hide the create form and show the login form - $("#loginForm").style.display = "flex"; - $("#createForm").style.display = "none"; + $("#loginForm").css("display", "flex"); + $("#createForm").css("display", "none"); } function showCreateForm() { // Hide the login form and show the create form - $("#loginForm").style.display = "none"; - $("#createForm").style.display = "flex"; + $("#loginForm").css("display", "none"); + $("#createForm").css("display", "flex"); } \ No newline at end of file diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c889188..02b3d02 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,7 +13,8 @@ //= require rails-ujs //= require activestorage //= require turbolinks -//= require jquery +//= require jquery3 +//= require jquery_ujs //= require_tree . function getButton(url, name, value){ // A function allowing a button to make a get request with a parameter diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 8119130..1add801 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,6 @@ class HomeController < ApplicationController + def new_lst # Method for creating new lists if List.user(session[:user_id]).where(name: params[:name]).exists? # If the user already has a list of the same name, then we display a relevant message redirect_to homepage_path alert: t('.homepage.existing', name: params[:name]) @@ -15,9 +16,7 @@ class HomeController < ApplicationController redirect_to homepage_path end - def login; # Method for login page view - @username = '' - @pagename = t('.page_title') + def login # Method for login page view end def logincheck # Here we check if the login info is correct diff --git a/app/controllers/listview_controller.rb b/app/controllers/listview_controller.rb index 63bfda8..6d07127 100644 --- a/app/controllers/listview_controller.rb +++ b/app/controllers/listview_controller.rb @@ -5,7 +5,9 @@ class ListviewController < ApplicationController (0..params[:product_id].length - 1).each do |i| # Loop through each product and keep track of the relevant changes change = Hash[] - change[:quantity] = params[:quantity][i] unless params[:quantity].nil? || params[:quantity][i].blank? || Integer(params[:quantity][i]) < 1 + unless params[:quantity].nil? || params[:quantity][i].blank? || Integer(params[:quantity][i]) < 1 + change[:quantity] = params[:quantity][i] + end change[:acquired] = params[:acquired][i] unless params[:acquired].nil? || params[:acquired][i].blank? change[:name] = params[:name][i] unless params[:name].nil? || params[:name][i].blank? @@ -22,10 +24,12 @@ class ListviewController < ApplicationController end def listview # Method for displaying the list page - if session[:user_id].nil? # If we have no session variable for the user_id, then the user has not signed in + if session[:user_id].nil? # If we have no session variable for the user_id, then the user has not signed in redirect_to root_path else # Otherwise we set the relevant variables and render the listview page - session[:list_id] = params[:list_id] + + session[:list_id] = params[:list_id] unless params[:list_id].blank? + @list_id = session[:list_id] @username = User.find(session[:user_id]).name diff --git a/app/views/home/homepage.html.haml b/app/views/home/homepage.html.haml index cbce390..848bbeb 100644 --- a/app/views/home/homepage.html.haml +++ b/app/views/home/homepage.html.haml @@ -7,6 +7,7 @@ %p{class: "text"}= list.name .listButtons = form_tag listview_path, method: 'get' do + =hidden_field_tag :list_id, list.id %input{type: "submit", value: t('.view'), class: "button1"} = button_tag(class: "iconButton", onclick: "removeList(" + String(list.id) + ", this)") do diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 6125438..aa7e8db 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -10,9 +10,10 @@ %meta{'name' => 'description', 'content' => t('app_description')} %meta{'name' => 'viewport', 'content' => 'width=device-width, initial-scale=1'} - = stylesheet_link_tag 'application.css', media: 'all', 'data-turbolinks-track' => true - = javascript_include_tag 'application.js', 'data-turbolinks-track' => true + = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true + = javascript_include_tag 'application', 'data-turbolinks-track' => true = csrf_meta_tags + -# Font awesome stuff %script{src: "https://kit.fontawesome.com/caf9832e26.js", crossorigin: "anonymous"} diff --git a/app/views/listview/listview.html.haml b/app/views/listview/listview.html.haml index a0c35e6..4171230 100644 --- a/app/views/listview/listview.html.haml +++ b/app/views/listview/listview.html.haml @@ -18,7 +18,6 @@ = text_field_tag :name, "", required: true, class: "inputText", placeholder: t('.name') %br = number_field_tag :quantity, "", min: 1, class: "inputText", placeholder: t('.quantity') - =hidden_field_tag :list_id, @list_id %input{type: "submit", value: t('.add'), class: "button1"} -- GitLab