Adding pictures to resources
This commit is contained in:
@@ -12,9 +12,9 @@
|
||||
|
||||
|
||||
<style>
|
||||
.thumbnail { height: 150px; position: relative; }
|
||||
.thumbnail .ownership,
|
||||
.thumbnail .disposed
|
||||
.resource .thumbnail { height: 150px; position: relative; }
|
||||
.resource .thumbnail .ownership,
|
||||
.resource .thumbnail .disposed
|
||||
{ position: absolute; top: 1px;
|
||||
text-shadow:
|
||||
-1px -1px 0 #fff,
|
||||
@@ -22,8 +22,8 @@
|
||||
-1px 1px 0 #fff,
|
||||
1px 1px 0 #fff;
|
||||
font-weight: bold; left: 10px; }
|
||||
.thumbnail .disposed { color: red; }
|
||||
.thumbnail h4 { position: absolute; bottom: 1px; margin-bottom: 1px; }
|
||||
.resource .thumbnail .disposed { color: red; }
|
||||
.resource .thumbnail h4 { position: absolute; bottom: 1px; margin-bottom: 1px; }
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= form_for @resource, :html => { :multipart => true } do |f| %>
|
||||
<%= form_for @resource, :html => { :multipart => true, class: "col-sm-6" } do |f| %>
|
||||
<% if @resource.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@resource.errors.count, "error") %> prohibited this resource from being saved:</h2>
|
||||
@@ -13,26 +13,26 @@
|
||||
|
||||
<p>
|
||||
<%= f.label :resource_category_id, "Category" %><br />
|
||||
<%= select(:resource, :resource_category_id, options_from_collection_for_select(ResourceCategory.all.sort_by(&:name), :id, :name, @resource.resource_category_id ) ) %>
|
||||
<%= select(:resource, :resource_category_id, options_from_collection_for_select(ResourceCategory.all.sort_by(&:name), :id, :name, @resource.resource_category_id ), {}, {class: "form-control"} ) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :name %><br />
|
||||
<%= f.text_field :name %>
|
||||
<%= f.text_field :name, class: "form-control" %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :serial, "Serial" %>
|
||||
<br />
|
||||
<%= f.text_field :serial %>
|
||||
<%= f.text_field :serial, class: "form-control" %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :specs, "Specs" %>
|
||||
<br/>
|
||||
<%= f.text_field :specs %>
|
||||
<%= f.text_field :specs, class: "form-control" %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :status, "Status/Location" %>
|
||||
<br/>
|
||||
<%= f.text_field :status %>
|
||||
<%= f.text_field :status, class: "form-control" %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -43,7 +43,7 @@
|
||||
<p>
|
||||
<%= f.label :user_id, "Owner" %>
|
||||
<br />
|
||||
<%= select(:resource, :user_id, options_from_collection_for_select(@users, :id, :name, @resource.user_id), include_blank: true) %>
|
||||
<%= select(:resource, :user_id, options_from_collection_for_select(@users, :id, :name, @resource.user_id), {include_blank: true}, {class: "form-control"}) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -53,21 +53,27 @@
|
||||
|
||||
<p>
|
||||
<%= f.label :estimated_value, "Estimated Value" %><br />
|
||||
<%= f.text_field :estimated_value %>
|
||||
<%= f.text_field :estimated_value, class: "form-control" %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.label :picture %><br />
|
||||
<%= f.file_field :picture %>
|
||||
<%= link_to image_tag(@resource.picture.url(:tiny)), @resource.picture.url, :popup => ['form_image_preview', 'height=300,width=400'] if @resource.picture? %>
|
||||
</p>
|
||||
<% [:picture, :picture2, :picture3, :picture4].each do |p| %>
|
||||
<p class="row">
|
||||
<span class="col-sm-3">
|
||||
<%= f.label p %><br />
|
||||
<%= f.file_field p %>
|
||||
</span>
|
||||
<span class="col-sm-2">
|
||||
<%= link_to image_tag(@resource.send(p).url(:tiny)), @resource.send(p).url unless @resource.send(p).blank? %>
|
||||
</span>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<%= f.label :notes %><br />
|
||||
<%= f.text_area :notes %>
|
||||
<%= f.text_area :notes, class: "form-control" %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.submit %>
|
||||
<%= f.submit nil, class: "btn btn-primary" %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', resources_path %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="col-sm-2">
|
||||
<div class="resource">
|
||||
<div class="thumbnail">
|
||||
<%= link_to(resource) do %>
|
||||
<% if resource.user %>
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
<h1>Edit Resource</h1>
|
||||
<h1>Edit Resource
|
||||
<%= link_to 'Back', resources_path, class: "btn btn-default" %>
|
||||
</h1>
|
||||
<%= render 'form' %>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
<h1 class="col-sm-4">Lab Resources
|
||||
<h1 class="col-sm-6">Lab Resources
|
||||
<%= link_to 'Add Resource', new_resource_path, :class => "btn btn-success" if can? :create, Resource %>
|
||||
<%= link_to 'Categories', resource_categories_path, :class => "btn btn-primary" if can? :read, ResourceCategory %>
|
||||
<a class="btn btn-default" onclick="$('#accordion .collapse').collapse('toggle')" />Expand/Collapse All</a>
|
||||
</h1>
|
||||
|
||||
<h3 class="col-sm-2">Featured item:</h3>
|
||||
<span class="col-sm-2">
|
||||
<h3>Featured item:</h3>
|
||||
<%= render @featured_resource %>
|
||||
</span>
|
||||
|
||||
<div class="row">
|
||||
<% unless @resources.blank? %>
|
||||
@@ -18,7 +21,11 @@
|
||||
</div>
|
||||
<div id="collapse_cat_<%= resource_category.id %>" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<%= render resources %>
|
||||
<% resources.each do |resource| %>
|
||||
<div class="col-sm-2">
|
||||
<%= render resource %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
<h1>New Resource</h1>
|
||||
<h1>New Resource
|
||||
<%= link_to 'Back', resources_path, class: "btn btn-default" %>
|
||||
</h1>
|
||||
<%= render 'form' %>
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
<%= link_to image_tag(@resource.picture.url(:medium)), @resource.picture.url, :popup => ['show_image_preview', 'height=300,width=400'] if @resource.picture? %>
|
||||
<div class="row">
|
||||
<div class="thumbnail" style="width: 300px">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<%= link_to image_tag(@resource.picture.url(:medium), height: 300, width: 300), @resource.picture.url if @resource.picture? %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<% [:picture2, :picture3, :picture4].each do |p| %>
|
||||
<% unless @resource.send(p).blank? %>
|
||||
<div class="col-xs-4">
|
||||
<%= link_to image_tag(@resource.send(p).url(:thumb)), @resource.send(p).url %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2><%=h @resource.name %>
|
||||
<%= link_to 'Back', resources_path, class: "btn btn-default" %>
|
||||
@@ -47,9 +64,11 @@
|
||||
|
||||
<p>
|
||||
<b>Notes:</b>
|
||||
<%=h @resource.notes %>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<%= simple_format @resource.notes %>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<%= link_to 'Delete', resource_path(@resource), {:confirm => 'Are you sure you want to delete this forever?', :method => :delete, :class => "btn btn-danger"} if can? :destroy, @resource %>
|
||||
|
||||
Reference in New Issue
Block a user