fix error

This commit is contained in:
BOYA,CHIU 2021-07-15 19:51:44 +08:00
parent 783ba59965
commit 0c9fb978b0
15 changed files with 39 additions and 39 deletions

View File

@ -1,4 +1,4 @@
class Admin::TicketsController < OrbitAdminController class Admin::TicketsManageController < OrbitAdminController
include TicketsHelper include TicketsHelper
@ -207,7 +207,7 @@ class Admin::TicketsController < OrbitAdminController
rescue e rescue e
end end
end end
# url = "/admin/tickets-manage/#{tq.ticket.id.to_s}#response_#{response.id.to_s}" # url = "/admin/tickets_manage/#{tq.ticket.id.to_s}#response_#{response.id.to_s}"
# Fiber.new{ # Fiber.new{
# params[:user_tags].each do |user_id| # params[:user_tags].each do |user_id|
# WebsocketRails["tag_notifications_for_#{user_id}".to_sym].trigger(:new_notification_recieved, {"ticket_link" => "<a href='#{url}'>#{tq.ticket.subject}</a>", "total_ticket_count" => Ticket.get_ticket_unread_count_for_user(user_id), "blink_message" => "#{current_user.name} tagged you!"}) # WebsocketRails["tag_notifications_for_#{user_id}".to_sym].trigger(:new_notification_recieved, {"ticket_link" => "<a href='#{url}'>#{tq.ticket.subject}</a>", "total_ticket_count" => Ticket.get_ticket_unread_count_for_user(user_id), "blink_message" => "#{current_user.name} tagged you!"})

View File

@ -40,7 +40,7 @@ module TicketsHelper
end end
def send_email(useremail,ticket,response, username) def send_email(useremail,ticket,response, username)
url = "#{request.protocol}#{request.host_with_port}/#{I18n.locale}/admin/tickets-manage/#{ticket.id.to_s}#response_#{response.id.to_s}" url = "#{request.protocol}#{request.host_with_port}/#{I18n.locale}/admin/tickets_manage/#{ticket.id.to_s}#response_#{response.id.to_s}"
email = Email.new(:mail_to => useremail, :mail_subject => "Tagged : #{ticket.subject}.", :template => "email/ticket_tag_email.html.erb", :template_data => {"url" => url, "mention" => current_user.name, "name" => username}) email = Email.new(:mail_to => useremail, :mail_subject => "Tagged : #{ticket.subject}.", :template => "email/ticket_tag_email.html.erb", :template_data => {"url" => url, "mention" => current_user.name, "name" => username})
email.deliver email.deliver
end end

View File

@ -17,7 +17,7 @@
</div> </div>
<% if params[:reopen] != "true" && @ticket.ticket_queries.count == (query_counter + 1) %> <% if params[:reopen] != "true" && @ticket.ticket_queries.count == (query_counter + 1) %>
<div id="form_container" class="ticket-editor"> <div id="form_container" class="ticket-editor">
<form method="post" action="/admin/tickets-manage/submit_response" id="reopen-form" for="query-response"> <form method="post" action="/admin/tickets_manage/submit_response" id="reopen-form" for="query-response">
<textarea class="ckeditor" name="ticket_query_response" data-fv-validation="required;" data-fv-messages="Cannot be empty;"></textarea> <textarea class="ckeditor" name="ticket_query_response" data-fv-validation="required;" data-fv-messages="Cannot be empty;"></textarea>
<div class="ticket-internal-response-wrap"> <div class="ticket-internal-response-wrap">
<div class="ticket-internal-response"> <div class="ticket-internal-response">

View File

@ -16,7 +16,7 @@
</div> </div>
<div class="ticket-response-delete-wrap"> <div class="ticket-response-delete-wrap">
<% if !user.nil? && user.id.to_s == current_user.id.to_s %> <% if !user.nil? && user.id.to_s == current_user.id.to_s %>
<a class="ticket-response-delete" href="/admin/tickets-manage/delete_response" data-response-id="<%= response.id.to_s %>"> <a class="ticket-response-delete" href="/admin/tickets_manage/delete_response" data-response-id="<%= response.id.to_s %>">
<i class="ticket-response-delete-icon fa fa-trash"></i> <i class="ticket-response-delete-icon fa fa-trash"></i>
Delete Delete
</a> </a>

View File

