From 36d6483a511910eb0155d97c358dd67ed4d2f895 Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 5 Aug 2015 10:36:27 +0300 Subject: [PATCH] ability to create custom note types --- .../Espo/Resources/metadata/clientDefs/Note.json | 13 ++++++++----- frontend/client/src/views/stream/list.js | 7 ++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/application/Espo/Resources/metadata/clientDefs/Note.json b/application/Espo/Resources/metadata/clientDefs/Note.json index fd07c8ac4b..55e9e99c3d 100644 --- a/application/Espo/Resources/metadata/clientDefs/Note.json +++ b/application/Espo/Resources/metadata/clientDefs/Note.json @@ -1,7 +1,10 @@ { - "collection": "collections/note", - "recordViews":{ - "edit":"Note.Record.Edit", - "editQuick":"Note.Record.Edit" - } + "collection": "collections/note", + "recordViews":{ + "edit":"Note.Record.Edit", + "editQuick":"Note.Record.Edit" + }, + "itemViews": { + "Post": "Stream.Notes.Post" + } } diff --git a/frontend/client/src/views/stream/list.js b/frontend/client/src/views/stream/list.js index 6014ca1e14..900808009d 100644 --- a/frontend/client/src/views/stream/list.js +++ b/frontend/client/src/views/stream/list.js @@ -25,12 +25,17 @@ Espo.define('Views.Stream.List', 'Views.Record.ListExpanded', function (Dep) { type: 'listStream', + setup: function () { + this.itemViews = this.getMetadata().get('clientDefs.Note.itemViews') || {}; + Dep.prototype.setup.call(this); + }, + buildRow: function (i, model, callback) { var key = 'row-' + model.id; this.rows.push(key); var type = model.get('type'); - var viewName = 'Stream.Notes.' + type; + var viewName = this.itemViews[type] || 'Stream.Notes.' + type; this.createView(key, viewName, { model: model,