diff --git a/app/actions/admin/players/create.rb b/app/actions/admin/players/create.rb new file mode 100644 index 0000000..ff4cddd --- /dev/null +++ b/app/actions/admin/players/create.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module EuchreCamp + module Actions + module Admin + module Players + class Create < EuchreCamp::Action + def handle(request, response) + end + end + end + end + end +end diff --git a/app/actions/admin/players/destroy.rb b/app/actions/admin/players/destroy.rb new file mode 100644 index 0000000..3712891 --- /dev/null +++ b/app/actions/admin/players/destroy.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module EuchreCamp + module Actions + module Admin + module Players + class Destroy < EuchreCamp::Action + def handle(request, response) + end + end + end + end + end +end diff --git a/app/actions/admin/players/edit.rb b/app/actions/admin/players/edit.rb new file mode 100644 index 0000000..72fc879 --- /dev/null +++ b/app/actions/admin/players/edit.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module EuchreCamp + module Actions + module Admin + module Players + class Edit < EuchreCamp::Action + def handle(request, response) + end + end + end + end + end +end diff --git a/app/actions/admin/players/index.rb b/app/actions/admin/players/index.rb new file mode 100644 index 0000000..23f303a --- /dev/null +++ b/app/actions/admin/players/index.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module EuchreCamp + module Actions + module Admin + module Players + class Index < EuchreCamp::Action + include Deps[repo: 'repositories.players'] + + def handle(_request, response) + players = repo.all + response.render(view, players: players) + end + end + end + end + end +end diff --git a/app/actions/admin/players/new.rb b/app/actions/admin/players/new.rb new file mode 100644 index 0000000..1267413 --- /dev/null +++ b/app/actions/admin/players/new.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module EuchreCamp + module Actions + module Admin + module Players + class New < EuchreCamp::Action + def handle(request, response) + end + end + end + end + end +end diff --git a/app/actions/admin/players/update.rb b/app/actions/admin/players/update.rb new file mode 100644 index 0000000..f1a4338 --- /dev/null +++ b/app/actions/admin/players/update.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module EuchreCamp + module Actions + module Admin + module Players + class Update < EuchreCamp::Action + def handle(request, response) + end + end + end + end + end +end diff --git a/app/templates/admin/players/destroy.html.erb b/app/templates/admin/players/destroy.html.erb new file mode 100644 index 0000000..d1edc1b --- /dev/null +++ b/app/templates/admin/players/destroy.html.erb @@ -0,0 +1 @@ +

EuchreCamp::Views::Admin::Players::Destroy

diff --git a/app/templates/admin/players/edit.html.erb b/app/templates/admin/players/edit.html.erb new file mode 100644 index 0000000..a163304 --- /dev/null +++ b/app/templates/admin/players/edit.html.erb @@ -0,0 +1 @@ +

EuchreCamp::Views::Admin::Players::Edit

diff --git a/app/templates/admin/players/index.html.erb b/app/templates/admin/players/index.html.erb new file mode 100644 index 0000000..798875a --- /dev/null +++ b/app/templates/admin/players/index.html.erb @@ -0,0 +1,29 @@ +

EuchreCamp::Views::Admin::Players::Index

+

Player Administration

+Create New Player + + + + + + + + + + + <% players.each do |player| %> + + + + + + + <% end %> + +
IDNameRatingActions
<%= player.id %><%= player.name %><%= player.rating %> + Edit +
+ + +
+
diff --git a/app/templates/admin/players/new.html.erb b/app/templates/admin/players/new.html.erb new file mode 100644 index 0000000..62a3041 --- /dev/null +++ b/app/templates/admin/players/new.html.erb @@ -0,0 +1 @@ +

EuchreCamp::Views::Admin::Players::New

