only display inline HTML revision history on mobile

This commit is contained in:
Régis Hanol 2013-12-17 17:45:04 +01:00
parent 76c246664d
commit 1b6050bdb0
3 changed files with 116 additions and 16 deletions

View File

@ -12,7 +12,10 @@ Discourse.HistoryController = Discourse.ObjectController.extend(Discourse.ModalF
viewMode: "side_by_side",
refresh: function(postId, postVersion) {
this.set("loading", true);
this.setProperties({
loading: true,
viewMode: Discourse.Mobile.mobileView ? "inline" : "side_by_side"
});
var self = this;
Discourse.Post.loadRevision(postId, postVersion).then(function (result) {

View File

@ -12,8 +12,10 @@
</div>
<div id="display-modes">
<button {{bindAttr class=":btn displayingInline:btn-primary:standard"}} title="{{i18n post.revisions.displays.inline.title}}" {{action displayInline}}>{{{i18n post.revisions.displays.inline.button}}}</button>
<button {{bindAttr class=":btn displayingSideBySide:btn-primary:standard"}} title="{{i18n post.revisions.displays.side_by_side.title}}" {{action displaySideBySide}}>{{{i18n post.revisions.displays.side_by_side.button}}}</button>
<button {{bindAttr class=":btn displayingSideBySideMarkdown:btn-primary:standard"}} title="{{i18n post.revisions.displays.side_by_side_markdown.title}}" {{action displaySideBySideMarkdown}}>{{{i18n post.revisions.displays.side_by_side_markdown.button}}}</button>
{{#unless Discourse.Mobile.mobileView}}
<button {{bindAttr class=":btn displayingSideBySide:btn-primary:standard"}} title="{{i18n post.revisions.displays.side_by_side.title}}" {{action displaySideBySide}}>{{{i18n post.revisions.displays.side_by_side.button}}}</button>
<button {{bindAttr class=":btn displayingSideBySideMarkdown:btn-primary:standard"}} title="{{i18n post.revisions.displays.side_by_side_markdown.title}}" {{action displaySideBySideMarkdown}}>{{{i18n post.revisions.displays.side_by_side_markdown.button}}}</button>
{{/unless}}
</div>
</div>
<div id="revision-details">

View File

@ -1,26 +1,121 @@
// styles that apply to the popup that appears when you show the edit history
// of a post
// styles that apply to the popup that appears when you show the edit history of a post
@import "../common/foundation/variables";
@import "../common/foundation/mixins";
@import "common/foundation/variables";
@import "common/foundation/mixins";
.modal.history-modal {
.modal-inner-container {
min-width: 100%;
min-height: 100%;
min-width: 960px;
min-height: 500px;
}
#revision-controls {
float: left;
.btn[disabled]:hover {
color: #534d4b;
}
}
#display-modes {
text-align: right;
.btn-primary {
float: none;
}
}
#revision-details {
background-color: #eee;
padding: 5px;
margin-top: 10px;
}
#revisions {
word-wrap: break-word;
}
img {
max-width: 670px;
height: auto;
}
.inline-diff {
width: 670px;
}
.markdown {
font-family: monospace;
font-size: 12px;
width: 100%;
border-collapse: collapse;
border-spacing: 0px;
td {
width: 50%;
vertical-align: top;
max-width: 440px;
word-wrap: break-word;
white-space: pre-wrap;
}
}
.span8, .markdown {
img {
max-width: 400px;
}
}
ins, .diff-ins {
code, img {
border: 2px solid #405A04;
}
img {
opacity: .75;
filter: alpha(opacity=75);
}
a {
color: #2D4003;
text-decoration: none;
}
}
img.diff-ins, code.diff-ins {
border: 2px solid #405A04;
}
img.diff-ins {
opacity: .75;
filter: alpha(opacity=75);
}
.diff-ins {
background: #f9ffe1;
}
ins {
background: #e6ffe6;
color: #405A04;
background: #D1E1AD;
}
del, .diff-del {
code, img {
border: 2px solid #A82400;
}
img {
opacity: .5;
filter: alpha(opacity=50);
}
a {
color: #400E00;
text-decoration: none;
}
}
img.diff-del, code.diff-del {
border: 2px solid #A82400;
}
img.diff-del {
opacity: .5;
filter: alpha(opacity=50);
}
.diff-del {
background: #fff4f4;
}
del {
background: #ffe6e6;
color: #A82400;
background: #E5BDB2;
}
span.date {
font-weight: bold;
}
span.edit-reason {
background-color: #ffffcc;
padding: 3px 5px 5px 5px;
}
.modal-header {
height: 42px;
padding-bottom: 10px;
}
.modal-body {padding-top: 0px;}
}
.offset1 {display: none;}