partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit a1c41b35936d008298aaefbf012630c7ba278e38
parent 0224c388a6d360d869c1cf215087b0b293f527ba
Author: Felicitus <felicitus@felicitus.org>
Date:   Sat, 18 Jul 2015 01:24:51 +0200

Added getFile action for footprint attachments

Diffstat:
Mapp/config/config.yml | 17++++++++++++++++-
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/AttachmentGrid.js | 8+-------
2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/app/config/config.yml b/app/config/config.yml @@ -180,6 +180,21 @@ services: 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" ] + arguments: + - "@resource.footprint_attachment" # Resource + - [ "GET" ] # Methods - "/footprint_attachments/{id}/getMimeTypeIcon" # Path - "PartKeeprFootprintBundle:FootprintAttachment:getMimeTypeIcon" # Controller - "FootprintAttachmentMimeTypeIcon" # Route name @@ -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" diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/AttachmentGrid.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/AttachmentGrid.js @@ -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"),