Changeset 156859 in indico


Ignore:
Timestamp:
11/17/10 11:35:58 (3 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
Children:
55b3c5
Parents:
c04c53
git-author:
Leszek Syroka <leszek.marek.syroka@…> (11/16/10 17:51:20)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (11/17/10 11:35:58)
Message:

[FIX] New editor

  • ckeditor was implemented in the news editor
  • fix#584
File:
1 edited

Legend:

Unmodified
Added
Removed
  • indico/htdocs/js/indico/Admin/News.js

    re8b0b5 r156859  
    44            return item.draw(); 
    55        }, 
    6      
     6 
    77        addItem: function() { 
    88            var addNews = new NewsItem('edit', this); 
     
    4747            this.request(params); 
    4848        }, 
    49      
     49 
    5050        _saveResource: function() { 
    5151            var params = {"id":this.id, "title": this.titleField.get(), "type": this.typeField.get(), "content": this.content.get()}; 
    5252            var self = this; 
    5353            var killProgress = IndicoUI.Dialogs.Util.progress(); 
    54             jsonRpc(Indico.Urls.JsonRpcService, 'news.save', params, 
    55                     function(response, error){ 
    56                         if (exists(error)) { 
    57                             killProgress(); 
    58                             IndicoUtil.errorReport(error); 
    59                         } 
    60                         else { 
    61                             killProgress(); 
    62                             self._success(response); 
    63                         } 
    64                     }); 
     54            if(self.content.clean()) 
     55                jsonRpc(Indico.Urls.JsonRpcService, 'news.save', params, 
     56                        function(response, error){ 
     57                            if (exists(error)) 
     58                                IndicoUtil.errorReport(error); 
     59                            else 
     60                                self._success(response); 
     61                        }); 
     62            killProgress() 
    6563        }, 
    66      
     64 
    6765        _success: function(response) { 
    6866            this.creationDate = response.creationDate; 
     
    7169            this.text = response.text; 
    7270           this.id = response.id; 
    73      
     71 
    7472            this.chooser.set('display'); 
    7573        }, 
    76      
     74 
    7775        draw: function() { 
    7876            var self = this; 
    79      
     77 
    8078            var titleField = Html.input('text',{'className':'newsEditTitle'},'Write a title'); 
    8179            var typeField = Widget.select(self.parentList.newsTypesList); 
    8280            typeField.set('general'); 
    83      
     81 
    8482            this.titleField = titleField; 
    8583            this.typeField = typeField; 
    86      
     84 
    8785            var saveButton = null; 
    8886            if (self.id) { 
     
    9795                }, "Save")); 
    9896            } 
    99      
     97 
    10098            var cancelButton = Widget.button(command(function (){ 
    10199               if (self.id) { 
     
    105103               } 
    106104            }, "Cancel")); 
    107      
     105 
    108106            this.chooser = new Chooser(new Lookup({ 
    109107                edit: function() { 
    110                    var content = new RichTextEditor(500,200); 
     108                   var content = new ParsedRichTextEditor(600,400,'IndicoMinimal'); 
    111109                   self.content = content; 
    112      
     110 
    113111                   if (self.id) { 
    114112                       content.set(self.text); 
    115113                   } 
    116      
     114 
    117115                    return Html.div("newsItemEdit", titleField, typeField, content.draw(), 
    118116                                                   saveButton, cancelButton); }, 
     
    134132                } 
    135133            })); 
    136      
     134 
    137135            this.chooser.set(this.choice); 
    138      
     136 
    139137            return this.ServiceWidget.prototype.draw.call(this, Widget.block(this.chooser)); 
    140138        } 
Note: See TracChangeset for help on using the changeset viewer.