             $ctrl.loadCustomAttributesValues()
 
         $el.on "click", ".custom-fields-header a", ->
-            collapsed = not($storage.get(collapsedHash) or false)
-            $storage.set(collapsedHash, collapsed)
+            hash = collapsedHash($attrs.type)
+            collapsed = not($storage.get(hash) or false)
+            $storage.set(hash, collapsed)
             if collapsed
                 $el.find(".custom-fields-header a").removeClass("open")
                 $el.find(".custom-fields-body").removeClass("open")

            $el.off()

    templateFn = ($el, $attrs) ->
        collapsed = $storage.get(collapsedHash) or false

        return template({
            requiredEditionPerm: $attrs.requiredEditionPerm


CustomAttributesValuesDirective = ($templates, $storage) ->
    template = $templates.get("custom-attributes/custom-attributes-values.html", true)
    collapsedHash = (type) ->
        return generateHash(["custom-attributes-collapsed", type])

    link = ($scope, $el, $attrs, $ctrls) ->
        $ctrl = $ctrls[0]