@ -4,7 +4,7 @@
Search tickets Search tickets
</h3> </h3>
<span class="search-box"> <span class="search-box">
<form action="<%= !(defined? form_action).nil? ? form_action : "/admin/tickets-manage/search" %>" method="get" id="search-form"> <form action="<%= !(defined? form_action).nil? ? form_action : "/admin/tickets_manage/search" %>" method="get" id="search-form">
<select id="smart-field-select" class="ticket-search-option"> <select id="smart-field-select" class="ticket-search-option">
<option value="">General</option> <option value="">General</option>
<% @smart_search_fields.each do |ssf| %> <% @smart_search_fields.each do |ssf| %>

View File

@ -28,7 +28,7 @@
<% end %> <% end %>
</td> </td>
<td class="span6"> <td class="span6">
<a href="/admin/tickets-manage/<%= ticket_by_c.id.to_s %>"><%= ticket_by_c.subject %></a> <a href="/admin/tickets_manage/<%= ticket_by_c.id.to_s %>"><%= ticket_by_c.subject %></a>
</td> </td>
<td class="span3"> <td class="span3">
<% t = DateTime.parse(ticket_by_c.created_at.to_s) %> <% t = DateTime.parse(ticket_by_c.created_at.to_s) %>

View File

@ -34,7 +34,7 @@
</h4> </h4>
<%= render :partial => "ticket", :collection => @tickets[category] %> <%= render :partial => "ticket", :collection => @tickets[category] %>
<div class="ticket-section-view-all"> <div class="ticket-section-view-all">
<a class="ticket-section-view-all-btn" href="/admin/tickets-manage/category/<%= category.id.to_s %>"> <a class="ticket-section-view-all-btn" href="/admin/tickets_manage/category/<%= category.id.to_s %>">
<i class="ticket-section-view-all-icon fa fa-share"></i> <i class="ticket-section-view-all-icon fa fa-share"></i>
View all tickets from <%= category.title %> View all tickets from <%= category.title %>
</a> </a>

View File

@ -17,16 +17,16 @@
} }
</style> </style>
<% end %> <% end %>
<%= render :partial => "search_form", locals: {:form_action => "/admin/tickets-manage/my_tickets"} %> <%= render :partial => "search_form", locals: {:form_action => "/admin/tickets_manage/my_tickets"} %>
<div class="ticket-container"> <div class="ticket-container">
<h3 class="ticket-section-heading type--normal"> <h3 class="ticket-section-heading type--normal">
<i class="ticket-section-heading-icon fa fa-clock-o"></i> <i class="ticket-section-heading-icon fa fa-clock-o"></i>
Tickets Tickets
<div class="pull-right past-link"> <div class="pull-right past-link">
<% if params[:type] == "history" %> <% if params[:type] == "history" %>
<a href="/admin/tickets-manage/my_tickets">View my current tickets</a> <a href="/admin/tickets_manage/my_tickets">View my current tickets</a>
<% else %> <% else %>
<a href="/admin/tickets-manage/my_tickets?type=history">View my past tickets</a> <a href="/admin/tickets_manage/my_tickets?type=history">View my past tickets</a>
<% end %> <% end %>
</div> </div>
</h3> </h3>
@ -38,7 +38,7 @@
</h4> </h4>
<%= render :partial => "ticket", :collection => @tickets[category] %> <%= render :partial => "ticket", :collection => @tickets[category] %>
<div class="ticket-section-view-all"> <div class="ticket-section-view-all">
<a class="ticket-section-view-all-btn" href="/admin/tickets-manage/category/<%= category.id.to_s %>?takenby=<%= current_user.id.to_s %>"> <a class="ticket-section-view-all-btn" href="/admin/tickets_manage/category/<%= category.id.to_s %>?takenby=<%= current_user.id.to_s %>">
<i class="ticket-section-view-all-icon fa fa-share"></i> <i class="ticket-section-view-all-icon fa fa-share"></i>
View all tickets from <%= category.title %> View all tickets from <%= category.title %>
</a> </a>

View File

@ -13,7 +13,7 @@
</h4> </h4>
<%= render :partial => "ticket", :collection => @tickets[category] %> <%= render :partial => "ticket", :collection => @tickets[category] %>
<div class="ticket-section-view-all"> <div class="ticket-section-view-all">
<a class="ticket-section-view-all-btn" href="/admin/tickets-manage/category/<%= category.id.to_s %>/?<%= request.original_fullpath.split("?")[1] %>"> <a class="ticket-section-view-all-btn" href="/admin/tickets_manage/category/<%= category.id.to_s %>/?<%= request.original_fullpath.split("?")[1] %>">
<i class="ticket-section-view-all-icon fa fa-share"></i> <i class="ticket-section-view-all-icon fa fa-share"></i>
View all tickets from <%= category.title %> View all tickets from <%= category.title %>
</a> </a>

View File

