app/controllers/bigbluebutton/servers_controller.rb in bigbluebutton_rails-2.2.0 vs app/controllers/bigbluebutton/servers_controller.rb in bigbluebutton_rails-2.3.0
- old
+ new
@@ -1,10 +1,9 @@
class Bigbluebutton::ServersController < ApplicationController
include BigbluebuttonRails::InternalControllerMethods
respond_to :html
- respond_to :json, :only => [:index, :show, :new, :create, :update, :destroy, :activity, :rooms]
before_filter :find_server, :except => [:index, :new, :create]
def index
@servers ||= BigbluebuttonServer.all
respond_with(@servers)
@@ -45,18 +44,12 @@
# we return/render the fetched meetings even in case of error
# but we set the error message in the response
if error
flash[:error] = message
format.html { render :activity }
- format.json {
- array = @server.meetings
- array.insert(0, { :message => message })
- render :json => array, :status => :error
- }
else
format.html
- format.json
end
end
end
def create
@@ -66,14 +59,12 @@
if @server.save
format.html {
message = t('bigbluebutton_rails.servers.notice.create.success')
redirect_to_using_params @server, :notice => message
}
- format.json { render :json => @server, :status => :created }
else
format.html { redirect_to_params_or_render :new }
- format.json { render :json => @server.errors.full_messages, :status => :unprocessable_entity }
end
end
end
def update
@@ -81,25 +72,22 @@
if @server.update_attributes(server_params)
format.html {
message = t('bigbluebutton_rails.servers.notice.update.success')
redirect_to_using_params @server, :notice => message
}
- format.json { render :json => true, :status => :ok }
else
format.html { redirect_to_params_or_render :edit }
- format.json { render :json => @server.errors.full_messages, :status => :unprocessable_entity }
end
end
end
def destroy
# TODO: what if it fails?
@server.destroy
respond_with do |format|
format.html { redirect_to_using_params bigbluebutton_servers_url }
- format.json { render :json => true, :status => :ok }
end
end
def recordings
@recordings ||= @server.recordings
@@ -172,18 +160,16 @@
else
message = t('bigbluebutton_rails.servers.notice.unpublish_recordings.success')
end
redirect_to_using_params recordings_bigbluebutton_server_path(@server), :notice => message
}
- format.json { render :json => message }
end
rescue BigBlueButton::BigBlueButtonException => e
respond_with do |format|
format.html {
flash[:error] = e.to_s[0..200]
redirect_to_using_params recordings_bigbluebutton_server_path(@server)
}
- format.json { render :json => e.to_s, :status => :error }
end
end
end
def server_params