Module:Userbox and Module:Userbox/sandbox: Difference between pages

(Difference between pages)
Jump to navigation Jump to search
Page 1
Page 2
imported>Jonesey95
Add more color:inherit properties so that background-color is not left without a color. Tested in the sandbox. Please revert if this breaks anything.
 
imported>Mathglot
Distinguish default flow (left, non-float) which gets no right margin for, e.g., a string of userboxes, from float:left, which gets a bit of right margin to avoid jammed text wrapping.
 
Line 85: Line 85:
data.width = borderWidthNum and addSuffix(240 - 2 * borderWidthNum, 'px')
data.width = borderWidthNum and addSuffix(240 - 2 * borderWidthNum, 'px')
data.bodyClass = args.bodyclass
data.bodyClass = args.bodyclass
data.bodyMargin = args.bodymargin  -- NEW ARG (having bodyStyle would be nice, too)


-- Get table tag values.
-- Get table tag values.
Line 129: Line 130:
data.width = borderWidthNum and addSuffix(240 - 2 * borderWidthNum, 'px')
data.width = borderWidthNum and addSuffix(240 - 2 * borderWidthNum, 'px')
data.bodyClass = args.bodyclass
data.bodyClass = args.bodyclass
data.bodyMargin = args.bodymargin  -- NEW ARG (having bodyStyle would be nice, too)


-- Get table tag values.
-- Get table tag values.
Line 182: Line 184:
data.width = borderWidthNum and addSuffix(240 - 2 * borderWidthNum, 'px')
data.width = borderWidthNum and addSuffix(240 - 2 * borderWidthNum, 'px')
data.bodyClass = args.bodyclass
data.bodyClass = args.bodyclass
data.bodyMargin = args.bodymargin  -- NEW ARG (having bodyStyle would be nice, too)


-- Get table tag values.
-- Get table tag values.
Line 230: Line 233:
root:css('border-width', data.borderWidth)
root:css('border-width', data.borderWidth)
end
end
if data.bodyMargin then                -- if user provides a margin value by param, then...
root:css('margin', data.bodyMargin) --  just use the param value
elseif data.float == 'right' then      -- if not, then set some minimal margin so floated box doesn't jam up against text
root:css('margin-left', '8px')      -- default probly should be a local variable near the top somewhere
elseif data.float == 'left' then        -- ditto for float left because we are worrying about text wrapping on the right
root:css('margin-right', '8px')    -- (the 8px default probly should be a local variable up top somewhere)
end                                    -- no margin for default flow (left, non-float) e.g. for a string of boxes
if data.borderColor then  
if data.borderColor then  
root:css('border-color', data.borderColor)
root:css('border-color', data.borderColor)