Method: Effective::Resources::Controller#resource_klass_actions

Defined in:
app/models/effective/resources/controller.rb

#resource_klass_actionsObject

This is the fallback for render_resource_actions when no actions are specified, but a class is given Used by Datatables new



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'app/models/effective/resources/controller.rb', line 121

def resource_klass_actions
  human_index = EffectiveResources.et("effective_resources.actions.index")
  human_new = EffectiveResources.et("effective_resources.actions.new")

  {}.tap do |buttons|
    if collection_get_actions.find { |a| a == :index }
      buttons["#{human_index} #{human_plural_name}"] = { action: :index, default: true }
    end

    if collection_get_actions.find { |a| a == :new }
      buttons["#{human_new} #{human_name}"] = { action: :new, default: true }
    end

    (collection_get_actions - crud_actions).each do |action|
      buttons[human_action_name(action)] = { action: action, default: true }
    end
  end
end