Class: Ld4lVirtualCollection::ItemsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Ld4lVirtualCollection::ItemsController
- Defined in:
- app/controllers/ld4l_virtual_collection/items_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /collections/1/items.
-
#destroy ⇒ Object
DELETE /collections/1/items/1.
-
#edit ⇒ Object
GET /items/1/edit.
-
#index ⇒ Object
GET /collections/1/items.
-
#metadata_from_uri ⇒ Object
GET /collections/1/items/1.
-
#new ⇒ Object
GET /collections/1/items/new.
-
#show ⇒ Object
GET /collections/1/items/1.
-
#update ⇒ Object
PATCH/PUT /collections/1/items/1.
Instance Method Details
#create ⇒ Object
POST /collections/1/items
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/ld4l_virtual_collection/items_controller.rb', line 30 def create # puts("*** Entering CTRL: create item") @item = Item.new(@collection, item_params) # TODO How to save only affected items & collection instead of all items & collection??? if LD4L::OreRDF::PersistAggregation.call(@collection) == true redirect_to my_virtual_collection_path(@collection.id.to_s), notice: 'Item was successfully created.' else # TODO How to add error message about what failed to persist??? render :new end end |
#destroy ⇒ Object
DELETE /collections/1/items/1
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/ld4l_virtual_collection/items_controller.rb', line 62 def destroy # puts("*** Entering CTRL: destroy item") # TODO -- need to implement destroy in ORE Gem -- Destroying just the item leaves the aggregates triples @item.destroy ## TODO REMOVE THIS LINE WHEN DestroyProxy IS IMPLEMENTED # if LD4L::OreRDF::DestroyProxy.call(@collection,@item.rdf_subject) == true redirect_to my_virtual_collection_path(@collection.id.to_s), notice: 'Item was successfully removed.' # else # # TODO Should it redirect to edit??? OR list??? OR where??? # # TODO How to add error message about what failed to be destroyed??? # render :edit # end end |
#edit ⇒ Object
GET /items/1/edit
25 26 27 |
# File 'app/controllers/ld4l_virtual_collection/items_controller.rb', line 25 def edit # puts("*** Entering CTRL: edit item") end |
#index ⇒ Object
GET /collections/1/items
9 10 11 |
# File 'app/controllers/ld4l_virtual_collection/items_controller.rb', line 9 def index @items = Item.all(@collection) end |
#metadata_from_uri ⇒ Object
GET /collections/1/items/1
56 57 58 59 |
# File 'app/controllers/ld4l_virtual_collection/items_controller.rb', line 56 def # puts("*** Entering CTRL: create_from_uri (item)") LD4L::WorksRDF::GetMetadataFromURI(@proxy_for) end |
#new ⇒ Object
GET /collections/1/items/new
18 19 20 21 22 |
# File 'app/controllers/ld4l_virtual_collection/items_controller.rb', line 18 def new # puts("*** Entering CTRL: new item") @item = Item.new(@collection) @proxy_for = "" end |
#show ⇒ Object
GET /collections/1/items/1
14 15 |
# File 'app/controllers/ld4l_virtual_collection/items_controller.rb', line 14 def show end |
#update ⇒ Object
PATCH/PUT /collections/1/items/1
44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/ld4l_virtual_collection/items_controller.rb', line 44 def update # puts("*** Entering CTRL: update item") @item = Item.update(@collection, @item, item_params) # TODO How to save only affected items & collection instead of all items & collection??? if LD4L::OreRDF::PersistAggregation.call(@collection) == true redirect_to my_virtual_collection_path(@collection.id.to_s), notice: 'Item was successfully updated.' else render :edit end end |