Changed default sort order.
This commit is contained in:
parent
3d76ab5cd2
commit
81acdbb06a
2 changed files with 8 additions and 6 deletions
|
@ -19,13 +19,15 @@ class Index extends App.Controller
|
||||||
@ajax(
|
@ajax(
|
||||||
id: 'user_devices'
|
id: 'user_devices'
|
||||||
type: 'GET'
|
type: 'GET'
|
||||||
url: @apiPath + '/user_devices'
|
url: "#{@apiPath}/user_devices"
|
||||||
success: (data) =>
|
success: (data) =>
|
||||||
@render(data)
|
@render(data)
|
||||||
)
|
)
|
||||||
|
|
||||||
render: (data) =>
|
render: (data) =>
|
||||||
@html App.view('profile/devices')( devices: data )
|
@html App.view('profile/devices')(
|
||||||
|
devices: data
|
||||||
|
)
|
||||||
|
|
||||||
delete: (e) =>
|
delete: (e) =>
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
@ -41,10 +43,10 @@ class Index extends App.Controller
|
||||||
)
|
)
|
||||||
|
|
||||||
error: (xhr, status, error) =>
|
error: (xhr, status, error) =>
|
||||||
data = JSON.parse( xhr.responseText )
|
data = JSON.parse(xhr.responseText)
|
||||||
@notify(
|
@notify(
|
||||||
type: 'error'
|
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')
|
||||||
|
|
|
@ -4,7 +4,7 @@ class UserDevicesController < ApplicationController
|
||||||
before_action :authentication_check
|
before_action :authentication_check
|
||||||
|
|
||||||
def index
|
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_full = []
|
||||||
devices.each {|device|
|
devices.each {|device|
|
||||||
attributes = device.attributes
|
attributes = device.attributes
|
||||||
|
|
Loading…
Reference in a new issue