Skip to content

Commit

Permalink
Added getFile action for footprint attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
Felicitus committed Jul 17, 2015
1 parent 0224c38 commit a1c41b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
17 changes: 16 additions & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,21 @@ services:
- { groups: [ "default" ] }

resource.footprint_attachment.item_operation.custom_get:
class: "Dunglas\ApiBundle\Api\Operation\Operation"
public: false
factory: [ "@api.operation_factory", "createItemOperation" ]
arguments:
- "@resource.footprint_attachment" # Resource
- [ "GET" ] # Methods
- "/footprint_attachments/{id}/getFile" # Path
- "PartKeeprFootprintBundle:FootprintAttachment:getFile" # Controller
- "FootprintAttachmentGet" # Route name
- # Context (will be present in Hydra documentation)
"@type": "hydra:Operation"
"hydra:title": "A custom operation"
"returns": "xmls:string"

resource.footprint_attachment.item_operation.custom_get_mime:
class: "Dunglas\ApiBundle\Api\Operation\Operation"
public: false
factory: [ "@api.operation_factory", "createItemOperation" ]
Expand All @@ -200,7 +215,7 @@ services:
tags: [ { name: "api.resource" } ]
calls:
- method: "initItemOperations"
arguments: [ [ "@resource.footprint_attachment.item_operation.get", "@resource.footprint_attachment.item_operation.custom_get" ] ]
arguments: [ [ "@resource.footprint_attachment.item_operation.get", "@resource.footprint_attachment.item_operation.custom_get", "@resource.footprint_attachment.item_operation.custom_get_mime" ] ]
- method: "initFilters"
arguments: [ [ "@resource.order_filter" ] ]
- method: "initNormalizationContext"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,7 @@ Ext.define('PartKeepr.AttachmentGrid', {
}
},
viewAttachment: function (record) {
var mySrc = "file.php?type="+this.model+"&";

if (record.get("id") === 0) {
mySrc += "id=0&tmpId=" + record.get("tmp_id");
} else {
mySrc += "id=" + record.get("id");
}
var mySrc = record.getId() + "/getFile";

new Ext.Window({
title : i18n("Display File"),
Expand Down

0 comments on commit a1c41b3

Please sign in to comment.