This commit is contained in:
BoHung Chiu 2022-07-26 15:23:12 +08:00
parent ea3117a941
commit 3f4821d0db
7 changed files with 43 additions and 43 deletions

View File

@ -273,7 +273,7 @@ class Admin::SitePanelController < OrbitAdminController
system("bundle exec rake exec_commands:exec_commands[#{params[:id]},,open_site,,#{params[:env]}]")
end
elsif params[:type] == 'detail'
@site = SiteConstruct.find(params[:id])
@site_construct = SiteConstruct.find(params[:id])
render 'see_detail_for_created_site' and return
elsif params[:type] == 'change_server_name'
site_construct = SiteConstruct.find(params[:id])

View File

@ -83,14 +83,14 @@ class ClientManagementsController < CPanelController
def site_tickets
if params[:category].present? && params[:keyword].present?
regex = ::Regexp.new(".*" + params[:keyword] + ".*", "i")
@tickets = @site.tickets.where(:category_id => params[:category], :subject => regex).order_by([:status, :desc],[:created_at, :desc]).page(params[:page]).per(10)
@tickets = @site_construct.tickets.where(:category_id => params[:category], :subject => regex).order_by([:status, :desc],[:created_at, :desc]).page(params[:page]).per(10)
elsif params[:category].present?
@tickets = @site.tickets.where(:category_id => params[:category]).order_by([:status, :desc],[:created_at, :desc]).page(params[:page]).per(10)
@tickets = @site_construct.tickets.where(:category_id => params[:category]).order_by([:status, :desc],[:created_at, :desc]).page(params[:page]).per(10)
elsif params[:keyword].present?
regex = ::Regexp.new(".*" + params[:keyword] + ".*", "i")
@tickets = @site.tickets.where(:subject => regex).order_by([:status, :desc],[:created_at, :desc]).page(params[:page]).per(10)
@tickets = @site_construct.tickets.where(:subject => regex).order_by([:status, :desc],[:created_at, :desc]).page(params[:page]).per(10)
else
@tickets = @site.tickets.order_by([:status, :desc],[:created_at, :desc]).page(params[:page]).per(10)
@tickets = @site_construct.tickets.order_by([:status, :desc],[:created_at, :desc]).page(params[:page]).per(10)
end
render :layout => false
end
@ -103,7 +103,7 @@ class ClientManagementsController < CPanelController
def create_ticket
ticket = Ticket.new(ticket_params)
ticket.save
redirect_to cpanel_site_show_path(@site.uid)
redirect_to cpanel_site_show_path(@site_construct.uid)
end
def close_ticket
@ -275,8 +275,8 @@ class ClientManagementsController < CPanelController
private
def is_site_authorized_to_user?
@site = RegisteredSite.where(:uid => params[:site_uid]).first
if !current_cpanel_user.registered_site_ids.include?(@site.id)
@site_construct = RegisteredSite.where(:uid => params[:site_uid]).first
if !current_cpanel_user.registered_site_ids.include?(@site_construct.id)
redirect_to sites_path
end
end
@ -290,7 +290,7 @@ class ClientManagementsController < CPanelController
redirect_to sites_path
end
else
@site = @ticket.registered_site
@site_construct = @ticket.registered_site
end
end

View File

