| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- $(document).off('click', '[data-formaction]').on('click', '[data-formaction]', function()
- {
- const $this = $(this);
- const dtable = zui.DTable.query($('#stories'));
- const checkedList = dtable.$.getChecks();
- if(!checkedList.length) return;
- const postData = new FormData();
- checkedList.forEach((id) => postData.append('storyIDList[]', id));
- if($this.data('account')) postData.append('assignedTo', $this.data('account'));
- if($this.data('page') == 'batch')
- {
- postAndLoadPage($this.data('formaction'), postData);
- }
- else
- {
- $.ajaxSubmit({"url": $this.data('formaction'), "data": postData});
- }
- });
- window.renderCell = function(result, info)
- {
- if(info.col.name == 'title' && result)
- {
- const story = info.row.data;
- let html = '';
- let gradeLabel = '';
- if(showGrade || story.grade >= 2) gradeLabel = gradeGroup[story.type][story.grade]?.name;
- if(gradeLabel) html += "<span class='label gray-pale rounded-xl clip'>" + gradeLabel + "</span> ";
- if(story.color) result[0].props.style = 'color: ' + story.color;
- if(html) result.unshift({html});
- }
- return result;
- };
- $(document).off('click', '.switchButton').on('click', '.switchButton', function()
- {
- const storyViewType = $(this).attr('data-type');
- $.cookie.set('storyViewType', storyViewType, {expires:config.cookieLife, path:config.webRoot});
- loadCurrentPage();
- });
- window.setShowGrades = function()
- {
- const showGrades = $('[name^=showGrades]').zui('picker').$.state.value;
- if(oldShowGrades == showGrades) return;
- const link = $.createLink('product', 'ajaxSetShowGrades', 'module=assetlib&showGrades=' + showGrades);
- $.get(link, function()
- {
- loadCurrentPage();
- });
- }
|