Added config option for browser tracking and browser storage.

This commit is contained in:
Martin Edenhofer 2014-07-28 09:36:05 +02:00
parent a937196a49
commit 202269bb58
7 changed files with 114 additions and 12 deletions

View file

@ -311,7 +311,6 @@ class App.ControllerNavSidbar extends App.ControllerContent
group.items = _.sortBy( itemsUnsorted, (item) -> return item.prio )
# set active item
selectedItem = undefined
for group in @groupsSorted
@ -328,11 +327,6 @@ class App.ControllerNavSidbar extends App.ControllerContent
@render(selectedItem)
if selectedItem
new selectedItem.controller(
el: @el.find('.main')
)
@bind(
'ui:rerender'
=>
@ -349,6 +343,10 @@ class App.ControllerNavSidbar extends App.ControllerContent
@el.find('li').removeClass('active')
@el.find('a[href="' + selectedItem.target + '"]').parent().addClass('active')
new selectedItem.controller(
el: @el.find('.main')
)
class App.GenericHistory extends App.ControllerModal
events:
'click [data-type=sortorder]': 'sortorder',

View file

@ -10,11 +10,11 @@ class App.SettingsArea extends App.Controller
render: =>
settings = App.Setting.all()
html = $('<div></div>')
for setting in settings
if setting.area is @area
item = new App.SettingsAreaItem( setting: setting )
item = new App.SettingsAreaItem( setting: setting )
html.append( item.el )
@html html
@ -67,10 +67,12 @@ class App.SettingsAreaItem extends App.Controller
state = {
value: params
}
#App.Config.set((@setting.name, params)
else
state = {
value: directData
}
#App.Config.set(@setting.name, directData)
@setting['state'] = state
ui = @
@ -83,6 +85,7 @@ class App.SettingsAreaItem extends App.Controller
timeout: 1500
}
ui.render()
#App.Event.trigger( 'ui:rerender' )
# login check
# App.Auth.loginCheck()
App.Auth.loginCheck()
)

View file

@ -10,6 +10,7 @@ class System extends App.ControllerTabs
# { name: 'Log', 'target': 'log', controller: App.SettingsSystem, params: { area: 'System::Log' } },
{ name: 'Storage', 'target': 'storage', controller: App.SettingsArea, params: { area: 'System::Storage' } },
{ name: 'Geo Services', 'target': 'geo', controller: App.SettingsArea, params: { area: 'System::Geo' } },
{ name: 'Frontend', 'target': 'ui', controller: App.SettingsArea, params: { area: 'System::UI' } },
]
# render page

View file

@ -89,8 +89,8 @@ class _trackSingleton
return
)
log: ( area, level, args ) ->
return if !App.Config.get('ui_send_client_stats')
info =
time: Math.round( new Date().getTime() / 1000 )
area: area
@ -100,10 +100,11 @@ class _trackSingleton
@data.push info
send: (async = true) =>
return if !App.Config.get('ui_send_client_stats')
return if _.isEmpty @data
newData = _.clone( @data )
@data = []
newDataNew = []
newDataNew = []
for item in newData
try
itemNew = _.clone( item )

View file

@ -46,6 +46,7 @@ class _storeSingleton
write: (key, value) ->
@store[key] = value
return if !@support
return if !App.Config.get('ui_client_storage')
try
sessionStorage.setItem( key, JSON.stringify( value ) )
catch e
@ -56,6 +57,7 @@ class _storeSingleton
# get item
get: (key) ->
return @store[key] if !@support
return @store[key] if !App.Config.get('ui_client_storage')
value = sessionStorage.getItem( key )
return if !value
object = JSON.parse( value )
@ -65,6 +67,7 @@ class _storeSingleton
delete: (key) ->
delete @store[key]
return if !@support
return if !App.Config.get('ui_client_storage')
sessionStorage.removeItem( key )
# clear local storage
@ -75,7 +78,7 @@ class _storeSingleton
# return list of all keys
list: ->
list = []
if !@support
if !@support || !App.Config.get('ui_client_storage')
for key of @store
list.push key
return list

View file

@ -0,0 +1,51 @@
class UpdateSetting1 < ActiveRecord::Migration
def up
Setting.create_if_not_exists(
:title => 'Send client stats.',
:name => 'ui_send_client_stats',
:area => 'System::UI',
:description => 'Send client stats to central server.',
:options => {
:form => [
{
:display => '',
:null => true,
:name => 'ui_send_client_stats',
:tag => 'boolean',
:options => {
true => 'yes',
false => 'no',
},
},
],
},
:state => true,
:frontend => true
)
Setting.create_if_not_exists(
:title => 'Client storage.',
:name => 'ui_client_storage',
:area => 'System::UI',
:description => 'Use client storage to cache data to perform speed of application.',
:options => {
:form => [
{
:display => '',
:null => true,
:name => 'ui_client_storage',
:tag => 'boolean',
:options => {
true => 'yes',
false => 'no',
},
},
],
},
:state => false,
:frontend => true
)
end
def down
end
end

View file

@ -178,6 +178,51 @@ Setting.create_if_not_exists(
:frontend => false
)
Setting.create_if_not_exists(
:title => 'Send client stats.',
:name => 'ui_send_client_stats',
:area => 'System::UI',
:description => 'Send client stats to central server.',
:options => {
:form => [
{
:display => '',
:null => true,
:name => 'ui_send_client_stats',
:tag => 'boolean',
:options => {
true => 'yes',
false => 'no',
},
},
],
},
:state => true,
:frontend => true
)
Setting.create_if_not_exists(
:title => 'Client storage.',
:name => 'ui_client_storage',
:area => 'System::UI',
:description => 'Use client storage to cache data to perform speed of application.',
:options => {
:form => [
{
:display => '',
:null => true,
:name => 'ui_client_storage',
:tag => 'boolean',
:options => {
true => 'yes',
false => 'no',
},
},
],
},
:state => false,
:frontend => true
)
Setting.create_if_not_exists(
:title => 'New User Accounts',
:name => 'user_create_account',