Fixed variable name error.

This commit is contained in:
Martin Edenhofer 2014-06-09 00:53:30 +02:00
parent 3c139a5810
commit 7eb05401d7
2 changed files with 16 additions and 16 deletions

View file

@ -451,12 +451,12 @@ class Edit extends App.Controller
# find sender_id # find sender_id
if @isRole('Customer') if @isRole('Customer')
sender = App.TicketArticleSender.findByAttribute( 'name', 'Customer' ) sender = App.TicketArticleSender.findByAttribute( 'name', 'Customer' )
article_type = App.TicketArticleType.findByAttribute( 'name', 'web' ) type = App.TicketArticleType.findByAttribute( 'name', 'web' )
params.type_id = article_type.id params.type_id = type.id
params.sender_id = sender.id params.sender_id = sender.id
else else
sender = App.TicketArticleSender.findByAttribute( 'name', 'Agent' ) sender = App.TicketArticleSender.findByAttribute( 'name', 'Agent' )
article_type = App.TicketArticleType.find( params['type_id'] ) type = App.TicketArticleType.find( params['type_id'] )
params.sender_id = sender.id params.sender_id = sender.id
# update ticket # update ticket
@ -475,7 +475,7 @@ class Edit extends App.Controller
return return
# validate email params # validate email params
if article_type.name is 'email' if type.name is 'email'
# check if recipient exists # check if recipient exists
if !params['to'] && !params['cc'] if !params['to'] && !params['cc']
@ -624,10 +624,10 @@ class ArticleView extends App.Controller
$(e.target).text( App.i18n.translateContent('See more') ) $(e.target).text( App.i18n.translateContent('See more') )
$(e.target).next('div').addClass('hide') $(e.target).next('div').addClass('hide')
checkIfSignatureIsNeeded: (article_type) => checkIfSignatureIsNeeded: (type) =>
# add signature # add signature
if @ui.signature && @ui.signature.body && article_type.name is 'email' if @ui.signature && @ui.signature.body && type.name is 'email'
body = @ui.el.find('[name="body"]').val() || '' body = @ui.el.find('[name="body"]').val() || ''
regexp = new RegExp( escapeRegExp( @ui.signature.body ) , 'i') regexp = new RegExp( escapeRegExp( @ui.signature.body ) , 'i')
if !body.match(regexp) if !body.match(regexp)
@ -641,15 +641,15 @@ class ArticleView extends App.Controller
e.preventDefault() e.preventDefault()
article_id = $(e.target).parents('[data-id]').data('id') article_id = $(e.target).parents('[data-id]').data('id')
article = App.TicketArticle.find( article_id ) article = App.TicketArticle.find( article_id )
article_type = App.TicketArticleType.find( article.type_id ) type = App.TicketArticleType.find( article.type_id )
customer = App.User.find( article.created_by_id ) customer = App.User.find( article.created_by_id )
# update form # update form
@checkIfSignatureIsNeeded(article_type) @checkIfSignatureIsNeeded(type)
# preselect article type # preselect article type
@ui.el.find('[name="type_id"]').find('option:selected').removeAttr('selected') @ui.el.find('[name="type_id"]').find('option:selected').removeAttr('selected')
@ui.el.find('[name="type_id"]').find('[value="' + article_type.id + '"]').attr('selected',true) @ui.el.find('[name="type_id"]').find('[value="' + type.id + '"]').attr('selected',true)
@ui.el.find('[name="type_id"]').trigger('change') @ui.el.find('[name="type_id"]').trigger('change')
# empty form # empty form
@ -661,19 +661,19 @@ class ArticleView extends App.Controller
if article.message_id if article.message_id
@ui.el.find('[name="in_reply_to"]').val(article.message_id) @ui.el.find('[name="in_reply_to"]').val(article.message_id)
if article_type.name is 'twitter status' if type.name is 'twitter status'
# set to in body # set to in body
to = customer.accounts['twitter'].username || customer.accounts['twitter'].uid to = customer.accounts['twitter'].username || customer.accounts['twitter'].uid
@ui.el.find('[name="body"]').val('@' + to) @ui.el.find('[name="body"]').val('@' + to)
else if article_type.name is 'twitter direct-message' else if type.name is 'twitter direct-message'
# show to # show to
to = customer.accounts['twitter'].username || customer.accounts['twitter'].uid to = customer.accounts['twitter'].username || customer.accounts['twitter'].uid
@ui.el.find('[name="to"]').val(to) @ui.el.find('[name="to"]').val(to)
else if article_type.name is 'email' else if type.name is 'email'
@ui.el.find('[name="to"]').val(article.from) @ui.el.find('[name="to"]').val(article.from)
# add quoted text if needed # add quoted text if needed
@ -762,10 +762,10 @@ class Article extends App.Controller
type: 'internal' type: 'internal'
} }
] ]
if @article.article_type.name is 'note' if @article.type.name is 'note'
# actions.push [] # actions.push []
else else
if @article.article_sender.name is 'Customer' if @article.sender.name is 'Customer'
actions.push { actions.push {
name: 'reply' name: 'reply'
type: 'reply' type: 'reply'

View file

@ -4,8 +4,8 @@
<div class="avatar"> <div class="avatar">
<img class="thumbnail user-popover" data-id="<%= article.created_by_id %>" src="<%= article.created_by.image %>" alt=""> <img class="thumbnail user-popover" data-id="<%= article.created_by_id %>" src="<%= article.created_by.image %>" alt="">
<ul> <ul>
<li style="font-size: 10px;"><%- @T(article.article_type.name) %></li> <li style="font-size: 10px;"><%- @T(article.type.name) %></li>
<% if article.article_type.name is 'email': %><li style="font-size: 10px;"><a href="<%= App.Config.get('api_path') %>/ticket_article_plain/<%= article.id %>"><%- @T( 'raw' ) %></a></li><% end %> <% if article.type.name is 'email': %><li style="font-size: 10px;"><a href="<%= App.Config.get('api_path') %>/ticket_article_plain/<%= article.id %>"><%- @T( 'raw' ) %></a></li><% end %>
</ul> </ul>
</div> </div>
<div class="ticket-article-message"> <div class="ticket-article-message">