@ -29,7 +29,7 @@
<i class="ticket-external-link-icon fa fa-external-link"></i> <i class="ticket-external-link-icon fa fa-external-link"></i>
<%= @ticket.registered_site.title %> <%= @ticket.registered_site.title %>
</a> </a>
<a href="/admin/tickets-manage/search?keywords=sitename%3A+<%= @ticket.registered_site.title %>" target="_blank" class="btn btn-normal"> <a href="/admin/tickets_manage/search?keywords=sitename%3A+<%= @ticket.registered_site.title %>" target="_blank" class="btn btn-normal">
<i class="ticket-external-link-icon fa fa-search"></i> <i class="ticket-external-link-icon fa fa-search"></i>
Search tickets from <b><i><%= @ticket.registered_site.title %></i></b> Search tickets from <b><i><%= @ticket.registered_site.title %></i></b>
</a> </a>
@ -63,26 +63,26 @@
<ul class="t-list-unstyled dropdown-menu" role="menu"> <ul class="t-list-unstyled dropdown-menu" role="menu">
<% if @ticket.status == "open" %> <% if @ticket.status == "open" %>
<li> <li>
<a class="ticket-start t-item" href="/admin/tickets-manage/<%= @ticket.id.to_s %>/start" data-ticket-id="<%= @ticket.id.to_s %>"> <a class="ticket-start t-item" href="/admin/tickets_manage/<%= @ticket.id.to_s %>/start" data-ticket-id="<%= @ticket.id.to_s %>">
<i class="fa fa-times-circle"></i> <i class="fa fa-times-circle"></i>
Start Start
</a> </a>
</li> </li>
<li> <li>
<a class="ticket-close t-item" href="/admin/tickets-manage/<%= @ticket.id.to_s %>/close" data-ticket-id="<%= @ticket.id.to_s %>"> <a class="ticket-close t-item" href="/admin/tickets_manage/<%= @ticket.id.to_s %>/close" data-ticket-id="<%= @ticket.id.to_s %>">
<i class="fa fa-eye-slash"></i> <i class="fa fa-eye-slash"></i>
Close Close
</a> </a>
</li> </li>
<% elsif @ticket.status == "commenced" %> <% elsif @ticket.status == "commenced" %>
<li> <li>
<a class="ticket-start t-item" data-confirm="Are you sure?" href="/admin/tickets-manage/<%= @ticket.id.to_s %>/leave" data-ticket-id="<%= @ticket.id.to_s %>"> <a class="ticket-start t-item" data-confirm="Are you sure?" href="/admin/tickets_manage/<%= @ticket.id.to_s %>/leave" data-ticket-id="<%= @ticket.id.to_s %>">
<i class="fa fa-times-circle"></i> <i class="fa fa-times-circle"></i>
Leave Leave
</a> </a>
</li> </li>
<li> <li>
<a class="ticket-close t-item" href="/admin/tickets-manage/<%= @ticket.id.to_s %>/close" data-ticket-id="<%= @ticket.id.to_s %>"> <a class="ticket-close t-item" href="/admin/tickets_manage/<%= @ticket.id.to_s %>/close" data-ticket-id="<%= @ticket.id.to_s %>">
<i class="fa fa-eye-slash"></i> <i class="fa fa-eye-slash"></i>
Close Close
</a> </a>
@ -93,7 +93,7 @@
<% if params[:reopen] == "true" %> <% if params[:reopen] == "true" %>
<a href="#" class="reopen-back-btn t-item" >Cancel</a> <a href="#" class="reopen-back-btn t-item" >Cancel</a>
<% else %> <% else %>
<a href="/admin/tickets-manage/<%= @ticket.id.to_s %>?reopen=true" class="t-btn">Reopen</a> <a href="/admin/tickets_manage/<%= @ticket.id.to_s %>?reopen=true" class="t-btn">Reopen</a>
<% end %> <% end %>
</li> </li>
<% else %> <% else %>
@ -103,7 +103,7 @@
<% end %> <% end %>
<% end %> <% end %>
<li> <li>
<a class="ticket-delete t-item" data-method="delete" data-confirm="Are you sure?" href="/admin/tickets-manage/<%= @ticket.id.to_s %>" data-ticket-id="<%= @ticket.id.to_s %>"> <a class="ticket-delete t-item" data-method="delete" data-confirm="Are you sure?" href="/admin/tickets_manage/<%= @ticket.id.to_s %>" data-ticket-id="<%= @ticket.id.to_s %>">
<i class="fa fa-trash-o"></i> <i class="fa fa-trash-o"></i>
Delete Delete
</a> </a>
@ -127,7 +127,7 @@
<% if @ticket.status != "closed" %> <% if @ticket.status != "closed" %>
<div class="onoffswitch ticket-toggle-urgent" title=""> <div class="onoffswitch ticket-toggle-urgent" title="">
<span class="ticket-tooltip-wrap"></span> <span class="ticket-tooltip-wrap"></span>
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox <%= "active" if @ticket.is_urgent? %>" id="myonoffswitch" data-url="/admin/tickets-manage/<%= @ticket.id.to_s %>/toggleurgent"> <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox <%= "active" if @ticket.is_urgent? %>" id="myonoffswitch" data-url="/admin/tickets_manage/<%= @ticket.id.to_s %>/toggleurgent">
<label class="onoffswitch-label" for="myonoffswitch"> <label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span> <span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span> <span class="onoffswitch-switch"></span>
@ -166,7 +166,7 @@
<% if params[:reopen] == "true"%> <% if params[:reopen] == "true"%>
<% if @ticket.status == "closed" %> <% if @ticket.status == "closed" %>
<div id="form_container" class="ticket-editor"> <div id="form_container" class="ticket-editor">
<form method="post" action="/admin/tickets-manage/<%= @ticket.id.to_s %>/reopen" id="reopen-form" for="query"> <form method="post" action="/admin/tickets_manage/<%= @ticket.id.to_s %>/reopen" id="reopen-form" for="query">
<textarea class="ckeditor" name="ticket_query" data-fv-validation="required;" data-fv-messages="Cannot be empty;"></textarea> <textarea class="ckeditor" name="ticket_query" data-fv-validation="required;" data-fv-messages="Cannot be empty;"></textarea>
</form> </form>
<input type="submit" id="reopen-form-submit" class="btn btn-primary" value="Reopen" /> <input type="submit" id="reopen-form-submit" class="btn btn-primary" value="Reopen" />

