如何使用简单形式的标签管理器并使用HAML?

时间:2014-11-05 16:16:24

标签: ruby-on-rails twitter-bootstrap tags haml

的Env

我当前的代码

= simple_form_for(@project,
  html: {class: 'form-horizontal' }, wrapper: :horizontal_form, wrapper_mappings: { check_boxes: :horizontal_radio_and_checkboxes, radio_buttons: :horizontal_radio_and_checkboxes, file: :horizontal_file_input, boolean: :horizontal_boolean}) do |f|
  = f.error_notification

  .form-inputs
    = f.hidden_field :owner_id
    = f.label "#{current_user.id}" 
    = f.input :title

    %input#tm-language.tm-input{:name => "language", :placeholder => "Programming language", :type => "text"}/

  .form-actions{style: "text-align:right;"}
    = f.button :submit

:javascript
  jQuery(".tm-input").tagsManager();

我希望能够改变这个

    %input#tm-language.tm-input{:name => "language", :placeholder => "Programming language", :type => "text"}/

进入看起来像这样的东西:

    = f.input.tm-input :language, placeholder: "Programming language" 

只有后者才是正确的语法。

试过这个:

= f.input.tm-input :language, :input_html => { :placeholder => 'Programming Language' }

并收到此错误

SyntaxError at /projects/new
syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '('
...true_false(( f.input.tm-input :language, :input_html => { :p...
...       

                    ^

0 个答案:

没有答案