update by joshua for css

This commit is contained in:
Harry Bomrah 2015-09-02 18:16:01 +08:00
parent c8cdfac08c
commit 6906b186ad
15 changed files with 975 additions and 678 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

View File

@ -1,74 +1,178 @@
@charset "utf-8"; @charset "utf-8";
@import 'ticket_variables'; @import 'ticket_variables';
#filter { #filter {
display: none; display: none;
}
.ticket-container {
max-width: $main-width;
width: 96%;
margin: auto;
} }
.img-avatar { .img-avatar {
width: 50px; width: 50px;
height: 50px; height: 50px;
} }
.t-avatar { .t-avatar {
width: 30px; width: 30px;
height: 30px; height: 30px;
border-radius: 50%; border-radius: 50%;
} }
.t-label { .t-label {
border-radius: 0.125rem; border-radius: 0.125rem;
display: inline-block; display: inline-block;
padding: 4px 0.5rem; padding: 4px 0.5rem;
font-family: $main-font; font-family: $main-font;
} }
.t-label-primary { .t-label-primary {
color: $gray; color: $gray;
background-color: $white; background-color: $white;
} }
.t-status { .t-status {
text-transform: uppercase; text-transform: uppercase;
border-radius: 0.125rem; border-radius: 0.125rem;
font-size: 0.75rem; font-size: 0.75rem;
display: inline-block; display: inline-block;
padding: 4px 0.375rem; padding: 4px 0.375rem;
font-family: $main-font; font-family: $main-font;
} }
.t-status-open { .t-status-open {
color: $white; color: $white;
background-color: $green; background-color: $green;
} }
.t-status-close { .t-status-close {
color: $white; color: $white;
background-color: $gray; background-color: $gray;
} }
.t-status-processing { .t-status-processing {
color: $white; color: $white;
background-color: $purple; background-color: $purple;
} }
// change bootstrap label colors to fit this design theme // change bootstrap label colors to fit this design theme
.label { .label {
text-shadow: none; text-shadow: none;
font-family: $main-font; font-family: $main-font;
font-size: 12px; font-size: 12px;
font-weight: 100; font-weight: 100;
display: inline-block; display: inline-block;
} }
.label-primary { .label-primary {
background-color: $primary; background-color: $primary;
} }
.label-second {
background-color: $second;
}
.label-info {
background-color: $green;
}
.label-open { .label-open {
background-color: $green; background-color: $green;
} }
.label-commenced { .label-commenced {
background-color: $purple; background-color: $purple;
} }
.label-danger { .label-danger {
background-color: $red; background-color: $red;
}
.btn {
padding: 6px 1rem;
font-family: $main-font;
font-size: 0.8125rem;
text-shadow: none;
letter-spacing: 0;
border: 0;
border-radius: $t-round;
background-color: $primary;
background-image: none;
&.btn-primary {
background-color: $second;
&:hover {
background-color: darken($second, 5%);
}
}
&.btn-normal {
color: $white;
background-color: lighten($gray, 8%);
&:hover {
background-color: $second;
}
}
}
// Tool Tip
.tool-tip-parent {
position: relative;
&:hover {
.tool-tip {
display: block;
}
}
}
.tool-tip {
padding: 6px 0.75rem;
border-radius: $t-round;
color: $white;
background: $black;
position: absolute;
left: 0;
bottom: 120%;
z-index: 150;
display: none;
white-space: nowrap;
&:after {
border: 5px solid transparent;
border-top-color: $black;
content: "";
position: absolute;
left: 10px;
bottom: -8px;
}
&.right {
left: auto;
right: 0;
&:after {
left: auto;
right: 10px;
}
}
&.bottom {
top: 100%;
bottom: auto;
&:after {
top: -10px;
bottom: auto;
border-top-color: transparent;
border-bottom-color: rgba(0, 0, 0, 0.85);
}
}
&.nowrap {
white-space: nowrap;
}
} }

View File

@ -23,6 +23,8 @@ $light-gray: #edf0f1;
$white: #fff; $white: #fff;
$black: #000; $black: #000;
$subtle-black: #5a5a5a;
// units // units
$main-width: 1000px; $main-width: 1000px;
$t-round: 0.125rem; $t-round: 0.125rem;

View File

