Module:Tabs: Difference between revisions

Want an adless experience? Log in or Create an account.
fix default tabs if left and top share the same selector
(forgot delimiter arg for split)
(fix default tabs if left and top share the same selector)
Line 204: Line 204:
   local args = Args.fromFrame( frame )
   local args = Args.fromFrame( frame )
   local tabs = TabContainer.new( args )
   local tabs = TabContainer.new( args )
  -- fix default tabs if left and top share the same selector
  if args.left and args.top and (args.left.selector or '0') == (args.top.selector or '0') then
    if args.left.selector and args.left.selector ~= '0' then args.top.selector = 0 end
    if not args.left.selector then
      if args.top.selector and args.top.selector ~= '0' then
        args.left.selector = 0
      else
        args.top.selector = 0
      end
    end
  end


   if args.left then
   if args.left then
     local left = tabs:leftTabs( args.left )
     local left = tabs:leftTabs( args.left )
     for _, leftArgs in ipairs( args.left ) do
     for _, tabArgs in ipairs( args.left ) do
       leftArgs = Args.getTable( leftArgs )
       tabArgs = Args.getTable( tabArgs )
       leftArgs.selection = Args.getValue( leftArgs )
       tabArgs.selection = Args.getValue( tabArgs )
       left:addTab( leftArgs )
       tab:addTab( tabArgs )
     end
     end
   end
   end
Line 217: Line 229:
     local topArgs = args.top
     local topArgs = args.top
     if args.left and not topArgs.selector then topArgs.selector = 1 end -- default to 2D behavior if both sets are present
     if args.left and not topArgs.selector then topArgs.selector = 1 end -- default to 2D behavior if both sets are present
    if args.left and args.left.selector == topArgs.selector and args.left.default ~= 0 then topArgs.default = 0 end
     local top = tabs:topTabs( topArgs )
     local top = tabs:topTabs( topArgs )
     for _, topArgs in ipairs( args.top ) do
     for _, tabArgs in ipairs( args.top ) do
       topArgs = Args.getTable( topArgs )
       tabArgs = Args.getTable( tabArgs )
       topArgs.selection = Args.getValue( topArgs )
       tabArgs.selection = Args.getValue( tabArgs )
       top:addTab( topArgs )
       tab:addTab( tabArgs )
     end
     end
   end
   end