summaryrefslogtreecommitdiff
path: root/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/header.html
blob: 380569851df0e542c3b08d1203875a99ef3b203d (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
{% load get_nroer_menu  get_user_group  get_group_object  get_existing_groups_excluded  get_profile_pic  get_gapps_iconbar from ndf_tags %}

{% load i18n %}
{% load cache %}

  {% get_group_object groupid as group_object %}
  <!-- <div class="contain-to-grid sticky"> -->
  <div class="row" id="top-headers">

    <!-- top LHS logo -->
    {% cache 3600 site_logo %}
    <a class="large-2 small-5 medium-5 columns drop-shadow logo" href="{{site.HOME_PAGE|default_if_none:'/home/'}}">
      <img src="{{site.LOGO}}">
    </a>
    {% endcache %}

    <!-- two menus headers -->
    <div class="large-10 small-7 medium-7 columns two-nav-container">
    
      <!-- first menu header  -->
      <nav class="top-bar drop-shadow" data-topbar role="navigation">

        <ul class="title-area">
          <li class="name"> </li>
          <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
          <li class="toggle-topbar"><a href="#"><span>{% trans "Menu" %}</span></a></li>
        </ul>

        <section class="top-bar-section">
      <!-- Left Nav Section -->

      <!-- add GSTUDIO_SITE_NAME = "NROER" in the local_settings.py file, to check locally -->
      <!-- {#% cache 3600 top_header request.LANGUAGE_CODE request.path request.user.username %} -->
      {% if site.SITE_NAME == "NROER" %} 
      
        <!-- NROER level one menu -->
        {% get_nroer_menu request group_name_tag as nroer_menu %}

        <ul class="left">

          <li>
            <!-- <a href="{#% url 'GAPPS' 'home' 'topics' %#}" {#% if nroer_menu.top_menu_selected == "Repository" %#}class="active"{#% endif %#}> -->
            <a href="{% url 'repository' 'home' %}" {% if nroer_menu.top_menu_selected == "Repository" %}class="active"{% endif %}>
              {% trans "Repository" %}
            </a>
          </li>

          {% for each_menu in nroer_menu.top_menus %}
            {% for menuk, menuv in each_menu.items %}

            <li class="has-dropdown">
	      
              <a {% if nroer_menu.top_menu_selected == menuk %}class="active"{% endif %}
              	 href="{% url 'nroer_groups' 'home' menuk %}" 
              > {{menuk}} </a>
              <ul class="dropdown">
	
                {% for each_sub_menu in menuv %}
                <li>
                  <a 
                  {% for mapk, mapv in nroer_menu.mapping.items %}

                    {% if mapv in "Teachers, Schools, Interest Groups" %}
                      {% if each_sub_menu == mapk %}
                        href="/{{mapv}}"
                        {% if nroer_menu.sub_menu_selected == mapk %}
                          class="active" 
                        {% endif %}
                      {% endif %}
          		      {% endif %}

                    {% if each_sub_menu == mapk %}
                      href="{% url 'partnerlist' mapv %}"
                      {% if nroer_menu.sub_menu_selected == mapk %}
                        class="active" 
                      {% endif %}
                    {% endif %}
                  {% endfor %}
                  >{{each_sub_menu}}
                  </a>
                </li>
                {% endfor %}
              </ul>
            </li>

            {% endfor %}
          {% endfor %}

        </ul>
        <!-- -END of NROER level one menu -->
      {% else %}
      <ul class="left">

        <!-- Current group selector -->
        <li class="has-dropdown group">
          <a title="{{group_object.name|default:' -- '}}" class="active" href="{% url 'groupchange' group_object.name %}">
            {{group_object.name|truncatechars:20}}
          </a>
          
          <!-- If logged in show user groups -->
          {% if user.is_authenticated %}
          {% get_user_group request.user group_object.name as groups %}

          {% else %}  
          {% get_existing_groups_excluded group_object.name as groups %}

          {% endif %} 

          <!-- dropdown for group's -->
          <ul class="dropdown">
            
            {% if groups == "None" %}
              <li id="{{gp_id}}">
                <a class="group" href="{% url 'groupchange' 'None' %}">{{gp_id}}</a>
              </li>

            {% else %}
              {% for group_node in groups|slice:":10" %}
                <li id="{{group_node}}">
                {% if "Author" in group_node.member_of_names_list %}
                <a data-tooltip aria-haspopup="true" class="has-tip tip-right" title="{{group_node.name|default:' -- '}}" class="group" href="{% url 'dashboard' request.user.pk %}">
                  {{group_node.name|truncatechars:20}} (User group)
                </a>
                {% else %}
                <a data-tooltip aria-haspopup="true" class="has-tip tip-right" title="{{group_node.name|default:' -- '}}" class="group" href="{% url 'groupchange' group_node.name %}">
                  {{group_node.name|truncatechars:20}}
                </a>
                {% endif %}
                </li>
              {% endfor %}  
            {% endif %} 

            <li id="more_groups">
              <a class="group" href="{% url 'group' 'home' %}">{% trans "See more groups..." %}</a>
            </li>
          </ul>
          <!-- END of dropdown for group's -->

        </li>

      </ul>
      {% endif %}
      <!-- {#% endcache %} -->

      <!-- Closes Left Nav section -->

       <!-- Right Nav Section -->
      <ul class="right">

      <!-- Language selector--> 
      <li class="has-form"> 
        <a href="#" class="rounded language button"  data-reveal-id="languageModal">{{request.LANGUAGE_CODE}}</a>  

          <div id="languageModal" class="small reveal-modal" data-reveal> 
              
            <h3>{% trans "Preferred language" %}</h3> 
            <form action="/i18n/setlang/" method="POST">
              {% csrf_token %}
              <!-- <input name="next" type="hidden" value="/pref_lang/?url={{request.path}}&group_id={{group_id}}&appid={{appId}}"/> -->
              <input name="url" type="hidden" value="{{request.get_full_path}}"/>

              <select name="language" id="lan">
                {% for lang in LANGUAGES %}
                <option value="{{ lang.0 }}">{{ lang.1 }}</option>
                {% endfor %}
              </select>
              <input type="submit" class="button" value='{% trans "Set Language" %}' />
                  <a class="close-reveal-modal">&#215;</a>
            </form>

            {% comment %}       
            <!--                       {% get_languages as lan %} -->
            <!--                   <select id="pref">{% for each in lan %}<option id="{{each}}" value="{{each}}">{{each}}</option>{% endfor %}</select>     -->
            <!--                   <h3>Secondary language</h3> -->
            <!--                   <select id="fallback">{% for each in lan %}<option id="{{each}}" value="{{each}}">{{each}}</option>{% endfor %}</select>       -->
            <!--                   <input type="button" id="savepref" value="Save Settings" class="small button" onclick="$('a.close-reveal-modal').trigger('click');"/> -->
            <!--                   <a class="close-reveal-modal">&#215;</a> -->
            {% endcomment %}

          </div> 
        </li>
        <!-- end of language selector -->

        <!-- If logged in show user options -->
        {% if user.is_authenticated %}
        <li class="has-dropdown">

          {% cache 300 profile_pic request.user.pk %}
          {% get_profile_pic request.user.pk as prof_pic %}

          {% if prof_pic %}
          <a href="{% url 'dashboard' request.user.pk %}">
            <img src="{% url 'getFileThumbnail' group_object prof_pic.pk %}" id="profile-img">
            {{ user.username }}
          </a>
          
          {% else %}
          <a class="user" href="{% url 'dashboard' request.user.pk %}">
            {{ user.username }}
          </a>
          {% endif %}
          {% endcache %}
          
          <ul class="dropdown text-center">
                
            <li class="text-center">
              <a href="{% url 'auth_password_change' %}">{% trans "Change Password" %}</a>
            </li>
            {% if user.is_superuser %}
              <li class="text-center">
                <a href="/admin/data">{% trans "Admin Data" %}</a>
              </li>
              <li class="text-center">
                <a href="/admin/designer">{% trans "Admin Designer" %}</a>
              </li>
              {% if site.SITE_NAME == "NROER" %} 
                <li class="text-center">
                  <a href="/home/">{% trans "Home Dashboard" %}</a>
                </li>
              {% endif %}
            {% endif %}
            <li>
              <a class="logout" href="{% url 'auth_logout' %}">
                <i class="fi-power"></i> &nbsp;{% trans "Logout" %}
              </a>
            </li>
          </ul>
        </li>

        <!-- Else show login link -->
        {% else %}
        <!-- 
        check_accounts_url:
          If accounts related url exists in path, then returns True; otherwise False

        Required only for:
          If path is other than accounts then only append it for redirection after login
          Otherwise it will get into unending loop i.e. as soon as logs-in it gets logged-out
          as redirection-url was of logout; similar case with password-reset!
        -->
        
        <li class="has-form">
          <a class="button" href="{% url 'auth_login' %}{% if not is_ac_url %}?next={{request.path}}{% endif %}" accesskey="l">
            <i class="fi-key"></i> {% trans "Login" %}
          </a>
        </li>
        {% endif %}
        </ul>  
        <!-- Closes Right Nav section -->

        </section>

      </nav>
      <!-- closing of first nav -->

      <!-- =========| divider between two nav's/header's |=========== -->
      <!-- start of second nav  or group level header-->
      <div class="contain-to-grid {% if request.path != '/welcome' %}{% if group_object.edit_policy != 'EDITABLE_MODERATED' %}{% if not is_ac_url %}sticky{% endif %}{% endif %}{% endif %} drop-shadow" id="group-level-header">

        <nav class="top-bar" data-topbar data-options="sticky_on: large" role="navigation">
        <!-- don't show this app bar for groups with editable moderated -->
        {% if "ModeratingGroup" not in group_object.member_of_names_list %}
        {% if not is_ac_url %}
        {% if request.path != "/welcome" %}
          <!-- #{#% cache 3600 group_header request.LANGUAGE_CODE request.path request.user.username %} -->
          <ul class="title-area">
            <li class="name">
              <h1><a href="{{site.HOME_PAGE|default_if_none:'/home/'}}"><i class="fi-home"></i></a></h1>
              <!-- <i class="fi-home"></i> -->
            </li>
            <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
            <li class="toggle-topbar menu-icon"><a href="#"><span>{% trans "APPS" %}</span></a></li>
          </ul>

          <section class="top-bar-section">
            <!-- Right Nav Section -->

            <ul class="right" id="group-search-update">
              <!-- update/about of group -->
              <li class="">
                {% if group_name_tag %}
                
                  {% if not "/partner/" in request.path %}
                  <!-- while listing the partners and/or groups cards dont show any text -->
                    {% if "/dashboard/group" in request.path %}
                      <a title="About - {{ group_object.name }}" href="{% url 'groupchange' group_object.name %}">
                        <i class="fi-record"></i> {% trans "About" %}
                      </a>
                    {% else %}
                      <a title="Find Latest Updates in {{ group_object.name }}" href="{% url 'group_dashboard' group_object.name %}">
                        <i class="fi-results"></i> {% trans "Updates" %}
                      </a>
                    {% endif %}
                  {% endif %}

                {% endif %}
              </li>
              <!-- END of update/about of group -->

              <!-- search in the app bar -->
              <li class="has-form">
                <form {% if groupid %} action="{% url 'results' groupid %}" {% else %} action="" {% endif %}
                  name="search_form" method="GET" >
                  <div class="row collapse">
                    <div class="large-9 small-10 columns">
                      <input type="text" name="search_text" id="search_text" placeholder='{% trans "Search" %} {{group_object.name}}' autocomplete="off" required/>
                    </div>
                    <div class="large-3 small-2 columns">
                      <button type="submit" class="tiny button" value="" ><i class="fi-magnifying-glass"></i></button>
                    </div>
                  </div>
                </form>
              </li>
              <!-- END of search in the app bar -->

              <!-- <li class="has-dropdown">
                <a href="#">Right Button Dropdown</a>
                <ul class="dropdown">
                  <li><a href="#">First link in dropdown</a></li>
                  <li class="active"><a href="#">Active link in dropdown</a></li>
                </ul>
              </li> -->
            </ul>

            <ul class="left" id="group-apps">
              <!-- add GSTUDIO_SITE_NAME = "NROER" in the local_settings.py file, to check locally -->
              {% if site.SITE_NAME == "NROER" %} 
              
                {% if group_name_tag == "home" %}
                <!-- NROER level-two menu -->
                  {% if request.path|length > 6 and "repository" not in request.path %}
                    {% if "/partner/" not in request.path %}
                    <!-- <ul class="button-group nroer-menu"> -->
                    <li class="divider"></li>
                    {% for each_gapp in nroer_menu.gapps %}
                      {% for k, v in each_gapp.items %}
                        <li {% if v == nroer_menu.selected_gapp %}class="active"{% endif %}>
                          <!-- <a class="button" {#% if v %#} href="{#% url 'GAPPS' group_name_tag v %#}" {#% endif %#}> -->
                          <a class="" {% if v %} href="{% url v group_name_tag %}" {% endif %}>
                            {{k}}
                          </a>
                        </li>
                      {% endfor %}
                    {% endfor %}
                    <!-- </ul> -->
                  {% endif %}
                  {% endif %}
                {% else %}
                  {% get_gapps_iconbar request groupid %}
                {% endif %}
              <!-- END of NROER level two menu -->
              {% else %}
                {% get_gapps_iconbar request groupid %}
              {% endif %}
            </ul>

          </section>
          <!-- {#% endcache %} -->
        {% endif %} <!-- end of "/welcome" landing page check -->
        {% endif %} <!-- end of "accounts" urls check -->
        </nav>

        {% endif %} <!-- end of "group's edit_policy" urls check -->
      </div>

      <!-- end of second nav -->

    </div>
    <!-- end of section appointed for two header's -->
  </div>
  <!-- end of LOGO + top header's -->