@ -4,22 +4,22 @@
<form method="get" action="<%= "/#{I18n.locale}/admin/site_panel/edit_site" %>">
<div class="control-group">
<label class="control-label">Server</label>
<div class="controls"><%=@site.server_type%></div>
<div class="controls"><%=@site_construct.server_type%></div>
</div>
<div class="control-group">
<label class="control-label" for="enable_redirect_default_domain"><%= t("client_management.redirect_to_default_domain_name") %></label>
<div class="controls">
<% %>
<%= select_tag "site_construct[enable_redirect_default_domain]", options_for_select((0..2).to_a.collect{ |i| [I18n.t("client_management.option.#{i}") + (i == 0 ? ": #{@site.default_enable_redirect_default_domain ? I18n.t("client_management.option.2") : I18n.t("client_management.option.1")}" : ""), i.to_s] }, @site.enable_redirect_default_domain) ,:id=>"enable_redirect_default_domain" %>
<%= select_tag "site_construct[enable_redirect_default_domain]", options_for_select((0..2).to_a.collect{ |i| [I18n.t("client_management.option.#{i}") + (i == 0 ? ": #{@site_construct.default_enable_redirect_default_domain ? I18n.t("client_management.option.2") : I18n.t("client_management.option.1")}" : ""), i.to_s] }, @site_construct.enable_redirect_default_domain) ,:id=>"enable_redirect_default_domain" %>
</div>
</div>
<%= hidden_field_tag "site_construct[default_domain_idx]", "-1" %>
<div class="control-group">
<label class="control-label">Domain name</label>
<div class="controls">
<% @site.domain_name.split(' ').each_with_index do |domain_name,i| %>
<% @site_construct.domain_name.split(' ').each_with_index do |domain_name,i| %>
<div class="domain_group">
<%= check_box_tag "site_construct[default_domain_idx]", i, (@site.default_domain_idx == i), :class=>"default_domain_idx", :title=>t("client_management.set_to_default_domain_name") %>
<%= check_box_tag "site_construct[default_domain_idx]", i, (@site_construct.default_domain_idx == i), :class=>"default_domain_idx", :title=>t("client_management.set_to_default_domain_name") %>
<%= text_field_tag nil,domain_name,:class=>'domain_name',onchange: 'domain_name_change()',:oninput=>'replace_domain_input(this)' %>
<% if i != 0 %>
<button class="btn btn-danger" onclick="delete_domain(this)">
@ -29,18 +29,18 @@
</div>
<% end %>
<%= button_tag 'add domain',:type => 'button', :id => 'add_root_domain',class: 'btn btn-info',:style => 'margin-top: 1em;' %>
<%= hidden_field_tag 'site_construct[domain_name]',@site.domain_name,id: 'site_construct_domain_name' %>
<%= hidden_field_tag 'site_construct[domain_name]',@site_construct.domain_name,id: 'site_construct_domain_name' %>
</div>
</div>
<div class="control-group">
<label class="control-label">Port</label>
<div class="controls">
<div class="port_block">
<%= number_field_tag("site_construct[port][]",@site.get_port, :min => 1, :id => nil) %>
<%= number_field_tag("site_construct[port][]",@site_construct.get_port, :min => 1, :id => nil) %>
<div style="clear: both;"></div>
</div>
<div id="append_port_block">
<% @site.port[1..-1].to_a.each do |port| %>
<% @site_construct.port[1..-1].to_a.each do |port| %>
<div class="port_block">
<span class="remove_btn">X</span>
<%= number_field_tag("site_construct[port][]",port, :min => 1, :id => nil) %>
@ -53,33 +53,33 @@
</div>
<div class="control-group">
<label class="control-label">Site type</label>
<div class="controls"><%=@site.site_type%></div>
<div class="controls"><%=@site_construct.site_type%></div>
</div>
<% if @site.site_type == "School"%>
<% if @site_construct.site_type == "School"%>
<div class="control-group">
<label class="control-label">School name</label>
<div class="controls"><%=@site.school_name%></div>
<div class="controls"><%=@site_construct.school_name%></div>
</div>
<% end %>
<div class="control-group">
<label class="control-label">Site name</label>
<div class="controls"><%=@site.site_name%></div>
<div class="controls"><%=@site_construct.site_name%></div>
</div>
<div class="control-group">
<label class="control-label">Database name</label>
<div class="controls"><%=@site.db_name%></div>
<div class="controls"><%=@site_construct.db_name%></div>
</div>
<div class="control-group">
<label class="control-label">Nginx file</label>
<div class="controls"><%=@site.nginx_file%></div>
<div class="controls"><%=@site_construct.nginx_file%></div>
</div>
<div class="control-group">
<label class="control-label">Site path</label>
<div class="controls"><%=@site.full_site_path%></div>
<div class="controls"><%=@site_construct.full_site_path%></div>
</div>
<div class="control-group">
<div class="controls">
<%= hidden_field_tag 'id',@site.id %>
<%= hidden_field_tag 'id',@site_construct.id %>
<%= hidden_field_tag 'type','change_server_name' %>
<a href="<%=admin_site_panel_sites_list_path%>" class="btn btn-primary"><%=t(:back)%></a>
<input type="submit" value="<%=t("client_management.change_setting")%>" class="btn btn-primary btn-danger">

View File

@ -1,8 +1,8 @@
<% content_for :page_menu do %>
<ul class="list-sidebar">
<li class="item-sidebar"><a class="btn-sidebar" href="<%= sites_path %>"><i class="fa fa-home" aria-hidden="true"></i><%= t("client_management.my_sites") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="/cpanel/site/<%= @site.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="/cpanel/site/<%= @site_construct.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site_construct.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa fa-credit-card-alt" aria-hidden="true"></i><%= t("client_management.payments") %></a></li>
</ul>
<% end %>
@ -33,7 +33,7 @@
<%= f.hidden_field :ticket_creater_cpanel_id, :value => current_cpanel_user.email %>
<%= f.hidden_field :site_type, :value => "orbit" %>
<%= f.hidden_field :status, :value => "open" %>
<%= f.hidden_field :registered_site, :value => @site.id %>
<%= f.hidden_field :registered_site, :value => @site_construct.id %>
<%= f.submit "Submit", :class => "btn btn-primary" %>
</div>
<% end %>

View File

