Commit d926ab52 authored by pierre.tremouilhac's avatar pierre.tremouilhac
Browse files

Merge branch '24-add-comment-line-to-measurement' into 'init19'

Resolve "Add comment line to measurement"

Closes #24

See merge request !21
parents 94f20673 aabe43b1
......@@ -33,7 +33,12 @@ p {
footer {
background-color: #555;
color: white;
padding: 15px;
padding: 5px;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
text-align: left;
}
/* On small screens, set height to 'auto' for sidenav and grid */
......@@ -270,4 +275,8 @@ div.absolute {
#user_remember_me {
width: 10%;
}
}
\ No newline at end of file
}
.rm-mg-bottom {
margin-bottom: unset;
}
......@@ -141,7 +141,7 @@ class SamplesController < ApplicationController
def sample_params
keys=Sample::ELEMENTS.keys
params.require(:sample).permit(:name, :formula, results_attributes: [:id, :_destroy, :element_N, :element_C,:element_H, :element_S]) if params[:sample].present?
params.require(:sample).permit(:name, :formula, :comment_by_operator, :comment_by_user, results_attributes: [:id, :_destroy, :element_N, :element_C,:element_H, :element_S]) if params[:sample].present?
end
def correct_user
......
<footer class="container-fluid text-center">
<small><p style="text-align:left">© 2016 - ela</p></small>
<footer class="container-fluid">
<small>© 2016 - ela</small>
</footer>
<%= form_for(@sample) do |f| %>
<% if @sample.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@sample.errors.count, "error") %> prohibited this sample from being saved:</h2>
<ul>
<% @sample.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="table-responsive" style="margin-left: 20px">
<table class="table rm-mg-bottom">
<tbody>
<tr>
<td>
<label for="comment_by_op">Operator comments</label>
<%= f.text_area :comment_by_operator, class: 'form-control', rows: 3, id: 'comment_by_op', readonly: !operator? %>
</td>
<td>
<label for="comment_by_user">Submitter comments</label>
<%= f.text_area :comment_by_user, class: 'form-control', rows: 3, id: 'comment_by_user', readonly: operator? %>
</td>
</tr>
</tbody>
</table>
<div class="links">
<%= f.submit "Save Comments", class: "btn btn-primary" %>
</div>
</div>
<% end %>
......@@ -27,4 +27,5 @@
<br>
<%= render 'form_operator' %>
<%end%>
<%= render 'comment' %>
</div>
......@@ -129,17 +129,18 @@ $(document).ready(function(){
</table>
<br>
<%if @sample.status == "in preparation" %>
<div class='container absolute'><%=link_to (@sample.status ? "Submit for Measurement" : "No"),
<div class='absolute'><%=link_to (@sample.status ? "Submit for Measurement" : "No"),
Measured_sample_path(@sample), :action => 'solve', :class => 'btn btn-block btn-success' %>
</div>
<%elsif current_user?(@sample.user) && @sample.status == "submitted" %>
<div class='container absolute'><%=link_to (@sample.status ? "Withdraw this Sample" : "No"),
<div class='absolute'><%=link_to (@sample.status ? "Withdraw this Sample" : "No"),
Withdraw_sample_path(@sample), :action => 'solve', :class => 'btn btn-block btn-danger' %>
</div>
<%elsif operator? && @sample.status == "submitted" %>
<div class='container absolute'><%=link_to (@sample.status ? "Release Measurement" : "No"),
<div class='absolute'><%=link_to (@sample.status ? "Release Measurement" : "No"),
ReleaseMeasurment_sample_path(@sample), :action => 'solve', :class => 'btn btn-block btn-success' %>
</div>
<%end%>
<%= render 'samples/comment' %>
<br>
<p><%=link_to "Download PDF", sample_path(@sample, format: "pdf"), target: "_blank" %><p>
class AddCommentToSamples < ActiveRecord::Migration[5.0]
def change
add_column :samples, :comment_by_operator, :string unless column_exists? :samples, :comment_by_operator
add_column :samples, :comment_by_user, :string unless column_exists? :samples, :comment_by_user
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment