Commit c9f84af155b3e13bf87501da6e0aa2ff6ba22eb8
1 parent
c99d0e5f
Exists in
master
and in
3 other branches
starting language selector backend
Showing
4 changed files
with
27 additions
and
7 deletions
Show diff stats
amadeus/static/js/main.js
@@ -25,4 +25,13 @@ $(function () { | @@ -25,4 +25,13 @@ $(function () { | ||
25 | $($(this).data('parent')).find('.panel-collapse.in').collapse('hide'); | 25 | $($(this).data('parent')).find('.panel-collapse.in').collapse('hide'); |
26 | $($(this).attr('href')).collapse('show'); | 26 | $($(this).attr('href')).collapse('show'); |
27 | }); | 27 | }); |
28 | -}); | ||
29 | \ No newline at end of file | 28 | \ No newline at end of file |
29 | +}); | ||
30 | + | ||
31 | +var change_language = { | ||
32 | + post: function(url, language){ | ||
33 | + $.post(url, language ,function(data){ | ||
34 | + console.log(data); | ||
35 | + }); | ||
36 | + } | ||
37 | +} | ||
38 | + |
amadeus/templates/base.html
@@ -106,13 +106,13 @@ | @@ -106,13 +106,13 @@ | ||
106 | </a> | 106 | </a> |
107 | <ul class="dropdown-menu"> | 107 | <ul class="dropdown-menu"> |
108 | <li > | 108 | <li > |
109 | - <a href="#"> | 109 | + <a href="#" class="language-item"> |
110 | <img src="{% static "img/brazilicon.png" %}" /> | 110 | <img src="{% static "img/brazilicon.png" %}" /> |
111 | - <span>{% trans "PT-BR" %}</span> | 111 | + <span>{% trans "pt_BR" %}</span> |
112 | </a> | 112 | </a> |
113 | </li> | 113 | </li> |
114 | <li> | 114 | <li> |
115 | - <a href="#"> | 115 | + <a href="#" class="language-item"> |
116 | <img src="{% static "img/euaicon.png" %}" /> | 116 | <img src="{% static "img/euaicon.png" %}" /> |
117 | <span>{% trans "EN" %}</span> | 117 | <span>{% trans "EN" %}</span> |
118 | </a> | 118 | </a> |
@@ -268,6 +268,16 @@ | @@ -268,6 +268,16 @@ | ||
268 | <script type="text/javascript">$.material.init()</script> | 268 | <script type="text/javascript">$.material.init()</script> |
269 | <script src="{% static 'js/main.js' %}"></script> | 269 | <script src="{% static 'js/main.js' %}"></script> |
270 | <script src="{% static 'js/socket.js' %}"></script> | 270 | <script src="{% static 'js/socket.js' %}"></script> |
271 | + | ||
272 | + <!-- Language selector code --> | ||
273 | + | ||
274 | + <script> | ||
275 | + $(".language-item").click(function(event) { | ||
276 | + | ||
277 | + change_language.post("{% url 'set_language' %}", ); | ||
278 | + | ||
279 | + }); | ||
280 | + </script> | ||
271 | </body> | 281 | </body> |
272 | 282 | ||
273 | </html> | 283 | </html> |
274 | \ No newline at end of file | 284 | \ No newline at end of file |
amadeus/urls.py
@@ -39,6 +39,7 @@ urlpatterns = [ | @@ -39,6 +39,7 @@ urlpatterns = [ | ||
39 | url(r'^pendencies/', include('notifications.urls', namespace = 'notifications')), | 39 | url(r'^pendencies/', include('notifications.urls', namespace = 'notifications')), |
40 | url(r'^links/', include('links.urls', namespace='links')), | 40 | url(r'^links/', include('links.urls', namespace='links')), |
41 | url(r'^pdf_files/', include('pdf_file.urls', namespace='pdf_files')), | 41 | url(r'^pdf_files/', include('pdf_file.urls', namespace='pdf_files')), |
42 | + url(r'^i18n/', include('django.conf.urls.i18n')), | ||
42 | #API | 43 | #API |
43 | url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')), | 44 | url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')), |
44 | #S3Direct | 45 | #S3Direct |
users/templates/users/login.html
@@ -85,13 +85,13 @@ | @@ -85,13 +85,13 @@ | ||
85 | </a> | 85 | </a> |
86 | <ul class="dropdown-menu"> | 86 | <ul class="dropdown-menu"> |
87 | <li class="active"> | 87 | <li class="active"> |
88 | - <a href="#"> | 88 | + <a href="#" class="language-item" value="pt_BR"> |
89 | <img src="{% static "img/brazilicon.png" %}" /> | 89 | <img src="{% static "img/brazilicon.png" %}" /> |
90 | - <span>{% trans "PT-BR" %}</span> | 90 | + <span>{% trans "pt_BR" %}</span> |
91 | </a> | 91 | </a> |
92 | </li> | 92 | </li> |
93 | <li > | 93 | <li > |
94 | - <a href="#"> | 94 | + <a href="#" class="language-item" value="EN"> |
95 | <img src="{% static "img/euaicon.png" %}" /> | 95 | <img src="{% static "img/euaicon.png" %}" /> |
96 | <span>{% trans "EN" %}</span> | 96 | <span>{% trans "EN" %}</span> |
97 | </a> | 97 | </a> |