From fa181c1dff072ed6055ea35a2df83554f236a3e0 Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Fri, 2 Sep 2016 09:34:39 +0200 Subject: [PATCH 1/3] controllers: fix of ``invenioRecordsAlert`` * Fixes an issue of ``invenioRecordsAlert`` in which it did not update the error message. Signed-off-by: Harris Tzovanakis --- .../controllers/InvenioRecordsCtrl.js | 7 +++++-- .../invenioRecordsActionsSpec.js | 16 ++++++++++++++-- .../invenioRecordsErrorSpec.js | 9 ++++++++- test/unit/invenio-records-js/controllersSpec.js | 7 ++++++- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/invenio-records-js/controllers/InvenioRecordsCtrl.js b/src/invenio-records-js/controllers/InvenioRecordsCtrl.js index d0123f2..c947fd1 100644 --- a/src/invenio-records-js/controllers/InvenioRecordsCtrl.js +++ b/src/invenio-records-js/controllers/InvenioRecordsCtrl.js @@ -29,7 +29,7 @@ * Invenio records controller. */ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, - InvenioRecordsAPI) { + $timeout, InvenioRecordsAPI) { // Parameters @@ -357,7 +357,9 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, // Reset the error vm.invenioRecordsAlert = null; // Attach the error to the scope - vm.invenioRecordsAlert = data; + $timeout(function() { + vm.invenioRecordsAlert = data; + }, 0); } /** @@ -469,6 +471,7 @@ InvenioRecordsCtrl.$inject = [ '$q', '$window', '$location', + '$timeout', 'InvenioRecordsAPI', ]; diff --git a/test/e2e/invenio-records-js/invenioRecordsActionsSpec.js b/test/e2e/invenio-records-js/invenioRecordsActionsSpec.js index 07c5f89..da35e81 100644 --- a/test/e2e/invenio-records-js/invenioRecordsActionsSpec.js +++ b/test/e2e/invenio-records-js/invenioRecordsActionsSpec.js @@ -29,6 +29,7 @@ describe('testing directive invenio-records-actions', function() { var $controller; var $httpBackend; var $rootScope; + var $timeout; var ctrl; var scope; var template; @@ -47,7 +48,7 @@ describe('testing directive invenio-records-actions', function() { }); beforeEach(inject(function( - _$controller_, _$compile_, _$rootScope_, _$httpBackend_ + _$controller_, _$compile_, _$rootScope_, _$httpBackend_, _$timeout_ ) { // Template compiler $compile = _$compile_; @@ -57,6 +58,8 @@ describe('testing directive invenio-records-actions', function() { $rootScope = _$rootScope_; // The http backend $httpBackend = _$httpBackend_; + // The timeout, + $timeout = _$timeout_; // Expected requests responses // Record Schema @@ -147,6 +150,9 @@ describe('testing directive invenio-records-actions', function() { // Should trigger an event spy.should.have.been.called.twice; + // Flush timeout + $timeout.flush(); + // Expect no errors expect(scope.recordsVM.invenioRecordsAlert).to.be.equal(null); @@ -216,6 +222,9 @@ describe('testing directive invenio-records-actions', function() { // Expect error var error = 'The action type is not supported.'; + // Flush timeout + $timeout.flush(); + // Expect the message to be expect(scope.recordsVM.invenioRecordsAlert.data.message).to.be.equal(error); @@ -337,6 +346,8 @@ describe('testing directive invenio-records-actions', function() { // Expect error var error = 'Bruce Wayne is with Wonder Woman and Superman right now!'; + // Flush timeout + $timeout.flush(); // Expect the message to be expect(scope.recordsVM.invenioRecordsAlert.data.message).to.be.equal(error); }); @@ -366,7 +377,8 @@ describe('testing directive invenio-records-actions', function() { $httpBackend.flush(); // Expect error var error = 'Bruce Wayne is with Wonder Woman and Superman right now!'; - + // Flush timeout + $timeout.flush(); // Expect the message to be expect(scope.recordsVM.invenioRecordsAlert.data.message).to.be.equal(error); }); diff --git a/test/e2e/invenio-records-js/invenioRecordsErrorSpec.js b/test/e2e/invenio-records-js/invenioRecordsErrorSpec.js index 89af758..d5e3236 100644 --- a/test/e2e/invenio-records-js/invenioRecordsErrorSpec.js +++ b/test/e2e/invenio-records-js/invenioRecordsErrorSpec.js @@ -28,6 +28,7 @@ describe('testing directive invenio-records-error', function() { var $compile; var $httpBackend; var $rootScope; + var $timeout; var scope; var template; @@ -37,13 +38,16 @@ describe('testing directive invenio-records-error', function() { // Load the templates beforeEach(angular.mock.module('templates')); - beforeEach(inject(function(_$compile_, _$rootScope_, _$httpBackend_) { + beforeEach(inject(function(_$compile_, _$rootScope_, _$httpBackend_, + _$timeout_) { // Template compiler $compile = _$compile_; // The Scope $rootScope = _$rootScope_; // The http backend $httpBackend = _$httpBackend_; + // The timeout + $timeout = _$timeout_; // Expected requests responses // Record Schema var schema = readJSON('test/fixtures/records.json'); @@ -82,6 +86,9 @@ describe('testing directive invenio-records-error', function() { } }; scope.$broadcast('invenio.records.alert', message); + + // Flush timeout + $timeout.flush(); expect(scope.recordsVM.invenioRecordsAlert.data) .to.deep.equal(message.data); diff --git a/test/unit/invenio-records-js/controllersSpec.js b/test/unit/invenio-records-js/controllersSpec.js index 7999ef1..6ed2cd9 100644 --- a/test/unit/invenio-records-js/controllersSpec.js +++ b/test/unit/invenio-records-js/controllersSpec.js @@ -27,6 +27,7 @@ describe('Unit: testing controllers', function() { var $controller; var $rootScope; + var $timeout; var $location; var ctrl; var InvenioRecordsAPI; @@ -36,7 +37,7 @@ describe('Unit: testing controllers', function() { beforeEach(angular.mock.module('invenioRecords')); beforeEach(inject(function(_$controller_, _$rootScope_, - _$location_, _InvenioRecordsAPI_) { + _$location_, _InvenioRecordsAPI_, _$timeout_) { // Controller $controller = _$controller_; // The Scope @@ -45,6 +46,8 @@ describe('Unit: testing controllers', function() { $location = _$location_; // Set the scope scope = $rootScope; + // Set the timout + $timeout = _$timeout_; // Set the service InvenioRecordsAPI = _InvenioRecordsAPI_; // The controller @@ -90,6 +93,8 @@ describe('Unit: testing controllers', function() { } }); + $timeout.flush(); + expect(ctrl.invenioRecordsAlert.data.message).to.be.equal( 'Bruce Wayne is not Superman Clark Kent is, dah!' ); From f49f2b5f5211716ed386fc70a551369de988496a Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Fri, 2 Sep 2016 13:21:35 +0200 Subject: [PATCH 2/3] controllers: addition of chained actions Signed-off-by: Harris Tzovanakis --- .../controllers/InvenioRecordsCtrl.js | 166 +++++++++--------- src/invenio-records-js/templates/actions.html | 10 +- .../invenioRecordsActionsSpec.js | 126 +++++++++++-- .../invenio-records-js/invenioRecordsSpec.js | 25 +++ 4 files changed, 227 insertions(+), 100 deletions(-) diff --git a/src/invenio-records-js/controllers/InvenioRecordsCtrl.js b/src/invenio-records-js/controllers/InvenioRecordsCtrl.js index c947fd1..6aa12c0 100644 --- a/src/invenio-records-js/controllers/InvenioRecordsCtrl.js +++ b/src/invenio-records-js/controllers/InvenioRecordsCtrl.js @@ -155,78 +155,84 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, } /** - * Records actions + * Do a data massage before sending with request * @memberof InvenioRecordsCtrl - * @function invenioRecordsActions - * @param {Object} evt - The event object. - * @param {String} type - The invenio action type. - * @param {String} method - The invenio request method. - * @param {Object} successCallback - Call function after success. - * @param {Object} errorCallback - Call function after error.. + * @function cleanData */ - function invenioRecordsActions(evt, type, method, successCallback, errorCallback) { + function cleanData() { + var _data = angular.merge({}, {metadata: vm.invenioRecordsModel}); + var unwatend = [[null], [{}], '', [undefined]]; + angular.forEach(_data.metadata, function(value, key) { + angular.forEach(unwatend, function(_value) { + if (angular.equals(_value, value)) { + delete _data[key]; + } + }); + }); + return _data; + } - // Get the endpoints and do the request - getEndpoints().then( - function success() { - var _data = angular.merge({}, vm.invenioRecordsModel); - - var unwatend = [[null], [{}], '', [undefined]]; - angular.forEach(_data, function(value, key) { - angular.forEach(unwatend, function(_value) { - if (angular.equals(_value, value)) { - delete _data[key]; - } - }); - }); + /** + * Make the API request with the _data payload + * @memberof InvenioRecordsCtrl + * @function makeActionRequest + * @param {String} type - The action type (any existing key from ``links``). + * @param {String} method - The method (POST, PUT, DELETE). + */ + function makeActionRequest(type, method) { + var _data = cleanData(); + return InvenioRecordsAPI.request({ + url: vm.invenioRecordsEndpoints[type], + method: (method || 'PUT').toUpperCase(), + data: _data, + headers: vm.invenioRecordsArgs.headers || {} + }); + } - if (!angular.isUndefined(vm.invenioRecordsEndpoints[type])) { - InvenioRecordsAPI.request({ - url: vm.invenioRecordsEndpoints[type], - method: (method || 'PUT').toUpperCase(), - data: { - metadata: _data - }, - headers: vm.invenioRecordsArgs.headers || {} - }).then( - successCallback, - errorCallback - ); - } else { - errorCallback({ - type: 'danger', - data: { - message: 'The action type is not supported.' - } - }); - } - }, - errorCallback); + /** + * Handle the redirection after a success action if needed + * @memberof InvenioRecordsCtrl + * @function handleActionRedirection + * @param {String} redirect_path - The url to redirect on success. + */ + function handleActionRedirection(redirect_path) { + // Redirect if defined + if (!angular.isUndefined(redirect_path) && redirect_path !== '') { + // Redirect to new location + var _url = redirect_path; + if (redirect_path.substr(0, 1) !== '/' && redirect_path.substr(0, 4) !== 'http') { + // Find the url + _url = vm.invenioRecordsEndpoints[redirect_path]; + } + $window.location.href = _url; + } } /** * Action handler * @memberof InvenioRecordsCtrl * @function invenioRecordsHandler - * @param {string} type - The action key from ``links`` object. - * @param {string} method - The request method type i.e. GET, POST, PUT. - * @param {string} redirect_path - The url to redirect on success. + * @param {Array} actions - Actions array [[type, method]]. + * @param {String} redirect_path - The url to redirect on success. */ - function invenioRecordsHandler(type, method, redirect_path) { + function invenioRecordsHandler(actions, redirect_path) { + var _actions = (typeof(actions[0]) === 'string') ? [actions] : actions; /** * After a successful request * @memberof invenioRecordsHandler * @function actionSuccessful - * @param {Object} response - The action request response. + * @param {Object} responses - The promise action request responses. */ - function actionSuccessful(response) { + function actionSuccessful(responses) { + // NOTE: We keep only the response of the last action!! + var response = responses[responses.length - 1] || {}; + $rootScope.$broadcast('invenio.records.alert', { type: 'success', data: response.data, - action: type, + action: _actions }); - // Update the endpoints if (!angular.isUndefined(response.data.links)){ $rootScope.$broadcast( @@ -235,19 +241,13 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, } // Trigger successful event for action - $rootScope.$broadcast('invenio.records.action.success', type); + $rootScope.$broadcast('invenio.records.action.success', _actions); // Stop loadig idicator $rootScope.$broadcast('invenio.records.loading.stop'); - if (!angular.isUndefined(redirect_path) && redirect_path !== '') { - // Redirect to new location - var _url = redirect_path; - if (redirect_path.substr(0, 1) !== '/' && redirect_path.substr(0, 4) !== 'http') { - // Find the url - _url = vm.invenioRecordsEndpoints[redirect_path]; - } - $window.location.href = _url; - } + + // Redirect if defined + handleActionRedirection(redirect_path || undefined); } /** * After an errored request @@ -259,7 +259,6 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, $rootScope.$broadcast('invenio.records.alert', { type: 'danger', data: response.data, - action: type }); if (response.data.status === 400 && response.data.errors) { @@ -295,12 +294,20 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, // Start loading $rootScope.$broadcast('invenio.records.loading.start'); - // Request submission - $scope.$broadcast( - 'invenio.records.action', - type, - method, - actionSuccessful, + // Get the endpoints and do the request + getEndpoints().then( + function() { + var promises = []; + angular.forEach(_actions, function(action, index) { + this.push( + makeActionRequest(action[0], action[1]) + ); + }, promises); + $q.all(promises).then( + actionSuccessful, + actionErrored + ); + }, actionErrored ); } @@ -367,18 +374,22 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, * @memberof InvenioRecordsCtrl * @function invenioRecordsActionFinished * @param {Object} evt - The event object. - * @param {Object} type - The action type + * @param {Object} types - The action types. */ - function invenioRecordsActionSuccess(evt, type) { + function invenioRecordsActionSuccess(evt, types) { // Set the form to pristine if it's self or publish - if (['publish', 'self'].indexOf(type) > -1) { + var _types = []; + // Get all the types requested + angular.forEach(types, function(item, index) { + this.push(item[0]); + }, _types); + // Change the form state + if (_types.indexOf('self') > -1) { $scope.depositionForm.$setPristine(); - // Set the form to submitted if it's published - if (type === 'publish') { - $scope.depositionForm.$setSubmitted(); - } + } else if (_types.indexOf('publish') > -1) { + $scope.depositionForm.$setPristine(); + $scope.depositionForm.$setSubmitted(); } - // Set the form to $invalid if it's deleted/discarded } /** @@ -432,9 +443,6 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, // Local - // When invenio.records action requested - $scope.$on('invenio.records.action', invenioRecordsActions); - // When the module initialized $scope.$on('invenio.records.init', invenioRecordsInit); diff --git a/src/invenio-records-js/templates/actions.html b/src/invenio-records-js/templates/actions.html index 23ec726..b4de461 100644 --- a/src/invenio-records-js/templates/actions.html +++ b/src/invenio-records-js/templates/actions.html @@ -1,16 +1,16 @@
    -
  • -
  • -
  • +
  • +
  • +
    -
  • -
  • +
  • +
diff --git a/test/e2e/invenio-records-js/invenioRecordsActionsSpec.js b/test/e2e/invenio-records-js/invenioRecordsActionsSpec.js index da35e81..3fc9124 100644 --- a/test/e2e/invenio-records-js/invenioRecordsActionsSpec.js +++ b/test/e2e/invenio-records-js/invenioRecordsActionsSpec.js @@ -102,6 +102,7 @@ describe('testing directive invenio-records-actions', function() { // Complile&Digest here to catch the event // The directive's template template = ' ' + @@ -116,6 +117,8 @@ describe('testing directive invenio-records-actions', function() { scope.$digest(); // The rendered buttons should be ``2`` expect(template.find('.btn').length).to.be.equal(5); + + expect(scope.recordsVM.invenioRecordsArgs.data.jessica).to.be.equal('jones'); }); it('should trigger action event for save', function() { @@ -195,8 +198,6 @@ describe('testing directive invenio-records-actions', function() { //Should trigger init expect(spy.calledWith('invenio.records.init')).to.be.true; - //Should trigger action - expect(spy.calledWith('invenio.records.action')).to.be.true; //Should trigger endpoints updated expect(spy.calledWith('invenio.records.endpoints.updated')).to.be.true; // Should trigger action success @@ -214,20 +215,6 @@ describe('testing directive invenio-records-actions', function() { // Flash responses to trigger the events $httpBackend.flush(); - scope.recordsVM.actionHandler('The Punisher Action'); - - // Digest - scope.$digest(); - - // Expect error - var error = 'The action type is not supported.'; - - // Flush timeout - $timeout.flush(); - - // Expect the message to be - expect(scope.recordsVM.invenioRecordsAlert.data.message).to.be.equal(error); - // Check the validation scope.recordsVM.removeValidationMessage( angular.noop, { @@ -257,6 +244,7 @@ describe('testing directive invenio-records-actions', function() { expect(spy.calledWith('schemaForm.error.hello')).to.be.false; }); + it('should trigger action event for delete', function() { // Spy the broadcast var spy = sinon.spy($rootScope, '$broadcast'); @@ -412,4 +400,110 @@ describe('testing directive invenio-records-actions', function() { // Should trigger an event spy.should.have.been.called.twice; }); + + it('should trigger successful chained actions', function() { + // Spy the broadcast + var spy = sinon.spy($rootScope, '$broadcast'); + var links = { + links: { + harley: '/harley/quinn/wins', + jessica: '/jessica/jones/wins', + kilgrave: '/kilgrave/wins', + jocker: '/jocker/wins', + } + } + var batman_link = { + links: { + batman: '/bruce/wayne' + } + }; + // Request expected + $httpBackend.whenPOST('jessica jones://herley/quinn').respond(200, links); + $httpBackend.whenPOST('/harley/quinn/wins').respond(200, {}); + $httpBackend.whenPUT('/jessica/jones/wins').respond(200, batman_link); + // Complile&Digest here to catch the event + // The directive's template + template = ' ' + + ' '+ + ''+ + ''; + // Compile + template = $compile(template)(scope); + // Digest + scope.$digest(); + + // Flash responses to trigger the events + $httpBackend.flush(); + + // Do a chained action + scope.recordsVM.actionHandler([ + ['harley', 'POST'], + ['jessica', 'PUT'], + ]); + + // Flash responses to trigger the events + $httpBackend.flush(); + // Expected the new links to be added + expect(scope.recordsVM.invenioRecordsEndpoints.batman).to.be.equal('/bruce/wayne'); + // Expect success action + expect(spy.calledWith('invenio.records.action.success')).to.be.true; + }); + + it('should trigger errrored chained actions', function() { + // Spy the broadcast + var spy = sinon.spy($rootScope, '$broadcast'); + var links = { + links: { + kilgrave: '/kilgrave/wins', + jocker: '/jocker/wins', + } + }; + var message = { + message: 'Bring Bruce Wayne back!' + }; + // Request expected + $httpBackend.whenPOST('jessica jones://herley/quinn').respond(200, links); + $httpBackend.whenPUT('/kilgrave/wins').respond(200, {}); + $httpBackend.whenPOST('/jocker/wins').respond(400, message); + // Complile&Digest here to catch the event + // The directive's template + template = ' ' + + ' '+ + ''+ + ''; + // Compile + template = $compile(template)(scope); + // Digest + scope.$digest(); + + // Flash responses to trigger the events + $httpBackend.flush(); + + // Do a chained action + scope.recordsVM.actionHandler([ + ['kilgrave', 'PUT'], + ['jocker', 'POST'], + ]); + + // Flash responses to trigger the events + $httpBackend.flush(); + // Flash the timeout + $timeout.flush(); + // Force digest + scope.$digest(); + // Expected the error + expect(scope.recordsVM.invenioRecordsAlert.data.message).to.be.equal(message.message); + // Expect error event + expect(spy.calledWith('invenio.records.action.error')).to.be.true; + }); }); diff --git a/test/e2e/invenio-records-js/invenioRecordsSpec.js b/test/e2e/invenio-records-js/invenioRecordsSpec.js index ded5bcc..572aa0d 100644 --- a/test/e2e/invenio-records-js/invenioRecordsSpec.js +++ b/test/e2e/invenio-records-js/invenioRecordsSpec.js @@ -164,4 +164,29 @@ describe('testing directive invenio-records', function() { // Digest scope.$digest(); }); + + it('should have the links from the directive', function() { + // Spy the broadcast + var spy = sinon.spy($rootScope, '$broadcast'); + + // Complile&Digest here to catch the event + // The directive's template + template = ' ' + + '>'; + // Compile + template = $compile(template)(scope); + // Digest + scope.$digest(); + + // Check if the event has been triggered + expect(spy.calledWith('invenio.records.init')).to.be.true; + $httpBackend.flush(); + scope.$digest(); + expect(spy.calledWith('invenio.records.endpoints.updated')).to.be.true; + }); }); From 8bb5e029c885955837f01e0babc7f9da2724172e Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Mon, 5 Sep 2016 13:09:08 +0200 Subject: [PATCH 3/3] global: addition of data preparation Signed-off-by: Harris Tzovanakis Conflicts: src/invenio-records-js/controllers/InvenioRecordsCtrl.js --- .../controllers/InvenioRecordsCtrl.js | 67 ++++++++++++++----- .../directives/invenioRecords.js | 2 - 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/src/invenio-records-js/controllers/InvenioRecordsCtrl.js b/src/invenio-records-js/controllers/InvenioRecordsCtrl.js index 6aa12c0..b968440 100644 --- a/src/invenio-records-js/controllers/InvenioRecordsCtrl.js +++ b/src/invenio-records-js/controllers/InvenioRecordsCtrl.js @@ -154,22 +154,52 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, return deferred.promise; } + /** - * Do a data massage before sending with request + * Remove any empty values from the data * @memberof InvenioRecordsCtrl - * @function cleanData + * @function defaultDataPrepare + * @param {Object} data - Provided by ``extra-params.data``. + * @param {Object} unwanted - A list with unwanted values. + * */ - function cleanData() { - var _data = angular.merge({}, {metadata: vm.invenioRecordsModel}); - var unwatend = [[null], [{}], '', [undefined]]; - angular.forEach(_data.metadata, function(value, key) { - angular.forEach(unwatend, function(_value) { + function removeEmptyValues(data, unwanted) { + var _unwantend = unwanted || [[null], [{}], '', [undefined]]; + angular.forEach(data, function(value, key) { + angular.forEach(_unwantend, function(_value) { if (angular.equals(_value, value)) { - delete _data[key]; + delete data[key]; } }); }); - return _data; + return data; + } + + /** + * The data preparation before make a request + * @memberof InvenioRecordsCtrl + * @function defaultRequestPrepare + * @param {Object} url - The request url. + * @param {Object} method - The request method. + * @param {Object} model -The data model. + * @param {Object} extraParams - Provided by ``extra-params``. + * + */ + function defaultRequestPrepare(url, method, model, extraParams) { + // Clean the model + var _model = removeEmptyValues(model) || {}; + // Pass all the data information + var _data = angular.merge( + {}, + extraParams.data || {}, + _model + ); + return { + url: url, + method: (method || 'PUT').toUpperCase(), + data: _data, + headers: extraParams.headers || {} + }; } /** @@ -180,13 +210,14 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, * @param {String} method - The method (POST, PUT, DELETE). */ function makeActionRequest(type, method) { - var _data = cleanData(); - return InvenioRecordsAPI.request({ - url: vm.invenioRecordsEndpoints[type], - method: (method || 'PUT').toUpperCase(), - data: _data, - headers: vm.invenioRecordsArgs.headers || {} - }); + var request = (vm.requestPrepare || defaultRequestPrepare) + .call(this, + vm.invenioRecordsEndpoints[type], + method, + vm.invenioRecordsModel, + vm.invenioRecordsArgs + ); + return InvenioRecordsAPI.request(request); } /** @@ -436,6 +467,10 @@ function InvenioRecordsCtrl($scope, $rootScope, $q, $window, $location, vm.actionHandler = invenioRecordsHandler; // Remove validation vm.removeValidationMessage = invenioRecordsRemoveValidation; + // Remove empty values + vm.removeEmptyValues = removeEmptyValues; + // Prepare for action request + vm.defaultRequestPrepare = defaultRequestPrepare; //////////// diff --git a/src/invenio-records-js/directives/invenioRecords.js b/src/invenio-records-js/directives/invenioRecords.js index 4bd1b94..e1ce486 100644 --- a/src/invenio-records-js/directives/invenioRecords.js +++ b/src/invenio-records-js/directives/invenioRecords.js @@ -53,7 +53,6 @@ function invenioRecords() { * @param {InvenioRecordsCtrl} vm - Invenio records controller. */ function link(scope, element, attrs, vm) { - // Upadate parameters // Get extra template parameters var templateParams = { @@ -80,7 +79,6 @@ function invenioRecords() { }; // Get the record object var record = JSON.parse(attrs.record || '{}'); - // Spread the love of initialization scope.$broadcast( 'invenio.records.init', args, endpoints, record, links