eruby.snippets 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # .erb and .rhmtl files
  2. # Includes html.snippets
  3. # Rails *****************************
  4. snippet rc
  5. <% ${1} %>
  6. snippet rce
  7. <%= ${1} %>${2}
  8. snippet %
  9. <% ${1} %>
  10. snippet =
  11. <%= ${1} %>${2}
  12. snippet end
  13. <% end %>${1}
  14. snippet ead
  15. <% ${1}.each do |${2}| %>
  16. ${3}
  17. <% end %>
  18. snippet for
  19. <% for ${2:item} in ${1} %>
  20. ${3}
  21. <% end %>
  22. snippet rp
  23. <%= render :partial => '${1:item}' %>
  24. snippet rpl
  25. <%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'$4 } %>
  26. snippet rps
  27. <%= render :partial => '${1:item}', :status => ${2:500} %>
  28. snippet rpc
  29. <%= render :partial => '${1:item}', :collection => ${2:items} %>
  30. snippet lia
  31. <%= link_to '${1:link text...}', :action => '${2:index}' %>
  32. snippet liai
  33. <%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${3:@item} %>
  34. snippet lic
  35. <%= link_to '${1:link text...}', :controller => '${2:items}' %>
  36. snippet lica
  37. <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:index}' %>
  38. snippet licai
  39. <%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${4:@item} %>
  40. snippet yield
  41. <%= yield ${1::content_symbol} %>${2}
  42. snippet conf
  43. <% content_for :${1:head} do %>
  44. ${2}
  45. <% end %>
  46. snippet cs
  47. <%= collection_select <+object+>, <+method+>, <+collection+>, <+value_method+>, <+text_method+><+, <+[options]+>, <+[html_options]+>+> %>
  48. snippet ct
  49. <%= content_tag '${1:DIV}', ${2:content}${3:,options} %>
  50. snippet ff
  51. <% form_for @${1:model} do |f| %>
  52. ${2}
  53. <% end %>
  54. snippet ffcb
  55. <%= ${1:f}.check_box :${2:attribute} %>
  56. snippet ffe
  57. <% error_messages_for :${1:model} %>
  58. <% form_for @${2:model} do |f| %>
  59. ${3}
  60. <% end %>
  61. snippet ffff
  62. <%= ${1:f}.file_field :${2:attribute} %>
  63. snippet ffhf
  64. <%= ${1:f}.hidden_field :${2:attribute} %>
  65. snippet ffl
  66. <%= ${1:f}.label :${2:attribute}, '${3:$2}' %>
  67. snippet ffpf
  68. <%= ${1:f}.password_field :${2:attribute} %>
  69. snippet ffrb
  70. <%= ${1:f}.radio_button :${2:attribute}, :${3:tag_value} %>
  71. snippet ffs
  72. <%= ${1:f}.submit "${2:submit}" %>
  73. snippet ffta
  74. <%= ${1:f}.text_area :${2:attribute} %>
  75. snippet fftf
  76. <%= ${1:f}.text_field :${2:attribute} %>
  77. snippet fields
  78. <% fields_for :${1:model}, @$1 do |${2:f}| %>
  79. ${3}
  80. <% end %>
  81. snippet i18
  82. I18n.t('${1:type.key}')${2}
  83. snippet it
  84. <%= image_tag "${1}"${2} %>
  85. snippet jit
  86. <%= javascript_include_tag ${1::all} %>
  87. snippet jsit
  88. <%= javascript_include_tag "${1}" %>
  89. snippet lim
  90. <%= link_to ${1:model}.${2:name}, ${3:$1}_path(${4:$1}) %>
  91. snippet linp
  92. <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${5:@$3}) %>
  93. snippet linpp
  94. <%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}) %>
  95. snippet lip
  96. <%= link_to "${1:Link text...}", ${2:model}_path(${3:@$2}) %>
  97. snippet lipp
  98. <%= link_to "${1:Link text...}", ${2:model}s_path %>
  99. snippet lt
  100. <%= link_to "${1:name}", ${2:dest} %>
  101. snippet ofcfs
  102. <%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${4:selected_value} %>
  103. snippet rf
  104. <%= render :file => "${1:file}"${2} %>
  105. snippet rt
  106. <%= render :template => "${1:file}"${2} %>
  107. snippet slt
  108. <%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %>
  109. snippet sslt
  110. <%= stylesheet_link_tag "${1}" %>