#encoding
module RailsAdmin
  module Config
    module Actions

        class PushTmplRedirect < RailsAdmin::Config::Actions::Base
            register_instance_option :visible?  do
          authorized?
            end

            register_instance_option :member do
                true
            end

            register_instance_option :link_icon do
                'icon-share'
            end

            register_instance_option :pjax? do
                false
            end

            register_instance_option :controller do
                Proc.new do
                    url = "#{CONFIG_FILE["api_host"]}/railsadmin/push/template/#{@object.id}"
                    open(url)
                    redirect_to :back, notice: "已推送!"
                end
            end

        end

    end
  end
end