Commit 51979feec67ccd9899c3d7cc7b65e4c83a7a0c63
1 parent
11fb6a7b
Exists in
master
and in
3 other branches
modified course.js to category.js and where it's imported
Showing
8 changed files
with
212 additions
and
212 deletions
Show diff stats
@@ -0,0 +1,206 @@ | @@ -0,0 +1,206 @@ | ||
1 | +var locale = navigator.language || navigator.userLanguage; | ||
2 | + | ||
3 | +$('.date-picker').datepicker({ | ||
4 | + language: locale, | ||
5 | +}); | ||
6 | + | ||
7 | +/* | ||
8 | +* | ||
9 | +* Function to get a cookie stored on browser | ||
10 | +* | ||
11 | +*/ | ||
12 | +function getCookie(name) { | ||
13 | + var cookieValue = null; | ||
14 | + if (document.cookie && document.cookie !== '') { | ||
15 | + var cookies = document.cookie.split(';'); | ||
16 | + for (var i = 0; i < cookies.length; i++) { | ||
17 | + var cookie = jQuery.trim(cookies[i]); | ||
18 | + // Does this cookie string begin with the name we want? | ||
19 | + if (cookie.substring(0, name.length + 1) === (name + '=')) { | ||
20 | + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); | ||
21 | + break; | ||
22 | + } | ||
23 | + } | ||
24 | + } | ||
25 | + return cookieValue; | ||
26 | +} | ||
27 | +/* | ||
28 | +* | ||
29 | +* Function to subscribe (works for courses and subjects) | ||
30 | +* | ||
31 | +*/ | ||
32 | +function subscribe(elem, url, id, confirm_message) { | ||
33 | + alertify.confirm(confirm_message, function(){ | ||
34 | + $.ajax({ | ||
35 | + dataType: "json", | ||
36 | + url: url, | ||
37 | + success: function (data) { | ||
38 | + if (data.status == "ok") { | ||
39 | + elem.remove(); | ||
40 | + alertify.success(data.message); | ||
41 | + $(".panel_"+id).find(".view_btn").show() | ||
42 | + } else { | ||
43 | + alertify.error(data.message); | ||
44 | + } | ||
45 | + } | ||
46 | + }); | ||
47 | + }); | ||
48 | +} | ||
49 | + | ||
50 | +/* | ||
51 | +* | ||
52 | +* Function to delete a course | ||
53 | +* | ||
54 | +*/ | ||
55 | + | ||
56 | +var RemoveCourse = { | ||
57 | + remove: function(url,dados,id_li_link){ | ||
58 | + $('#category').modal().hide(); | ||
59 | + $.post(url,dados, function(data){ | ||
60 | + $(id_li_link).remove(); | ||
61 | + // alert("certo"); | ||
62 | + $('body').removeClass('modal-open'); | ||
63 | + $("#modal_course").empty(); | ||
64 | + $(".modal-backdrop.in").remove(); | ||
65 | + alertify.success("Course removed successfully!"); | ||
66 | + // setTimeout(function () { location.reload(1); }, 1); | ||
67 | + }).fail(function(){ | ||
68 | + $("#modal_course").empty(); | ||
69 | + $("#modal_course").append(data); | ||
70 | + $('#course').modal('show'); | ||
71 | + }); | ||
72 | + } | ||
73 | +} | ||
74 | + | ||
75 | +var delete_course = { | ||
76 | + get: function (url, id_modal, id_div_modal){ | ||
77 | + $.get(url, function(data){ | ||
78 | + if($(id_modal).length){ | ||
79 | + $(id_div_modal).empty(); | ||
80 | + $(id_div_modal).append(data); | ||
81 | + } else { | ||
82 | + $(id_div_modal).append(data); | ||
83 | + } | ||
84 | + $(id_modal).modal('show'); | ||
85 | + }); | ||
86 | + } | ||
87 | +}; | ||
88 | + | ||
89 | +/* | ||
90 | +* | ||
91 | +* Function to load create course's form | ||
92 | +* | ||
93 | +*/ | ||
94 | +function replicate_course(url, course) { | ||
95 | + $.ajax({ | ||
96 | + url: url, | ||
97 | + data: {'form': course}, | ||
98 | + success: function(data) { | ||
99 | + $(".course_replicate_form").html(data); | ||
100 | + } | ||
101 | + }); | ||
102 | +} | ||
103 | + | ||
104 | +/* | ||
105 | +* | ||
106 | +* Functions to control category marker | ||
107 | +* | ||
108 | +*/ | ||
109 | +$('.collapse').on('show.bs.collapse', function (e) { | ||
110 | + if($(this).is(e.target)){ | ||
111 | + var btn = $(this).parent().find('.fa-angle-right'); | ||
112 | + | ||
113 | + btn = btn[0]; | ||
114 | + | ||
115 | + $(btn).switchClass("fa-angle-right", "fa-angle-down", 250, "easeInOutQuad"); | ||
116 | + | ||
117 | + var url = $(this).parent().find('.log_url').val(); | ||
118 | + var log_input = $(this).parent().find('.log_id'); | ||
119 | + | ||
120 | + if (typeof(url) != 'undefined') { | ||
121 | + $.ajax({ | ||
122 | + url: url, | ||
123 | + data: {'action': 'open'}, | ||
124 | + dataType: 'json', | ||
125 | + success: function (data) { | ||
126 | + log_input.val(data.log_id); | ||
127 | + }, | ||
128 | + error: function (data) { | ||
129 | + console.log(data); | ||
130 | + } | ||
131 | + }); | ||
132 | + } | ||
133 | + | ||
134 | + } | ||
135 | +}); | ||
136 | + | ||
137 | +$('.category-panel-content').on('shown.bs.collapse', function(e) { | ||
138 | + if($(this).is(e.target)){ | ||
139 | + var panel_id = $(this).attr('id'); | ||
140 | + var holder = $(this).find('.holder'); | ||
141 | + | ||
142 | + var items = $('#' + panel_id + '-accordion').children(":visible").length; | ||
143 | + | ||
144 | + if (items > 10) { | ||
145 | + holder.jPages({ | ||
146 | + containerID : panel_id + "-accordion", | ||
147 | + perPage: 10, | ||
148 | + previous: "«", | ||
149 | + next: "»", | ||
150 | + midRange: 5 | ||
151 | + }); | ||
152 | + } | ||
153 | + } | ||
154 | +}); | ||
155 | + | ||
156 | +$('.category-panel-content').on('hidden.bs.collapse', function(e) { | ||
157 | + if($(this).is(e.target)){ | ||
158 | + var panel_id = $(this).attr('id'); | ||
159 | + var holder = $(this).find('.holder'); | ||
160 | + | ||
161 | + var items = $('#' + panel_id + '-accordion').children(":visible").length; | ||
162 | + | ||
163 | + if (items > 10) { | ||
164 | + holder.jPages("destroy"); | ||
165 | + } | ||
166 | + | ||
167 | + $(this).find('.panel-collapse.in').collapse('hide'); | ||
168 | + } | ||
169 | +}); | ||
170 | + | ||
171 | +$('.collapse').on('hide.bs.collapse', function (e) { | ||
172 | + if($(this).is(e.target)){ | ||
173 | + var btn = $(this).parent().find('.fa-angle-down'); | ||
174 | + | ||
175 | + btn = btn[0]; | ||
176 | + | ||
177 | + $(btn).switchClass("fa-angle-down", "fa-angle-right", 250, "easeInOutQuad"); | ||
178 | + | ||
179 | + var url = $(this).parent().find('.log_url').val(); | ||
180 | + var log_id = $(this).parent().find('.log_id').val(); | ||
181 | + | ||
182 | + if (typeof(url) != 'undefined') { | ||
183 | + $.ajax({ | ||
184 | + url: url, | ||
185 | + data: {'action': 'close', 'log_id': log_id}, | ||
186 | + dataType: 'json', | ||
187 | + success: function (data) { | ||
188 | + console.log(data.message); | ||
189 | + }, | ||
190 | + error: function (data) { | ||
191 | + console.log(data); | ||
192 | + } | ||
193 | + }); | ||
194 | + } | ||
195 | + } | ||
196 | +}); | ||
197 | + | ||
198 | +function delete_group(url) { | ||
199 | + $('.modal').remove(); | ||
200 | + | ||
201 | + $.get(url, function (modal) { | ||
202 | + $("#group-accordion").after(modal); | ||
203 | + | ||
204 | + $('.modal').modal('show'); | ||
205 | + }); | ||
206 | +} | ||
0 | \ No newline at end of file | 207 | \ No newline at end of file |
amadeus/static/js/course.js
@@ -1,206 +0,0 @@ | @@ -1,206 +0,0 @@ | ||
1 | -var locale = navigator.language || navigator.userLanguage; | ||
2 | - | ||
3 | -$('.date-picker').datepicker({ | ||
4 | - language: locale, | ||
5 | -}); | ||
6 | - | ||
7 | -/* | ||
8 | -* | ||
9 | -* Function to get a cookie stored on browser | ||
10 | -* | ||
11 | -*/ | ||
12 | -function getCookie(name) { | ||
13 | - var cookieValue = null; | ||
14 | - if (document.cookie && document.cookie !== '') { | ||
15 | - var cookies = document.cookie.split(';'); | ||
16 | - for (var i = 0; i < cookies.length; i++) { | ||
17 | - var cookie = jQuery.trim(cookies[i]); | ||
18 | - // Does this cookie string begin with the name we want? | ||
19 | - if (cookie.substring(0, name.length + 1) === (name + '=')) { | ||
20 | - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); | ||
21 | - break; | ||
22 | - } | ||
23 | - } | ||
24 | - } | ||
25 | - return cookieValue; | ||
26 | -} | ||
27 | -/* | ||
28 | -* | ||
29 | -* Function to subscribe (works for courses and subjects) | ||
30 | -* | ||
31 | -*/ | ||
32 | -function subscribe(elem, url, id, confirm_message) { | ||
33 | - alertify.confirm(confirm_message, function(){ | ||
34 | - $.ajax({ | ||
35 | - dataType: "json", | ||
36 | - url: url, | ||
37 | - success: function (data) { | ||
38 | - if (data.status == "ok") { | ||
39 | - elem.remove(); | ||
40 | - alertify.success(data.message); | ||
41 | - $(".panel_"+id).find(".view_btn").show() | ||
42 | - } else { | ||
43 | - alertify.error(data.message); | ||
44 | - } | ||
45 | - } | ||
46 | - }); | ||
47 | - }); | ||
48 | -} | ||
49 | - | ||
50 | -/* | ||
51 | -* | ||
52 | -* Function to delete a course | ||
53 | -* | ||
54 | -*/ | ||
55 | - | ||
56 | -var RemoveCourse = { | ||
57 | - remove: function(url,dados,id_li_link){ | ||
58 | - $('#category').modal().hide(); | ||
59 | - $.post(url,dados, function(data){ | ||
60 | - $(id_li_link).remove(); | ||
61 | - // alert("certo"); | ||
62 | - $('body').removeClass('modal-open'); | ||
63 | - $("#modal_course").empty(); | ||
64 | - $(".modal-backdrop.in").remove(); | ||
65 | - alertify.success("Course removed successfully!"); | ||
66 | - // setTimeout(function () { location.reload(1); }, 1); | ||
67 | - }).fail(function(){ | ||
68 | - $("#modal_course").empty(); | ||
69 | - $("#modal_course").append(data); | ||
70 | - $('#course').modal('show'); | ||
71 | - }); | ||
72 | - } | ||
73 | -} | ||
74 | - | ||
75 | -var delete_course = { | ||
76 | - get: function (url, id_modal, id_div_modal){ | ||
77 | - $.get(url, function(data){ | ||
78 | - if($(id_modal).length){ | ||
79 | - $(id_div_modal).empty(); | ||
80 | - $(id_div_modal).append(data); | ||
81 | - } else { | ||
82 | - $(id_div_modal).append(data); | ||
83 | - } | ||
84 | - $(id_modal).modal('show'); | ||
85 | - }); | ||
86 | - } | ||
87 | -}; | ||
88 | - | ||
89 | -/* | ||
90 | -* | ||
91 | -* Function to load create course's form | ||
92 | -* | ||
93 | -*/ | ||
94 | -function replicate_course(url, course) { | ||
95 | - $.ajax({ | ||
96 | - url: url, | ||
97 | - data: {'form': course}, | ||
98 | - success: function(data) { | ||
99 | - $(".course_replicate_form").html(data); | ||
100 | - } | ||
101 | - }); | ||
102 | -} | ||
103 | - | ||
104 | -/* | ||
105 | -* | ||
106 | -* Functions to control category marker | ||
107 | -* | ||
108 | -*/ | ||
109 | -$('.collapse').on('show.bs.collapse', function (e) { | ||
110 | - if($(this).is(e.target)){ | ||
111 | - var btn = $(this).parent().find('.fa-angle-right'); | ||
112 | - | ||
113 | - btn = btn[0]; | ||
114 | - | ||
115 | - $(btn).switchClass("fa-angle-right", "fa-angle-down", 250, "easeInOutQuad"); | ||
116 | - | ||
117 | - var url = $(this).parent().find('.log_url').val(); | ||
118 | - var log_input = $(this).parent().find('.log_id'); | ||
119 | - | ||
120 | - if (typeof(url) != 'undefined') { | ||
121 | - $.ajax({ | ||
122 | - url: url, | ||
123 | - data: {'action': 'open'}, | ||
124 | - dataType: 'json', | ||
125 | - success: function (data) { | ||
126 | - log_input.val(data.log_id); | ||
127 | - }, | ||
128 | - error: function (data) { | ||
129 | - console.log(data); | ||
130 | - } | ||
131 | - }); | ||
132 | - } | ||
133 | - | ||
134 | - } | ||
135 | -}); | ||
136 | - | ||
137 | -$('.category-panel-content').on('shown.bs.collapse', function(e) { | ||
138 | - if($(this).is(e.target)){ | ||
139 | - var panel_id = $(this).attr('id'); | ||
140 | - var holder = $(this).find('.holder'); | ||
141 | - | ||
142 | - var items = $('#' + panel_id + '-accordion').children(":visible").length; | ||
143 | - | ||
144 | - if (items > 10) { | ||
145 | - holder.jPages({ | ||
146 | - containerID : panel_id + "-accordion", | ||
147 | - perPage: 10, | ||
148 | - previous: "«", | ||
149 | - next: "»", | ||
150 | - midRange: 5 | ||
151 | - }); | ||
152 | - } | ||
153 | - } | ||
154 | -}); | ||
155 | - | ||
156 | -$('.category-panel-content').on('hidden.bs.collapse', function(e) { | ||
157 | - if($(this).is(e.target)){ | ||
158 | - var panel_id = $(this).attr('id'); | ||
159 | - var holder = $(this).find('.holder'); | ||
160 | - | ||
161 | - var items = $('#' + panel_id + '-accordion').children(":visible").length; | ||
162 | - | ||
163 | - if (items > 10) { | ||
164 | - holder.jPages("destroy"); | ||
165 | - } | ||
166 | - | ||
167 | - $(this).find('.panel-collapse.in').collapse('hide'); | ||
168 | - } | ||
169 | -}); | ||
170 | - | ||
171 | -$('.collapse').on('hide.bs.collapse', function (e) { | ||
172 | - if($(this).is(e.target)){ | ||
173 | - var btn = $(this).parent().find('.fa-angle-down'); | ||
174 | - | ||
175 | - btn = btn[0]; | ||
176 | - | ||
177 | - $(btn).switchClass("fa-angle-down", "fa-angle-right", 250, "easeInOutQuad"); | ||
178 | - | ||
179 | - var url = $(this).parent().find('.log_url').val(); | ||
180 | - var log_id = $(this).parent().find('.log_id').val(); | ||
181 | - | ||
182 | - if (typeof(url) != 'undefined') { | ||
183 | - $.ajax({ | ||
184 | - url: url, | ||
185 | - data: {'action': 'close', 'log_id': log_id}, | ||
186 | - dataType: 'json', | ||
187 | - success: function (data) { | ||
188 | - console.log(data.message); | ||
189 | - }, | ||
190 | - error: function (data) { | ||
191 | - console.log(data); | ||
192 | - } | ||
193 | - }); | ||
194 | - } | ||
195 | - } | ||
196 | -}); | ||
197 | - | ||
198 | -function delete_group(url) { | ||
199 | - $('.modal').remove(); | ||
200 | - | ||
201 | - $.get(url, function (modal) { | ||
202 | - $("#group-accordion").after(modal); | ||
203 | - | ||
204 | - $('.modal').modal('show'); | ||
205 | - }); | ||
206 | -} | ||
207 | \ No newline at end of file | 0 | \ No newline at end of file |
categories/templates/categories/list.html
@@ -151,5 +151,5 @@ | @@ -151,5 +151,5 @@ | ||
151 | </div> | 151 | </div> |
152 | <div id="modal_course"> | 152 | <div id="modal_course"> |
153 | </div> | 153 | </div> |
154 | - <script type="text/javascript" src="{% static 'js/course.js' %}"></script> | 154 | + <script type="text/javascript" src="{% static 'js/category.js' %}"></script> |
155 | {% endblock %} | 155 | {% endblock %} |
students_group/templates/groups/index.html
@@ -85,5 +85,5 @@ | @@ -85,5 +85,5 @@ | ||
85 | </div> | 85 | </div> |
86 | </div> | 86 | </div> |
87 | 87 | ||
88 | - <script type="text/javascript" src="{% static 'js/course.js' %}"></script> | 88 | + <script type="text/javascript" src="{% static 'js/category.js' %}"></script> |
89 | {% endblock %} | 89 | {% endblock %} |
90 | \ No newline at end of file | 90 | \ No newline at end of file |
subjects/templates/subjects/initial.html
@@ -45,5 +45,5 @@ | @@ -45,5 +45,5 @@ | ||
45 | </div> | 45 | </div> |
46 | 46 | ||
47 | 47 | ||
48 | - <script type="text/javascript" src="{% static 'js/course.js' %}"></script> | 48 | + <script type="text/javascript" src="{% static 'js/category.js' %}"></script> |
49 | {% endblock content %} | 49 | {% endblock content %} |
50 | \ No newline at end of file | 50 | \ No newline at end of file |
subjects/templates/subjects/list.html
@@ -193,7 +193,7 @@ | @@ -193,7 +193,7 @@ | ||
193 | 193 | ||
194 | <div id="modal_subject"></div> | 194 | <div id="modal_subject"></div> |
195 | 195 | ||
196 | - <script type="text/javascript" src="{% static 'js/course.js' %}"></script> | 196 | + <script type="text/javascript" src="{% static 'js/category.js' %}"></script> |
197 | <script type="text/javascript"> | 197 | <script type="text/javascript"> |
198 | $(function (){ | 198 | $(function (){ |
199 | var cat_slug = "{{ cat_slug }}" | 199 | var cat_slug = "{{ cat_slug }}" |
subjects/templates/subjects/list_search.html
@@ -66,6 +66,6 @@ | @@ -66,6 +66,6 @@ | ||
66 | 66 | ||
67 | <div id="modal_subject"></div> | 67 | <div id="modal_subject"></div> |
68 | 68 | ||
69 | - <script type="text/javascript" src="{% static 'js/course.js' %}"></script> | 69 | + <script type="text/javascript" src="{% static 'js/category.js' %}"></script> |
70 | 70 | ||
71 | {% endblock content %} | 71 | {% endblock content %} |
72 | \ No newline at end of file | 72 | \ No newline at end of file |
topics/templates/topics/list.html
@@ -67,4 +67,4 @@ | @@ -67,4 +67,4 @@ | ||
67 | </div> | 67 | </div> |
68 | 68 | ||
69 | <script type="text/javascript" src="{% static 'js/topics.js' %}"></script> | 69 | <script type="text/javascript" src="{% static 'js/topics.js' %}"></script> |
70 | -<script type="text/javascript" src="{% static 'js/course.js' %}"></script> | ||
71 | \ No newline at end of file | 70 | \ No newline at end of file |
71 | +<script type="text/javascript" src="{% static 'js/category.js' %}"></script> | ||
72 | \ No newline at end of file | 72 | \ No newline at end of file |