<commit_before>

// we.js theme engine
var themeEngine = require('we-theme-engine');

exports.getModelsAttributes = function(){
  var models = {};
  _.forEach(sails.models, function(model, i){
    if(!model.emberJsExcludeFromClient && i != 'permissions'){
      models[i] = model._attributes;
    }
  });
  return models;
};

/**
 * Get requireJs preload config like urlArgs used for files refresh
 * @return {string} urlArgs from config or a empty string
 */
exports.getRequirejsPreloadConfig = function(){
  // if forceBrowserCacheRefresh is true force browser refresh with require.js urlArgs ...
  return '';
};

/**
 * Get requireJs script tag
 * @return {string} script tag with requirejs configs
 */
exports.getRequireJsScriptTag = function(){
  return HelpersService.getJsScriptTag();
};

/**
 * Get javascript assets tags to print in sails.js template
 *
 * @todo  move this logic to we-theme-engine
 * @return {string} string with <link> tags and project js files based on enviroment
 */
exports.getJsScriptTag = function(){
  var tags = '';
  var refreshString;

  // refresh string
  if(sails.config.clientside.forceBrowserCacheRefresh) {
    refreshString = Math.floor(Math.random() * 1000);
    sails.log.info('config:clientside.forceBrowserCacheRefresh enabled '+
      refreshString + ' will be added in all .js assets files.');
  } else {
    // by default get refresh string from package version
    refreshString = require('../../package.json').version;
  }

  if(sails.config.environment === 'production'){
    // client side production global variable
    tags = '<script>window.PRODUCTION_ENV = true;</script>';
    // production concatened and minified js files
    tags += '<script src="/min/production.js?v='+refreshString+'"></script>';
    // user translations file
    tags += '<script src="/api/v1/translations.js?v='+refreshString+'"></script>';

    return tags;
  }

  var urls = themeEngine.getProjectJsAssetsFiles();

  urls.forEach(function(url){
    tags += '<script src="/'+url+'?v='+refreshString+'"></script>';
  });

  tags += '<script src="/api/v1/translations.js"></script>';

  tags += '<script src="/tpls.hbs.js?v='+refreshString+'"></script>';

  if(themeEngine.javascript)
      tags += '<script src="/theme/'+themeEngine.javascript+'?v='+refreshString+'"></script>';

  // load live reload script tag
  if(sails.config.clientside.enableLiveReload){
    tags += '<script src="'+sails.config.clientside.liveReloadUrl+'"></script>';
  }

  return tags;
};

/**
 * Get css assets tags to print in sails.js template
 *
 * @todo  move this logic to we-theme-engine
 * @return {string} string with <link> tags and project css files based on enviroment
 */
exports.getlinkCssTags = function() {
  var tags = '';

  // if forceBrowserCacheRefresh is true force browser refresh
  var refreshString = '';
  if (sails.config.forceBrowserCacheRefresh) {
    // get a randon number for force browser refresh assets
    refreshString = '?ar='+ Math.floor(Math.random() * 1000);
  } else {
    // by default get refresh string from package version
    refreshString = require('../../package.json').version;
  }

  if(sails.config.environment == 'production'){
    tags += '<link rel="stylesheet" href="/min/production.css?v='+refreshString+'">';
  } else {
    sails.config.assets.css.forEach(function(src) {
      tags += '<link rel="stylesheet" href="/'+src+ '?v=' + refreshString+'">';
    });
  }

  if (themeEngine.stylesheet) {
    tags += '<link rel="stylesheet" href="/theme/'+themeEngine.stylesheet+'?v='+refreshString+'">';
  }

  return tags;
};<commit_msg>updated HelpersService to add suport to admin themes<commit_after>

// we.js theme engine
var themeEngine = require('we-theme-engine');

exports.getModelsAttributes = function(){
  var models = {};
  _.forEach(sails.models, function(model, i){
    if(!model.emberJsExcludeFromClient && i != 'permissions'){
      models[i] = model._attributes;
    }
  });
  return models;
};

/**
 * Get requireJs preload config like urlArgs used for files refresh
 * @return {string} urlArgs from config or a empty string
 *
 * DEPRECATED!
 */
exports.getRequirejsPreloadConfig = function(){
  // if forceBrowserCacheRefresh is true force browser refresh with require.js urlArgs ...
  return '';
};

/**
 * Get requireJs script tag
 * @return {string} script tag with requirejs configs
 *
 * DEPRECATED! use HelpersService.getJsScriptTag();
 */
exports.getRequireJsScriptTag = function() {
  return HelpersService.getJsScriptTag();
};

/**
 * Get javascript assets tags to print in sails.js template
 *
 * @todo  move this logic to we-theme-engine
 * @return {string} string with <link> tags and project js files based on enviroment
 */
