|
|
@@ -1,75 +1,41 @@
|
|
|
+#encoding
|
|
|
module RailsAdmin
|
|
|
module Config
|
|
|
module Actions
|
|
|
class BuilkExportOrder < RailsAdmin::Config::Actions::Base
|
|
|
- RailsAdmin::Config::Actions.register(self)
|
|
|
+ register_instance_option :visible? do
|
|
|
+ authorized?
|
|
|
+ end
|
|
|
|
|
|
- register_instance_option :collection do
|
|
|
+ register_instance_option :member do
|
|
|
true
|
|
|
end
|
|
|
|
|
|
- register_instance_option :http_methods do
|
|
|
- [:post, :get]
|
|
|
+ register_instance_option :link_icon do
|
|
|
+ 'icon-star'
|
|
|
end
|
|
|
|
|
|
- register_instance_option :controller do
|
|
|
- proc do
|
|
|
- if request.post? # BULK DELETE
|
|
|
- p 123
|
|
|
- p 123
|
|
|
- p 123
|
|
|
- p 123
|
|
|
- p 123
|
|
|
-
|
|
|
- @objects = list_entries(@model_config, :post?)
|
|
|
-
|
|
|
- if @objects.blank?
|
|
|
- # flash[:error] = t('admin.flash.error', name: pluralize(0, @model_config.label), action: t('admin.actions.delete.done'))
|
|
|
- redirect_to index_path
|
|
|
-
|
|
|
- end
|
|
|
-
|
|
|
- elsif request.get # BULK DESTROY
|
|
|
-
|
|
|
- destroyed = nil
|
|
|
- not_destroyed = nil
|
|
|
- p 456
|
|
|
- p 456
|
|
|
- p 456
|
|
|
- p 456
|
|
|
- p 456
|
|
|
- unless params[:bulk_ids].blank?
|
|
|
- @objects = list_entries(@model_config, :get)
|
|
|
- unless @objects.blank?
|
|
|
-=begin
|
|
|
- processed_objects = @abstract_model.destroy(@objects)
|
|
|
- destroyed = processed_objects.select(&:destroyed?)
|
|
|
- not_destroyed = processed_objects - destroyed
|
|
|
- destroyed.each do |object|
|
|
|
- @auditing_adapter && @auditing_adapter.delete_object(object, @abstract_model, _current_user)
|
|
|
- end
|
|
|
-=end
|
|
|
- end
|
|
|
- end
|
|
|
+ register_instance_option :pjax? do
|
|
|
+ false
|
|
|
+ end
|
|
|
|
|
|
-=begin
|
|
|
- if destroyed.nil?
|
|
|
- flash[:error] = t('admin.flash.error', name: pluralize(0, @model_config.label), action: t('admin.actions.delete.done'))
|
|
|
- else
|
|
|
- flash[:success] = t('admin.flash.successful', name: pluralize(destroyed.count, @model_config.label), action: t('admin.actions.delete.done')) unless destroyed.empty?
|
|
|
- flash[:error] = t('admin.flash.error', name: pluralize(not_destroyed.count, @model_config.label), action: t('admin.actions.delete.done')) unless not_destroyed.empty?
|
|
|
+ register_instance_option :controller do
|
|
|
+ Proc.new do
|
|
|
+ require 'rest-client'
|
|
|
+ live_award = LiveAward.where("id = ? and status = ? ",@object.id,0).first
|
|
|
+ n = "发放成功"
|
|
|
+ if not live_award.blank?
|
|
|
+ n = "已成功发放"
|
|
|
+ url = "#{CONFIG_FILE["api_host"]}/railsadmin/live/award/#{@object.id}"
|
|
|
+ begin
|
|
|
+ ret = RestClient.get url, {} #per_page: 5
|
|
|
+ rescue Exception => e
|
|
|
+ n = "发放失败!"
|
|
|
end
|
|
|
-=end
|
|
|
- redirect_to back_or_index
|
|
|
end
|
|
|
+ redirect_to :back, notice: "#{n}"
|
|
|
end
|
|
|
end
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- register_instance_option :bulkable? do
|
|
|
- true
|
|
|
- end
|
|
|
end
|
|
|
end
|
|
|
end
|