Sha256: a9c0d6b3f6d04d3d88530690831da68f1323409e893e1294d9d450401f284b18

Contents?: true

Size: 1.29 KB

Versions: 26

Compression:

Stored size: 1.29 KB

Contents

# PluginFactoryScaffolding : PARTIAL
########################################################################################################################

# FILTER: fromNow
####################################################################################
App.filter('fromNow', ()-> (date) ->
  return 'never' if !date
  moment(date).fromNow()
)

# FILTER: titleize
####################################################################################
App.filter('titleize', -> (str) ->
  return str if typeof str != 'string'
  smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|vs?\.?|via)$/i
  str.replace /([^\W_]+[^\s-]*) */g, (match, p1, index, title)->
    return match.toLowerCase() if (index > 0 && index + p1.length != title.length && p1.search(smallWords) > -1) && (title.charAt(index - 2) != ":") && (title.charAt(index - 1).search(/[^\s-]/) < 0)
    return match if (p1.substr(1).search(/[A-Z]|\../) > -1)
    match.charAt(0).toUpperCase() + match.substr(1)
)

# FILTER: humanize
####################################################################################
App.filter('humanize', -> (str) ->
  return str if typeof str != 'string'
  str.replace('_', ' ')
)

# END PARTIAL ##########################################################################################################

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
fanforce-plugin-factory-2.0.0.rc7 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/filters.coffee
fanforce-plugin-factory-2.0.0.rc6 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/filters.coffee
fanforce-plugin-factory-2.0.0.rc5 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/filters.coffee
fanforce-plugin-factory-2.0.0.rc3 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/filters.coffee
fanforce-plugin-factory-2.0.0.rc2 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/filters.coffee
fanforce-plugin-factory-2.0.0.rc1 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/filters.coffee