Add configuration module and adapt layout for it.
parent
05f293e7ca
commit
86ed95ac49
|
@ -2,3 +2,4 @@
|
|||
dist/
|
||||
node_modules/
|
||||
app/vendor
|
||||
config/main.coffee
|
|
@ -0,0 +1,44 @@
|
|||
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
|
||||
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
|
||||
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class ConfigService
|
||||
defaults: {
|
||||
host: "localhost:8000"
|
||||
scheme: "http"
|
||||
defaultLanguage: "en"
|
||||
debug: false
|
||||
languageOptions: {
|
||||
"es": "Spanish"
|
||||
"en": "English"
|
||||
}
|
||||
}
|
||||
|
||||
initialize: (localconfig) ->
|
||||
defaults = _.clone(@.defaults, true)
|
||||
@.config = _.merge(defaults, localconfig)
|
||||
|
||||
get: (key, defaultValue=null) ->
|
||||
return @.config[key] || defaultValue
|
||||
|
||||
|
||||
init = ($log, localconfig, config) ->
|
||||
$log.debug("Initializing configuration")
|
||||
config.initialize(localconfig)
|
||||
|
||||
module = angular.module("taigaConfig", ["taigaLocalConfig"])
|
||||
module.service("$tgConfig", ConfigService)
|
||||
module.run(["$log", "localconfig", "$tgConfig", init])
|
|
@ -43,17 +43,17 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $compil
|
|||
# $httpProvider.responseInterceptors.push('authHttpIntercept')
|
||||
|
||||
|
||||
init = ($rootScope) ->
|
||||
console.log "INIT"
|
||||
|
||||
init = ($log, $rootScope) ->
|
||||
$log.debug("Initialize application")
|
||||
|
||||
configure.$inject = ["$routeProvider", "$locationProvider","$httpProvider"]
|
||||
init.$inject = ["$rootScope"]
|
||||
init.$inject = ["$log", "$rootScope"]
|
||||
|
||||
modules = [
|
||||
"ngRoute",
|
||||
"ngAnimate",
|
||||
|
||||
"taigaConfig"
|
||||
# Taiga specific modules
|
||||
# "taigaCommon"
|
||||
]
|
|
@ -0,0 +1,7 @@
|
|||
config = {
|
||||
host: "localhost:8000"
|
||||
scheme: "http"
|
||||
debug: true
|
||||
}
|
||||
|
||||
angular.module("taigaLocalConfig", []).value("localconfig", config)
|
|
@ -32,7 +32,9 @@ var paths = {
|
|||
sassMain: "app/styles/main.scss",
|
||||
css: "dist/styles/**/*.css",
|
||||
images: "app/images/**/*",
|
||||
coffee: ["app/coffee/*.coffee", "app/coffee/**/*.coffee"]
|
||||
coffee: ["app/coffee/*.coffee",
|
||||
"config/main.coffee",
|
||||
"app/coffee/**/*.coffee"]
|
||||
};
|
||||
|
||||
// Ordered list of vendor/external libraries.
|
||||
|
|
Loading…
Reference in New Issue