mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-08-13 14:29:27 -07:00
link:https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md#100-2026-07-12[Details]. This includes the following: * My long standing bug has been fixed which allows for implicit elses to be ignored. This cleans up code related to using monads with pattern matching which is nice to see. * We still can't enable ERB code coverage (this is why the templates are skipped). I've logged a few more new bugs on the SimpleCov side to tackle. This might take a while because I noticed Erik Berlin logged issues with Ruby core in order to make this possible. * Use of the *strict* profile ensures all code committed to this project must be 100%. This also cleans up having to be explicit about this. Milestone: patch
38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Terminus
|
|
module Actions
|
|
module Users
|
|
# The create action.
|
|
class Create < Action
|
|
include Deps[
|
|
:htmx_layout,
|
|
repository: "repositories.user",
|
|
status_repository: "repositories.user_status",
|
|
creator: "aspects.users.creator",
|
|
index_view: "views.users.index"
|
|
]
|
|
|
|
def handle request, response
|
|
case creator.call(**request.params.to_h.slice(:user))
|
|
in Success(Structs::User)
|
|
response.render index_view, users: repository.all, layout: htmx_layout.call(request)
|
|
in Failure(result) then error request, response, result
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def error request, response, result
|
|
response.render view,
|
|
user: repository.find(request.params[:id]),
|
|
statuses: status_repository.all,
|
|
fields: result[:user],
|
|
errors: result.errors[:user],
|
|
layout: false
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|