Commit 53572754 by Awais Committed by Awais Qureshi

Add compression.

Refactoring JS.

ECOM-6466
parent 03914f54
$(document).ready(function(){
$(".administration-nav .tab-container > button").click(function(event) {
event.preventDefault();
$(this).addClass("selected");
$(this).siblings().removeClass("selected");
var tab = $(this).data("tab");
$(".tab-content").not(tab).css("display", "none");
$(tab).fadeIn();
});
$('ul.tabs .course-tabs').click(function(){
var tab_id = $(this).attr('data-tab'),
$tabContent = $(this).closest('.row').siblings("#"+tab_id);
$(this).parent().find('.course-tabs').removeClass('active');
$tabContent.siblings('.content').removeClass('active');
$(this).addClass('active');
$tabContent.addClass('active');
});
});
$(document).ready(function(){
var org_id = $('#organization-name').data('org_id');
if (org_id){
loadAdminUsers(org_id);
}
});
$(document).on('change', '#id_organization', function (e) {
var org_id = this.value;
// it will reset the select input
$("#id_team_admin").prop("selectedIndex", 0);
if (org_id) {
loadAdminUsers(org_id);
}
});
function loadAdminUsers(org_id) {
$.getJSON({
url: '/publisher/api/admins/organizations/'+ org_id +'/users/',
success: function (data) {
var teamAdminDropDown = $('#id_team_admin'),
selectedTeamAdmin = $('#id_team_admin option:selected').val(),
organizationInputType = $('#id_organization').attr('type');
teamAdminDropDown.empty();
if (organizationInputType == 'hidden' ) {
teamAdminDropDown.append('<option>---------</option>');
} else {
// it will looks same like other django model choice fields
teamAdminDropDown.append('<option selected="selected">---------</option>');
}
$.each(data.results, function (i, user) {
if (selectedTeamAdmin == user.id && organizationInputType === 'hidden' ) {
teamAdminDropDown.append(
$('<option selected="selected"> </option>').val(user.id).html(user.full_name)
);
} else {
teamAdminDropDown.append($('<option> </option>').val(user.id).html(user.full_name));
}
});
}
});
}
$(document).ready(function(){
$(".administration-nav .tab-container > button").click(function(event) {
event.preventDefault();
$(this).addClass("selected");
$(this).siblings().removeClass("selected");
var tab = $(this).data("tab");
$(".tab-content").not(tab).css("display", "none");
$(tab).fadeIn();
});
$('ul.tabs .course-tabs').click(function(){
var tab_id = $(this).attr('data-tab'),
$tabContent = $(this).closest('.row').siblings("#"+tab_id);
$(this).parent().find('.course-tabs').removeClass('active');
$tabContent.siblings('.content').removeClass('active');
$(this).addClass('active');
$tabContent.addClass('active');
});
$("#change-admin").click(function (e) {
e.preventDefault();
$(".field-admin-name").hide();
......
......@@ -247,5 +247,6 @@
{% block extra_js %}
<script src="{% static 'js/publisher/publisher.js' %}"></script>
<script src="{% static 'js/publisher/organizations.js' %}"></script>
<script src="{% static 'js/publisher/seat-type-change.js' %}"></script>
{% endblock %}
{% extends 'publisher/base.html' %}
{% load i18n %}
{% load staticfiles %}
......@@ -636,7 +635,11 @@
{% endblock %}
{% block extra_js %}
<script src="{% static 'js/publisher/publisher.js' %}"></script>
<script src="{% static 'js/publisher/seat-type-change.js' %}"></script>
<script src="{% static 'js/publisher/publisher.js' %}"></script>
<script src="{% static 'js/publisher/organizations.js' %}"></script>
<script src="{% static 'js/publisher/seat-type-change.js' %}"></script>
{% endblock %}
{% block js_without_compress %}
{{ run_form.media }}
{% endblock %}
......@@ -69,5 +69,10 @@
});
</script>
{% block extra_js %}{% endblock %}
{% compress js %}
{% block extra_js %}
{% endblock %}
{% endcompress %}
{% block js_without_compress %}{% endblock %}
{% endblock %}
......@@ -168,6 +168,7 @@
<script src="{% static 'bower_components/google-diff-match-patch/diff_match_patch.js' %}"></script>
<script src="{% static 'js/publisher/views/course_detail.js' %}"></script>
<script src="{% static 'js/publisher/publisher.js' %}"></script>
<script src="{% static 'js/publisher/organizations.js' %}"></script>
<script src="{% static 'js/publisher/comparing-objects.js' %}"></script>
<script src="{% static 'js/publisher/jquery-dateFormat.min.js' %}"></script>
<script src="{% static 'js/publisher/comments.js' %}"></script>
......
......@@ -409,4 +409,5 @@
{% block extra_js %}
<script src="{% static 'js/publisher/publisher.js' %}"></script>
<script src="{% static 'js/publisher/organizations.js' %}"></script>
{% endblock %}
......@@ -94,7 +94,9 @@
<script src="{% static 'js/publisher/jquery-dateFormat.min.js' %}"></script>
<script src="{% static 'js/publisher/views/course_detail.js' %}"></script>
<script src="{% static 'js/publisher/publisher.js' %}"></script>
<script src="{% static 'js/publisher/organizations.js' %}"></script>
<script src="{% static 'js/publisher/comments.js' %}"></script>
<script src="{% static 'js/publisher/course-tabs.js' %}"></script>
<script>
new Clipboard(".btn-copy", {
text: function(trigger) {
......
{% extends 'publisher/base.html' %}
{% load i18n %}
{% block title %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment