2 lines
9.5 KiB
JavaScript
2 lines
9.5 KiB
JavaScript
define("css!taoDeliveryRdfCss/delivery-rdf",[],function(){}),define("taoDeliveryRdf/controller/DeliveryMgmt/editDelivery",["jquery","util/url","ui/modal","css!taoDeliveryRdfCss/delivery-rdf.css"],function($,urlUtil){'use strict';return{start:function start(){$("#exclude-btn").click(function(){var delivery=$(this).data("delivery");$("#testtaker-form").load(urlUtil.route("excludeTesttaker","DeliveryMgmt","taoDeliveryRdf",{uri:delivery}),function(){$("body").prepend($("#modal-container")),$("#testtaker-form").modal()})})}}}),define("taoDeliveryRdf/controller/DeliveryMgmt/testtaker",["jquery","i18n","helpers","module","layout/section","ui/feedback"],function($,__,helpers,module,section,feedback){'use strict';function switchList(){var target,current=$(this).parent().attr("id");"excludedList"==current?target=$("#assignedList"):"assignedList"==current&&(target=$("#excludedList")),"undefined"!=typeof target&&(target.append(this),this.scrollIntoView())}var timeout,$search=$("#tt-filter"),$list=$("#assignedList"),liveSearch=function(){var pattern=$search.val();clearTimeout(timeout),timeout=setTimeout(function(){filterList(new RegExp(pattern),$list)},300)},filterList=function(regex,list){list.children().each(function(index,element){null===$(element).text().match(regex)?$(element).hide():$(element).show()})};return{start:function start(){$("#save-tt").click(function(){var excluded=[];$("#excludedList > li").each(function(){excluded.push($(this).data("uri"))});var assemblyUri=$("input[name=\"assemblyUri\"]").val();$.ajax({url:helpers._url("saveExcluded","DeliveryMgmt","taoDeliveryRdf"),type:"POST",data:{uri:assemblyUri,excluded:JSON.stringify(excluded)},dataType:"json",success:function success(response){response.saved&&(feedback().success(__("Selection saved successfully")),section.loadContentBlock(helpers._url("editDelivery","DeliveryMgmt","taoDeliveryRdf"),{uri:assemblyUri}))}})}),$("#assignedList > li").click(switchList),$("#excludedList > li").click(switchList),$("#close-tt").click(function(){$("#testtaker-form").modal("close")}),$search.keyup(liveSearch).siblings(".ctrl").click(liveSearch)}}}),define("taoDeliveryRdf/util/providers/testsProvider",["jquery","i18n","util/url"],function($,__,urlUtils){'use strict';return{listTests:function listTests(data){return new Promise(function(resolve,reject){$.ajax({url:urlUtils.route("getAvailableTests","DeliveryMgmt","taoDeliveryRdf"),data:{q:data.q,page:data.page},type:"GET",dataType:"JSON"}).done(function(tests){tests?resolve(tests):reject(new Error(__("Unable to load tests")))}).fail(function(){reject(new Error(__("Unable to load tests")))})})}}}),define("taoDeliveryRdf/util/forms/deliveryFormHelper",["jquery","lodash","i18n","ui/filter","ui/feedback","layout/actions","ui/taskQueue/taskQueue","ui/taskQueueButton/standardButton"],function($,_,__,filterFactory,feedback,actionManager,taskQueue,taskCreationButtonFactory){'use strict';var refreshTree=function(uriResource){actionManager.trigger("refresh",{uri:uriResource})};return{createSelectorInput:function createSelectorInput(_ref){var $filterContainer=_ref.$filterContainer,$inputElement=_ref.$inputElement,taskButton=_ref.taskButton,dataProvider=_ref.dataProvider,_ref$inputPlaceholder=_ref.inputPlaceholder,inputPlaceholder=void 0===_ref$inputPlaceholder?__("Select the test you want to publish to the test-takers"):_ref$inputPlaceholder,_ref$inputLabel=_ref.inputLabel,inputLabel=void 0===_ref$inputLabel?__("Select the test"):_ref$inputLabel;return filterFactory($filterContainer,{placeholder:inputPlaceholder,label:inputLabel,width:"64%",quietMillis:1e3}).on("change",function(selection){$inputElement.val(selection),selection?taskButton.enable():taskButton.disable()}).on("request",function(params){dataProvider.list(params.data).then(function(data){params.success(data)}).catch(function(err){params.error(err),feedback().error(err)})}).render("<%- text %>")},replaceSubmitWithTaskButton:function replaceSubmitWithTaskButton(_ref2){var $form=_ref2.$form,$reportContainer=_ref2.$reportContainer,_ref2$buttonTitle=_ref2.buttonTitle,buttonTitle=void 0===_ref2$buttonTitle?__("Publish the test"):_ref2$buttonTitle,_ref2$buttonLabel=_ref2.buttonLabel,buttonLabel=void 0===_ref2$buttonLabel?__("Publish"):_ref2$buttonLabel,$oldSubmitter=$form.find(".form-submitter"),taskCreationButton=taskCreationButtonFactory({type:"info",icon:"delivery",title:buttonTitle,label:buttonLabel,taskQueue:taskQueue,taskCreationUrl:$form.prop("action"),taskCreationData:function(){return $form.serializeArray()},taskReportContainer:$reportContainer}).on("finished",function(result){result&&result.task&&result.task.report&&_.isArray(result.task.report.children)&&result.task.report.children.length&&result.task.report.children[0]&&(result.task.report.children[0].data&&result.task.report.children[0].data.uriResource?(feedback().info(__("%s completed",result.task.taskLabel),{encodeHtml:!1}),refreshTree(result.task.report.children[0].data.uriResource)):this.displayReport(result.task.report.children[0],__("Error")))}).on("continue",function(){refreshTree()}).on("error",function(err){feedback().error(err),this.trigger("finished")}).render($oldSubmitter.closest(".form-toolbar")).disable();return $oldSubmitter.replaceWith(taskCreationButton.getElement()),taskCreationButton},setupTaoLocalForm:function setupTaoLocalForm($form,providers){var $reportContainer=$form.closest(".content-block"),$filterContainer=$(".test-select-container",$form),$inputElement=$("#test",$form),taskButton=this.replaceSubmitWithTaskButton({$form:$form,$reportContainer:$reportContainer});this.createSelectorInput({$filterContainer:$filterContainer,$inputElement:$inputElement,taskButton:taskButton,dataProvider:{list:providers.listTests}})}}}),define("taoDeliveryRdf/controller/DeliveryMgmt/wizard",["jquery","taoDeliveryRdf/util/providers/testsProvider","taoDeliveryRdf/util/forms/deliveryFormHelper","css!taoDeliveryRdfCss/delivery-rdf.css"],function($,testsProvider,deliveryFormHelper){'use strict';return{start:function start(){var $form=$("#simpleWizard");deliveryFormHelper.setupTaoLocalForm($form,testsProvider)}}}),define("taoDeliveryRdf/controller/Publish/index",["jquery","lodash","i18n","util/url","layout/actions","provider/resources","ui/destination/selector","ui/feedback","ui/taskQueue/taskQueue"],function($,_,__,urlHelper,actionManager,resourceProviderFactory,destinationSelectorFactory,feedback,taskQueue){'use strict';var refreshTree=function(uriResource){actionManager.trigger("refresh",{uri:uriResource})};return{start:function(){var $container=$(".selector-container"),testUri=$container.data("test"),testLabel=$container.data("label"),resourceProvider=resourceProviderFactory();destinationSelectorFactory($container,{title:__("Publish \"%s\" to",testLabel),actionName:__("Publish"),icon:"delivery",taskQueue:taskQueue,taskCreationData:{testUri:testUri},taskCreationUrl:urlHelper.route("publish","Publish","taoDeliveryRdf"),classUri:$container.data("root-class")}).on("query",function(params){var self=this;params.classOnly=!0,resourceProvider.getResources(params,!0).then(function(resources){self.update(resources,params)}).catch(function(err){self.trigger("error",err)})}).on("finished",function(result,button){result.task&&result.task.report&&_.isArray(result.task.report.children)&&result.task.report.children.length&&result.task.report.children[0]&&(result.task.report.children[0].data&&result.task.report.children[0].data.uriResource?(feedback().info(__("%s completed",result.task.taskLabel),{encodeHtml:!1}),refreshTree(result.task.report.children[0].data.uriResource)):button.displayReport(result.task.report.children[0],__("Error")))}).on("continue",function(){refreshTree(testUri)}).on("error",function(err){err&&err.errorMsg&&(err=err.errorMsg),feedback().error(err)})}}}),define("taoDeliveryRdf/controller/routes",[],function(){'use strict';return{DeliveryMgmt:{actions:{editDelivery:"controller/DeliveryMgmt/editDelivery",excludeTesttaker:"controller/DeliveryMgmt/testtaker",wizard:"controller/DeliveryMgmt/wizard"}},Publish:{actions:{index:"controller/Publish/index"}}}}),function(c){var d=document,s=d.createElement("style");s.type="text/css",d.getElementsByTagName("head")[0].appendChild(s),s.styleSheet?s.styleSheet.cssText=c:s.appendChild(d.createTextNode(c))}(".delivery-headings h3{margin-bottom:5px}.delivery-headings h2{margin-bottom:5px}.delivery-headings .label{font-weight:bold}.delivery-headings .label:not(:first-child){margin-left:1em}.xhtml_form .form-toolbar .loading-button{float:right}.ttlist{overflow:auto}.ttlist li{cursor:pointer;border-bottom:1px solid #ddd;padding:3px;background:#f9f8f7}.ttlist li:hover{color:white;background:rgba(14,93,145,0.8)}.filter-div{text-align:right;position:relative;background:#ddd;padding:1px}.filter-div input{display:block;width:calc(100% - 14px);padding:6px;font-size:14px;font-size:1.4rem;max-width:none}.filter-div span{position:absolute;right:10px;top:8px;opacity:.3}#assignedList,#excludedList{height:267px;border:1px solid #ddd;border-radius:2px;-webkit-border-radius:2px}#assignedList li,#excludedList li{line-height:1.4}#assignedList li .arrow:before,#excludedList li .arrow:before{font-family:'tao' !important;speak:never;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\e60f\"}#assignedList li .arrow{float:right;margin-right:5px}#excludedList{margin-top:43px}#excludedList li .arrow{float:left;margin-left:5px;margin-right:10px}\n\n/*# sourceMappingURL=../../../taoDeliveryRdf/views/css/delivery-rdf.css.map */"),define("taoDeliveryRdf/loader/taoDeliveryRdf.bundle",function(){});
|
|
//# sourceMappingURL=taoDeliveryRdf.min.js.map
|