Sha256: 510012abb57efd9329e0ccd379209ee74dc6c6dfb788e942a1247571b897d98e

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

require_dependency 'signum/application_controller'

module Signum
  class SignalController < ApplicationController
    def show
      signal = Signum::Signal.find(signal_params[:id])
      signal.show! if signal.broadcasted?
      head :ok
    end

    def close
      signal = Signum::Signal.find(signal_params[:id])
      signal.close!
      head :ok
    end

    def close_all
      signals = Signum.config.current_user.call.signals.where.not(state: "closed")
      signals.each(&:close!)
      head :ok
    end

    private

    def signal_params
      params.require(:signal).permit(:id)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
signum-0.7.8 app/controllers/signum/signal_controller.rb