angular.module('pcApp.deliberation.directives.showDiscussion', [
    'pcApp.adhocracyEmbedder.services.adhocracy',
])

.directive('showDiscussion', ['Adhocracy', function (Adhocracy) {
    return {
        restrict: 'E',
        scope: {
            path: '@'
        },
        link: function(scope, element, attrs) {
            Adhocracy.then(function (adh) {
                element.append(adh.getIframe('comment-listing', {
                    path: scope.path
                }))
            });
        }
    };
}]);

angular.module('pcApp.deliberation.directives.showDiscussion', [
    'pcApp.adhocracyEmbedder.services.adhocracy',
])

.directive('showDiscussion', ['API_CONF', 'Adhocracy', function (API_CONF, Adhocracy) {
    return {
        restrict: 'E',
        scope: {
            key: '@'
        },
        link: function(scope, element, attrs) {
            Adhocracy.then(function (adh) {
                element.append(adh.getIframe('create-or-show-comment-listing', {
                    "pool-path": API_CONF.ADHOCRACY_BACKEND_URL + '/adhocracy/',
                    key: scope.key
                }))
            });
        }
    };
}]);

Adjust show-discussion directive to actual functionality
Adjust show-discussion directive to actual functionality

This now embeds the adhocracy create-or-show-comment-listing widget,
which creates new commentables on the fly.

This can be used as the following:

    <show-discussion ng-if="metric.id" data-key="metric_{{ metric.id
}}"></show-discussion>
