소스 검색

Adds a method to message handle that can render more than 2 buttons.

j8
hristoterezov 10 년 전
부모
커밋
3ff161321b
1개의 변경된 파일22개의 추가작업 그리고 0개의 파일을 삭제
  1. 22
    0
      message_handler.js

+ 22
- 0
message_handler.js 파일 보기

@@ -39,6 +39,28 @@ var messageHandler = (function(my) {
39 39
         });
40 40
     };
41 41
 
42
+    /**
43
+     * Shows a message to the user with two buttons: first is given as a parameter and the second is Cancel.
44
+     *
45
+     * @param titleString the title of the message
46
+     * @param msgString the text of the message
47
+     * @param persistent boolean value which determines whether the message is persistent or not
48
+     * @param buttons object with the buttons. The keys must be the name of the button and value is the value
49
+     * that will be passed to submitFunction
50
+     * @param submitFunction function to be called on submit
51
+     * @param loadedFunction function to be called after the prompt is fully loaded
52
+     */
53
+    my.openDialog = function(titleString, msgString, persistent, buttons, submitFunction, loadedFunction) {
54
+        $.prompt(msgString, {
55
+            title: titleString,
56
+            persistent: false,
57
+            buttons: buttons,
58
+            defaultButton: 1,
59
+            loaded: loadedFunction,
60
+            submit: submitFunction
61
+        });
62
+    };
63
+
42 64
     /**
43 65
      * Shows a dialog with different states to the user.
44 66
      *

Loading…
취소
저장