exports.getJsScriptTag = function(){
  var tags = '';
  var refreshString;

  // refresh string
  if(sails.config.clientside.forceBrowserCacheRefresh) {
    refreshString = Math.floor(Math.random() * 1000);
    sails.log.info('config:clientside.forceBrowserCacheRefresh enabled '+
      refreshString + ' will be added in all .js assets files.');
  } else {
    // by default get refresh string from package version
    refreshString = require('../../package.json').version;
  }

  if(sails.config.environment === 'production'){
    // client side production global variable
    tags = '<script>window.PRODUCTION_ENV = true;</script>';
    // production concatened and minified js files
    tags += '<script src="/min/production.js?v='+refreshString+'"></script>';
    // user translations file
    tags += '<script src="/api/v1/translations.js?v='+refreshString+'"></script>';

    return tags;
  }

  var urls = themeEngine.getProjectJsAssetsFiles();

  urls.forEach(function(url){
    tags += '<script src="/'+url+'?v='+refreshString+'"></script>';
  });

  tags += '<script src="/api/v1/translations.js"></script>';

  tags += '<script src="/tpls.hbs.js?v='+refreshString+'"></script>';

  if(themeEngine.javascript)
      tags += '<script src="/theme/'+themeEngine.javascript+'?v='+refreshString+'"></script>';

  // load live reload script tag
  if(sails.config.clientside.enableLiveReload){
    tags += '<script src="'+sails.config.clientside.liveReloadUrl+'"></script>';
  }

  return tags;
};

/**
 * Get javascript assets tags to print in sails.js template for admin theme
 *
 * @todo  move this logic to we-theme-engine
 * @return {string} string with <link> tags and project js files based on enviroment
 */
exports.getAdminJsScriptTag = function(){
  var tags = '';
  var refreshString;

  // refresh string
  if(sails.config.clientside.forceBrowserCacheRefresh) {
    refreshString = Math.floor(Math.random() * 1000);
    sails.log.info('config:clientside.forceBrowserCacheRefresh enabled '+
      refreshString + ' will be added in all .js assets files.');
  } else {
    // by default get refresh string from package version
    refreshString = require('../../package.json').version;
  }

  if(sails.config.environment === 'production'){
    // client side production global variable
    tags = '<script>window.PRODUCTION_ENV = true;</script>';
    // production concatened and minified js files
    tags += '<script src="/min/admin.production.js?v='+refreshString+'"></script>';
    // user translations file
    tags += '<script src="/api/v1/translations.js?v='+refreshString+'"></script>';

    return tags;
  }

  var urls = themeEngine.getProjectAdminJsAssetsFiles();

  urls.forEach(function(url){
    tags += '<script src="/'+url+'?v='+refreshString+'"></script>';
  });

  tags += '<script src="/api/v1/translations.js"></script>';

  tags += '<script src="/admin.tpls.hbs.js?v='+refreshString+'"></script>';

  if(sails.themes.admin.javascript)
      tags += '<script src="/theme/'+sails.themes.admin.javascript+'?v='+refreshString+'"></script>';

  // load live reload script tag
  if(sails.config.clientside.enableLiveReload){
    tags += '<script src="'+sails.config.clientside.liveReloadUrl+'"></script>';
  }

  return tags;
};

/**
 * Get css assets tags to print in sails.js template
 *
 * @todo  move this logic to we-theme-engine
 * @return {string} string with <link> tags and project css files based on enviroment
 */
exports.getlinkCssTags = function() {
  var tags = '';

  // if forceBrowserCacheRefresh is true force browser refresh
  var refreshString = '';
  if (sails.config.forceBrowserCacheRefresh) {
    // get a randon number for force browser refresh assets
    refreshString = '?ar='+ Math.floor(Math.random() * 1000);
  } else {
    // by default get refresh string from package version
    refreshString = require('../../package.json').version;
  }

  var urls = themeEngine.getProjectCSSAssetsFiles();

  if(sails.config.environment == 'production'){
    tags += '<link rel="stylesheet" href="/min/production.css?v='+refreshString+'">';
  } else {
    urls.forEach(function(src) {
      tags += '<link rel="stylesheet" href="/'+src+ '?v=' + refreshString+'">';
    });
  }

  if (sails.themes.active.config.stylesheet) {
    tags += '<link rel="stylesheet" href="/theme/' + sails.themes.active.config.stylesheet + '?v=' + refreshString + '">';
  }

  return tags;
};

exports.getAdminlinkCssTags = function() {
 var tags = '';

  // if forceBrowserCacheRefresh is true force browser refresh
  var refreshString = '';
  if (sails.config.forceBrowserCacheRefresh) {
    // get a randon number for force browser refresh assets
    refreshString = '?ar='+ Math.floor(Math.random() * 1000);
  } else {
    // by default get refresh string from package version
    refreshString = require('../../package.json').version;
  }

  var urls = themeEngine.getProjectAdminCSSAssetsFiles();

  if(sails.config.environment == 'production') {
    tags += '<link rel="stylesheet" href="/min/admin.production.css?v=' + refreshString + '">';
  } else {
    urls.forEach(function(src) {
      tags += '<link rel="stylesheet" href="/' + src + '?v=' + refreshString + '">';
    });
  }

  if (sails.themes.admin.config.stylesheet) {
    tags += '<link rel="stylesheet" href="/adminTheme/' + sails.themes.admin.config.stylesheet + '?v=' + refreshString + '">';
  }

  return tags;
}
{'fraction_non_alphanumeric': 0.15960912052117263, 'fraction_numerical': 0.002961208172934557, 'mean_word_length': 3.845528455284553, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2737012', 'n_tokens_mistral': 3059, 'n_tokens_neox': 3000, 'n_words': 754}