<% if (data.length) {
    var partId = data[0].ParentId;
    var groupId = data[0].GroupId;
} %>
<div id="gh-result-summary">
    <button type="button" class="btn btn-default gh-btn-secondary gh-btn-reverse gh-new-module" data-partid="<%= partId %>" data-groupid="<%= groupId %>"><i class="fa fa-plus-square"></i> New module</button>
</div>
<div id="gh-modules-list-container" data-partId="<%= partId %>">
    <ul id="gh-modules-list" class="list-group">
        <%= _.partial('admin-module-item', {
            'data': data,
            'state': state
        }) %>
    </ul>
</div>

<% var partId = state.part; %>
<% if (data.length) {
    var groupId = data[0].GroupId;
} %>
<div id="gh-result-summary">
    <button type="button" class="btn btn-default gh-btn-secondary gh-btn-reverse gh-new-module" data-partid="<%= partId %>" data-groupid="<%= groupId %>"><i class="fa fa-plus-square"></i> New module</button>
</div>
<div id="gh-modules-list-container" data-partId="<%= partId %>">
    <ul id="gh-modules-list" class="list-group">
        <%= _.partial('admin-module-item', {
            'data': data,
            'state': state
        }) %>
    </ul>
</div>

Fix issue with creating a new module in a part that didn't have any yet
Fix issue with creating a new module in a part that didn't have any yet
