Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds PrintablePageAsOfRevision view that uses an iframe #168

Merged
merged 2 commits into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions wikilabels/wsgi/static/css/views.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,18 @@ This can be removed if this file is loaded using ResourceLoader and CSSJanus.
background: #fff;
padding: 1em;
}

.wikilabels-printable-page-as-of-revision {
}

.wikilabels-printable-page-as-of-revision iframe {
border-width: 0px;
width: 100%;
height: 120%;
}
.wikilabels-printable-page-as-of-revision iframe #contentSub {
display: none;
}
.wikilabels-printable-page-as-of-revision iframe .wikibase-statementgrouplistview{
display: none;
}
11 changes: 7 additions & 4 deletions wikilabels/wsgi/static/js/wikiLabels/api.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
( function ($, WL) {

var API = function () {};
API.prototype.request = function (data) {
data['format'] = "json";
API.prototype.request = function (data, o) {
o = o || {}
var path = o.path || "/w/api.php";
var dataType = o.dataType || "jsonp";
data['format'] = o.format || "json";
var deferred = $.Deferred(),
ajaxPromise = $.ajax(
"//" + WL.mediawiki.host + "/w/api.php",
"//" + WL.mediawiki.host + path,
{
dataType: "jsonp",
dataType: dataType,
data: data
}
);
Expand Down
20 changes: 20 additions & 0 deletions wikilabels/wsgi/static/js/wikiLabels/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,25 @@
);
};

var PrintablePageAsOfRevision = function(taskListData) {
PrintablePageAsOfRevision.super.call( this, taskListData );
this.$element.addClass(WL.config.prefix + "printable-page-as-of-revision")
.addClass('display-page-html');
};
OO.inheritClass(PrintablePageAsOfRevision, View);
PrintablePageAsOfRevision.prototype.present = function(taskInfo) {
this.presentPage(
"//" + WL.mediawiki.host + "/w/index.php?oldid=" +
taskInfo.data.data.rev_id + "&printable=yes");
};
PrintablePageAsOfRevision.prototype.presentPage = function(src) {
var iframe = $("<iframe>").attr("src", src), limit = 10;
this.$element.html("");
this.$element.append( iframe );
};



var ParsedWikitext = function(taskListData) {
ParsedWikitext.super.call( this, taskListData );
this.$element.addClass(WL.config.prefix + "parsed-wikitext")
Expand Down Expand Up @@ -231,6 +250,7 @@
View: View,
DiffToPrevious: DiffToPrevious,
PageAsOfRevision: PageAsOfRevision,
PrintablePageAsOfRevision: PrintablePageAsOfRevision,
ParsedWikitext: ParsedWikitext
};
}(jQuery, wikiLabels));
2 changes: 1 addition & 1 deletion wikilabels/wsgi/templates/ui_wiki.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
background: #eaecf0;
}
body {
max-width: 50em;
max-width: 55em;
margin: 0px auto;
padding: 1em 2em;
background: #fff;
Expand Down