mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-12 16:34:18 +00:00
tweaking rails and ruby snippets slightly
This commit is contained in:
@@ -134,9 +134,14 @@
|
||||
(and (yas/rails-root)
|
||||
(string-match "db/migrate/" default-directory)))
|
||||
|
||||
(defun yas/rails-activate-maybe
|
||||
(when (yas/rails-root)
|
||||
(set (make-local-variable 'yas/mode-symbol) 'rails-mode)))
|
||||
|
||||
(defadvice cd (after yas/rails-on-cd-activate activate)
|
||||
"Set `yas/mode-symbol' to `rails-mode' so that rails snippets
|
||||
are recognized"
|
||||
are recognized. Stolen from `rinari-mode' more or`' less."
|
||||
(setq yas/rails-root-cache nil)
|
||||
(when (yas/rails-root)
|
||||
(set (make-local-variable 'yas/mode-symbol) 'rails-mode)))
|
||||
(yas/rails-activate-maybe))
|
||||
|
||||
(add-hook 'find-file-hook 'yas/rails-activate-maybe)
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
# type: command
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Go to Controller
|
||||
## binding: "~$@"
|
||||
## condition: "text.html.ruby, source.ruby.rails.embedded.html, meta.rails.helper, meta.rails.functional_test, source.js, source.css, source.yaml, meta.rails.model, meta.rails.unit_test, text.haml"
|
||||
# binding: C-c g c
|
||||
# --
|
||||
(call-interactively (find-file (concat (yas/rails-root) "/app/controllers")))
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: f.
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: f.check_box (ffcb)
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.check_box :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: f.
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: f.file_field (ffff)
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.file_field :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: f.
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: f.hidden_field (ffhf)
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.hidden_field :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: f.
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: f.label (ffl)
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.label :${1:attribute}${2:, "${3:${1:$(capitalize (replace-regexp-in-string "_" " " yas/text))}}"} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: f.
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: f.password_field (ffpf)
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.password_field :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: f.
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: f.radio_box (ffrb)
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.radio_box :${1:attribute}, :${2:tag_value} %>
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: f.
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: f.submit (ffs)
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# name: f.submit (ffs
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: f.
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: f.text_area (ffta)
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.text_area :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: f.
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: f.text_field (fftf)
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.text_field :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: ffcb
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: form_for check_box
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.check_box :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: ffff
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: form_for file_field
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.file_field :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: ffhf
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: form_for hidden_field
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.hidden_field :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: ffl
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: form_for label
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.label :${1:attribute}${2:, "${3:${1:$(capitalize (replace-regexp-in-string "_" " " yas/text))}}"} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: ffpf
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: form_for password_field
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.password_field :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: ffrb
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: form_for radio_box
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.radio_box :${1:attribute}, :${2:tag_value} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: ffs
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: form_for submit
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: ffta
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: form_for text_area
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.text_area :${1:attribute} %>
|
||||
@@ -2,6 +2,6 @@
|
||||
# key: fftf
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: form_for text_field
|
||||
## condition: "text.html.ruby, text.haml"
|
||||
# condition: (yas/rails-view-p)
|
||||
# --
|
||||
<%= f.text_field :${1:attribute} %>
|
||||
Reference in New Issue
Block a user