class Orvos::V1::CollectionsController < ApplicationController
- # GET /collections
- # GET /collections.json
- def index
- @collections = Collection.all
-
- @collectionlist = {
- :kind => "orvos#collectionList",
- :etag => "",
- :self_link => "",
- :next_page_token => "",
- :next_link => "",
- :items => @collections.map { |collection| collection }
- }
- respond_to do |format|
- format.json { render json: @collectionlist }
- end
- end
-
- # GET /collections/1
- # GET /collections/1.json
- def show
- @collection = Collection.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.json { render json: @collection }
- end
- end
-
- # GET /collections/new
- # GET /collections/new.json
- def new
- @collection = Collection.new
-
- respond_to do |format|
- format.html # new.html.erb
- format.json { render json: @collection }
- end
- end
-
- # GET /collections/1/edit
- def edit
- @collection = Collection.find(params[:id])
- end
-
- # POST /collections
- # POST /collections.json
- def create
- if params[:collection].class == String
- @collection = Collection.new(JSON.parse(params[:collection]))
- else
- @collection = Collection.new(params[:collection])
- end
-
- respond_to do |format|
- if @collection.save
- format.html { redirect_to @collection, notice: 'Collection was successfully created.' }
- format.json { render json: @collection, status: :created, location: @collection }
- else
- format.html { render action: "new" }
- format.json { render json: @collection.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # PUT /collections/1
- # PUT /collections/1.json
- def update
- @collection = Collection.find(params[:id])
-
- respond_to do |format|
- if @collection.update_attributes(params[:collection])
- format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }
- format.json { head :ok }
- else
- format.html { render action: "edit" }
- format.json { render json: @collection.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # DELETE /collections/1
- # DELETE /collections/1.json
- def destroy
- @collection = Collection.find(params[:id])
- @collection.destroy
-
- respond_to do |format|
- format.html { redirect_to collections_url }
- format.json { head :ok }
- end
- end
end
--- /dev/null
+<table style="width:100%">
+ <tr class="contain-align-left">
+ <th>
+ redundancy
+ </th><th>
+ uuid
+ </th><th>
+ name
+ </th><th>
+ locator
+ </th><th>
+ last updated
+ </th>
+ </tr>
+
+ <% @objects.each do |o| %>
+
+ <tr class="collection-redundancy-status collection-redundancy-status-<%= o.redundancy_status %>" data-showhide-selector="tr#extra-info-<%= o.uuid %>" style="cursor:pointer">
+ <td>
+ <%= o.redundancy_status %> (<%= o.redundancy %>)
+ </td><td>
+ <%= o.uuid %>
+ </td><td>
+ <%= o.name %>
+ </td><td>
+ <%= o.locator %>
+ </td><td>
+ <%= distance_of_time_in_words(o.updated_at, Time.now, true) + ' ago' if o.updated_at %>
+ </td>
+ </tr>
+
+ <% if %>
+ <tr id="extra-info-<%= o.uuid %>" data-showhide-default>
+ <td colspan="5">
+ <table>
+ <tr>
+ <td>
+ (file list not available)
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <% end %>
+ <% end %>
+</table>