Sha256: 70e8852c7c9f3bb1042a70346b08cc75aa1b1cac67fbfa323d3f1c4f2676773a

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 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);
      },
      error:function(xhr, textStatus, errorThrown){
        f = $("#flash");
        f.html("<span style='color:red'>An Error occured, please contact support personel</span>");
        f.slideDown("fast")
      }
    })
  }
  // 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
})

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lolita-3.1.16 public/javascripts/lolita/tab.js
lolita-3.1.15 public/javascripts/lolita/tab.js
lolita-3.1.14 public/javascripts/lolita/tab.js
lolita-3.1.13 public/javascripts/lolita/tab.js
lolita-3.1.12 public/javascripts/lolita/tab.js
lolita-3.1.11 public/javascripts/lolita/tab.js
lolita-3.1.9 public/javascripts/lolita/tab.js
lolita-3.1.8 public/javascripts/lolita/tab.js
lolita-3.1.7 public/javascripts/lolita/tab.js
lolita-3.1.6 public/javascripts/lolita/tab.js