Sha256: fd53c29f7b7ebcc638814a51d3a9b6a6e47bd3b1efcb72fce4296bfb4591dd82

Contents?: true

Size: 753 Bytes

Versions: 12

Compression:

Stored size: 753 Bytes

Contents

module Admin::Resources::DataTypes::HasOneHelper

  def typus_form_has_one(field)
    setup_relationship(field)

    @items = Array.new
    if item = @item.send(field)
      @items << item
    end

    # TODO: Find a cleaner way to add these actions ...
    @resource_actions = [["Edit", {:action=>"edit"}, {}],
                         ["Trash", { :resource_id => @item.id, :resource => @resource.model_name, :action => "destroy" }, { :confirm => "Trash?" }]]

    options = { :resource_id => nil, @reflection.foreign_key => @item.id }

    render "admin/templates/has_one",
           :association_name => @association_name,
           :add_new => @items.empty? ? build_add_new(options) : nil,
           :table => build_relationship_table
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
typus-3.1.0.rc18 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc17 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc16 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc15 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc14 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc13 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc12 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc11 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc10 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc9 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc8 app/helpers/admin/resources/data_types/has_one_helper.rb
typus-3.1.0.rc7 app/helpers/admin/resources/data_types/has_one_helper.rb