View File

@ -3,7 +3,7 @@
<%= stylesheet_link_tag "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" %> <%= stylesheet_link_tag "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" %>
<%= stylesheet_link_tag "tickets/ticket_index" %> <%= stylesheet_link_tag "tickets/ticket_index" %>
<% end %> <% end %>
<%= render :partial => "search_form", locals: {:form_action => "/admin/tickets-manage/tagged_tickets"} %> <%= render :partial => "search_form", locals: {:form_action => "/admin/tickets_manage/tagged_tickets"} %>
<div class="ticket-container"> <div class="ticket-container">
<div class="ticket-section"> <div class="ticket-section">
<h3 class="ticket-section-heading type--ugrent"> <h3 class="ticket-section-heading type--ugrent">
@ -18,7 +18,7 @@
</h4> </h4>
<%= render :partial => "ticket", :collection => @unread_tickets[category] %> <%= render :partial => "ticket", :collection => @unread_tickets[category] %>
<div class="ticket-section-view-all"> <div class="ticket-section-view-all">
<a class="ticket-section-view-all-btn" href="/admin/tickets-manage/category/<%= category.id.to_s %>"> <a class="ticket-section-view-all-btn" href="/admin/tickets_manage/category/<%= category.id.to_s %>">
<i class="ticket-section-view-all-icon fa fa-share"></i> <i class="ticket-section-view-all-icon fa fa-share"></i>
View all tickets from <%= category.title %> View all tickets from <%= category.title %>
</a> </a>
@ -38,7 +38,7 @@
</h4> </h4>
<%= render :partial => "ticket", :collection => @read_tickets[category] %> <%= render :partial => "ticket", :collection => @read_tickets[category] %>
<div class="ticket-section-view-all"> <div class="ticket-section-view-all">
<a class="ticket-section-view-all-btn" href="/admin/tickets-manage/category/<%= category.id.to_s %>"> <a class="ticket-section-view-all-btn" href="/admin/tickets_manage/category/<%= category.id.to_s %>">
<i class="ticket-section-view-all-icon fa fa-share"></i> <i class="ticket-section-view-all-icon fa fa-share"></i>
View all tickets from <%= category.title %> View all tickets from <%= category.title %>
</a> </a>

View File