@ -10,8 +10,8 @@
<% content_for :page_menu do %>
<ul class="list-sidebar">
<li class="item-sidebar"><a class="btn-sidebar" href="<%= sites_path %>"><i class="fa fa-home" aria-hidden="true"></i><%= t("client_management.my_sites") %></a></li>
<li class="item-sidebar active"><a class="btn-sidebar" href="/cpanel/site/<%= @site.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar active"><a class="btn-sidebar" href="/cpanel/site/<%= @site_construct.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site_construct.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa fa-credit-card-alt" aria-hidden="true"></i><%= t("client_management.payments") %></a></li>
</ul>
<% end %>
@ -19,8 +19,8 @@
<div class="cp-bread">
<ol class="breadcrumb">
<li><a href="/cpanel/sites">Sites</a></li>
<li><a href="/cpanel/site/<%= @site.uid %>"><%= @site.title %></a></li>
<li><a href="/cpanel/site/<%= @site.uid %>">Tickets</a></li>
<li><a href="/cpanel/site/<%= @site_construct.uid %>"><%= @site_construct.title %></a></li>
<li><a href="/cpanel/site/<%= @site_construct.uid %>">Tickets</a></li>
<li class="active"><%= @ticket.uid %></li>
</ol>
</div>

View File

@ -1,8 +1,8 @@
<% content_for :page_menu do %>
<ul class="list-sidebar">
<li class="item-sidebar"><a class="btn-sidebar" href="<%= sites_path %>"><i class="fa fa-home" aria-hidden="true"></i><%= t("client_management.my_sites") %></a></li>
<li class="item-sidebar active"><a class="btn-sidebar" href="/cpanel/site/<%= @site.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar active"><a class="btn-sidebar" href="/cpanel/site/<%= @site_construct.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site_construct.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa fa-credit-card-alt" aria-hidden="true"></i><%= t("client_management.payments") %></a></li>
</ul>
<% end %>
@ -11,13 +11,13 @@
<div class="cp-bread">
<ol class="breadcrumb">
<li><a href="/cpanel/sites">Sites</a></li>
<li><a href="/cpanel/site/<%= @site.uid %>"><%= @site.title %></a></li>
<li><a href="/cpanel/site/<%= @site_construct.uid %>"><%= @site_construct.title %></a></li>
<li class="active">Tickets</li>
</ol>
</div>
<h2 class="cp-page-title">
<%= @site.title %>
<span class="cp-title-smalltext">Total Ticket(s): <span id="total-tickets-count"><%= @site.tickets.count %></span></span>
<%= @site_construct.title %>
<span class="cp-title-smalltext">Total Ticket(s): <span id="total-tickets-count"><%= @site_construct.tickets.count %></span></span>
</h2>
<div class="cp-function-box clear">
<div class="cp-search-box">
@ -25,10 +25,10 @@
<%= select_tag "category", options_for_select(@categories), {:prompt => "Select Category", :class => "form-control cp-select"} %>
<input type="text" name="keyword" id="ticket-search" class="form-control cp-input" placeholder="Keyword">
<button type="submit" class="btn btn-success cp-submit fa fa-search form-control"></button>
<a href="/cpanel/site/<%= @site.uid %>" id="search-clear-btn" class="btn btn-default cp-reset form-control hide">Clear</a>
<a href="/cpanel/site/<%= @site_construct.uid %>" id="search-clear-btn" class="btn btn-default cp-reset form-control hide">Clear</a>
</form>
</div>
<a href="/cpanel/site/<%= @site.uid %>/new_ticket" class="btn btn-primary pull-right"><%= t("client_management.create_ticket") %></a>
<a href="/cpanel/site/<%= @site_construct.uid %>/new_ticket" class="btn btn-primary pull-right"><%= t("client_management.create_ticket") %></a>
</div>
<div id="error-msg-area" class="cp-message-box hide">
<div class="message-text">
@ -49,7 +49,7 @@
</nav>
</div>
<div class="cp-function-box bottom">
<a href="/cpanel/site/<%= @site.uid %>/new_ticket" class="btn btn-primary pull-right"><%= t("client_management.create_ticket") %></a>
<a href="/cpanel/site/<%= @site_construct.uid %>/new_ticket" class="btn btn-primary pull-right"><%= t("client_management.create_ticket") %></a>
</div>
</section>
<script type="text/javascript">

View File

@ -10,8 +10,8 @@
<% content_for :page_menu do %>
<ul class="list-sidebar">
<li class="item-sidebar"><a class="btn-sidebar" href="<%= sites_path %>"><i class="fa fa-home" aria-hidden="true"></i><%= t("client_management.my_sites") %></a></li>
<li class="item-sidebar active"><a class="btn-sidebar" href="/cpanel/site/<%= @site.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar active"><a class="btn-sidebar" href="/cpanel/site/<%= @site_construct.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site_construct.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa fa-credit-card-alt" aria-hidden="true"></i><%= t("client_management.payments") %></a></li>
</ul>
<% end %>
@ -19,8 +19,8 @@
<div class="cp-bread">
<ol class="breadcrumb">
<li><a href="/cpanel/sites">Sites</a></li>
<li><a href="/cpanel/site/<%= @site.uid %>"><%= @site.title %></a></li>
<li><a href="/cpanel/site/<%= @site.uid %>">Tickets</a></li>
<li><a href="/cpanel/site/<%= @site_construct.uid %>"><%= @site_construct.title %></a></li>
<li><a href="/cpanel/site/<%= @site_construct.uid %>">Tickets</a></li>
<li class="active"><%= @ticket.uid %></li>
</ol>
</div>