view.ui.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. $(document).on('mouseenter', '.detail-side .tab-pane ul li', function(e)
  2. {
  3. $(this).find('.unlink').removeClass('hidden');
  4. e.stopPropagation();
  5. });
  6. $(document).on('mouseleave', '.detail-side .tab-pane ul li', function(e)
  7. {
  8. $(this).find('.unlink').addClass('hidden');
  9. e.stopPropagation();
  10. });
  11. window.ajaxDelete = function(storyID)
  12. {
  13. zui.Modal.confirm({message: confirmDeleteTip, icon:'icon-exclamation-sign', iconClass: 'warning-pale rounded-full icon-2x'}).then((res) =>
  14. {
  15. if(res) $.get($.createLink('story', 'delete', 'storyID=' + storyID + '&confirm=yes'), function(data){if(data.result == 'success') loadPage(data.load)});
  16. });
  17. }
  18. $('#mainContent .files').removeClass('px-6');
  19. window.refreshViewModal = function()
  20. {
  21. if(isInModal)
  22. {
  23. loadModal($.createLink('story', 'view', 'storyID=' + storyID), $('.modal').attr('id'));
  24. }
  25. else
  26. {
  27. loadPage($.createLink('story', 'view', 'storyID=' + storyID));
  28. }
  29. }
  30. window.waitDom('body.body-modal .toolbar', function()
  31. {
  32. $('.body-modal .toolbar a[data-load="modal"]').attr('data-toggle', 'modal').removeAttr('data-load');
  33. })
  34. window.renderChildCell = function(result, info)
  35. {
  36. if(info.col.name == 'title' && result)
  37. {
  38. let html = '';
  39. const story = info.row.data;
  40. const gradeMap = gradeGroup[story.type] || {};
  41. let gradeLabel = gradeMap[story.grade];
  42. if(gradeLabel) html += "<span class='label gray-pale rounded-xl clip'>" + gradeLabel + "</span> ";
  43. if(html) result.unshift({html});
  44. }
  45. return result;
  46. }