@ -8,15 +8,15 @@
<div> <div>
<h3> <h3>
<%= @category.title %><%= " - history" if params[:type] == "history" %> <%= @category.title %><%= " - history" if params[:type] == "history" %>
<%= render :partial => "search_form", locals: {:form_action => "/admin/tickets-manage/category/#{@category.id.to_s}"} %> <%= render :partial => "search_form", locals: {:form_action => "/admin/tickets_manage/category/#{@category.id.to_s}"} %>
</h3> </h3>
<% h = request.original_fullpath.split("?")[1] %> <% h = request.original_fullpath.split("?")[1] %>
<% if params[:type] == "history" %> <% if params[:type] == "history" %>
<% h = h.gsub("type=history","").chomp("&") %> <% h = h.gsub("type=history","").chomp("&") %>
<span style="position:relative;margin-top:-30px;" class="pull-right"><a href="/admin/tickets-manage/category/<%= @category.id.to_s %><%= h != ""? "?#{h}" : "" %>">View current</a></span> <span style="position:relative;margin-top:-30px;" class="pull-right"><a href="/admin/tickets_manage/category/<%= @category.id.to_s %><%= h != ""? "?#{h}" : "" %>">View current</a></span>
<% else %> <% else %>
<% h = h.nil? ? "type=history" : "#{h}&type=history" %> <% h = h.nil? ? "type=history" : "#{h}&type=history" %>
<span style="position:relative;margin-top:-30px;" class="pull-right"><a href="/admin/tickets-manage/category/<%= @category.id.to_s %>?<%= h %>">View history</a></span> <span style="position:relative;margin-top:-30px;" class="pull-right"><a href="/admin/tickets_manage/category/<%= @category.id.to_s %>?<%= h %>">View history</a></span>
<% end %> <% end %>
</div> </div>
<% else %> <% else %>

View File

@ -11,16 +11,16 @@ Rails.application.routes.draw do
get "/xhr/ticket/types", to: 'admin/tickets_api#tickettypes' get "/xhr/ticket/types", to: 'admin/tickets_api#tickettypes'
delete "/xhr/ticket/:ticket_id", to: 'admin/tickets_api#destroy' delete "/xhr/ticket/:ticket_id", to: 'admin/tickets_api#destroy'
namespace :admin do namespace :admin do
scope "tickets-manage", :controller => 'tickets',as: 'tickets' do scope "tickets_manage", :controller => 'tickets_manage',as: 'tickets' do
get "search" get "search"
post "submit_response" post "submit_response"
delete "delete_response" delete "delete_response"
get "category/:category_id" => 'tickets#tickets_by_category' get "category/:category_id" => 'tickets_manage#tickets_by_category'
get "my_tickets" get "my_tickets"
get "tagged_tickets" get "tagged_tickets"
end end
post "comments/read" => 'tickets#mark_response_read' post "comments/read" => 'tickets_manage#mark_response_read'
resources :tickets, path: "tickets-manage" do resources :tickets_manage do
get "start" get "start"
get "leave" get "leave"
get "changecategory" get "changecategory"

View File

@ -11,32 +11,32 @@ module Tickets
side_bar do side_bar do
head_label_i18n 'tickets.tickets', icon_class: "icons-ticket" head_label_i18n 'tickets.tickets', icon_class: "icons-ticket"
available_for "users" available_for "users"
active_for_controllers (['admin/tickets-manage']) active_for_controllers (['admin/tickets_manage'])
head_link_path "admin_tickets_path" head_link_path "admin_tickets_manage_index_path"
context_link 'tickets.all', context_link 'tickets.all',
:link_path=>"admin_tickets_path" , :link_path=>"admin_tickets_manage_index_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{'admin/tickets-manage'=>"index"}, :active_for_action=>{'admin/tickets_manage'=>"index"},
:available_for => 'users' :available_for => 'users'
context_link 'tickets.my_tickets', context_link 'tickets.my_tickets',
:link_path=>"admin_tickets_my_tickets_path" , :link_path=>"admin_tickets_my_tickets_path" ,
:priority=>2, :priority=>2,
:active_for_action=>{'admin/tickets-manage'=>"my_tickets"}, :active_for_action=>{'admin/tickets_manage'=>"my_tickets"},
:available_for => 'users' :available_for => 'users'
context_link 'tickets.tickets_tagged', context_link 'tickets.tickets_tagged',
:link_path=>"admin_tickets_tagged_tickets_path" , :link_path=>"admin_tickets_tagged_tickets_path" ,
:priority=>2, :priority=>2,
:active_for_action=>{'admin/tickets-manage'=>"tagged_tickets"}, :active_for_action=>{'admin/tickets_manage'=>"tagged_tickets"},
:available_for => 'users' :available_for => 'users'
context_link 'categories', context_link 'categories',
:link_path=>"admin_module_app_categories_path" , :link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'ticket').id}", :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'ticket').id}",
:priority=>3, :priority=>3,
:active_for_action=>{'admin/tickets-manage'=>'categories'}, :active_for_action=>{'admin/tickets_manage'=>'categories'},
:active_for_category => 'Ticket', :active_for_category => 'Ticket',
:available_for => 'managers' :available_for => 'managers'
end end