Files
grecia/app/controllers/admin/tenants_controller.rb
Javi Martín e1e16d21c3 Allow having tenants with different domains
Some institutions using CONSUL have expressed interest in this feature
since some of their tenants might already have their own domains.

We've considered many options for the user interface to select whether
we're using a subdomain or a domain, like having two separate fields,
using a check box, ... In the end we've chosen radio buttons because
they make it easier to follow a logical sequence: first you decide
whether you're introducing a domain or subdomain, and then you enter it.

We've also considered hiding this option and assuming "if it's got a
dot, it's a domain". However, this wouldn't work with nested subdomains
and it wouldn't work with domains which are simply machine names.

Note that a group of radio buttons (or check boxes) is difficult to
style when the text of the label might expand over more than one line
(as is the case here on small screens); in this case, most solutions
result in the second line of the label appearing immediately under the
radio button, instead of being aligned with the first line of the label.
That's why I've added a container for the input+label combination.
2022-12-13 13:10:02 +01:00

36 lines
615 B
Ruby

class Admin::TenantsController < Admin::BaseController
load_and_authorize_resource
def index
@tenants = @tenants.order(:name)
end
def new
end
def edit
end
def create
if @tenant.save
redirect_to admin_tenants_path, notice: t("admin.tenants.create.notice")
else
render :new
end
end
def update
if @tenant.update(tenant_params)
redirect_to admin_tenants_path, notice: t("admin.tenants.update.notice")
else
render :edit
end
end
private
def tenant_params
params.require(:tenant).permit(:name, :schema, :schema_type)
end
end