Skip to content
This repository has been archived by the owner on Dec 22, 2018. It is now read-only.

Commit

Permalink
reorder form internal notes
Browse files Browse the repository at this point in the history
  • Loading branch information
basschoen committed Nov 13, 2015
1 parent 447ca95 commit aa5cc63
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,7 @@ ul.off-canvas-list form button:hover {
pre {
overflow-x: auto;
}

.internal-reply li > a, .internal-reply .row {
background-color: #fff6d9 !important;
}
2 changes: 1 addition & 1 deletion app/controllers/tickets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def show
@reply = draft
else
@reply = @ticket.replies.new(user: current_user)
@reply.reply_to = @replies.last || @ticket
@reply.reply_to = @replies.select{ |r| !r.internal? }.last || @ticket
@reply.set_default_notifications!
end

Expand Down
23 changes: 14 additions & 9 deletions app/views/replies/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
<%= r.hidden_field :content_type, value: current_user.prefer_plain_text? ? 'text' : 'html' %>
<%= r.hidden_field :ticket_id %>

<div class="row collapse bb">
<div class="medium-1 column ptl pll">
<%= user_avatar current_user, class: 'avatar', size: 35 %>
</div>
<div class="medium-11 columns ptm pbm pll prl">
<h3 class="text-default"><%= t(:reply) %></h3>
<% if current_user.agent? %>
<%= r.radio_button :internal, false, label: t(:reply), data: { remote: true, url: new_reply_path, params: "reply[ticket_id]=#{@reply.ticket.id}" } %>
<%= r.radio_button :internal, true, label: t(:internal_note), data: { remote: true, url: new_reply_path, params: "reply[ticket_id]=#{@reply.ticket.id}" } %>
<% end %>
<% if can? :update, @reply.ticket %>
<div class="row collapse">
<%= r.fields_for :ticket do |f| %>
Expand All @@ -23,6 +28,15 @@
</div>
<% end %>

<div class="row collapse mbl">
<div class="medium-4 columns">
<label><%= t(:notification_will_be_sent_to) %></label>
</div>
<div class="medium-8 columns">
<%= render 'replies/notified_users', r: r %>
</div>
</div>

<%
if @reply.content.blank?
if current_user.prefer_plain_text?
Expand Down Expand Up @@ -50,13 +64,6 @@

<%= render 'attachments/form', f: r %>
<p class="no-m">
<%= t(:notification_will_be_sent_to) %>
</p>
<p>
<%= render 'replies/notified_users', r: r %>
</p>

<% if can? :update, @reply.ticket %>
<div class="row collapse">
<%= r.fields_for :ticket do |f| %>
Expand All @@ -72,8 +79,6 @@
</div>
<% end %>

<%= r.check_box :internal, data: { remote: true, url: new_reply_path, params: "reply[ticket_id]=#{@reply.ticket.id}" } %>

<p>
<%= r.button t(:save_as_draft), name: 'reply[draft]', value: true, class: 'button regular radius primary' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/replies/_reply.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ul class="accordion" data-accordion>
<ul class="accordion <%= 'internal-reply' if reply.internal? %>" data-accordion>
<li class="accordion-navigation <%= div_class %>">
<a href="#reply-<%=reply.id%>" class="bb text-default">
<div class="row collapse">
Expand Down
2 changes: 1 addition & 1 deletion app/views/replies/new.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
%>
<% if @reply.internal? %>
jQuery('iframe').contents().find('#tinymce').css('background-color', 'yellow');
jQuery('iframe').contents().find('#tinymce').css('background-color', '#fff6d9');
<% else %>
jQuery('iframe').contents().find('#tinymce').css('background-color', '');
<% end %>
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ en:
on_date_author_wrote: 'On %{date}, %{author} wrote:'
notification_will_be_sent_to: Your notification will be sent to
save_as_draft: Save as draft
internal_note: Internal note

# replies/_reply
reply_by: Reply by
Expand Down
1 change: 1 addition & 0 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ nl:
on_date_author_wrote: 'Op %{date} schreef %{author}:'
notification_will_be_sent_to: Een notificatie van je reactie wordt verstuurd naar
save_as_draft: Als concept opslaan
internal_note: Interne reactie

# replies/_reply
reply_by: Reactie door
Expand Down

0 comments on commit aa5cc63

Please sign in to comment.