Skip to content

Instantly share code, notes, and snippets.

@themoxman
Created February 20, 2014 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themoxman/9107347 to your computer and use it in GitHub Desktop.
Save themoxman/9107347 to your computer and use it in GitHub Desktop.
.small-12.medium-9.large-9.columns
  = simple_form_for [@collection, @note] do |f|
    = f.input :title, label: false
    .content-form-size= f.input :content, label: false
    #tags
      - @tag_list.each do |tag|
        %a{:style => "display:inline-block", :data => "#{tag.name}", :class => 'button tiny'}= tag.name
    #new_tags
    = text_field_tag 'new_tags', nil, placeholder: "Add additional comma separated tags here"
    = hidden_field_tag 'tag_list', @tag_ids
    %br
    = f.button :submit, "Save Changes", class: "button"
  %ul.button-group
    %li= link_to "Back to Search Results", collection_results_search_path(@collection, tag_list: @tag_ids), class: 'button'
    %li= button_to 'Delete Note', collection_note_path(@collection, @note), :method => :delete, data: { confirm: 'Delete this Note?' }, class: 'button'
  scenario "update Note tags", feature: true do
    sign_in_user

    collection = create(:collection, user: @user)
    note = create(:note, collection: collection)
    tag1 = create(:tag, collection: collection)
    tag2 = create(:tag, collection: collection)
    note.tags << tag1

    visit collection_new_search_path(collection)
    click_button 'Find Notes'
    click_link 'Edit Note'
    find('#tags a', :text => 'Tag2').click
    click_button 'Save Changes'

    expect(page).to have_content "Note updated"
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment