_new_post.html 4 KB
Newer Older
Arjun Singh committed
1 2 3 4 5 6 7 8 9 10 11
<%def name="render_form_filter_dropdown(map)">
    % for child in map["children"]:
        % if child in map["entries"]:
            ${render_entry(map["entries"], child)}
        %else:
            ${render_category(map["subcategories"], child)}
        %endif
    %endfor
</%def>

<%def name="render_entry(entries, entry)">
12
    <li><a href="#" class="topic" data-discussion_id="${entries[entry]['id']}" cohorted = "${entries[entry]['id'] in cohorted_commentables}">${entry}</a></li>
Arjun Singh committed
13 14 15 16 17 18 19 20 21 22 23
</%def>

<%def name="render_category(categories, category)">
    <li>
        <a href="#">${category}</a>
        <ul>
            ${render_form_filter_dropdown(categories[category])}
        </ul>
    </li>
</%def>

24

25
<article class="new-post-article">
26
    <div class="inner-wrapper">
27 28
        <form class="new-post-form">
            <div class="left-column">
Arjun Singh committed
29
                <label>Create new post about:</label>
30
                <div class="form-topic-drop">
31
                    <a href="#" class="topic_dropdown_button">Show All Discussions<span class="drop-arrow"></span></a>
Arjun Singh committed
32 33
                    <div class="topic_menu_wrapper">
                        <div class="topic_menu_search">
34 35
                            <input type="text" class="form-topic-drop-search-input" placeholder="filter topics">
                        </div>
Arjun Singh committed
36
                        <ul class="topic_menu">
Arjun Singh committed
37
                            ${render_form_filter_dropdown(category_map)}
38 39 40 41
                        </ul>
                    </div>
                </div>
                <div class="options">
Arjun Singh committed
42
                    <input type="checkbox" name="follow" class="discussion-follow" class="discussion-follow" id="new-post-follow" checked><label for="new-post-follow">follow this post</label>
43
                    <br>
44
                    % if course.allow_anonymous:
45
                        <input type="checkbox" name="anonymous" class="discussion-anonymous" id="new-post-anonymous"><label for="new-post-anonymous">post anonymously</label>
46
                    %elif course.allow_anonymous_to_peers:
47 48
                        <input type="checkbox" name="anonymous_to_peers" class="discussion-anonymous-to-peers" id="new-post-anonymous-to-peers"><label for="new-post-anonymous-to-peers">post anonymously to classmates</label>
                    %endif
Your Name committed
49
                    %if is_course_cohorted and is_moderator:
50
                    <div class="form-group-label choose-cohort">
51
                        Make visible to:
52
                        <select class="group-filter-select new-post-group" name = "group_id">
53
                            <option value="">All Groups</option>
Your Name committed
54
                            %for c in cohorts:
55
                                <option value="${c.id}"
Your Name committed
56
                                %if user_cohort and str(user_cohort) == str(c.id):
Your Name committed
57
                                    selected
Your Name committed
58
                                %endif
Your Name committed
59 60
                                >${c.name}</option>
                            %endfor
61 62
                        </select>
                    </div>
63
                    %endif
64 65 66
                </div>
            </div>
            <div class="right-column">
67
                <ul class="new-post-form-errors"></ul>
68 69 70 71
                <div class="form-row">
                    <input type="text" class="new-post-title" name="title" placeholder="Title">
                </div>
                <div class="form-row">
72 73
                    <div class="new-post-body" name="body" placeholder="Enter your question or comment…"></div>
                    <!---<div class="new-post-preview"><span class="new-post-preview-label">Preview</span></div>-->
74
                </div>
75 76 77 78
                ## TODO tags commenting out til we figure out what to do w/ tags
                ##<div class="form-row">
                ##    <input type="text" class="new-post-tags" name="tags" placeholder="Tags">
                ##</div>
79 80 81 82 83
                <input type="submit" class="submit" value="Add post">
                <a href="#" class="new-post-cancel">Cancel</a>
            </div>
        </form>
    </div>
Arjun Singh committed
84
</article>