Infos:
i want to customize a simple variable in a basic erb file (ticket-update.erb) in this case it is the variable #{recipient.fullname}
here i would get the full name, but i want to customize the output so that i get the first name and then only 2 letters of the last name with a dot. these two letters should also be written in caps format.
i have tried to save the respective variable using a simple <script>
tag and to achieve the desired behavior using the split method in the script tag. however, it is not possible for me to create the script tag, or the script tag does nothing.
i have no experience with coffescript and erb, but i do have experience with javascript. How can I achieve this desired behavior? is it possible in the respective erb file or do I have to cache this in another variable in another file?
thanks for the suggestions!
- Used Zammad version: 5.4.1
Code Snippet:
plain code:
<div>Hallo #{recipient.fullname},</div>
<br>
<div>
ticket (#{ticket.title} from #{ticket.customer.longname}) was "<b>#{current_user.longname}</b>" changed.
</div>
<% if @objects[:article] %>
<div>
Information:
<blockquote type="cite">
<br>
#{ticket.articles.first.body}
<br>
</blockquote>
</div>
<% end %>
<br>
<% if @objects[:article] %>
<div>
Information:
<blockquote type="cite">
#{article.body_as_html}
</blockquote>
</div>
<% end %>
<br>
what I tried:
<script>
var edit = #{recipient.fullname}
var edit_ = "it works"
</script>
Ticket: (#{ticket.title})
<script><p> {edit} </p></script>
<script><p> #{edit} </p></script>
<script><p> edit </p></script>
<p> edit </p>
<p> {edit} </p>
<p> #{edit} </p>
<script><p> {edit_} </p></script>
<script><p> #{edit_} </p></script>
<script><p> edit_ </p></script>
<p> edit_ </p>
<p> {edit_} </p>
<p> #{edit_} </p>
<div>Hallo #{recipient.fullname},</div>
<br>
<div>
ticket (#{ticket.title} from #{ticket.customer.longname}) was "<b>#{current_user.longname}</b>" changed.
</div>
<% if @objects[:article] %>
<div>
Information:
<blockquote type="cite">
<br>
#{ticket.articles.first.body}
<br>
</blockquote>
</div>
<% end %>
<br>
<% if @objects[:article] %>
<div>
Information:
<blockquote type="cite">
#{article.body_as_html}
</blockquote>
</div>
<% end %>
<br>
Expected behavior:
Hallo Max MU.
Actual behavior:
Hallo Max Mustermann