diff --git a/Gemfile b/Gemfile index 4654550..12ce9f7 100644 --- a/Gemfile +++ b/Gemfile @@ -18,8 +18,8 @@ gem 'puma', '~> 5.0' gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 5.0' -# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks -gem 'turbolinks', '~> 5' +# The speed of a single-page web application without having to write any JavaScript. +gem 'turbo-rails' # Use Redis adapter to run Action Cable in production gem 'redis', '~> 4.2.5' # Use Active Model has_secure_password @@ -71,7 +71,7 @@ group :development do gem 'web-console', '>= 4.1.0' # Display performance information such as SQL time and flame graphs for each request in your browser. # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md - gem 'rack-mini-profiler', '~> 2.0' + gem 'rack-mini-profiler', '~> 2.3.2' , git: "https://github.com/ceritium/rack-mini-profiler", branch: 'turbodrive-support' # The Listen gem listens to file modifications and notifies you about the changes. Works everywhere gem 'listen', '~> 3.3' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring diff --git a/Gemfile.lock b/Gemfile.lock index f4d34d9..a33a153 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,6 +6,14 @@ GIT require_all typhoeus (~> 1.1) +GIT + remote: https://github.com/ceritium/rack-mini-profiler + revision: da799a00e15faa04f2d7e95ccea1ede6eb6ed622 + branch: turbodrive-support + specs: + rack-mini-profiler (2.3.2) + rack (>= 1.2.0) + GEM remote: https://rubygems.org/ specs: @@ -72,7 +80,7 @@ GEM public_suffix (>= 2.0.2, < 5.0) ast (2.4.2) awesome_print (1.9.2) - backport (1.1.2) + backport (1.2.0) bcrypt (3.1.16) benchmark (0.1.1) bindex (0.8.1) @@ -163,7 +171,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) nio4r (2.5.7) - nokogiri (1.11.6-x86_64-linux) + nokogiri (1.11.7-x86_64-linux) racc (~> 1.4) oauth2 (1.4.7) faraday (>= 0.8, < 2.0) @@ -199,8 +207,6 @@ GEM nio4r (~> 2.0) racc (1.5.2) rack (2.2.3) - rack-mini-profiler (2.3.1) - rack (>= 1.2.0) rack-proxy (0.6.5) rack rack-test (1.1.0) @@ -272,7 +278,7 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.10.2) - rubocop (1.16.0) + rubocop (1.17.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) @@ -329,10 +335,11 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.2) - solargraph (0.41.1) - backport (~> 1.1) + solargraph (0.42.3) + backport (~> 1.2) benchmark bundler (>= 1.17.2) + diff-lcs (~> 1.4) e2mmap jaro_winkler (~> 1.5) kramdown (~> 2.3) @@ -353,9 +360,8 @@ GEM sprockets (>= 3.0.0) thor (1.1.0) tilt (2.0.10) - turbolinks (5.2.1) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) + turbo-rails (0.5.9) + rails (>= 6.0.0) typhoeus (1.4.0) ethon (>= 0.9.0) tzinfo (2.0.4) @@ -407,7 +413,7 @@ DEPENDENCIES pg (~> 1.1) pry-rails (~> 0.3.9) puma (~> 5.0) - rack-mini-profiler (~> 2.0) + rack-mini-profiler (~> 2.3.2)! rails (~> 6.1.3, >= 6.1.3.1) rails-erd rails-i18n (~> 6.0.0) @@ -425,7 +431,7 @@ DEPENDENCIES simplecov solargraph spring - turbolinks (~> 5) + turbo-rails tzinfo-data web-console (>= 4.1.0) webdrivers diff --git a/app/controllers/rp_worlds_controller.rb b/app/controllers/rp_worlds_controller.rb index ed5eef5..5ba84dd 100644 --- a/app/controllers/rp_worlds_controller.rb +++ b/app/controllers/rp_worlds_controller.rb @@ -1,9 +1,52 @@ class RpWorldsController < ApplicationController + before_action :set_rp_world, only: [:show, :edit, :update, :destroy] + + # GET /rp_worlds def index @rp_worlds = RpWorld.all end - def show + # GET /rp_worlds/1 + def show; end + + # GET /rp_worlds/1/edit + def edit; end + + # POST /rp_worlds + def create + @rp_world = RpWorld.new(rp_world_params) + + if @rp_world.save + redirect_to @rp_world, notice: 'Rp world was successfully created.' + else + render :new + end + end + + # PATCH/PUT /rp_worlds/1 + def update + if @rp_world.update(rp_world_params) + redirect_to @rp_world, notice: 'Rp world was successfully updated.' + else + render :edit + end + end + + # DELETE /rp_worlds/1 + def destroy + @rp_world.destroy + redirect_to rp_worlds_url, notice: 'Rp world was successfully destroyed.' + end + + private + + # Use callbacks to share common setup or constraints between actions. + def set_rp_world @rp_world = RpWorld.includes(:wow_characters).find(params[:id]) end + + # Only allow a list of trusted parameters through. + def rp_world_params + params.require(:rp_world).permit(:name, :description) + end end diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 2397e74..671b032 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -4,7 +4,7 @@ // that code so it'll be compiled. import Rails from "@rails/ujs" -import Turbolinks from "turbolinks" +import "@hotwired/turbo-rails" import * as ActiveStorage from "@rails/activestorage" import "channels" @@ -20,5 +20,4 @@ document.addEventListener("turbolinks:load", () => { }) Rails.start() -Turbolinks.start() ActiveStorage.start() diff --git a/app/views/rp_worlds/_form.html.erb b/app/views/rp_worlds/_form.html.erb new file mode 100644 index 0000000..5af5355 --- /dev/null +++ b/app/views/rp_worlds/_form.html.erb @@ -0,0 +1,15 @@ +<%= form_with(model: rp_world) do |form| %> +
<%= notice %>
-| <%= t('rp_worlds.world_list.name') %> | -<%= t('rp_worlds.world_list.description') %> | +<%= t('rp_worlds.world_list.name') %> | +|||
|---|---|---|---|---|---|
| <%= link_to world.name, world %> | -<%= world.description %> | -||||
| <%= rp_world.name %> | +<%= link_to 'Show', rp_world %> | +<%= link_to 'Edit', edit_rp_world_path(rp_world) %> | +<%= link_to 'Destroy', rp_world, method: :delete, data: { confirm: 'Are you sure?' } %> | +||
<%= notice %>
+" do + render + expect(rendered).to match(/Name/) + end +end diff --git a/yarn.lock b/yarn.lock index 6f06790..11809a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -852,6 +852,19 @@ resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.3.tgz#c36ffa64a2a239bf948541a97b6ae8d729e09a9a" integrity sha512-rFnSUN/QOtnOAgqFRooTA3H57JLDm0QEG/jPdk+tLQNL/eWd+Aok8g3qCI+Q1xuDPWpGW/i9JySpJVsq8Q0s9w== +"@hotwired/turbo-rails@^7.0.0-beta.5": + version "7.0.0-beta.5" + resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.0.0-beta.5.tgz#a0efdb7a20613845c43afe6f376b353e62f7e68d" + integrity sha512-zj+ZYbs2IHeJHtLavcLX5K0oW/3K8s3zjok4lpujxqLactp3OpuqBZxKBr+tgODnAX/WYFoKLpzivyx3xVRfTw== + dependencies: + "@hotwired/turbo" "^7.0.0-beta.4" + "@rails/actioncable" "^6.1.0" + +"@hotwired/turbo@^7.0.0-beta.4": + version "7.0.0-beta.5" + resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.0.0-beta.5.tgz#3167e8e882b9075c5b3b2e2f32432cca2862c61c" + integrity sha512-z10dI2U/StkMSmnfJUsyez6jrhnitgzjyw2CxE3LnAAzW/TBhvsMYKsVG7Xu337r3gh0r6UwIFWyvvtm3in6gg== + "@npmcli/move-file@^1.0.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@npmcli/move-file/-/move-file-1.1.2.tgz#1a82c3e372f7cae9253eb66d72543d6b8685c674" @@ -865,7 +878,7 @@ resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.9.2.tgz#adea7b6953cbb34651766b0548468e743c6a2353" integrity sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q== -"@rails/actioncable@^6.0.0": +"@rails/actioncable@^6.0.0", "@rails/actioncable@^6.1.0": version "6.1.3" resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-6.1.3.tgz#c8a67ec4d22ecd6931f7ebd98143fddbc815419a" integrity sha512-m02524MR9cTnUNfGz39Lkx9jVvuL0tle4O7YgvouJ7H83FILxzG1nQ5jw8pAjLAr9XQGu+P1sY4SKE3zyhCNjw== @@ -7167,11 +7180,6 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -turbolinks@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/turbolinks/-/turbolinks-5.2.0.tgz#e6877a55ea5c1cb3bb225f0a4ae303d6d32ff77c" - integrity sha512-pMiez3tyBo6uRHFNNZoYMmrES/IaGgMhQQM+VFF36keryjb5ms0XkVpmKHkfW/4Vy96qiGW3K9bz0tF5sK9bBw== - tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"