Class: ServerController

Inherits:
ApplicationController show all
Defined in:
app/controllers/server_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#after_sign_in_path_for, #any_admin_user_exists?, #first_admin_user_action?

Instance Method Details

#indexObject



3
4
5
6
7
8
# File 'app/controllers/server_controller.rb', line 3

def index
  properties = Property.all_to_show
  @properties_JSON = properties.to_json
  @properties = properties.index_by(&:key)
  @properties_with_new_value = Property.all_new_values
end

#propertyObject



10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/server_controller.rb', line 10

def property
  property = Property.find params[:id]
  if property.set_value(params[:value])
    render :json => {:result => 'success'}
  else
    render :json => {:errors => property.errors.to_json}
  end
rescue
  render :json => {:errors => t('unknown_error')}
end

#updateObject



21
22
23
24
25
26
# File 'app/controllers/server_controller.rb', line 21

def update
  SystemManager.change_configuration_and_restart
  render :json => {:result => 'success'}
rescue
  render :json => {:errors => t('unknown_error')}
end