Skip to content

Commit

Permalink
Add right click modal to profile skill wheel - refs BT#9413
Browse files Browse the repository at this point in the history
  • Loading branch information
ilosada committed Feb 19, 2015
1 parent 4e25291 commit 1d23e75
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 23 deletions.
1 change: 1 addition & 0 deletions main/admin/skills_wheel.php
Expand Up @@ -46,6 +46,7 @@

$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?1=1';
$tpl->assign('url', $url);
$tpl->assign('isAdministration', true);

$content = $tpl->fetch('default/skill/skill_wheel.tpl');
$tpl->assign('content', $content);
Expand Down
57 changes: 34 additions & 23 deletions main/template/default/skill/skill_wheel.js.tpl
Expand Up @@ -324,10 +324,16 @@ function open_popup(skill_id, parent_id) {
if (skill) {
var parent_info = get_skill_info(skill.extra.parent_id);
$("#id").attr('value', skill.id);
$("#name").attr('value', skill.name);
$("#short_code").attr('value', skill.short_code);
$("#description").attr('value', skill.description);
if ("{{ isAdministration }}") {
$("#id").attr('value', skill.id);
$("#name").attr('value', skill.name);
$("#short_code").attr('value', skill.short_code);
$("#description").attr('value', skill.description);
} else {
$("#name").text(skill.name);
$("#short_code").text(skill.short_code);
$("#description").text(skill.description);
}
//Filling parent_id
$("#parent_id").append('<option class="selected" value="'+skill.extra.parent_id+'" selected="selected" >');
Expand All @@ -338,32 +344,37 @@ function open_popup(skill_id, parent_id) {
jQuery.each(skill.gradebooks, function(index, data) {
$("#gradebook_id").append('<option class="selected" value="'+data.id+'" selected="selected" >');
$("#gradebook_holder").append('<li id="gradebook_item_'+data.id+'" class="bit-box">'+data.name+' <a rel="'+data.id+'" class="closebutton" href="#"></a> </li>');
});
});
if ("{{ isAdministration }}") {
$("#dialog-form").dialog({
buttons: {
"{{ "Edit"|get_lang }}": function () {
var params = $("#add_item").find(':input').serialize();
add_skill(params);
},
/*"{{ "Delete"|get_lang }}" : function() {
},*/
"{{ "CreateChildSkill"|get_lang }}": function () {
open_popup(0, skill.id);
},
"{{ "AddSkillToProfileSearch"|get_lang }}": function () {
add_skill_in_profile_list(skill.id, skill.name);
}
}
});
}
$("#dialog-form").dialog({
buttons: {
"{{ "Edit"|get_lang }}" : function() {
var params = $("#add_item").find(':input').serialize();
add_skill(params);
},
/*"{{ "Delete"|get_lang }}" : function() {
},*/
"{{ "CreateChildSkill"|get_lang }}" : function() {
open_popup(0, skill.id);
},
"{{ "AddSkillToProfileSearch"|get_lang }}" : function() {
add_skill_in_profile_list(skill.id, skill.name);
}
},
close: function() {
close: function() {
$("#name").attr('value','');
$("#description").attr('value', '');
//Redirect to the main root
load_nodes(0, main_depth);
}
});
$("#dialog-form").dialog("open");
});
$("#dialog-form").dialog("open");
}
if (parent) {
Expand Down
50 changes: 50 additions & 0 deletions main/template/default/skill/skill_wheel_student.tpl
Expand Up @@ -388,3 +388,53 @@ $(document).ready(function() {
</div>
</div>
</div>

<div id="dialog-form" style="">
<p class="validateTips"></p>
<form id="add_item" class="form-horizontal" name="form">
<fieldset>
<div class="control-group">
<label class="control-label" for="name">{{ 'Name' | get_lang }}</label>
<div class="controls">
<!--<input type="text" name="name" id="name" class="span4" readonly />-->
<p id="name" class="span4">
</p>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ 'ShortCode' | get_lang }}</label>
<div class="controls">
<!--<input type="text" name="short_code" id="short_code" class="span2" readonly />-->
<p id="short_code" class="span4">
</p>
</div>
</div>
<div id="skill_row" class="control-group">
<label class="control-label" for="name">{{'Parent'|get_lang}}</label>
<div class="controls">
<ul id="skill_edit_holder" class="holder holder_simple">
</ul>
</div>
</div>
<div id="gradebook_row" class="control-group">
<label class="control-label" for="name">{{'Gradebook'|get_lang}}</label>
<div class="controls">
<ul id="gradebook_holder" class="holder holder_simple">
</ul>
<span class="help-block">
{{ 'WithCertificate'|get_lang }}
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="name">{{ 'Description'|get_lang }}</label>
<div class="controls">
<!--<textarea name="description" id="description" class="span4" rows="7" readonly>
</textarea>-->
<p id="description" class="span4">
</p>
</div>
</div>
</fieldset>
</form>
</div>

0 comments on commit 1d23e75

Please sign in to comment.