Commit cfcf04d0 authored by Randall Leeds's avatar Randall Leeds

Small style improvments to helpers and baseURI

To be consistent with angular style and our own in-house style
- Change baseurl to baseURI, since that is the normal DOM name for the
  concept
- Change helper to helpers (like controllers, services, etc)
- Wrap the dependency injection annotations on the baseURI factory
  function definition, rather than its use, because the annotations
  should always appear with the definition so they can be easily kept
  in sync
parent 0dcb8786
imports = [ imports = [
'bootstrap' 'bootstrap'
'ngRoute' 'ngRoute'
'h.helper'
'h.controllers' 'h.controllers'
'h.directives' 'h.directives'
'h.app_directives' 'h.app_directives'
'h.displayer' 'h.displayer'
'h.helpers'
'h.flash' 'h.flash'
'h.filters' 'h.filters'
'h.services' 'h.services'
......
...@@ -11,11 +11,11 @@ get_quote = (annotation) -> ...@@ -11,11 +11,11 @@ get_quote = (annotation) ->
class Displayer class Displayer
idTable : {} idTable : {}
this.$inject = ['$scope','$element','$timeout','baseurl', 'streamfilter'] this.$inject = ['$scope','$element','$timeout','baseURI', 'streamfilter']
constructor: ($scope, $element, $timeout, baseurl, streamfilter) -> constructor: ($scope, $element, $timeout, baseURI, streamfilter) ->
# Set streamer url # Set streamer url
init_path = document.init_path init_path = document.init_path
@path = baseurl[..-(init_path.toString().length)] + '__streamer__' @path = baseURI[..-(init_path.toString().length)] + '__streamer__'
delete document.init_path delete document.init_path
# Generate client ID # Generate client ID
...@@ -140,5 +140,5 @@ class Displayer ...@@ -140,5 +140,5 @@ class Displayer
document.init_annotation = null document.init_annotation = null
$scope.open() $scope.open()
angular.module('h.displayer',['h.streamfilter','h.filters','h.directives', 'h.helper','bootstrap']) angular.module('h.displayer',['h.streamfilter','h.filters','h.directives', 'h.helpers','bootstrap'])
.controller('DisplayerCtrl', Displayer) .controller('DisplayerCtrl', Displayer)
baseURL = ($document) ->
baseUrl = $document[0].baseURI
# Strip an empty hash and end in exactly one slash
baseUrl = baseUrl.replace /#$/, ''
baseUrl = baseUrl.replace /\/*$/, '/'
baseUrl
angular.module('h.helper', [])
.factory('baseurl', ['$document', baseURL])
\ No newline at end of file
baseURI = [
'$document'
($document) ->
# Strip an empty hash and end in exactly one slash
$document[0].baseURI.replace(/#$/, '').replace(/\/*$/, '/')
]
angular.module('h.helpers', [])
.factory('baseURI', baseURI)
...@@ -142,12 +142,12 @@ class StreamSearch ...@@ -142,12 +142,12 @@ class StreamSearch
and_or: 'and' and_or: 'and'
operator: 'ge' operator: 'ge'
this.inject = ['$element', '$location', '$scope', '$timeout', 'baseurl','streamfilter'] this.inject = ['$element', '$location', '$scope', '$timeout', 'baseURI','streamfilter']
constructor: ( constructor: (
$element, $location, $scope, $timeout, baseurl, streamfilter $element, $location, $scope, $timeout, baseURI, streamfilter
) -> ) ->
init_path = document.init_path init_path = document.init_path
$scope.path = baseurl[..-(init_path.toString().length)] + '__streamer__' $scope.path = baseURI[..-(init_path.toString().length)] + '__streamer__'
delete document.init_path delete document.init_path
$scope.empty = false $scope.empty = false
...@@ -308,5 +308,5 @@ class StreamSearch ...@@ -308,5 +308,5 @@ class StreamSearch
@search.searchBox.app.options.callbacks.search @search.searchBox.value(), @search.searchBox.app.searchQuery @search.searchBox.app.options.callbacks.search @search.searchBox.value(), @search.searchBox.app.searchQuery
,500 ,500
angular.module('h.streamsearch',['h.streamfilter','h.filters','h.directives','h.helper','bootstrap']) angular.module('h.streamsearch',['h.streamfilter','h.filters','h.directives','h.helpers','bootstrap'])
.controller('StreamSearchController', StreamSearch) .controller('StreamSearchController', StreamSearch)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment