environment_notification_plugin.js 912 Bytes
(function($) {
  "use strict";

  function notificationBar() {
    var completeMessage = $(".notification-bar").remove();
    $("#content-inner").before(completeMessage);
  },

  function hideNotification(){
    var notification = $(this).parent();
    var id = notification.attr("data-notification");

    $.ajax({
      url: noosfero_root()+"/admin/plugin/environment_notification/hide_notification",
      type: "POST",
      data: {notification_id: id},
      success: function(response) {
        notification.fadeOut();
      }
    });
  }

  function mceRestrict() {
    tinyMCE.init({
      menubar : false,
      selector: "textarea",
      plugins: [
          "autolink link"
      ],
      toolbar: "bold italic underline | link"
    });
  }

  jQuery(document).ready(function(){
    notificationBar();
    $(".notification-close").on("click", hideNotification);
    mceRestrict();
  });

})(jQuery);