Skip to content

Commit

Permalink
Show audit details on request and show audit history only to requestors
Browse files Browse the repository at this point in the history
  • Loading branch information
asadaqain committed Dec 17, 2024
1 parent 6a63305 commit cbd39cf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
10 changes: 3 additions & 7 deletions app/assets/javascripts/request_history.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
$(document).ready(function() {
$(".request_history table .comment").click(function() {
//alert($(this).parent().next().prop("class"));
$(this).parent().next().toggleClass('hide');
});


$(document).on("click", ".request_history table .comment", function() {
$(this).parent().next().toggleClass('hide');
});

$(document).on('keyup', '[id^="note-textarea_"]', function () {
checkCount($(this));
});



$('#history_popup').on('shown.bs.modal', function (e) {

var data_url = $("#request_history_log").data("url");
Expand Down
21 changes: 11 additions & 10 deletions app/views/requests/_history_log_modal.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if can?(:add_note, @request) %>


<div class="modal fade" id="history_popup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
Expand All @@ -11,15 +11,16 @@

<div class="modal-body">

<div class="panel panel-default">
<div class="panel-heading">
Add a note
</div>
<div class="panel-body">
<%= render "request_history/form", locals: { remote: true} %>
<% if can?(:add_note, @request) %>
<div class="panel panel-default">
<div class="panel-heading">
Add a note
</div>
<div class="panel-body">
<%= render "request_history/form", locals: { remote: true} %>
</div>
</div>
</div>

<% end %>
<div id="request_history_log" data-url="<%= history_request_path(@request, format: "js") %>">

</div>
Expand All @@ -32,4 +33,4 @@
</div>
</div>
</div>
<% end %>

11 changes: 6 additions & 5 deletions app/views/requests/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,15 @@
<% if can?(:manage, @request) %>
<span class="field">Assigned to</span><br/>
<%= @request.assigned_to ? @request.assigned_to.name : "Nobody" %>
<br/><br/>
<span class="field">History Log</span><br/>
<a data-toggle="modal" href="#history_popup" data-target="#history_popup" class="btn btn-xs btn-default">
Add a Note / History Log
</a>

<% else %>
<span class="field">Status</span><br/>
<%= @request.status ? @request.status.upcase : "Unknown" %>
<br/><br/>
<span class="field">Request History Log</span><br/>
<a data-toggle="modal" href="#history_popup" data-target="#history_popup" class="btn btn-xs btn-default">
View Log
</a>
<% end %>
</div>
<div class="col-md-3">
Expand Down
1 change: 0 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,4 @@
t.datetime "updated_at"
end


end

0 comments on commit cbd39cf

Please sign in to comment.