مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
initial commit from appmail
هذا الالتزام موجود في:
45
app/controllers/http_endpoints_controller.rb
Normal file
45
app/controllers/http_endpoints_controller.rb
Normal file
@@ -0,0 +1,45 @@
|
||||
class HTTPEndpointsController < ApplicationController
|
||||
|
||||
include WithinOrganization
|
||||
|
||||
before_action { @server = organization.servers.present.find_by_permalink!(params[:server_id]) }
|
||||
before_action { params[:id] && @http_endpoint = @server.http_endpoints.find_by_uuid!(params[:id]) }
|
||||
|
||||
def index
|
||||
@http_endpoints = @server.http_endpoints.order(:name).to_a
|
||||
end
|
||||
|
||||
def new
|
||||
@http_endpoint = @server.http_endpoints.build
|
||||
end
|
||||
|
||||
def create
|
||||
@http_endpoint = @server.http_endpoints.build(safe_params)
|
||||
if @http_endpoint.save
|
||||
flash[:notice] = params[:return_notice] if params[:return_notice].present?
|
||||
redirect_to_with_json [:return_to, [organization, @server, :http_endpoints]]
|
||||
else
|
||||
render_form_errors 'new', @http_endpoint
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @http_endpoint.update(safe_params)
|
||||
redirect_to_with_json [organization, @server, :http_endpoints]
|
||||
else
|
||||
render_form_errors 'edit', @http_endpoint
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@http_endpoint.destroy
|
||||
redirect_to_with_json [organization, @server, :http_endpoints]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def safe_params
|
||||
params.require(:http_endpoint).permit(:name, :url, :encoding, :format, :strip_replies, :include_attachments, :timeout)
|
||||
end
|
||||
|
||||
end
|
||||
المرجع في مشكلة جديدة
حظر مستخدم