Browse Source

Merge branch 'develop' into feature/ui2

Martin Edenhofer 11 years ago
parent
commit
7ecee95998

+ 1 - 0
.gitignore

@@ -15,6 +15,7 @@
 /tmp/websocket/*
 /tmp/cache/*
 /tmp/pids/*
+/public/assets/*
 
 # Ignore .project files
 /.project

+ 2 - 2
Gemfile

@@ -1,6 +1,6 @@
 source 'http://rubygems.org'
 
-gem 'rails', '3.2.13'
+gem 'rails', '3.2.14'
 
 # preparation for rails 4
 #gem 'rails', '4.0.0.rc1'
@@ -23,7 +23,7 @@ group :assets do
 #  gem 'coffee-rails', '~> 4.0.0.rc1'
   gem 'sass-rails',   '~> 3.2.4'
   gem 'coffee-rails', '~> 3.2.2'
-  gem 'uglifier', '>= 1.2.3'
+  gem 'uglifier'
 end
 
 gem 'omniauth'

+ 1 - 1
app/assets/javascripts/app/controllers/_application_controller.js.coffee

@@ -10,7 +10,7 @@ class App.Controller extends Spine.Controller
     super
 
     # generate controllerId
-    @controllerId = 'controller-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
+    @controllerId = 'controller-' + new Date().getTime() + '-' + Math.floor( Math.random() * 999999 )
 
     # apply to release controller on dom remove
     @el.on('remove', @releaseController)

+ 1 - 1
app/assets/javascripts/app/controllers/_dashboard/ticket.js.coffee

@@ -151,7 +151,7 @@ class Settings extends App.ControllerModal
 #      { name: 'from',                     display: 'From',     tag: 'input',    type: 'text', limit: 100, null: false, class: 'span8',  },
 #      { name: 'to',                       display: 'To',          tag: 'input',    type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },
 #      { name: 'ticket_article_type_id',   display: 'Type',        tag: 'select',   multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' },
-#      { name: 'internal',                 display: 'Visability',  tag: 'radio',  default: false,  null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
+#      { name: 'internal',                 display: 'Visibility',  tag: 'radio',  default: false,  null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
       {
         name:     'per_page',
         display:  'Items per page',

+ 1 - 1
app/assets/javascripts/app/controllers/login.js.coffee

@@ -5,7 +5,7 @@ class Index extends App.ControllerContent
   constructor: ->
     super
 
-    # navigate to # if sesstion if exists
+    # navigate to # if session if exists
     if @Session.get( 'id' )
       @navigate '#'
       return

+ 0 - 1
app/assets/javascripts/app/controllers/package.js.coffee

@@ -43,7 +43,6 @@ class Index extends App.ControllerContent
     e.preventDefault()
     id = $(e.target).parents('[data-id]').data('id')
     type = $(e.target).data('type')
-    console.log 'ID', id, type
     if type is 'uninstall'
       httpType = 'DELETE'
 

+ 1 - 1
app/assets/javascripts/app/controllers/ticket_overview.js.coffee

@@ -365,7 +365,7 @@ class Settings extends App.ControllerModal
 #      { name: 'from',                     display: 'From',     tag: 'input',    type: 'text', limit: 100, null: false, class: 'span8',  },
 #      { name: 'to',                       display: 'To',          tag: 'input',    type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },
 #      { name: 'ticket_article_type_id',   display: 'Type',        tag: 'select',   multiple: false, null: true, relation: 'TicketArticleType', default: '9', class: 'medium', item_class: 'pull-left' },
-#      { name: 'internal',                 display: 'Visability',  tag: 'radio',  default: false,  null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
+#      { name: 'internal',                 display: 'Visibility',  tag: 'radio',  default: false,  null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: 'pull-left' },
       {
         name:     'per_page'
         display:  'Items per page'

+ 1 - 1
app/assets/javascripts/app/controllers/ticket_zoom.js.coffee

@@ -345,7 +345,7 @@ class Edit extends App.Controller
 
     @configure_attributes_article = [
       { name: 'ticket_article_type_id',   display: 'Type',        tag: 'select',   multiple: false, null: true, relation: 'TicketArticleType', filter: @edit_form, default: '9', translate: true, class: 'medium' },
-      { name: 'internal',                 display: 'Visability',  tag: 'select',   null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: '', default: false },
+      { name: 'internal',                 display: 'Visibility',  tag: 'select',   null: true, options: { true: 'internal', false: 'public' }, class: 'medium', item_class: '', default: false },
       { name: 'to',                       display: 'To',          tag: 'input',    type: 'text', limit: 100, null: true, class: 'span7', hide: true },
       { name: 'cc',                       display: 'Cc',          tag: 'input',    type: 'text', limit: 100, null: true, class: 'span7', hide: true },
 #      { name: 'subject',                  display: 'Subject',     tag: 'input',    type: 'text', limit: 100, null: true, class: 'span7', hide: true },

+ 6 - 1
app/assets/javascripts/app/lib/app_init/log.js.coffee

@@ -36,5 +36,10 @@ class _Singleton
       @_log( module, level, args )
 
   _log: ( module, level, args ) ->
-    console.log "App.#{module}(#{level})", args
+    if level is 'error'
+      console.error "App.#{module}(#{level})", args
+    else if level is 'debug'
+      console.debug "App.#{module}(#{level})", args
+    else
+      console.log "App.#{module}(#{level})", args
 

+ 173 - 0
app/assets/javascripts/app/lib/app_init/track.js.coffee

@@ -0,0 +1,173 @@
+class App.Track
+  _instance = undefined
+
+  @init: ->
+    _instance ?= new _trackSingleton
+
+  @log: ( area, level, args ) ->
+    if _instance == undefined
+      _instance ?= new _trackSingleton
+    _instance.log( area, level, args )
+
+  @send: ->
+    if _instance == undefined
+      _instance ?= new _trackSingleton
+    _instance.send()
+
+  @_all: ->
+    if _instance == undefined
+      _instance ?= new _trackSingleton
+    _instance._all()
+
+class _trackSingleton
+  constructor: ->
+    @trackId = 'track-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
+    @browser = App.Browser.detection()
+    @data    = []
+    @url     = 'https://portal.znuny.com/api/ui'
+#    @url     = 'api/ui'
+
+    @log( 'start', 'notice', {} )
+
+    App.Interval.set @send, 60000
+
+    # log clicks
+    $(document).bind(
+      'click'
+      (e) =>
+        w = window.screen.width
+        h = window.screen.height
+        aTag = $(e.target)
+        if !aTag.attr('href')
+          newTag = $(e.target).parents('a')
+          if newTag[0]
+            aTag = newTag
+        info =
+          level:   'notice'
+          href:    aTag.attr('href')
+          title:   aTag.attr('title')
+          text:    aTag.text()
+          clickX:  e.pageX
+          clickY:  e.pageY
+          screenX: w
+          screenY: h
+        @log( 'click', 'notice', info )
+    )
+
+    # log ajax calls
+    $(document).bind( 'ajaxComplete', ( e, request, settings ) =>
+      length = @url.length
+      if settings.url.substr(0,length) isnt @url && settings.url.substr(0,6) isnt 'api/ui'
+        level = 'notice'
+        responseText = ''
+        if request.status >= 400
+          level = 'error'
+          responseText = request.responseText
+        @log(
+          'ajax.send',
+          level,
+          {
+            type:         settings.type
+            dataType:     settings.dataType
+            async:        settings.async
+            url:          settings.url
+            data:         settings.data
+            status:       request.status
+            responseText: responseText
+          }
+        )
+    )
+
+    $(window).bind(
+      'beforeunload'
+      =>
+        @log( 'end', 'notice', {} )
+        @send(false)
+        return
+    )
+
+
+  log: ( area, level, args ) ->
+    info =
+      time:     Math.round( new Date().getTime() / 1000 )
+      area:     area
+      level:    level
+      location: window.location.href
+      data:     args
+    @data.push info
+
+  send: (async = true) =>
+    return if _.isEmpty @data
+    newData = _.clone( @data )
+    @data = []
+    newDataNew = [] 
+    for item in newData
+      try
+        itemNew = _.clone( item )
+        JSON.stringify(item)
+
+        # add browser info
+        for item, value of @browser
+          itemNew[item] = value
+        newDataNew.push itemNew
+      catch e
+        # nothing
+
+    App.Com.ajax(
+      type:   'POST'
+      url:    @url
+      async:  async
+      data:   JSON.stringify(
+        track_id: @trackId
+        log:      newDataNew
+      )
+      crossDomain: true
+#      success: (data, status, xhr) =>
+#        @data = []
+#        console.log('done')
+      error: =>
+
+        # queue all data
+        for item in newDataNew
+          @data.push item
+    )
+
+  _all: ->
+    @data
+
+`
+window.onerror = function(errorMsg, url, lineNumber) {
+  console.error(errorMsg + " - in " + url + ", line " + lineNumber);
+};
+
+(function() {
+  var console = window.console
+  if (!console) return
+  function intercept(method){
+    var original = console[method]
+    console[method] = function(){
+
+      //alert('new m' + method)
+      App.Track.log(
+        'console.' + method,
+        method,
+        arguments
+      )
+
+      // do sneaky stuff
+      if (original.apply){
+        // Do this for normal browsers
+        original.apply(console, arguments)
+      }
+      else{
+        // Do this for IE
+        var message = Array.prototype.slice.apply(arguments).join(' ')
+        original(message)
+      }
+    }
+  }
+  var methods = ['log', 'warn', 'error']
+  for (var i = 0; i < methods.length; i++)
+    intercept(methods[i])
+}).call(this);
+`

Some files were not shown because too many files changed in this diff