Sha256: 5560c414ade430a9767674e8425455572ebd527d57642e239b85c5d1f8509faa

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 Bytes

Contents

module RademadeAdmin
  module Notifier

    def success_action
      render :json => {
        :message => 'ok'
      }
    end

    def success_insert(item)
      success_message(item, 'was inserted!', {
        :form_action => admin_update_uri(item)
      })
    end

    def success_update(item)
      success_message(item, 'data was updated!')
    end

    def success_delete(item)
      success_message(item, 'was deleted!')
    end

    def success_unlink(item)
      success_message(item, 'was unlinked from entity!')
    end

    def success_link(item)
      success_message(item, 'was linked to entity!')
    end

    def success_message(item, action_message, additional_data = {})
      render :json => {
        :data => item,
        :message => "#{item_name.capitalize} #{action_message}"
      }.merge(additional_data)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rademade_admin-0.0.1 app/services/model_controller/notifier.rb