diff --git a/app/assets/javascripts/app/controllers/_profile/devices.coffee b/app/assets/javascripts/app/controllers/_profile/devices.coffee index 4cd832e12..e393c354a 100644 --- a/app/assets/javascripts/app/controllers/_profile/devices.coffee +++ b/app/assets/javascripts/app/controllers/_profile/devices.coffee @@ -19,13 +19,15 @@ class Index extends App.Controller @ajax( id: 'user_devices' type: 'GET' - url: @apiPath + '/user_devices' + url: "#{@apiPath}/user_devices" success: (data) => @render(data) ) render: (data) => - @html App.view('profile/devices')( devices: data ) + @html App.view('profile/devices')( + devices: data + ) delete: (e) => e.preventDefault() @@ -41,10 +43,10 @@ class Index extends App.Controller ) error: (xhr, status, error) => - data = JSON.parse( xhr.responseText ) + data = JSON.parse(xhr.responseText) @notify( type: 'error' - msg: App.i18n.translateContent( data.message ) + msg: App.i18n.translateContent(data.message) ) -App.Config.set( 'Devices', { prio: 3100, name: 'Devices', parent: '#profile', target: '#profile/devices', controller: Index }, 'NavBarProfile' ) +App.Config.set('Devices', { prio: 3100, name: 'Devices', parent: '#profile', target: '#profile/devices', controller: Index }, 'NavBarProfile') diff --git a/app/controllers/user_devices_controller.rb b/app/controllers/user_devices_controller.rb index ddebe95fc..f57f3a572 100644 --- a/app/controllers/user_devices_controller.rb +++ b/app/controllers/user_devices_controller.rb @@ -4,7 +4,7 @@ class UserDevicesController < ApplicationController before_action :authentication_check def index - devices = UserDevice.where(user_id: current_user.id).order('created_at DESC') + devices = UserDevice.where(user_id: current_user.id).order('updated_at DESC, name ASC') devices_full = [] devices.each {|device| attributes = device.attributes