Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require(["app", "underscore", "handlebars", "core/UIManager", "helpers/file", "helpers/status", "helpers/string", "core/t", "moment"], function(e, t, n, i, o, r, a, s, l) {
  2.                 function c() {
  3.                     return e.PATH
  4.                 }
  5.  
  6.                 function u(e, t, o) {
  7.        
  8.                     // Set extra z var
  9.                     var r, a, z;
  10.                     z = '';
  11.                     if (e.structure && (r = e.structure.get(t)), r && (r.isOneToMany() || r.isManyToMany())) {
  12.                        
  13.                         // Get item value from all items and build a string
  14.                         for (ia = 0; ia < e.attributes[t].models.length; ia++) {                          
  15.                             if (e.attributes[t].models[ia].attributes.data.attributes.system_title !== undefined) {
  16.                                 z += e.attributes[t].models[ia].attributes.data.attributes.system_title;
  17.                             }                            
  18.  
  19.                              
  20.                                 if (e.attributes[t].models.length !== ia+1 && z.length > 0){
  21.                                     z += ', ';
  22.                                 }
  23.                         }    
  24.                        
  25.  
  26.                         var l = e.get(t).length,
  27.                             c = "item",
  28.                             u = "multiple";
  29.  
  30.                         "directus_files" === r.getRelatedTableName() && (c = "file"), 1 === l && (u = "single"),                      
  31.                         a = s("relational_count_x_" + c + "_" + u, {
  32.                             count: l
  33.                         }
  34.                        
  35.                     )
  36.  
  37.                     // If the string contains something, replace the item count with it
  38.                     if(z !== 'undefined' && z.length > 0){
  39.                         a = z
  40.                     }
  41.  
  42.  
  43.                     } else e.isNested && (e = e.get("data")), a = i.getList(e, t) || '<span class="no-value">--</span>';                
  44.            
  45.  
  46.                     return new n.SafeString(a)
  47.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement