Skip to content

Instantly share code, notes, and snippets.

@kuatsure
Created March 2, 2015 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuatsure/4774c147519be08caa11 to your computer and use it in GitHub Desktop.
Save kuatsure/4774c147519be08caa11 to your computer and use it in GitHub Desktop.
quick switch to grab image path based on extension
app.docIconHelper = ( extension ) ->
switch extension
when 'xlsx', 'xls' then icon = 'excel'
when 'docx', 'doc' then icon = 'word'
when 'pptx', 'ppt' then icon = 'powerpoint'
when 'bmp', 'png', 'jpg', 'jpeg' then icon = 'image'
when 'html', 'aspx', 'htm', 'asp', 'php' then icon = 'link'
when 'pdf' then icon = 'pdf'
when 'mov', 'mp4' then icon = 'video'
else icon = 'blank'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment