Changed default sort order.

This commit is contained in:
Martin Edenhofer 2016-03-25 08:19:59 +01:00
parent 3d76ab5cd2
commit 81acdbb06a
2 changed files with 8 additions and 6 deletions

View file

@ -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')

View file

@ -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