|
440 | 440 | flex-grow: 1; |
441 | 441 | } |
442 | 442 |
|
| 443 | + problem-set problem-editor > div { |
| 444 | + display: none; |
| 445 | + } |
| 446 | + |
| 447 | + problem-set problem-editor > div.active { |
| 448 | + display: block; |
| 449 | + } |
| 450 | + |
443 | 451 | .d-none { |
444 | 452 | display: none; |
445 | 453 | } |
|
597 | 605 | <!-- <div data-id="0" onclick="editProb(this)" class="active">A+B Problem</div> --> |
598 | 606 | </problem-list> |
599 | 607 | <problem-editor> |
600 | | - <div class="form-group"> |
601 | | - <label for="general_standard">Title</label> |
602 | | - <input type="text" class="form-control" id="problem_title_"> |
603 | | - <span class="bmd-help">The title of this problem, should be brief.</span> |
604 | | - </div> |
605 | | - <div class="form-group"> |
606 | | - <label for="general_standard">Type</label> |
607 | | - <input type="text" class="form-control" id="problem_type_"> |
608 | | - <span class="bmd-help">Type, could be OnlineJudge or VirtualJudge.</span> |
609 | | - </div> |
| 608 | + |
610 | 609 | </problem-editor> |
611 | 610 | </problem-set> |
612 | 611 | </div> |
|
660 | 659 | focusTab("problem-editor"); |
661 | 660 | var i=0; |
662 | 661 | message.problems.forEach((ele)=>{ |
663 | | - $('problem-list').append(`<div data-id="${i}" onclick="editProb(this)" ${i==0?'class="active"':''}>${ele.title}</div>`); |
| 662 | + $('problem-list').append(`<div data-id="${i}" onclick="editProb(this)">${ele.title}</div>`); |
| 663 | + $('problem-editor').append(` |
| 664 | + <div data-id="${i}"> |
| 665 | + <div class="form-group"> |
| 666 | + <label for="problem_title_${i}">Title</label> |
| 667 | + <input type="text" class="form-control" id="problem_title_${i}"> |
| 668 | + <span class="bmd-help">The title of this problem, should be brief.</span> |
| 669 | + </div> |
| 670 | + <div class="form-group"> |
| 671 | + <label for="problem_type_${i}">Type</label> |
| 672 | + <input type="text" class="form-control" id="problem_type_${i}"> |
| 673 | + <span class="bmd-help">Type, could be OnlineJudge or VirtualJudge.</span> |
| 674 | + </div> |
| 675 | + </div> |
| 676 | + `); |
| 677 | + $(`#problem_title_${i}`).val(ele.title); |
| 678 | + $(`#problem_type_${i}`).val(ele.type); |
| 679 | + $(`problem-editor > div[data-id="${i}"]`).bootstrapMaterialDesign(); |
664 | 680 | }); |
665 | 681 | $('problem-list').append(`<div data-id="-1" onclick="newProb()"><i class="MDI plus-circle"></i> Add New Problem</div>`); |
| 682 | + if($('problem-list')[0]) editProb($('problem-list > div')[0]); |
666 | 683 | }); |
667 | 684 |
|
668 | 685 | function focusTab(tabName){ |
|
673 | 690 | function editProb(ele){ |
674 | 691 | $('problem-list > div').removeClass('active'); |
675 | 692 | $(ele).addClass('active'); |
676 | | - console.log($(ele).attr("data-id")); |
| 693 | + let id=$(ele).attr("data-id"); |
| 694 | + $('problem-editor > div').removeClass("active"); |
| 695 | + $(`problem-editor > div[data-id="${id}"]`).addClass("active"); |
677 | 696 | } |
678 | 697 |
|
679 | 698 | ipcRenderer.on("windowStatusChange", (event, message) => { |
|
0 commit comments