Sha256: 0829998ba777920e4239eb429c175246f3a867d359c35cd756b98b71f335dbf1

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

# coding: utf-8

module Redditor
  module PagesHelper
    def button_tag_add_fields(name, f, association)
      new_object = f.object.send(association).klass.new
      id = new_object.object_id
      fields = f.fields_for(association, new_object, child_index: id) do |builder|
        content_tag(:dd, :id => "#{association.to_s.singularize}_#{id}") do
          tag(:div, class: "handle") +
          link_to("Удалить", "javascript:void(0);", onclick: "if (confirm('dfasdsa')) $(this).closest('dd').remove();") + "\s" +
          link_to("Обновить", [:admin, @article.page, association], method: "post", class: "redditor__update", remote: true, data: {disable_with: "Обновляется"}) + "\s" +
          render("admin/pages/" + association.to_s.singularize, f: builder)
        end
      end
      
      button_tag(name, class: "add_fields", type: "button", data: {id: id, fields: fields.gsub("\n", "")})
    end

    def redditor_validate f
      render "redditor/admin/pages/validate", {f: f} 
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
redditor-0.1.10 app/helpers/redditor/pages_helper.rb
redditor-0.1.9 app/helpers/redditor/pages_helper.rb
redditor-0.1.8 app/helpers/redditor/pages_helper.rb
redditor-0.1.7 app/helpers/redditor/pages_helper.rb
redditor-0.1.6 app/helpers/redditor/pages_helper.rb