 # limitations under the License.
 
 class KanbanController extends TaigaPageController
-    @.$inject = ['$scope', '$rootScope', '$routeParams', '$q', 'resource',
-               '$data','$modal', "$model", "$i18next", "$favico"]
+    @.$inject = ["$scope", "$rootScope", "$routeParams", "$q", "resource",
+               "$data","$modal", "$model", "$i18next", "$favico"]
 
     constructor: (@scope, @rootScope, @routeParams, @q, @rs, @data, @modal, @model, @i18next, @favico) ->
         super(scope, rootScope, favico)
 
-    section: 'kanban'
+    section: "kanban"
     getTitle: ->
-        @i18next.t('common.kanban')
+        @i18next.t("common.kanban")
 
     initialize: ->
         @rootScope.pageBreadcrumb = [
             ["", ""],
-            [@i18next.t('common.kanban'), null]
+            [@i18next.t("common.kanban"), null]
         ]
 
         @rs.resolve(pslug: @routeParams.pslug).then (data) =>

        hash = hex_sha1(option.text.trim().toLowerCase())
        color = hash
            .substring(0,6)
            .replace('8','0')
            .replace('9','1')
            .replace('a','2')
            .replace('b','3')
            .replace('c','4')
            .replace('d','5')
            .replace('e','6')
            .replace('f','7')

        container.parent().css('background', "##{color}")
        container.text(option.text)
        return


class KanbanUsController extends TaigaBaseController
    @.$inject = ['$scope', '$rootScope', '$q', "$location"]

    constructor: (@scope, @rootScope, @q, @location) ->
        super(scope)

            return us

        result = {}
        result["project"] = @scope.projectId
        result["status"] = status or @scope.project.default_us_status
        points = {}
        for role in @scope.constants.computableRolesList
            points[role.id] = @scope.project.default_points
        result["points"] = points
        return result

    openCreateUsForm: (statusId) ->
        promise = @modal.open("us-form", {"us": @initializeUsForm(null, statusId), "type": "create"})
        promise.then (us) =>
            newUs = @model.make_model("userstories", us)
            @scope.userstories.push(newUs)
            @formatUserStories()

    openEditUsForm: (us) ->
        promise = @modal.open("us-form", {"us": us, "type": "edit"})
        promise.then =>
            @formatUserStories()

