Commit 1d3e7593 authored by pei-chi.huang's avatar pei-chi.huang
Browse files

fix delete issue and UI adjustment

parent 7c1f07d7
......@@ -22,7 +22,7 @@ class SamplesController < ApplicationController
def index
@sample = if params[:display_sample].present?
Sample.find(params[:display_sample].to_i)
Sample.find_by(id: params[:display_sample].to_i)
else
current_user.samples.build
end
......
......@@ -3,7 +3,7 @@ class StaticPagesController < ApplicationController
def home
if user_signed_in?
@sample = if params[:display_sample].present?
Sample.find(params[:display_sample].to_i)
Sample.find_by(id: params[:display_sample].to_i)
else
current_user.samples.build
end
......
......@@ -16,7 +16,7 @@ class UsersController < ApplicationController
def show
@sample=Sample.new
@sample = if params[:display_sample].present?
Sample.find(params[:display_sample].to_i)
Sample.find_by(id: params[:display_sample].to_i)
else
current_user.samples.build
end
......
......@@ -90,7 +90,7 @@
</div>
</div>
</div>
<%if @sample.persisted? %>
<%if @sample&.persisted? %>
<div class="panel panel-default" id="show">
<%= render 'samples/show'%>
</div>
......
......@@ -4,9 +4,8 @@
<%if @user.samples.count < 1 && !operator? %>
<b> Add a new sample:</b>
<%end%>
<div class="panel panel-default">
<br>
<%=render 'shared/sample_form'%></br>
<div class="panel panel-default" style="max-height: 50vh">
<%=render 'shared/sample_form'%>
<% if @user.samples.any? %>
<%= render 'samples/samples' %>
</div>
......
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