mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
e59e8ac8e7
- Add .params to models and update controllers - Add afk time to gather - Reannotate models - Fix rspec problem by using latest rspec plugins from github
32 lines
711 B
Ruby
32 lines
711 B
Ruby
class ShoutmsgsController < ApplicationController
|
|
respond_to :html, :js
|
|
|
|
def index
|
|
@shoutmsgs = Shoutmsg.typebox
|
|
end
|
|
|
|
def show
|
|
if params[:id2]
|
|
@shoutmsgs = Shoutmsg.recent.of_object(params[:id], params[:id2]).reverse
|
|
else
|
|
@shoutmsgs = Shoutmsg.recent.box
|
|
end
|
|
end
|
|
|
|
def create
|
|
@shoutmsg = Shoutmsg.new(Shoutmsg.params(params, cuser))
|
|
@shoutmsg.user = cuser
|
|
raise AccessError unless @shoutmsg.can_create? cuser
|
|
|
|
unless @shoutmsg.save
|
|
flash[:error] = t(:invalid_message)
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
@shoutmsg = Shoutmsg.find params[:id]
|
|
raise AccessError unless @shoutmsg.can_destroy? cuser
|
|
@shoutmsg.destroy
|
|
redirect_to_back
|
|
end
|
|
end
|