                 data = ($ @).closest('.product-widget').data()
                 data.put = true
                 render_edit_product_form(data)
+
             .on 'click', '.delete-product', ->
                 data = ($ @).closest('.product-widget').data()
                 if confirm("Are you sure you want to delete #{data.name}?")

    product_photos_gallery_displayed = 'product-photos-gallery-displayed'

    reset_product_form = (data) ->
        $product_form_wrapper.find('form')
            .replaceWith($('<form />'))
        $window.scrollTop($product_form_wrapper)
        update_h2(Mustache.render(templates.stores_h2_add_template, {}))

    update_product_form = (data) ->
        $product_form_wrapper.find('form')
            .replaceWith(Mustache.render(templates.product_form_template, data, {product_form_label_template: templates.product_form_label_template}))
        $product_form_wrapper.find('form').validate(product_form_options)
        $window.scrollTop($product_form_wrapper)

    render_edit_product_form = (data) ->
        if data.rawInstagramTags
            data.instagram_tags = $.map(data.rawInstagramTags.split(', '), (instagram_tag) ->
                {value: instagram_tag, name: 'instagram-tag'})
        if data.sizes
            data.sizes = $.map(data.sizes.split(','), (size) ->
                {value: size, name: 'size'})

                ($ '#product_instagram_tag').val(map_label_values('instagram-tag'))

                verb = if @id is 'new_product' then 'created' else 'updated'

                $.ajax
                    url: ($ @).prop('action')
                    type: 'post'
                    data: ($ @).serialize()
                    success: (response) =>
                        if response.status isnt 'error'
                            expire_alert_and_notice_in(6000)
