diff --git a/Gemfile b/Gemfile index 57714c1..4654550 100644 --- a/Gemfile +++ b/Gemfile @@ -35,7 +35,7 @@ gem 'omniauth-bnet', '~> 2.0.0' # This gem provides a mitigation against CVE-2015-9284 gem 'omniauth-rails_csrf_protection', '~> 0.1.2' # A Ruby wrapper around Blizzard's Game Data and Profile APIs -gem 'rbattlenet', '~> 2.2.7', git: 'https://github.com/Dainii/rbattlenet' +gem 'rbattlenet', '~> 2.2.9', git: 'https://github.com/Dainii/rbattlenet' # A gem that provides Rails integration for the Sentry error logger gem 'sentry-rails', '~> 4.4.0' gem 'sentry-ruby', '~> 4.4.1' diff --git a/Gemfile.lock b/Gemfile.lock index d5d8d0e..f4d34d9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ GIT remote: https://github.com/Dainii/rbattlenet - revision: 6fc990a743b1cec56e95820aec9222b5ff2e843a + revision: a0492dd16f9b29b61e364009272d60e9201e1337 specs: - rbattlenet (2.2.7) + rbattlenet (2.2.9) require_all typhoeus (~> 1.1) @@ -163,7 +163,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) nio4r (2.5.7) - nokogiri (1.11.3-x86_64-linux) + nokogiri (1.11.6-x86_64-linux) racc (~> 1.4) oauth2 (1.4.7) faraday (>= 0.8, < 2.0) @@ -186,7 +186,7 @@ GEM orm_adapter (0.5.0) pagy (4.3.0) parallel (1.20.1) - parser (3.0.1.0) + parser (3.0.1.1) ast (~> 2.4.1) pg (1.2.3) pry (0.14.1) @@ -272,17 +272,17 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.10.2) - rubocop (1.13.0) + rubocop (1.16.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.2.0, < 2.0) + rubocop-ast (>= 1.7.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.4.1) - parser (>= 2.7.1.5) + rubocop-ast (1.7.0) + parser (>= 3.0.1.1) rubocop-performance (1.11.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) @@ -329,7 +329,7 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.2) - solargraph (0.40.4) + solargraph (0.41.1) backport (~> 1.1) benchmark bundler (>= 1.17.2) @@ -411,7 +411,7 @@ DEPENDENCIES rails (~> 6.1.3, >= 6.1.3.1) rails-erd rails-i18n (~> 6.0.0) - rbattlenet (~> 2.2.7)! + rbattlenet (~> 2.2.9)! redis (~> 4.2.5) rspec-rails rubocop diff --git a/app/assets/stylesheets/rp_world.scss b/app/assets/stylesheets/rp_world.scss new file mode 100644 index 0000000..c68ad24 --- /dev/null +++ b/app/assets/stylesheets/rp_world.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the RpWorld controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: https://sass-lang.com/ diff --git a/app/controllers/rp_worlds_controller.rb b/app/controllers/rp_worlds_controller.rb new file mode 100644 index 0000000..ed5eef5 --- /dev/null +++ b/app/controllers/rp_worlds_controller.rb @@ -0,0 +1,9 @@ +class RpWorldsController < ApplicationController + def index + @rp_worlds = RpWorld.all + end + + def show + @rp_world = RpWorld.includes(:wow_characters).find(params[:id]) + end +end diff --git a/app/helpers/rp_world_helper.rb b/app/helpers/rp_world_helper.rb new file mode 100644 index 0000000..1e02379 --- /dev/null +++ b/app/helpers/rp_world_helper.rb @@ -0,0 +1,2 @@ +module RpWorldHelper +end diff --git a/app/models/rp_world.rb b/app/models/rp_world.rb new file mode 100644 index 0000000..f600e52 --- /dev/null +++ b/app/models/rp_world.rb @@ -0,0 +1,9 @@ +class RpWorld < ApplicationRecord + belongs_to :user + alias_attribute :owner, :user + has_many :wow_character_play_rp_worlds, dependent: :destroy + has_many :wow_characters, through: :wow_character_play_rp_worlds + alias_attribute :members, :wow_characters + + validates :name, presence: true +end diff --git a/app/models/wow_character.rb b/app/models/wow_character.rb index fce4562..c5423c4 100644 --- a/app/models/wow_character.rb +++ b/app/models/wow_character.rb @@ -17,6 +17,8 @@ class WowCharacter < ApplicationRecord has_one :wow_character_medium, dependent: :destroy has_many :wow_standings, dependent: :destroy has_many :wow_reputations, through: :wow_standings + has_many :wow_character_play_rp_worlds, dependent: :destroy + has_many :rp_worlds, through: :wow_character_play_rp_worlds validates :name, presence: true validates :character_id, presence: true, uniqueness: true diff --git a/app/models/wow_character_play_rp_world.rb b/app/models/wow_character_play_rp_world.rb new file mode 100644 index 0000000..0c4742c --- /dev/null +++ b/app/models/wow_character_play_rp_world.rb @@ -0,0 +1,7 @@ +class WowCharacterPlayRpWorld < ApplicationRecord + belongs_to :wow_character + belongs_to :rp_world + + validates :status, presence: true, format: { with: /(INVITED|PENDING|PLAYING|BANNED)/ } + validates :role, presence: true, format: { with: /(PLAYER|MODERATOR|ADMIN)/ } +end diff --git a/app/models/wow_creature.rb b/app/models/wow_creature.rb new file mode 100644 index 0000000..4486363 --- /dev/null +++ b/app/models/wow_creature.rb @@ -0,0 +1,10 @@ +class WowCreature < ApplicationRecord + extend Mobility + translates :name + + belongs_to :wow_creature_family, optional: true + belongs_to :wow_creature_type, optional: true + + validates :name, presence: true + validates :creature_id, presence: true, uniqueness: true +end diff --git a/app/models/wow_creature_family.rb b/app/models/wow_creature_family.rb new file mode 100644 index 0000000..176d449 --- /dev/null +++ b/app/models/wow_creature_family.rb @@ -0,0 +1,9 @@ +class WowCreatureFamily < ApplicationRecord + extend Mobility + translates :name + + has_many :wow_creatures, dependent: :destroy + + validates :name, presence: true + validates :creature_family_id, presence: true, uniqueness: true +end diff --git a/app/models/wow_creature_type.rb b/app/models/wow_creature_type.rb new file mode 100644 index 0000000..e97ff9b --- /dev/null +++ b/app/models/wow_creature_type.rb @@ -0,0 +1,9 @@ +class WowCreatureType < ApplicationRecord + extend Mobility + translates :name + + has_many :wow_creatures, dependent: :destroy + + validates :name, presence: true + validates :creature_type_id, presence: true, uniqueness: true +end diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb index a13854b..8e82f63 100644 --- a/app/views/layouts/_navbar.html.erb +++ b/app/views/layouts/_navbar.html.erb @@ -16,6 +16,9 @@ +