Browse Source
Initial jquery, ruby, and eruby snippets
Initial jquery, ruby, and eruby snippets
- jquery ($ and drf) definitions - ruby (key => value) shortcuts - eruby basics: if, else, unless, for, image tags, link tags content_for, form_for, form elements, if flash, render partialmaster
jimi
15 years ago
3 changed files with 127 additions and 0 deletions
@ -0,0 +1,91 @@ |
|||
" |
|||
" |
|||
XPTemplate priority=personal+ |
|||
|
|||
XPTvar $img_path 'images' |
|||
|
|||
XPT end " <% end -%> |
|||
<% end -%> |
|||
|
|||
XPT else " <% else -%> |
|||
<% else -%> |
|||
` `cursor^ |
|||
|
|||
XPT content_for synonym=cf|cof " <% content_for :head ... |
|||
<% content_for :`head^ do -%> |
|||
`cursor^ |
|||
`:end:^ |
|||
|
|||
XPT for " <% for item in items... |
|||
<% for `item^ in `@items^ -%> |
|||
`cursor^ |
|||
`:end:^ |
|||
|
|||
XPT if synonym=unless " <% $_xSnipName cond... |
|||
XSET action=Echo('') |
|||
XSET other=Echo('') |
|||
<% `$_xSnipName^ `cond^ -%> |
|||
` `action^ |
|||
``else..` |
|||
{{^<% else -%> |
|||
` `other^ |
|||
`}}^`:end:^ |
|||
|
|||
XPT ifl " <% if flash[... |
|||
<% if flash[:`notice^] -%> |
|||
<div id="`notice^"><%= flash[:`notice^] %></div> |
|||
`:end:^ |
|||
|
|||
XPT it hidden " embed-able image tag |
|||
XSET image_path=$img_path/ |
|||
image_tag("`image_path^`image_file^"`, `opt?^) |
|||
|
|||
XPT image_tag synonym=imt " <%= image_tag... |
|||
<%= `:it:^ %> |
|||
|
|||
XPT link_to synonym=lt|lit " <%= link_to... |
|||
XSET link='`link_text^' |
|||
XSET target=Echo('') |
|||
<%= link_to `link^, `target^ %> |
|||
|
|||
XPT link_to_img synonym=ltim " <%= link_to image... |
|||
`:link_to({'link' : ':it:'}):^ |
|||
|
|||
XPT form_for synonym=ff " <% form_for @model do... |
|||
<% form_for `@obj^ do |`f^| -%> |
|||
` `cursor^ |
|||
`:end:^ |
|||
|
|||
XPT flabel " <%= f.label... |
|||
<%= `f^.label `:object^, '`label^' %> |
|||
|
|||
XPT ftxt " <%= f.text_field... |
|||
<%= `f^.text_field `:object^ %> |
|||
|
|||
XPT ftxa " <%= f.text_area... |
|||
<%= `f^.text_area `object^ %> |
|||
|
|||
XPT fhidden " <%= f.hidden_field... |
|||
<%= `f^.hidden_field `object^ %> |
|||
|
|||
XPT fpassword " <%= f.password_field... |
|||
<%= `f^.password_field `object^ %> |
|||
|
|||
XPT ferror " <%= f.error_messages... |
|||
<%= `f^.error_messages `object^ %> |
|||
|
|||
XPT fcheck " <%= f.check_box... |
|||
<%= `f^.check_box `object^ %> |
|||
|
|||
XPT fradio " <%= f.radio_button |
|||
<%= `f^.radio_button `object^ %> |
|||
|
|||
XPT ffile " <% f.file_field... |
|||
<%= `f^.file_field `:object^ %> |
|||
|
|||
XPT fsubmit " <%= f.submit... |
|||
<%= `f^.submit '`label^' %> |
|||
|
|||
XPT render_partial synonym=rp " <%= render :partial... |
|||
XSET name=Echo('') |
|||
<%= render :partial => "`name^" %> |
@ -0,0 +1,12 @@ |
|||
" |
|||
" |
|||
XPTemplate priority=personal |
|||
|
|||
XPT $ " $(target) |
|||
$(`$SParg^`^`$SParg^) |
|||
|
|||
XPT drf " $(document).rea... |
|||
$(document).ready(function() { |
|||
`^ |
|||
}); |
|||
|
@ -0,0 +1,24 @@ |
|||
" |
|||
" |
|||
XPTemplate priority=personal+ |
|||
|
|||
XPT key hidden " :key => val |
|||
XSET val=Echo('') |
|||
`$_xSnipName^ => `val^ |
|||
|
|||
XPT :cols synonym=:rows|:size|:maxsize|:null|:url |
|||
`:key:^ |
|||
|
|||
XPT :object synonym=:collection|:locals|:layout|:method |
|||
`:key:^ |
|||
|
|||
XPT :id synonym=:class|:alt|:title|:action|:controller |
|||
XSET str='`val^' |
|||
`:key({ 'val' : 'str' }):^ |
|||
|
|||
XPT :selected synonym=:multipart |
|||
XSET bool=true`^ |
|||
`:key({ 'val' : 'bool' }):^ |
|||
|
|||
XPT :html alias=key |
|||
XSET val={ `html^ } |
Reference in new issue