Sha256: d2a7aaa09a4e1ca0ef537b15375253e9ae0c5e66afca9943d1e2048b7ec3135e

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

$(function(){
  // Send ajax request with all forms data for given tabs block.
  function save_tab(tabs){
    var data=""
    tabs.find("form").each(function(){
      data=data+"&"+$(this).serialize()
    })
    //alert(data)
    $.ajax({
      url:tabs.attr("data-tabs-url"),
      dataType:"html",
      type:tabs.attr("data-method"),
      data:data,
      success:function(data){
        $("#content").html(data);
      }
    })
  }
  // Submit all forms through Ajax when Save All button clicked.
  $("button.save-all").live('click',function(){
    //var tab=$(this).parents("div[data-tabs-url]")
    var tab = $("#content").children("div[data-tabs-url]")
    save_tab(tab)
  })
  // All tabs are closable when clicked on tab title.
  $(".tab .tab-title").live('click',function(){
    var tab_title=$(this)
    var closed=tab_title.data("closed") || (tab_title.attr("data-closed")=="false" ? false : true)
      if(closed){
        tab_title.parents(".tab").find(".tab-content").show("fast")
      }else{
        tab_title.parents(".tab").find(".tab-content").hide("fast")
      }
      tab_title.data("closed",!closed)
    })
    // Flash is hidden when clicked on
  $("#flash").live("click", function(){
    $(this).slideUp("fast");
  })
})

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lolita-3.0.7 public/javascripts/lolita/tab.js