<%= f.text_field :status %> - <% if can? :assign_user, @resource %> + +
+ <%= f.label :disposed_at, "Disposed?" %>
+ <%= f.date_select :disposed_at, include_blank: true %>
+
<%= f.label :user_id, "Owner" %>
diff --git a/app/views/resources/_resource.html.erb b/app/views/resources/_resource.html.erb
index a7823e1..acb0c38 100755
--- a/app/views/resources/_resource.html.erb
+++ b/app/views/resources/_resource.html.erb
@@ -3,6 +3,9 @@
<% if resource.user %>
Owned by:
<%= resource.user.name %>
<% end %>
+ <% if resource.disposed_at %>
+ Disposed:
<%= resource.disposed_at.to_date %>
+ <% end %>
<%= link_to(resource) do %>
<%= image_tag(resource.picture.url(:thumb)) if resource.picture? %>
<%=h resource.name %>
diff --git a/app/views/resources/index.html.erb b/app/views/resources/index.html.erb index d8e49f2..dbd0fb1 100755 --- a/app/views/resources/index.html.erb +++ b/app/views/resources/index.html.erb @@ -1,6 +1,3 @@ -Lab Resources - <%= link_to 'Add Resource', new_resource_path, :class => "btn btn-success" if can? :create, Resource %> -
@@ -9,10 +6,28 @@ + +Lab Resources + <%= link_to 'Add Resource', new_resource_path, :class => "btn btn-success" if can? :create, Resource %> +
+ +Featured item:
+<%= render @featured_resource %> + +diff --git a/app/views/resources/show.html.erb b/app/views/resources/show.html.erb index edd1ca0..01efe9b 100644 --- a/app/views/resources/show.html.erb +++ b/app/views/resources/show.html.erb @@ -3,9 +3,13 @@
<%=h @resource.name %> <%= link_to 'Back', resources_path, class: "btn btn-default" %> <%= link_to 'Edit', edit_resource_path(@resource), class: "btn btn-primary" %> -<%= 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 %>
- +<% if @resource.user || @resource.owner %> ++ Owner: + <%=h (@resource.user || @resource.owner).name %> +
+<% end %>Category: <%=h @resource.category.name if !@resource.category.blank? %> @@ -24,6 +28,11 @@
Status/Location: <%=h @resource.status %> + + <% if @resource.disposed_at %> + Disposed: + <%=h @resource.disposed_at.to_date %> + <% end %>
@@ -43,3 +52,4 @@ +<%= 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 %> diff --git a/db/migrate/20140209104356_add_disposed_at_to_resource.rb b/db/migrate/20140209104356_add_disposed_at_to_resource.rb new file mode 100644 index 0000000..4aae5c4 --- /dev/null +++ b/db/migrate/20140209104356_add_disposed_at_to_resource.rb @@ -0,0 +1,5 @@ +class AddDisposedAtToResource < ActiveRecord::Migration + def change + add_column :resources, :disposed_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index de89034..52fde6c 100755 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140209080523) do +ActiveRecord::Schema.define(:version => 20140209104356) do create_table "cards", :force => true do |t| t.string "card_number" @@ -141,6 +141,7 @@ ActiveRecord::Schema.define(:version => 20140209080523) do t.datetime "updated_at" t.string "estimated_value" t.integer "user_id" + t.datetime "disposed_at" end create_table "settings", :force => true do |t|