work-in-progress
[redakcja.git] / redakcja / static / js / wiki / view_summary.js
1 (function($){
2
3         function SummaryPerspective(options) {
4                 var old_callback = options.callback;
5                 var self = this;
6
7         options.callback = function(){
8                         $('#publish_button').click(function() {
9                                 $.blockUI({message: "Oczekiwanie na odpowiedź serwera..."});
10                                 self.doc.publish({
11                                         success: function(doc, data) {
12                                                 $.blockUI({message: "Udało się.", timeout: 2000});
13                                         },
14                                         failure: function(doc, message) {
15                                                 $.blockUI({
16                                                         message: message,
17                                                         timeout: 5000
18                                                 });
19                                         }
20
21                                 });
22                         });
23
24                         old_callback.call(this);
25                 };
26
27                 $.wiki.Perspective.call(this, options);
28     };
29
30     SummaryPerspective.prototype = new $.wiki.Perspective();
31
32     SummaryPerspective.prototype.freezeState = function(){
33         // must
34     };
35
36         SummaryPerspective.prototype.onEnter = function(success, failure){
37                 $.wiki.Perspective.prototype.onEnter.call(this);
38
39                 console.log("Entered summery view");
40         };
41
42         $.wiki.SummaryPerspective = SummaryPerspective;
43
44 })(jQuery);
45