# ---------------------------------------- # rails3.2 {{{ # ActionView::Helpers options#{{{ snippet disable_with abbr disable_with: 'loading...' options word disable_with: "${1:message}" snippet confirm abbr confirm: "Are you sure?" options word confirm: "${1:message}" snippet method abbr method: (:delete|:post|:get|:put) options word method: :${1} snippet remote abbr remote: true options word remote: true #}}} # ActionView::Helpers::UrlHelper#{{{ snippet url_for abbr url_for((:back|http://...|action: :index)) URL生成 options word url_for ${1:options} snippet link_to abbr link_to(*args, &block) リンク生成 options word link_to ${1:*args} snippet link_to_do abbr link_to do ... end リンク生成 options word link_to ${1:*args} do ${2} snippet button_to abbr button_to(name, options={}, html_prop={}) ボタン作成 options word button_to ${1:name}${2:, ${3:options\}}${4:, ${5:html_prop\}} snippet button_to_destroy abbr button_to("text", { action: :delete ...} ) 削除ボタン作成 options word button_to ${1:text}, ${2:{ confirm: "削除してもよろしいですか?", method: :delete, remote: true, disable_with: 'loading...' }} snippet link_to_unless_current abbr link_to_unless_current(name, options={}, html_prop={}, &block) options word link_to_unless_current ${1:name}${2:, { ${3:prop\} \}}${4:, { ${5:html_prop\} \}} snippet link_to_unless_current_do abbr link_to_unless_current "name" {} do ... end options word link_to_unless_current ${1:name}${2:, { ${3:prop\} \}}${4:, { ${5:html_prop\} \}} do ${6} snippet link_to_unless abbr link_to_unless(condition, name, ops={}, html_prop={}, &block) options word link_to_unless ${1:true|false}, ${2:name}${3:, { ${4:prop\} \}}${5:, { ${6:html_prop\} \}} snippet link_to_unless_do abbr link_to_unless options word link_to_unless ${1:true|false}, ${2:name}${3:, { ${4:prop\} \}}${5:, { ${6:html_prop\} \}} do ${7} snippet link_to_if abbr link_to_if(condition, name, prop={}, html_prop={}, &block) options word link_to_if ${1:true|false}, ${2:name}${3:, { ${4:prop\} \}}${5:, { ${6:html_prop\} \}} snippet link_to_if_do abbr link_to_if options word link_to_if ${1:true|false}, ${2:name}${3:, { ${4:prop\} \}}${5:, { ${6:html_prop\} \}} do ${7} snippet mail_to abbr mail_to(email_address, name=nil, html_prop={}) options word mail_to ${1:admin@example.com}${2:, ${3:text\}}${4:, { ${5:html_prop\} \}} snippet mail_to_prop abbr mail_to_prop mail_toのオプション options word cc: "", replace_at: "_at_", replace_dot: "_dot_", encode: "javascript|hex", subject: "" snippet current_page? abbr current_page?(prop) options word current_page? ${1:action: :index} #}}} #ActionView::Helpers::TranslationHelper#{{{ snippet translate abbr translate(key, prop={}) 翻訳 alias t options word t(${1}) snippet localize abbr localize(*args) 時間等 alias l options word l(${1:*args}) #}}} #ActionView::Helpers::TextHelper#{{{ snippet concat abbr concat(string) printの代わり options word concat ${1:string} snippet safe_concat abbr safe_concat(string) printの代わり(安全) options word safe_concat ${1:string} snippet truncate abbr truncate(text, opt={}) 切り捨て options word truncate ${1:text}, length: ${2:n}${3:, omission: "${4\}"}${5:, separator: "${6:...\}"} snippet highlight abbr highlight(text, phrases, *args) キーワードにタグ追加 options word highlight ${1:text}, ${2:phrases}${3:, highlighter: "${4:\1\}"} snippet excerpt abbr excerpt(text, phrase, *args) キーワードを抜粋 options word excerpt ${1:text}, ${2:phrase}${3:, radius: ${4:n\}\}}${5:, omission: "${6:...\}"} snippet pluralize abbr pluralize(n, text) nを判定してtextの単数/複数へ options word pluralize ${1:n}, ${2:singular}${3:, ${4:plural\}} snippet word_wrap abbr word_wrap(text, n=80) options word word_wrap ${1:text}, ${2:80} snippet simple_format abbr simple_format(text, html_prop={}, prop={}) 改行をpタグに options word simple_format ${1:text}${2:, { ${3:html_prop\} \}}${4:, { ${5:prop\} \}} snippet cycle abbr cycle(first_value, *values) 一定周期で変数を返す options word cycle ${1:values}${2:, name: "${3\}"} snippet current_cycle abbr current_cycle(name="default") 今のcycleの変数 options word current_cycle ${1:name} snippet reset_cycle abbr reset_cycle(name="default") options word reset_cycle ${1:name} #}}} #ActionView::Helpers::TagHelper#{{{ snippet tag abbr tag(name, prop={}, open=false, escape=true) options word tag "${1:name}"${2:, prop={\}}${3:, false}${4:, true} snippet content_tag abbr content_tag(name, content_or_options_with_block=nil, prop=nil, escape=false, &block) options word content_tag :${1:tag}${2:prop} snippet cdata_section abbr cdata_section(content) '${1}'} do |feed| ${2} #}}} #ActionView::Helpers::AssetTagHelper#{{{ snippet auto_discovery_link_tag abbr auto_discovery_link_tag(type=:rss, url_prop={}, tag_prop={}) options word auto_discovery_link_tag ${1::rss|:atom} snippet favicon_link_tag abbr favicon_link_tag(source='/favicon.ico', prop={}) options word favicon_link_tag ${1:source}${2:, ${3:prop\}} snippet image_path abbr image_path(source) alias path_to_image options word image_path ${1:assets_path} snippet video_path abbr video_path(source) alias path_to_video options word video_path ${1:assets_path} snippet font_path abbr font_path(source) alias path_to_font options word font_path ${1:source} snippet image_tag abbr image_tag(source, prop={}) options word image_tag ${1:source}${2:, ${3:prop\}} snippet image_tags abbr image_tag(source, prop={}) options word image_tags "${1:assets_path}", size: "${2:16x16}", alt: "${3:text}" snippet image_tag_button abbr image_tag(source, prop={}) options word image_tag "${1:assets_path}", size: "${2:16x16}", onmouseover="this.src='$1${3}'", onmouseout="this.src='$1${4}'", alt: "${5}" snippet image_alt abbr image_alt(source) options word image_alt ${1:assets_path} snippet video_tag abbr video_tag(source, prop={}) options word video_tag ${1:assets_path}${2:, ${3:prop\}} snippet audio_tag abbr audio_tag(source, prop={}) options word audio_tag ${1:assets_path}${2:, ${3:prop\}} #}}} #ActionView::Helpers::ActionModelInstanceTag#{{{ snippet object abbr object options word object snippet error_wrapping abbr error_wrapping(html_tag) options word error_wrapping ${1:html_tag} snippet error_message abbr object.errors[@method_name] options word error_message #}}} # }}}