@ -1,159 +1,182 @@
@charset "utf-8"; @charset "utf-8";
@import 'ticket_variables';
@import 'common'; @import "ticket_variables";
@import 'classes'; @import "common";
@import "classes";
body { body {
background-color: $subtle-gray; background-color: $subtle-gray;
} }
.ticket-container { .ticket-container {
a { a {
color: $primary; color: $primary;
&:hover {
color: lighten($primary, 10%); &:hover {
} color: lighten($primary, 10%);
} }
}
} }
.ticket-container,
.ticket-search-wrap {
max-width: $main-width;
width: 96%;
margin: auto;
}
.ticket-search-wrap { .ticket-search-wrap {
font-family: $main-font; font-family: $main-font;
color: $gray;
.ticket-search-option {
outline: none;
width: 15%;
padding-left: 20px;
height: 50px;
border: none;
border-radius: $t-round;
font-size: 18px;
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
background: $white url(/assets/tickets/ticket-select-arrow.png) 90% 50% no-repeat;
}
.ticket-search-field {
color: $gray; color: $gray;
.ticket-search-option { font-size: 18px;
width: 15%; font-weight: normal;
height: 50px; padding: 0 20px;
border: none; width: 84%;
border-radius: $t-round; height: 50px;
font-size: 18px; margin-bottom: 0;
} box-shadow: none;
.ticket-search-field { border: none;
color: $gray; border-radius: $t-round;
font-size: 18px; &:focus {
font-weight: normal;
padding: 0 20px;
width: 84%;
height: 50px;
margin-bottom: 0;
box-shadow: none; box-shadow: none;
border: none; border: 0;
border-radius: $t-round;
} }
}
} }
.ticket-section { .ticket-section {
margin-bottom: 20px; margin-bottom: 20px;
} }
.ticket-section-heading { .ticket-section-heading {
background-color: $primary; background-color: $primary;
color: $white; color: $white;
padding: 16px 14px; padding: 16px 14px;
margin-bottom: 0; margin-bottom: 0;
font-family: $main-font; font-family: $main-font;
&.type--ugrent {
background-color: $red; &.type--ugrent {
} background-color: $red;
&.type--normal { }
background-color: $second;
} &.type--normal {
background-color: $second;
}
} }
.ticket-section-heading-icon { .ticket-section-heading-icon {
margin-right: 8px; margin-right: 8px;
} }
.ticket-section-container { .ticket-section-container {
background-color: $white; background-color: $white;
margin-bottom: 20px; margin-bottom: 20px;
position: relative; position: relative;
} }
.ticket-category-title { .ticket-category-title {
margin: 0; margin: 0;
padding: 20px 16px; padding: 20px 16px;
background-color: #fbfbfb; background-color: #fbfbfb;
font-family: $main-font; font-family: $main-font;
border-bottom: 1px solid $light-gray; border-bottom: 1px solid $light-gray;
} }
.ticket-category-title-icon { .ticket-category-title-icon {
margin-right: 5px; margin-right: 5px;
} }
.ticket-item { .ticket-item {
padding: 16px 20px; padding: 16px 20px;
border-bottom: 1px solid $light-gray; border-bottom: 1px solid $light-gray;
font-family: $main-font; font-family: $main-font;
&:hover {
background-color: $light-blue;
}
.ticket-site-link {
margin-left: 8px;
padding: 2px 4px;
font-size: 12px;
color: $white;
background-color: $second;
border-radius: $t-strong-round;
&:hover { &:hover {
background-color: $light-blue; color: $white;
} text-decoration: none;
.ticket-site-link { background-color: darken($second, 10%);
margin-left: 8px;
padding: 2px 4px;
font-size: 12px;
color: $white;
background-color: $second;
border-radius: $t-strong-round;
&:hover {
color: $white;
text-decoration: none;
background-color: darken($second, 10%);
}
} }
}
} }
.ticket-item:first-child { .ticket-item:first-child {
border-top: 1px solid $light-gray; border-top: 1px solid $light-gray;
} }
.ticket-label { .ticket-label {
white-space: nowrap; white-space: nowrap;
} }
.ticket-section-view-all { .ticket-section-view-all {
position: absolute; position: absolute;
right: 2rem; right: 2rem;
top: 20px; top: 20px;
&:hover {
.ticket-section-view-all-icon {
top: 0;
}
}
.ticket-section-view-all-btn {
overflow: hidden;
display: block;
font-size: 12px;
color: $gray;
font-family: $main-font;
&:hover { &:hover {
.ticket-section-view-all-icon { text-decoration: none;
top: 0;
}
}
.ticket-section-view-all-btn {
overflow: hidden;
display: block;
font-size: 12px;
color: $gray;
font-family: $main-font;
&:hover {
text-decoration: none;
}
} }
}
} }
.ticket-section-view-all-icon { .ticket-section-view-all-icon {
position: relative; position: relative;
top: 40px; top: 40px;
color: $second; color: $second;
-webkit-webkit-transition: $t-fast all; -webkit-webkit-transition: $t-fast all;
transition: $t-fast all; transition: $t-fast all;
} }
// Search result // Search result
.ticket-search-result { .ticket-search-result {
background-color: $second; background-color: $second;
padding: 16px 14px; padding: 16px 14px;
color: $white;
font-size: 24px;
a {
color: $white; color: $white;
font-size: 24px; &:hover {
a { color: $white;
color: $white; text-decoration: none;
} }
&:active {
text-decoration: none;
}
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -197,6 +197,18 @@ class Admin::TicketsController < OrbitAdminController
end end
end end
def mark_response_read
response = TicketQueryResponse.find(params[:response_id]) rescue nil
if !response.nil?
response.read_by << current_user.id.to_s if !response.read_by.include?(current_user.id.to_s)
response.save
data = {"success" => true, "user_id" => current_user.id.to_s}
else
data = {"success" => false}
end
render :json => data.to_json
end
def tickets_by_category def tickets_by_category
@table_fields = [:ticket_number, :site_name, :subject, :created_at, :tags, :status, :taken_by, :urgent] @table_fields = [:ticket_number, :site_name, :subject, :created_at, :tags, :status, :taken_by, :urgent]
statuses = params["type"] == "history" ? ["closed"] : ["open","commenced"] statuses = params["type"] == "history" ? ["closed"] : ["open","commenced"]

View File

@ -6,6 +6,7 @@ class TicketQueryResponse
field :internal_response, type: Boolean, :default => false field :internal_response, type: Boolean, :default => false
field :response_by, type: BSON::ObjectId field :response_by, type: BSON::ObjectId
field :user_tags, type: Array, default: [] field :user_tags, type: Array, default: []
field :read_by, type: Array, default: []
scope :for_clients, ->{ where(:internal_response.in => [nil, false]) } scope :for_clients, ->{ where(:internal_response.in => [nil, false]) }

View File

@ -14,25 +14,30 @@
<div id="form_container" class="ticket-editor"> <div id="form_container" class="ticket-editor">
<form method="post" action="/admin/ticket/submit_response" id="reopen-form" for="query-response"> <form method="post" action="/admin/ticket/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>
<input type="hidden" name="ticket_query_id" value="<%= query.id.to_s %>" /> <div class="ticket-internal-response-wrap">
<input type="checkbox" name="internal_response" value="1"> <div class="ticket-internal-response">
<span class="ticket-internal-response">Internal Response</span> <input type="hidden" name="ticket_query_id" value="<%= query.id.to_s %>" />
<div class="ticket-tag-member"> <input type="checkbox" name="internal_response" value="1">
<h4 class="ticket-tag-mebmer-heading">Tag member</h4> <span class="ticket-internal-response">Internal Response</span>
<select class="member_tags" multiple="multiple" name="user_tags[]"> </div>
<% @members.each do |member| %> <div class="ticket-tag-member">
<% <!-- <h4 class="ticket-tag-mebmer-heading">Tag member</h4> -->
name = member["name"][I18n.locale.to_s] == "" ? member["name"]["zh_tw"] : member["name"][I18n.locale.to_s] <select class="member_tags" multiple="multiple" name="user_tags[]">
name = "" if name.nil? <% @members.each do |member| %>
user_name = "(#{member["user_name"]})" <%
text = " #{name} #{user_name}" name = member["name"][I18n.locale.to_s] == "" ? member["name"]["zh_tw"] : member["name"][I18n.locale.to_s]
%> name = "" if name.nil?
<option value="<%= member["id"] %>" data-member="<%= member.to_json %>"><%= text %></option> user_name = "(#{member["user_name"]})"
<% end %> text = " #{name} #{user_name}"
</select> %>
<option value="<%= member["id"] %>" data-member="<%= member.to_json %>"><%= text %></option>
<% end %>
</select>
</div>
</div> </div>
</form> </form>
<input type="submit" id="reopen-form-submit" class="btn btn-primary" value="Submit" /> <input type="submit" id="reopen-form-submit" class="ticket-submit-btn btn btn-primary" value="&#xf1d8; Submit" />
</div> </div>
<div id="ticket_loader" style="display:none;"> <div id="ticket_loader" style="display:none;">
<%= image_tag("preloader.gif", size: "50") %> <%= image_tag("preloader.gif", size: "50") %>

View File

@ -14,24 +14,33 @@
<div class="ticket-response-created-date"> <div class="ticket-response-created-date">
<% dt = DateTime.parse(response.created_at.to_s) %> <%= dt.strftime("%d %B %Y - %H:%M") %> <% dt = DateTime.parse(response.created_at.to_s) %> <%= dt.strftime("%d %B %Y - %H:%M") %>
</div> </div>
<h4 class="ticket-inhouse-heading"> <div class="ticket-response-delete-wrap">
<%= response.internal_response ? "Inhouse" : "" %> <a class="ticket-response-delete" href="#">
</h4> <i class="ticket-response-delete-icon fa fa-trash"></i>
<div class="ticket-inhouse-wrap"> Delete
<% response.user_tags.each do |u| </a>
user = User.find(u) rescue nil </div>
if !user.nil?
if user.member_profile.avatar.nil? || user.member_profile.avatar.thumb.url == "thumb_person.png" <div class="ticket-internal-comment-wrap">
avatar = "/assets/thumb_person.png" <div class="ticket-internal-wrap">
else <% response.user_tags.each do |u|
avatar = user.member_profile.avatar.thumb.url user = User.find(u) rescue nil
end if !user.nil?
end %> if user.member_profile.avatar.nil? || user.member_profile.avatar.thumb.url == "thumb_person.png"
<img class="t-avatar" src="<%= avatar %>"> avatar = "/assets/thumb_person.png"
<% end %> else
avatar = user.member_profile.avatar.thumb.url
end
end %>
<div class="ticket-tag-member tool-tip-parent">
<img class="t-avatar <%= response.read_by.include?(user.id.to_s) ? "read" : "" %>" src="<%= avatar %>" data-avatar-id="<%= user.id.to_s %>">
<span class="ticket-tag-member-name tool-tip right"><%= user.name %></span>
</div>
<% end %>
</div>
</div> </div>
</div> </div>
<div class="ticket-response-content"> <div class="ticket-response-content <%= response.internal_response ? "in-house" : "" %>">
<%= response.response.html_safe %> <%= response.response.html_safe %>
</div> </div>
</div> </div>

View File

@ -1,5 +1,4 @@
<div class="search-wrap ticket-search-wrap"> <div class="search-wrap ticket-search-wrap ticket-container">
<!-- <a href="#" id="serach-btn"><i class="icons-search"></i></a> -->
<h3 class="ticket-search-heading"> <h3 class="ticket-search-heading">
<i class="ticket-search-icon fa fa-search"></i> <i class="ticket-search-icon fa fa-search"></i>
Search tickets Search tickets

View File

@ -19,7 +19,10 @@
</a> </a>
<div class="ticket-label pull-right"> <div class="ticket-label pull-right">
<% if ticket.is_urgent? %> <% if ticket.is_urgent? %>
<span class="label label-danger">Urgent</span> <span class="label label-danger">
<i class="fa fa-fire"></i>
Urgent
</span>
<% end %> <% end %>
<span class="label <%= badge_class %>"> <span class="label <%= badge_class %>">
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>

View File

@ -11,7 +11,7 @@
Urgent Tickets Urgent Tickets
</h3> </h3>
<% @categories.each do |category| %> <% @categories.each do |category| %>
<% if !@urgent_tickets[category].nil? %> <% if !@urgent_tickets[category].blank? %>
<div class="ticket-section-container t-strong-round"> <div class="ticket-section-container t-strong-round">
<h4 class="ticket-category-title"> <h4 class="ticket-category-title">
<i class="ticket-category-title-icon fa fa-tags"></i> <i class="ticket-category-title-icon fa fa-tags"></i>

View File

@ -8,6 +8,7 @@
<% @categories.each do |category| %> <% @categories.each do |category| %>
<div class="ticket-section-container"> <div class="ticket-section-container">
<h4 class="ticket-category-title"> <h4 class="ticket-category-title">
<i class="ticket-category-title-icon fa fa-tags"></i>
<%= category.title %> <%= category.title %>
</h4> </h4>
<%= render :partial => "ticket", :collection => @tickets[category] %> <%= render :partial => "ticket", :collection => @tickets[category] %>

View File

@ -18,17 +18,32 @@
badge_class = "t-status-processing" badge_class = "t-status-processing"
end end
%> %>
<ul class="ticket-breadcrumb breadcrumb"> <div class="ticket-home-btn-wrap ticket-container">
<li class="ticket-breadcrumb-item"><a href="/admin/tickets"><i class="icons-arrow-left"></i> Dashboard</a> <span class="divider">/</span></li> <a class="btn btn-normal" href="/admin/tickets">
<li class="ticket-breadcrumb-itme ticket-breadcrumb-active active"><%= @ticket.subject %></li> <i class="ticket-home-btn-icon fa fa-home"></i>
</ul> Back to Dashboard
</a>
<a href="http://<%= @ticket.registered_site.site_domain %>" target="_blank" class="btn btn-normal">
<i class="ticket-external-link-icon fa fa-external-link"></i>
<%= @ticket.registered_site.title %>
</a>
</div>
<div class="ticket-wrap"> <div class="ticket-wrap">
<div class="ticket-header"> <div class="ticket-header">
<div id="ticket-urgent-marker" class="ticket-heading-wrap <%= "active" if @ticket.is_urgent? %>" > <div id="ticket-urgent-marker" class="ticket-heading-wrap <%= "active" if @ticket.is_urgent? %>" >
<h3 class="ticket-heading">#<%= @ticket.uid %> - <%= @ticket.subject[0..50] %> <h3 class="ticket-heading">#<%= @ticket.uid %> - <%= @ticket.subject[0..50] %>
<% if !@ticket.taken_by.nil? %> <% if !@ticket.taken_by.nil? %>
<% user = User.find(@ticket.taken_by) %> <% user = User.find(@ticket.taken_by) %>
<img src="<%= user.member_profile.avatar.thumb.url if !user.member_profile.avatar.nil? %>" style="border-radius: 50%;height: 30px;margin-right: 0.3125rem;width: 30px;" /> <% if user.member_profile.avatar.nil? || user.member_profile.avatar.thumb.url == "thumb_person.png"
avatar = "/assets/thumb_person.png"
else
avatar = user.member_profile.avatar.thumb.url
end
%>
<div class="ticket-heading-avatar tool-tip-parent">
<img class="t-avatar" src="<%= avatar %>">
<span class="ticket-heading-avatar-name tool-tip"><%= user.name %></span>
</div>
<% end %> <% end %>
</h3> </h3>
<div class="ticket-action"> <div class="ticket-action">
@ -79,7 +94,7 @@
<% end %> <% end %>
<% end %> <% end %>
<li> <li>
<a class="ticket-close t-item" data-method="delete" data-confirm="Are you sure?" href="/admin/tickets/<%= @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/<%= @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>
@ -101,17 +116,18 @@
</div> </div>
<div class="ticket-state"> <div class="ticket-state">
<% if @ticket.status != "closed" %> <% if @ticket.status != "closed" %>
<a href="/admin/tickets/<%= @ticket.id.to_s %>/toggleurgent" class="ticket-urgent-btn t-btn t-btn-danger t-uppercase <%= "active" if @ticket.is_urgent? %>" id="toggle-urgent"> <!-- <a href="/admin/tickets/<%= @ticket.id.to_s %>/toggleurgent" class="ticket-urgent-btn t-btn t-btn-danger t-uppercase <%= "active" if @ticket.is_urgent? %>" id="toggle-urgent"> -->
<i class="fa fa-fire"></i> <!-- <i class="fa fa-fire"></i>
Urgent Urgent -->
<!-- <div class="onoffswitch"> <div class="onoffswitch ticket-toggle-urgent" title="">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch"> <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/<%= @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>
</label> </label>
</div> </div>
--> </a> <!-- </a> -->
<% end %> <% end %>
<span class="ticket-status t-status <%= badge_class %>"> <span class="ticket-status t-status <%= badge_class %>">
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>
@ -205,8 +221,18 @@ $(document).ready(function(){
el = $("div[data-scroll-id=" + item + "]"); el = $("div[data-scroll-id=" + item + "]");
$('html, body').scrollTop(el.offset().top - 100); $('html, body').scrollTop(el.offset().top - 100);
el.addClass("scroll-element"); el.addClass("scroll-element");
$.ajax({
url : "/admin/comments/read",
dataType : "json",
type : "post",
data : {"response_id" : item.split("_")[1]}
}).done(function(data){
if(data.success){
el.find("img[data-avatar-id="+ data.user_id +"]").addClass("read");
}
})
el.one("mouseover",function(){ el.one("mouseover",function(){
el.css( "border-color", "rgba(0,0,0,0)"); el.css('border-color', 'transparent');
}) })
} }
@ -225,6 +251,7 @@ $(document).ready(function(){
}, },
placeholder: "Add Members" placeholder: "Add Members"
}); });
}) })
$(".reopen-back-btn").on("click",function(){ $(".reopen-back-btn").on("click",function(){
for (instance in CKEDITOR.instances) { for (instance in CKEDITOR.instances) {
@ -237,7 +264,22 @@ $(document).ready(function(){
}else{ }else{
return false; return false;
} }
}) });
function switchTooltip() {
var $switch = $('.onoffswitch');
var $input = $switch.children('input');
var $tooltip = $switch.find('.ticket-tooltip-wrap');
var activeCls = 'active';
if ($input.hasClass(activeCls)) {
$tooltip.text('This ticket is marked urgent, click to unmark');
} else {
$tooltip.text('Click to mark this ticket urgent');
}
}
$(".ticket-category-select-option").on("click",function(){ $(".ticket-category-select-option").on("click",function(){
var el = $(this); var el = $(this);
@ -245,34 +287,38 @@ $(document).ready(function(){
window.location.href = window.location.pathname + "/changecategory?category_id=" + el.data("category-id"); window.location.href = window.location.pathname + "/changecategory?category_id=" + el.data("category-id");
} }
return false; return false;
}) });
$("#toggle-urgent").on("click",function(){
var el = $(this); switchTooltip();
var mark_urgent = !el.hasClass("active");
$("#myonoffswitch").on("click",function(){
var $el = $(this);
var mark_urgent = !$el.hasClass("active");
$.ajax({ $.ajax({
url : el.attr("href"), url : $el.attr("data-url"),
type : "post", type : "POST",
data : {"mark_urgent" : mark_urgent}, data : {"mark_urgent": mark_urgent},
dataType : "json" dataType : "json"
}).done(function(response){ }).done(function(response){
if(response.success){ if(response.success){
if(mark_urgent){ if(mark_urgent){
if(response.can_make_urgent){ if(response.can_make_urgent){
$("#ticket-urgent-marker").addClass('active'); $("#ticket-urgent-marker").addClass('active');
el.addClass("active"); $el.addClass("active");
}else{ }else{
alert("Urgent quota for this category is already over."); alert("Urgent quota for this category is already over.");
} }
}else{ }else{
$("#ticket-urgent-marker").removeClass('active'); $("#ticket-urgent-marker").removeClass('active');
el.removeClass("active"); $el.removeClass("active");
} }
switchTooltip();
} }
}) })
return false; return false;
}) })
</script> </script>

View File

@ -15,6 +15,7 @@ Rails.application.routes.draw do
post "ticket/submit_response" => 'tickets#submit_response' post "ticket/submit_response" => 'tickets#submit_response'
get "tickets/category/:category_id" => 'tickets#tickets_by_category' get "tickets/category/:category_id" => 'tickets#tickets_by_category'
get "tickets/my_tickets" => 'tickets#my_tickets' get "tickets/my_tickets" => 'tickets#my_tickets'
post "comments/read" => 'tickets#mark_response_read'
resources :tickets do resources :tickets do
get "start" get "start"
get "leave" get "leave"