visibility_editor.html 8.16 KB
Newer Older
1 2
<%
from django.utils.translation import ugettext as _
3 4
from openedx.core.djangoapps.credit.partition_schemes import VerificationPartitionScheme
from contentstore.utils import ancestor_has_staff_lock, get_visibility_partition_info
5

6 7 8 9 10 11
partition_info = get_visibility_partition_info(xblock)
user_partitions = partition_info["user_partitions"]
cohort_partitions = partition_info["cohort_partitions"]
verification_partitions = partition_info["verification_partitions"]
has_selected_groups = partition_info["has_selected_groups"]
selected_verified_partition_id = partition_info["selected_verified_partition_id"]
12 13 14 15 16

is_staff_locked = ancestor_has_staff_lock(xblock)
%>

<div class="modal-section visibility-summary">
17
    % if len(user_partitions) == 0:
18
        <div class="is-not-configured has-actions">
19
            <h4 class="title">${_('No content groups exist')}</h4>
20 21

            <div class="copy">
22
                <p>${_('Use content groups to give groups of students access to a specific set of course content. Create one or more content groups, and make specific components visible to them.')}</p>
23 24 25
            </div>

            <div class="actions">
26
                <a href="${manage_groups_url}" class="action action-primary action-settings">${_('Manage content groups')}</a>
27 28 29 30
            </div>
        </div>
    % elif is_staff_locked:
        <div class="summary-message summary-message-warning visibility-summary-message">
31
            <span class="icon fa fa-exclamation-triangle" aria-hidden="true"></span>
32 33 34 35 36 37 38 39 40 41
            <p class="copy">
                ## Translators: Any text between {screen_reader_start} and {screen_reader_end} is only read by screen readers and never shown in the browser.
                ${_(
                    "{screen_reader_start}Warning:{screen_reader_end} The Unit this component is contained in is hidden from students. Visibility settings here will be trumped by this."
                    ).format(
                        screen_reader_start='<span class="sr">',
                        screen_reader_end='</span>',
                    )
                }
            </p>
42 43 44 45
        </div>
    % endif
</div>

46
% if len(user_partitions) > 0:
47 48 49
    <form class="visibility-controls-form" method="post" action="">

        <div class="modal-section visibility-controls">
50
            <h3 class="modal-section-title">${_('Make visible to:')}</h3>
51 52 53 54

            <div class="modal-section-content">

                <section class="visibility-controls-primary">
55 56
                    <div class="list-fields list-radio">
                        <div class="field field-radio field-visibility-level">
57 58
                            <input type="radio" id="visibility-level-all" name="visibility-level" value="" class="input input-radio visibility-level-all" ${'checked="checked"' if not has_selected_groups else ''} />
                            <label for="visibility-level-all" class="label">${_('All Students and Staff')}</label>
59
                        </div>
60

61
                        <div class="field field-radio field-visibility-level">
62 63
                            <input type="radio" id="visibility-level-specific" name="visibility-level" value="" class="input input-radio visibility-level-specific"  ${'checked="checked"' if has_selected_groups else ''} />
                            <label for="visibility-level-specific" class="label">${_('Specific Content Groups')}</label>
64 65
                        </div>
                    </div>
66 67
                </section>

68
                <div class="wrapper-visibility-specific">
69 70 71
                    <section class="visibility-controls-secondary">
                        <div class="visibility-controls-group">
                            <h4 class="visibility-controls-title modal-subsection-title sr">${_('Content Groups')}</h4>
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
                            <div class="list-fields list-checkbox">
                            % for partition in cohort_partitions:
                                % for group in partition["groups"]:
                                    <div class="field field-checkbox field-visibility-content-group ${'was-removed' if group["deleted"] else ''}">
                                        <input type="checkbox"
                                            id="visibility-content-group-${partition["id"]}-${group["id"]}"
                                            name="visibility-content-group"
                                            value="${partition["id"]}-${group["id"]}"
                                            class="input input-checkbox"
                                            ${'checked="checked"' if group["selected"] else ''}
                                        />
                                        % if group["deleted"]:
                                            <label for="visibility-content-group-${partition["id"]}-${group["id"]}" class="label">
                                                ${_('Deleted Content Group')}
                                                <span class="note">${_('Content group no longer exists. Please choose another or allow access to All Students and staff')}</span>
                                            </label>
                                        % else:
                                            <label for="visibility-content-group-${partition["id"]}-${group["id"]}" class="label">${group["name"] | h}</label>
                                        % endif
                                    </div>
92
                                % endfor
93
                            % endfor
94

95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
                            ## Allow only one verification checkpoint to be selected at a time.
                            % if verification_partitions:
                                <div role="group" aria-labelledby="verification-access-title">
                                    <div id="verification-access-title" class="sr">${_('Verification Checkpoint')}</div>
                                    <div class="field field-checkbox field-visibility-verification">
                                        <input type="checkbox"
                                            id="verification-access-checkbox"
                                            name="verification-access-checkbox"
                                            class="input input-checkbox"
                                            value=""
                                            aria-describedby="verification-help-text"
                                            ${'checked="checked"' if selected_verified_partition_id is not None else ''}
                                        />
                                        <label for="verification-access-checkbox" class="label">
                                            ${_('Verification Checkpoint')}:
110
                                        </label>
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131

                                        <label class="sr" for="verification-access-dropdown">
                                            ${_('Verification checkpoint to complete')}
                                        </label>

                                        <select id="verification-access-dropdown">
                                            % for partition in verification_partitions:
                                            <option
                                                value="${partition["id"]}"
                                                ${ "selected" if partition["id"] == selected_verified_partition_id else ""}
                                            >${partition["name"]}</option>
                                            % endfor
                                        </select>

                                        <div class="note" id="verification-help-text">
                                            ${_("Learners who require verification must pass the selected checkpoint to see the content in this component. Learners who do not require verification see this content by default.")}
                                        </div>
                                    </div>
                                </div>
                            % endif
                            </div>
132 133 134 135 136 137 138
                        </div>
                    </section>
                </div>
            </div>
        </div>
    </form>
% endif