1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
| /**
| * Created by wisestone on 2018-05-08.
| */
| 'use strict';
|
| define([
| 'app'
| ],
| function (app) {
| app.controller('noticeAddController', ['$scope', '$rootScope', '$log', '$resourceProvider', '$uibModalInstance', 'Notice', 'SweetAlert', '$filter',
| function ($scope, $rootScope, $log, $resourceProvider, $uibModalInstance, Notice, SweetAlert, $filter) {
|
| $scope.fn = {
| cancel : cancel, // 팝업 창 닫기
| formSubmit : formSubmit, // 폼 전송
| formCheck : formCheck // 폼 체크
| };
|
| $scope.vm = {
| form : {
| title : "", // 제목
| description : "" // 내용
| },
| options : {
| callbacks : {
| onImageUpload : function (data) {
| data.pop();
| }
| },
| disableDragAndDrop : true,
| shortcuts : true,
| toolbar : [
| ['headline', ['style']],
| ['style', ['bold', 'italic', 'underline', 'clear', 'strikethrough', 'superscript', 'subscript']],
| ['fontface', ['fontname', 'fontsize']],
| ['insert', ['link', 'video']],
| ['fontclr', ['color']],
| ['alignment', ['ul', 'ol', 'paragraph', 'lineheight', 'height']],
| ['table', ['table']],
| ['view', ['redo', 'undo']]
| ],
| keyMap : {
| pc : {
| 'ENTER' : 'insertParagraph',
| 'CTRL+Z' : 'undo',
| 'CTRL+Y' : 'redo',
| /*'TAB': 'tab',*/
| 'SHIFT+TAB' : 'untab',
| 'CTRL+B' : 'bold',
| 'CTRL+I' : 'italic',
| 'CTRL+U' : 'underline',
| 'CTRL+SHIFT+S' : 'strikethrough',
| 'CTRL+BACKSLASH' : 'removeFormat',
| 'CTRL+SHIFT+L' : 'justifyLeft',
| 'CTRL+SHIFT+E' : 'justifyCenter',
| 'CTRL+SHIFT+R' : 'justifyRight',
| 'CTRL+SHIFT+J' : 'justifyFull',
| 'CTRL+SHIFT+NUM7' : 'insertUnorderedList',
| 'CTRL+SHIFT+NUM8' : 'insertOrderedList',
| 'CTRL+LEFTBRACKET' : 'outdent',
| 'CTRL+RIGHTBRACKET' : 'indent',
| 'CTRL+NUM0' : 'formatPara',
| 'CTRL+NUM1' : 'formatH1',
| 'CTRL+NUM2' : 'formatH2',
| 'CTRL+NUM3' : 'formatH3',
| 'CTRL+NUM4' : 'formatH4',
| 'CTRL+NUM5' : 'formatH5',
| 'CTRL+NUM6' : 'formatH6',
| 'CTRL+ENTER' : 'insertHorizontalRule',
| 'CTRL+K' : 'linkDialog.show'
| }
| }
| }
| };
|
| function formCheck(formInvalid) {
| if (formInvalid) {
| return true;
| }
|
| return false;
| }
|
| function formSubmit() {
| $rootScope.spinner = true;
|
| var content = {
| title : $rootScope.preventXss($scope.vm.form.title),
| description : $rootScope.preventXss($scope.vm.form.description)
| };
|
| Notice.add($resourceProvider.getContent(
| content,
| $resourceProvider.getPageContent(0, 10))).then(function (result) {
|
| if (result.data.message.status === "success") {
| $scope.fn.cancel();
| // 목록 화면 갱신
| $rootScope.$broadcast("getNoticeList", {});
| }
| else {
| SweetAlert.error($filter("translate")("notice.failedNoticeRegistration"), result.data.message.message);
| }
|
| $rootScope.spinner = false;
| });
| }
|
| function cancel() {
| $rootScope.$broadcast("closeLayer"); // 팝업이 열리고 나서 js-multi, js-single 등에서 body 이벤트가 날아가는 현상 수정
| $uibModalInstance.dismiss('cancel');
| $(document).unbind("keydown"); // 단축키 이벤트 제거
| }
| }]);
| });
|
|