%page expression_filter="h" args="section_data"/>
<%namespace name='static' file='../../static_content.html'/>
<%!
from django.utils.translation import ugettext as _
from openedx.core.djangolib.js_utils import js_escaped_string, dump_js_escaped_json
from courseware.courses import get_studio_url
from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition
%>
<%block name="js_extra">
<%static:require_module module_name="js/groups/views/cohorts_dashboard_factory" class_name="CohortsFactory">
<%
cohorted_user_partition = get_cohorted_user_partition(course)
content_groups = cohorted_user_partition.groups if cohorted_user_partition else []
%>
var cohortUserPartitionId = ${cohorted_user_partition.id if cohorted_user_partition else None | n, dump_js_escaped_json},
contentGroups = [
% for content_group in content_groups:
{
id: ${content_group.id | n, dump_js_escaped_json},
name: "${content_group.name | n, js_escaped_string}",
user_partition_id: cohortUserPartitionId
},
% endfor
];
CohortsFactory(contentGroups, "${get_studio_url(course, 'group_configurations') | n, js_escaped_string}");
%static:require_module>
%block>