From: Lincoln de Sousa Date: Fri, 27 Jul 2007 15:21:54 +0000 (-0300) Subject: alterando o tipo de dados do atributo Noticia.chamada para TextField e alterando... X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Feventmanager.git;a=commitdiff_plain;h=9160e737bbc2515f602deada80dd92e31e23c2f8 alterando o tipo de dados do atributo Noticia.chamada para TextField e alterando o nome do js (que foi renomeado) alem disso adicionando um pequeno hammer pra alterar o tamanho do textarea do campo chamada no admin --- diff --git a/conteudo/models.py b/conteudo/models.py index 49720e3..91f92b4 100644 --- a/conteudo/models.py +++ b/conteudo/models.py @@ -26,14 +26,13 @@ class Noticia(models.Model): titulo = models.CharField(maxlength=100) autor = models.ForeignKey(User) data_criacao = models.DateTimeField(auto_now=True) - chamada = models.CharField(maxlength=400, - help_text='Texto que irá aparecer na index.') + chamada = models.TextField(help_text='Texto que irá aparecer na index.') corpo = models.TextField(help_text='Texto que irá aparecer na ' 'página de detalhes da notícia.') class Admin: js = ('/site_media/tiny_mce/tiny_mce.js', - '/site_media/js/textarea.js',) + '/site_media/js/textarea-noticias.js',) def __str__(self): diff --git a/media/js/textarea-noticias.js b/media/js/textarea-noticias.js new file mode 100644 index 0000000..2df9003 --- /dev/null +++ b/media/js/textarea-noticias.js @@ -0,0 +1,32 @@ +tinyMCE.init({ + mode : "exact", + elements : "id_corpo", + theme : "advanced", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_buttons1 : "fullscreen,separator,preview,separator,bold,italic,underline,strikethrough,separator,bullist,numlist,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,separator,image,cleanup,help,separator,code", + theme_advanced_buttons2 : "", + theme_advanced_buttons3 : "", + auto_cleanup_word : true, + plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu,fullscreen", + plugin_insertdate_dateFormat : "%m/%d/%Y", + plugin_insertdate_timeFormat : "%H:%M:%S", + extended_valid_elements : "a[name|href|target=_blank|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", + fullscreen_settings : { + theme_advanced_path_location : "top", + theme_advanced_buttons1 : "fullscreen,separator,preview,separator,cut,copy,paste,separator,undo,redo,separator,search,replace,separator,code,separator,cleanup,separator,bold,italic,underline,strikethrough,separator,forecolor,backcolor,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,help", + theme_advanced_buttons2 : "removeformat,styleselect,formatselect,fontselect,fontsizeselect,separator,bullist,numlist,outdent,indent,separator,link,unlink,anchor", + theme_advanced_buttons3 : "sub,sup,separator,image,insertdate,inserttime,separator,tablecontrols,separator,hr,advhr,visualaid,separator,charmap,emotions,iespell,flash,separator,print" + } +}); + +callback = function () { + var chamada = document.getElementById('id_chamada'); + if (chamada) + chamada.style.height = '60px;'; +} + +if (window.addEventListener) + window.addEventListener('load', callback, false); +else if (window.attachEvent) + window.attachEvent('onload', callback);