Skip to content

Commit

Permalink
Merge pull request #39 from AtlasOfLivingAustralia/feature/#800
Browse files Browse the repository at this point in the history
#800 Add new categories to attachments
  • Loading branch information
temi authored Nov 13, 2023
2 parents e16b779 + 5a3c503 commit 2181465
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions grails-app/conf/application.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,13 @@ elasticSearch {
maxBulkRequest = 250
}

attachement {
categories = [
[key:"National Best Practice Manual", value:"National Best Practice Manual"],
[key:"National Weed Management Guide", value:"National Weed Management Guide"],
[key:"National Strategic Plan", value:"National Strategic Plan"],
[key:"Management", value:"Management"],
[key:"Other Management Resources", value:"Other Management Resources"],
[key:"General", value:"General"]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ class OpusController extends BaseController {
}
}

def getCategories() {
def categories = grailsApplication.config.getProperty('attachement.categories', List)
render(categories as JSON)
}

def getTags() {
render([tags: Tag.list()] as JSON)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class UrlMappings {
"/opus/$opusId/attachment/$attachmentId/download" controller: "opus", action: [GET: "downloadAttachment"]
"/opus/$opusId/attachment/$attachmentId" controller: "opus", action: [GET: "getAttachmentMetadata", DELETE: "deleteAttachment"]
"/opus/$opusId/attachment/" controller: "opus", action: [GET: "getAttachmentMetadata", POST: "saveAttachment"]
"/attachment/categories" controller: "opus", action: [GET: "getCategories"]

"/opus/$opusId" controller: "opus", action: [GET: "show", POST: "updateOpus", DELETE: "deleteOpus"]

Expand Down
2 changes: 1 addition & 1 deletion grails-app/domain/au/org/ala/profile/Attachment.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ class Attachment {
}

static constraints = {
category blank: true, inList: ['Management', 'General']
category blank: true, validator: {grailsApplication.config.getProperty('attachement.categories',List).value.contains(val)}
}
}

0 comments on commit 2181465

Please sign in to comment.