Skip to content

Instantly share code, notes, and snippets.

View willsza's full-sized avatar

William Franklin willsza

  • Raro Labs
  • Belo Horizonte - Brasil
View GitHub Profile
@willsza
willsza / _fields.slim
Last active August 29, 2015 14:27
Alterar todos os IDs dos elementos de uma DIV
.form-group.form-inline.fields#teste
.form-group
= f.input :nexts, label: false, collection: [ "Enviar para","Pergunta","Objetivo","Post","Tarefa","Tag" ], include_blank: false, prompt: "Selecione a Opção", :input_html => { :id => "first_select", :name => 'page[nexts][]' }
.form-group
= f.input :nexts, label: false, collection: Question.order(:title), include_blank: false, prompt: "Selecione a pergunta", :input_html => { :id => "question_select", :name => 'page[nexts][]' }
.form-group
= f.input :nexts, label: false, collection: Question.order(:title), as: :grouped_select, group_method: :answer_options, label_method: :content, value_method: :id, include_blank: false, prompt: "Selecione a Reposta", :input_html => { :id => "answer_option_select", :name => 'page[nexts][]' }
.form-group
= f.input :nexts, label: false, collection: Page.order(:title), include_blank: false, prompt: "Selecione a página", :input_html => { :id => "next_select", :name => 'page[nexts][]' }
@willsza
willsza / _form.html.slim
Last active August 29, 2015 14:26
Rails 4 - Salvar Array de Selects
= simple_form_for @page do |f|
= f.error_notification
.form-inputs
= f.input :title
= f.association :section
.panel.panel-default
.panel-heading
.panel-title Definir direcionamento da página
@willsza
willsza / _form.slim
Last active August 29, 2015 14:26
Salvando registros separados por quebra de linha
= simple_form_for @answer_option do |f|
= f.error_notification
.form-inputs
= f.input :content
= f.association :question
.form-actions
= f.button :submit, class: 'btn btn-success'
@willsza
willsza / _form_import.html.slim
Last active August 29, 2015 14:16
Criando uma action para importação de arquivos CSV
= simple_form_for @mailing, :url => import_mailings_path, multipart: true do |f|
= f.error_notification
.form-inputs
= f.input :file, as: :file
.form-actions
= f.button :submit, "Enviar Arquivo", class: 'btn btn-primary'