Mediawiki模板选项

时间:2015-12-16 22:39:18

标签: mediawiki mediawiki-templates

我有我的模板,而且大多数情况下它确实有效,有两件事是错的。我希望进度条对齐页面左侧,我还希望显示百分比。

<div style="
width:{{{width|25%}}};
{{#ifeq: {{{center|yes}}} | yes |
margin:auto;
text-align:center;}}">
{{#ifeq: {{{header|yes}}} | yes
| <p>
{{{text|completed <small>(estimate)</small>}}}
</p>
}}
<p style="border:{{{border|1px solid gray}}}; padding:{{{padding|1px}}};    overflow:hidden;">
<span style="
width: {{#expr: {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}} *   100}}%;
height: {{{height|2}}}px;
background:{{{color1|#5FDB00}}};
float:left;">&nbsp;</span>
<span style="
 width:{{#expr: 100 - {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}}    * 100}}%;
 height:{{{height|2}}}px;
 background:{{{color2|#efefef}}};
 float:left;
 ">&nbsp;</span>
 </p>
 </div>

我的例子

 {{Progress bar|90|text=KTG Image Rebuild}}

在此示例中,任务已完成90%但未显示在进度条上或上方。

1 个答案:

答案 0 :(得分:1)

试一试。你并没有真正尝试将进度文本放入其中,不确定为什么你会期望它在那里。它已在进度条super.updateConstraints() if !layoutConstrained { var lastRowView: UIView? = nil for (rowIndex, keyRow) in keyRows.enumerate() { var lastKeyView: UIView? = nil for (keyIndex, key) in keyRow.enumerate() { var relativeWidth: CGFloat = 0.0; switch key.type! { case .ModeChange: relativeWidth = 0.92/8 case .KeyboardChange: relativeWidth = 0.92/8 case .Space: relativeWidth = 3.92/8 case .Return: relativeWidth = 1.84/8 default: relativeWidth = 0.0 } key.translatesAutoresizingMaskIntoConstraints = false if let lastView = lastKeyView { let left: NSLayoutConstraint! if (key.keyCap == "Z" || (key.keyCap == "backspace" && keyRow[keyIndex - 1].keyCap == "M")) { left = NSLayoutConstraint(item: key, attribute: .Left, relatedBy: .Equal, toItem: lastView, attribute: .Right, multiplier: 1.0, constant: englishMZSpace) } else { left = NSLayoutConstraint(item: key, attribute: .Left, relatedBy: .Equal, toItem: lastView, attribute: .Right, multiplier: 1.0, constant: distanceBetweenKeys) } let top = NSLayoutConstraint(item: key, attribute: .Top, relatedBy: .Equal, toItem: lastView, attribute: .Top, multiplier: 1.0, constant: 0.0) let bottom = NSLayoutConstraint(item: key, attribute: .Bottom, relatedBy: .Equal, toItem: lastView, attribute: .Bottom, multiplier: 1.0, constant: 0.0) var width: NSLayoutConstraint? if relativeWidth == 0.0 { width = NSLayoutConstraint(item: key, attribute: .Width, relatedBy: .Equal, toItem: lastView, attribute: .Width, multiplier: 1.0, constant: 0.0) } else { width = NSLayoutConstraint(item: key, attribute: .Width, relatedBy: .Equal, toItem: self, attribute: .Width, multiplier: relativeWidth, constant: 0.0) } self.addConstraints([left, top, bottom, width!]) } else { let leftEdge: NSLayoutConstraint if key.keyCap == "A" { leftEdge = NSLayoutConstraint(item: key, attribute: .Left, relatedBy: .Equal, toItem: self, attribute: .Left, multiplier: 1.0, constant: englishALSpace) } else { leftEdge = NSLayoutConstraint(item: key, attribute: .Left, relatedBy: .Equal, toItem: self, attribute: .Left, multiplier: 1.0, constant: leftRightSpace) } self.addConstraint(leftEdge) if let lastRow = lastRowView { let top = NSLayoutConstraint(item: key, attribute: .Top, relatedBy:.Equal, toItem: lastRow, attribute: .Bottom, multiplier: 1.0, constant: rowTopInset) let height = NSLayoutConstraint(item: key, attribute: .Height, relatedBy: .Equal, toItem: lastRow, attribute: .Height, multiplier: 1.0, constant: 0.0) self.addConstraints([top, height]) } else { let topEdge = NSLayoutConstraint(item: key, attribute: .Top, relatedBy:.Equal, toItem: self, attribute: .Top, multiplier: 1.0, constant: rowTopInset) self.addConstraint(topEdge) } if rowIndex == keyRows.count - 1 { let bottomEdge = NSLayoutConstraint(item: key, attribute: .Bottom, relatedBy: .Equal, toItem: self, attribute: .Bottom, multiplier: 1.0, constant: -rowBottomInset) self.addConstraint(bottomEdge) } lastRowView = key } if keyIndex == keyRow.count - 1 { let rightEdge: NSLayoutConstraint if key.keyCap == "L" { rightEdge = NSLayoutConstraint(item: key, attribute: .Right, relatedBy: .Equal, toItem: self, attribute: .Right, multiplier: 1.0, constant: -englishALSpace) } else { rightEdge = NSLayoutConstraint(item: key, attribute: .Right, relatedBy: .Equal, toItem: self, attribute: .Right, multiplier: 1.0, constant: -leftRightSpace) } self.addConstraint(rightEdge) } lastKeyView = key } } layoutConstrained = true } 上方div添加。

<p>