diff --git a/app/views/admin/players/destroy.rb b/app/views/admin/players/destroy.rb new file mode 100644 index 0000000..914acb8 --- /dev/null +++ b/app/views/admin/players/destroy.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module EuchreCamp + module Views + module Admin + module Players + class Destroy < EuchreCamp::View + end + end + end + end +end diff --git a/app/views/admin/players/edit.rb b/app/views/admin/players/edit.rb new file mode 100644 index 0000000..b69e9fa --- /dev/null +++ b/app/views/admin/players/edit.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module EuchreCamp + module Views + module Admin + module Players + class Edit < EuchreCamp::View + end + end + end + end +end diff --git a/app/views/admin/players/index.rb b/app/views/admin/players/index.rb new file mode 100644 index 0000000..8811012 --- /dev/null +++ b/app/views/admin/players/index.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module EuchreCamp + module Views + module Admin + module Players + class Index < EuchreCamp::View + expose :players + end + end + end + end +end diff --git a/app/views/admin/players/new.rb b/app/views/admin/players/new.rb new file mode 100644 index 0000000..d67f525 --- /dev/null +++ b/app/views/admin/players/new.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module EuchreCamp + module Views + module Admin + module Players + class New < EuchreCamp::View + end + end + end + end +end diff --git a/config/routes.rb b/config/routes.rb index 4071a83..8805065 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,5 +4,12 @@ module EuchreCamp class Routes < Hanami::Routes # Add your routes here. See https://guides.hanamirb.org/routing/overview/ for details. get "/players/:id", to: "players.show" + + get "/admin/players/new", to: "admin.players.new" + post "/admin/players", to: "admin.players.create" + get "/admin/players", to: "admin.players.index" + get "/admin/players/:id/edit", to: "admin.players.edit" + patch "/admin/players/:id", to: "admin.players.update" + delete "/admin/players/:id", to: "admin.players.destroy" end end diff --git a/spec/actions/admin/players/create_spec.rb b/spec/actions/admin/players/create_spec.rb new file mode 100644 index 0000000..be6bfea --- /dev/null +++ b/spec/actions/admin/players/create_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +RSpec.describe EuchreCamp::Actions::Admin::Players::Create do + let(:params) { Hash[] } + + it "works" do + response = subject.call(params) + expect(response).to be_successful + end +end diff --git a/spec/actions/admin/players/destroy_spec.rb b/spec/actions/admin/players/destroy_spec.rb new file mode 100644 index 0000000..01bfd27 --- /dev/null +++ b/spec/actions/admin/players/destroy_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +RSpec.describe EuchreCamp::Actions::Admin::Players::Destroy do + let(:params) { Hash[] } + + it "works" do + response = subject.call(params) + expect(response).to be_successful + end +end diff --git a/spec/actions/admin/players/edit_spec.rb b/spec/actions/admin/players/edit_spec.rb new file mode 100644 index 0000000..450d7da --- /dev/null +++ b/spec/actions/admin/players/edit_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +RSpec.describe EuchreCamp::Actions::Admin::Players::Edit do + let(:params) { Hash[] } + + it "works" do + response = subject.call(params) + expect(response).to be_successful + end +end diff --git a/spec/actions/admin/players/index_spec.rb b/spec/actions/admin/players/index_spec.rb new file mode 100644 index 0000000..8876cbc --- /dev/null +++ b/spec/actions/admin/players/index_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +RSpec.describe EuchreCamp::Actions::Admin::Players::Index do + let(:params) { Hash[] } + + it "works" do + response = subject.call(params) + expect(response).to be_successful + end +end diff --git a/spec/actions/admin/players/new_spec.rb b/spec/actions/admin/players/new_spec.rb new file mode 100644 index 0000000..1e49d92 --- /dev/null +++ b/spec/actions/admin/players/new_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +RSpec.describe EuchreCamp::Actions::Admin::Players::New do + let(:params) { Hash[] } + + it "works" do + response = subject.call(params) + expect(response).to be_successful + end +end diff --git a/spec/actions/admin/players/update_spec.rb b/spec/actions/admin/players/update_spec.rb new file mode 100644 index 0000000..c1742e4 --- /dev/null +++ b/spec/actions/admin/players/update_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +RSpec.describe EuchreCamp::Actions::Admin::Players::Update do + let(:params) { Hash[] } + + it "works" do + response = subject.call(params) + expect(response).to be_successful + end +end