summaryrefslogtreecommitdiff
path: root/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf
diff options
context:
space:
mode:
Diffstat (limited to 'gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf')
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_detail.html6
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_units.html156
2 files changed, 82 insertions, 80 deletions
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_detail.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_detail.html
index 4497285d..5c7792ef 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_detail.html
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_detail.html
@@ -10,8 +10,6 @@
<script src="/static/ndf/bower_components/jqtree/tree.jquery.js"></script> <!-- checked -->
{% endblock %}
-
-
{% block style %}
{{block.super}}
@@ -55,8 +53,8 @@
<section class="medium-8 columns name-section" >
<h3>
<span class='node'>{{node.name}}</span>
- <!-- <span><a class="small button fi-pencil " href="{% url 'create_edit' group_id node.pk %}">{% trans "Edit" %}</a></span> -->
- <span><a class="fi-pencil " href="{% url 'create_edit' group_id node.pk %}"></a></span>
+ <span><a class="small button " href="{% url 'create_edit' group_id node.pk %}">{% trans "Edit" %}</a></span>
+ <!-- <span><a class="fi-pencil " href="{% url 'create_edit' group_id node.pk %}"></a></span> -->
<!-- This button publishes the drafted resource -->
{% if node %}
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_units.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_units.html
index 6618f1b0..733deaf2 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_units.html
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course_units.html
@@ -74,20 +74,9 @@
margin-left:0 !important;
}
- #add_res, #new_res{
- width:85%;
- }
-
{% endblock %}
{% block meta_content %}
- <br/><br/>
- <div class="row ">
- <input type="button" id="new_res" value="+ New Resource" class="small button" disabled="disabled">
- </div>
- <div class="row ">
- <input type="button" id="add_res" value="Add existing resource" class="small button" disabled="disabled">
- </div>
{% endblock %}
@@ -96,32 +85,45 @@
<div class="row unit-name-div">
<div class="small-3 columns">
- <label>{% trans "Enter Unit Name" %}</label>
+ <label><h5>{% trans "Unit Name: " %}</label></h5>
</div>
- <div class="small-3 columns">
- <input type="text" id="unit_name" value="{% if unit_node %} {{unit_node.name}}{% endif %}">
+ <div class="small-4 columns name-field">
+ {% if unit_node %}
+ <label id="{{unit_node.pk}}" class="unit_name" value="{{unit_node.name}}"><h5>{{unit_node.name}}</h5></label>
+ {% else %}
+ <input type="text" class="unit_name" value="{% if unit_node %} {{unit_node.name}}{% endif %}">
+ {% endif %}
</div>
+
<div class="small-2 columns">
- <input type="button" id="create_unit" value="{% if unit_node %} Update Unit {% else %} Create Unit{% endif %}" class="tiny round button"/>
+
+ {% if unit_node %}
+ <input type="button" value="Edit Unit" class="edit_unit tiny round button"/>
+ {% else %}
+ <input type="button" value="Create Unit" class="create_unit tiny round button"/>
+ {% endif %}
</div>
- <div class="small-4 columns">
+ <div class="small-3 columns">
<span data-tooltip title="You will be redirected to Course Authoring page" style="float:right;">
- <a class="done_units tiny button round" style="float:right;">Add more units later..</a>
+ <a class="done_units tiny button round" style="float:right;">Add later..</a>
</span>
</div>
</div>
- <div class="unit-list-div">
+ <div class="unit-list-div hide">
<ul class="button-group">
<li><a onclick="open_div('Page',this)" class="Page button res-btn">Page</a></li>
<li><a onclick="open_div('File',this)" class="File button res-btn">File </a></li>
<li><a onclick="open_div('Image',this)" class="Image button res-btn">Image </a></li>
<li><a onclick="open_div('Video',this)" class="Video button res-btn">Video </a></li>
- <li><a onclick="open_div('Pandora',this)" class="Pandora button res-btn">Pandora</a></li>
<li><a onclick="open_div('Quiz',this)" class="Quiz button res-btn">Quiz</a></li>
</ul>
</div>
+ <div class="res-opt-btns hide">
+ <input type="button" id="new_res" value="+ New Resource" class="small button">
+ <input type="button" id="add_res" value="Add existing resource" class="small button">
+ </div>
<div class="row collection_details">
</div>
@@ -168,7 +170,6 @@
</form>
</div>
</div>
- <input type="button" class="res-option hide button small">
<div class="collection_block_div">
</br></br></br>
@@ -186,9 +187,9 @@
var res_name_flag = "";
- //save unit button click
- $(document).on("click", "#create_unit", function(){
- unit_name_val = $("#unit_name").val();
+ //create unit button click
+ $(document).on("click", ".create_unit", function(event){
+ unit_name_val = $(".unit_name").val();
unit_node_id = $("#hidden_unit_node_id").val();
$.ajax({
@@ -215,23 +216,33 @@
});
});
+
+ //create unit button click
+ $(document).on("click", ".edit_unit", function(){
+ name_input_filed = '<input type="text" class="unit_name" value="{% if unit_node %} {{unit_node.name}}{% endif %}">'
+ $(".name-field").html(name_input_filed)
+ $(this).attr('value',"Update Unit")
+ .addClass("create_unit")
+ .removeClass("edit_unit")
+ });
+
//Cancel button
$(document).on("click", "#cancel_btn", function(){
$(".res-opt-div").find("#view_add_file, #view_add_page").addClass("hide");
- $(".res-option").removeClass("hide");
+ $(".res-opt-btns").removeClass("hide")
$(".name_id").val("");
});
//Create new page/ Upload file button
- $(document).on("click", ".res-option", function(){
- $(this).addClass("hide")
+ $(document).on("click", "#new_res", function(){
+ $(".res-opt-btns").addClass("hide")
if(res_name_flag == "Page"){
$(".res-opt-div").find("#view_add_page").removeClass("hide");
$(".res-opt-div").find("#view_add_page .name_id").focus();
$(".res-opt-div").find("#view_add_file").addClass("hide");
}
- else if(res_name_flag == "File" || res_name_flag == "Image" || res_name_flag == "Video" || res_name_flag == "Pandora"){
+ else if(res_name_flag == "File" || res_name_flag == "Image" || res_name_flag == "Video"){
$(".res-opt-div").find("#view_add_file").removeClass("hide");
$(".res-opt-div").find("#view_add_page").addClass("hide");
}
@@ -240,38 +251,33 @@
//Onclick of any resource type button
function open_div(name,this1){
- {% if unit_node %}
- res_name_flag = name
- console.log(res_name_flag)
- update_res_count();
- $(".button").removeClass("success");
- $(this1).addClass("success");
- $("#add_res,#new_res").removeAttr("disabled");
- {% else %}
- alert("Please create Unit")
- return false;
- {% endif %}
+ res_name_flag = name
+ update_res_count();
+ $(".button").removeClass("success");
+ $(".save_units").addClass("hide")
+
+ $(this1).addClass("success");
+ $(".resources_drawer_div").html("");
+ if(res_name_flag!="Quiz" && res_name_flag=="Page"){
+ $("#new_res").val("Create new "+ res_name_flag)
+ $(".res-opt-btns").removeClass("hide")
+ }
+ else if(res_name_flag!="Quiz" && res_name_flag!="Page"){
+ $("#new_res").val("Upload File")
+ $(".res-opt-btns").removeClass("hide")
+ }
+ else if(res_name_flag=="Quiz"){
+ $(".res-opt-btns").addClass("hide");
+ draw_drawer("Quiz")
+ }
+ $(".collection_details").html("");
};
- //create new resource
- $(document).on('click','#new_res',function(){
- $(".collection_details").html("")
-
- if(res_name_flag=="Quiz" || res_name_flag=="Page"){
- $(".res-option").val("Create new "+ res_name_flag)
- $(".res-option").removeClass("hide");
- }
- else {
- $(".res-option").removeClass("hide");
- $(".res-option").val("Upload File")
- }
- })
-
+
//add from existing resources
$(document).on('click','#add_res',function(){
$(".collection_details").html("")
- $(".res-option").addClass("hide");
draw_drawer(res_name_flag);
})
@@ -308,9 +314,10 @@
//save page
$("#add_page").click(function() {
- unit_name = $("#unit_name").val();
+ unit_node_id = "{{unit_node.pk}}"
+ unit_name = $(".unit_name").text();
page_name = $(".name_id").val();
- if(unit_name!="" && page_name!=""){
+ if(unit_node_id && page_name!=""){
$.ajax({
type: "POST",
url: "{% url 'add_page' groupid %}",
@@ -331,20 +338,19 @@
alert("Page name "+ page +" already available, Please choose different name");
}
else if (data["success"] == true) {
- alert("Succesully added to Unit "+unit_name)
+ alert("Succesully added to '"+unit_name+"'")
$(".name_id").val("");
$(".resources_drawer_div").html("");
+ $(".res-opt-btns").addClass("hide");
$(".res-opt-div").find("#view_add_file, #view_add_page").addClass("hide");
$(".button").removeClass("success")
-
+ location.reload();
}
}
});
- update_res_count();
}
else{
- alert("Please enter name");
- $("#unit_name").focus();
+ alert("You need to creat Unit first");
event.preventDefault();
}
@@ -354,14 +360,13 @@
//Submit button for file
$('#docPost input[type=submit]').click(function(){
//save file button, check wether unit name is entered
- unit_name_val = $("#unit_name").val()
+ unit_name_val = $(".unit_name").text();
if($("#docFile").val() != ""){
if(unit_name_val!=""){
$("#unit_name_file").val(unit_name_val);
$(".resources_drawer_div").html("");
$('#docPost').submit();
- unit_name_val = $("#unit_name").val()
- alert("Succesully added to Unit "+unit_name_val)
+ alert("Succesully added to '"+unit_name_val+"'")
}
else{
alert("Please enter unit name");
@@ -378,13 +383,13 @@
// Save units
$(document).on('click','.save_units',function(){
var resources_in_RHS = []
- unit_name_val = $("#unit_name").val()
+ unit_name_val = $(".unit_name").text()
total_resources_in_RHS = $(".resources_drawer_div").find("#create_course_structure_drawer2").children("li")
unit_node_id = $("#hidden_unit_node_id").val();
//check if right drawer has values
// if(total_resources_in_RHS.length > 0){
- if(unit_name_val){
+ if(unit_node_id){
//fetch right drawer values
$.each(total_resources_in_RHS,function(i,v){
resources_in_RHS.push(v.getAttribute('value'))
@@ -411,17 +416,16 @@
resp_dict = JSON.parse(data)
$(".resources_drawer_div").html("");
$(".save_units").addClass("hide")
- $(".res-option").addClass("hide")
+ $(".res-opt-btns").addClass("hide");
$(".button").removeClass("success")
$(".done_units").removeClass("hide")
$(".res-opt-div").find("#view_add_file, #view_add_page").addClass("hide");
- update_res_count();
+ location.reload();
},
});
}
else{
- alert("Please enter unit name");
- $("#unit_name").focus();
+ alert("You need to create Unit first");
event.preventDefault();
}
// }
@@ -468,7 +472,9 @@
{% endif %}
{% endfor %}
{% else %}
- $(".collection_details").html("You haven't added any resources to this unit yet");
+ {% if unit_node %}
+ $(".collection_details").html("You haven't added any resources to this unit yet");
+ {% endif %}
{% endif %}
if(dict_res){
@@ -485,12 +491,10 @@
{{block.super}}
update_res_count()
- // {% if unit_node %}
- // $(".res-btn").removeAttr("disabled");
- // {% else %}
- // $(".res-btn").attr("disabled",true);
- // $(".res-btn").removeAttr("onclick");
- // {% endif %}
+ {% if unit_node %}
+ $(".unit-list-div").removeClass("hide")
+ {% endif %}
+
{% endblock %}
</script