
-if @message

  = form_for [:forum, @message], :remote => (true if !@message.id) do |f| 
    #message_form
      .form


        =f.hidden_field :forum_topic_id
        =f.hidden_field :forum_user_id
  

  
        %label
          Contenu du message :*
        .forum_message


          .left

            .user
              =image_tag((current_fuser.avatar? ? current_fuser.avatar.square.url : ""), :class => "avatar" )
              %br
              =current_fuser.firstname+" "+current_fuser.name
    
            .date=l @message.created_at, :format => :human if @message and @message.created_at

          .right{:style => "padding:0px;"}
            .content{:style => "border:0px;padding:2% !important;min-height:200px;background:transparent !important;"}
              =raw f.object.description
        =f.text_area :description, :id => "redactor_content", :style => "display:none;"  
  
  
        =f.submit "Sauvegarder", :class => "btn btn-primary"



        :javascript
          $("#message_form").closest("form").submit(function (e){
  
            $("textarea").val($('#message_form .content').redactor("code.get"));
            $("#toolbar-text").html("");
  
          });
    
          $('#message_form .content').redactor({
            lang: 'en',
            buttons : ['undo','redo', '|', 'bold', 'italic', 'deleted','underline','|', 'alignleft', 'aligncenter', 'alignright', 'justify', '|', 'unorderedlist', 'orderedlist', '|', 'link', '|', 'backcolor','|', 'horizontalrule']
  
  
          });
    
-else
  #message_form
    .form


      =f.hidden_field :forum_topic_id
      =f.hidden_field :forum_user_id
  

  
      %label
        Contenu du message :*
      .forum_message


        .left

          .user
            =image_tag((current_fuser.avatar? ? current_fuser.avatar.square.url : ""), :class => "avatar" )
            %br
            =current_fuser.firstname+" "+current_fuser.name
    
          .date=l @message.created_at, :format => :human if @message and @message.created_at

        .right{:style => "padding:0px;"}
          .content{:style => "border:0px;padding:2% !important;min-height:200px;background:transparent !important;"}
            =raw f.object.description
      =f.text_area :description, :id => "redactor_content", :style => "display:none;"  
  
  
      %center 
        =f.submit "Sauvegarder", :class => "btn btn-primary"



      :javascript
        $("#message_form").closest("form").submit(function (e){
  
          $("textarea").val($('#message_form .content').redactor("code.get"));
          $("#toolbar-text").html("");
  
        });
    
        $('#message_form .content').redactor({
          lang: 'en',
          buttons : ['undo','redo', '|', 'bold', 'italic', 'deleted','underline','|', 'alignleft', 'aligncenter', 'alignright', 'justify', '|', 'unorderedlist', 'orderedlist', '|', 'link', '|', 'backcolor','|', 'horizontalrule']
  
  
        });
  
    
      

      
  
  
