@@ -22,7 +22,7 @@ angular.module('mm.addons.mod_data')
2222 * @name $mmaModDataHelper
2323 */
2424. factory ( '$mmaModDataHelper' , function ( $mmaModData , $mmaModDataFieldsDelegate , $q , mmaModDataComponent , $mmFileUploader , $mmSite ,
25- $mmaModDataOffline , $mmFS , $mmFileUploaderHelper , $mmSitesManager ) {
25+ $mmaModDataOffline , $mmFS , $mmFileUploaderHelper , $mmSitesManager , $translate ) {
2626
2727 var self = {
2828 searchOther : {
@@ -39,12 +39,12 @@ angular.module('mm.addons.mod_data')
3939 * @name $mmaModDataHelper#displayShowFields
4040 * @param {String } template Template HMTL.
4141 * @param {Array } fields Fields that defines every content in the entry.
42- * @param {Number } entryId Entry ID .
42+ * @param {Object } entry Entry .
4343 * @param {String } mode Mode list or show.
4444 * @param {Object } actions Actions that can be performed to the record.
4545 * @return {String } Generated HTML.
4646 */
47- self . displayShowFields = function ( template , fields , entryId , mode , actions ) {
47+ self . displayShowFields = function ( template , fields , entry , mode , actions ) {
4848 if ( ! template ) {
4949 return "" ;
5050 }
@@ -58,19 +58,21 @@ angular.module('mm.addons.mod_data')
5858 replace = new RegExp ( replace , 'gi' ) ;
5959
6060 // Replace field by a generic directive.
61- render = '<mma-mod-data-field field="fields[' + field . id + ']" value="entries[' + entryId + '].contents[' + field . id +
62- ']" mode="' + mode + '" database="data" view-action="gotoEntry(' + entryId + ')"></mma-mod-data-field>' ;
61+ render = '<mma-mod-data-field field="fields[' + field . id + ']" value="entries[' + entry . id + '].contents[' + field . id +
62+ ']" mode="' + mode + '" database="data" view-action="gotoEntry(' + entry . id + ')"></mma-mod-data-field>' ;
6363 template = template . replace ( replace , render ) ;
6464 } ) ;
6565
6666 angular . forEach ( actions , function ( enabled , action ) {
6767 replace = new RegExp ( "##" + action + "##" , 'gi' ) ;
6868 if ( enabled ) {
69- if ( action == " moreurl" ) {
69+ if ( action == ' moreurl' ) {
7070 // Render more url directly because it can be part of an HTML attribute.
71- render = $mmSite . getURL ( ) + '/mod/data/view.php?d={{data.id}}&rid=' + entryId ;
71+ render = $mmSite . getURL ( ) + '/mod/data/view.php?d={{data.id}}&rid=' + entry . id ;
72+ } else if ( action == 'approvalstatus' ) {
73+ render = $translate . instant ( 'mma.mod_data.' + ( entry . approved ? 'approved' : 'notapproved' ) ) ;
7274 } else {
73- render = '<mma-mod-data-action action="' + action + '" entry="entries[' + entryId +
75+ render = '<mma-mod-data-action action="' + action + '" entry="entries[' + entry . id +
7476 ']" mode="' + mode + '" database="data"></mma-mod-data-action>' ;
7577 }
7678 template = template . replace ( replace , render ) ;
0 commit comments