Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/app/templates/_context-solution-list.html
blob: 9d1584b90cdcb5dc22221bd9dcce766b5544da4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
                <div>
                    <div class="icon-column">
                        <img src="/static/icons/sugar-xo.png"/>
                        <br/>
                        <img class="resource-button" src="/static/icons/button-{{resource['type']|special_str}}.png"/>
                    </div>
                    <div class="resource-header-column">
                        <div class="resource-title">
                        {{resource['title']|safe}}
                        </div>
                        <div class="resource-content">
                        <pre>{{resource['content']|safe}}</pre>
                        </div>
                        <div class='mtime'>{{_('by %(author)s on %(date)s', author=resource['author'][0], date=resource['mtime']|timedelta)}}
                        </div>
                        <div class="resource-meta">
                        {%- for tag in resource['tags'] %}
                            <span class="tag">{{tag}}</span>
                        {%- endfor %}
                        </div>
                        {%- if userid in resource['user'] -%}
                        <span class="edit-button" 
                            onclick="edit_resource( {{resource_type|tojson}},
                                                    {{resource["guid"]|tojson}},
                                                    {{resource["content"]|tojson}}, 
                                                    {{resource["title"]|tojson}} )">
                            <img src="/static/icons/toolbar-edit.png" />
                        </span>
                        {%- endif -%}
                        <span class="comments-button" 
                            id="comments-button-{{resource['guid']}}" 
                            data-guid="{{resource['guid']}}">
                            <img src="/static/icons/comments.png" />
                        </span>
                        <img class="resource-throbber" id="throbber_{{resource['guid']}}" src="/static/images/throbber4.gif" />
                        <div class="comments" id="comments-{{resource['guid']}}"></div>
                    </div>
                </div>
                <hr />
                <ul class='generic-list'>
                {%- if not result %}
                <div class="notice">{{_('No %(resource)s have been shared yet for this context.<br><br>Be the first to share with the community!', resource=resource_label )}}
                </div>
                {%- endif %}
                {%- for item in result %}
                <li class="resource-list">
                    <div class="solution-content-column">
                        <img class="watermark" src="/static/icons/dialog-ok.png"/>
                        <div class="resource-content">
                        {{item['content']|safe}}
                        </div>
                        <div class='mtime'>
                        {{_('by %(author)s on %(date)s', author=item['author'][0], date=item['mtime']|timedelta)}}
                        </div>
                        <div class="resource-meta">
                        {%- for tag in item['tags'] %}
                            <span class="tag">{{tag}}</span>
                        {%- endfor %}
                        </div>
                        {%- if userid in item['user'] -%}
                        <span class="comments-button" 
                            onclick="edit_resource('solution',
                                            {{item["guid"]|tojson}},
                                            {{item["content"]|tojson}},
                                            false)">
                            <img src="/static/icons/toolbar-edit.png">
                            </img>
                            </span>
                        {%- endif -%}
                        <span class="comments-button" 
                            id="comments-button-{{item['guid']}}" 
                            data-guid="{{item['guid']}}">
                            <img src="/static/icons/comments.png" />
                        </span>
                        <img class="resource-throbber" id="throbber_{{item['guid']}}" src="/static/images/throbber4.gif" />
                        <div class="comments" id="comments-{{item['guid']}}"></div>
                    </div>
                    <div class="icon-column">
                        <img src="/static/icons/sugar-xo.png"/>
                    </div>
                </li>
                {%- endfor %}
                </ul>
                <hr />
                <form id="solution-form" method="POST" data-guid="{{resource['guid']}}" action="/submit_solution">
                    <input type="hidden" name="resource_guid" value="{{resource['guid']}}" /> 
                    <input type="hidden" name="resource_type" value="{{resource_type}}" /> 
        {%- if (session['connected'] or False) -%}
                    <textarea id="textarea-solution" name="solution"></textarea>
                    <br />
                    <input id="contribute-button" class="sugar-button" type="submit" value="{{_('contribute a solution')}}" />
        {%- else -%}
                    <textarea id="textarea-solution" name="solution" disabled></textarea>
                    <br />
                    <input id="contribute-button" class="sugar-button" type="submit" value="{{_('can\'t contribute in offline mode yet')}}" disabled />
        {%- endif -%}
                </form>