Page MenuHomePhabricator

Set appropriate content model for pages created by CentralNotice for CentralNotice banners
Closed, DuplicatePublic

Description

Currently, if the extension creates MediaWiki namespace pages for CN banners, they are being created with the default content model which looks very messy (see for example https://meta.wikimedia.org/wiki/MediaWiki:Centralnotice-template-stewnoms). I suggest either creating a new CN content model rendering these pages with mixed scripts (CSS, HTML, JS, …) or letting it default to plain text.

Event Timeline

Vogone renamed this task from Set apropriate content model for pages created by CentralNotice for CentralNotice banners to Set appropriate content model for pages created by CentralNotice for CentralNotice banners.Jan 15 2017, 11:51 PM

Here is the source code of the page for reference:

<style>

#centralNotice.collapsed #{{{banner}}} {
 display: none;
}

#{{{banner}}} {
 position: relative;
 overflow: hidden;
 background: url('//upload.wikimedia.org/wikipedia/commons/0/0d/Gray-gradient1.png') bottom repeat-x;
 margin-bottom: 0.5em !important;
 margin-top: 0.5em !important;
 background-color: #ffffff;
 border: 1px solid #aaaaaa;
 height: auto !important;
 min-height: 65px;
 display: none;
}

#{{{banner}}} a.cn-full-banner-click {
 display: block;
 height: 100%;
 width: 100%;
 cursor: pointer;
}

#{{{banner}}} a:hover {
 text-decoration: none;
}


#{{{banner}}}-logo {
 position: absolute;
 top: 11px;
 left: 15px;
 background-image: url(//upload.wikimedia.org/wikipedia/commons/thumb/7/75/Wikimedia_Community_Logo.svg/50px-Wikimedia_Community_Logo.svg.png);
 height: 50px;
 width: 50px;
 background-repeat: no-repeat;
}

#{{{banner}}} #black-text {
 font-size: 1em;
 color: black;
 font-weight: bold;
 padding: 0.75em 40px 1.6em 60px !important;
 line-height: 1.3em;
 text-align: center;
}

#{{{banner}}} #black-text:hover {
text-decoration: underline;
}

#{{{banner}}} div#cn-toggle-box {
 position: absolute;
 top: 3px;
 right: 6px;
}

#{{{banner}}} div#cn-translation-link {
 position:absolute;
 bottom: 3px;
 right: 6px;
 font-size: 0.7em;
}

#{{{banner}}} #cn-translation-link:hover {
 text-decoration: underline;
}
</style>

<div id="{{{banner}}}">

  <a class="cn-full-banner-click" href="//meta.wikimedia.org/wiki/Special:Mylanguage/Stewards/Elections_2017/Guidelines#Candidates">
    <div id="black-text">
      <div id="{{{banner}}}-logo"></div>
      <div id="black-text1">{{{text1}}}</div>
      <div id="black-text2">{{{text2}}}</div>
     </div>
  </a>

  <div id="cn-toggle-box">
<a href="#" title="Close" onclick="mw.centralNotice.hideBanner();return false;"><div class="cn-closeButton">Close</div></a>
</div>
<div id="cn-translation-link">
      [<a href="//meta.wikimedia.org/w/index.php?title=Special:Translate&group=Centralnotice-tgroup-stewnoms">{{int:centralnotice-shared-help-translate}}</a>]
</div>

</div>

<script>
var wgHideStewardNomNotice = {

    initialize: function () {
        var notice, insysops;

        // get elements
        notice = document.getElementById( '{{{banner}}}' );
        if ( !notice ) {
            return mw.log( 'could not locate #{{{banner}}}' );
        }

        // only visible to sysops
        insysops = $.inArray( 'sysop', mw.config.get( 'wgUserGroups' ) ) !== -1;
        if ( insysops || mw.util.getParamValue( 'force' ) ) {
                notice.style.display = 'block';
        } else {
                notice.style.display = 'none';
        }
    }
};
wgHideStewardNomNotice.initialize();
</script>