From 1b6050bdb08b0fff704f631d728a97f7b5ce7eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 17 Dec 2013 17:45:04 +0100 Subject: [PATCH] only display inline HTML revision history on mobile --- .../controllers/history_controller.js | 5 +- .../templates/modal/history.js.handlebars | 6 +- app/assets/stylesheets/mobile/history.scss | 121 ++++++++++++++++-- 3 files changed, 116 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/history_controller.js b/app/assets/javascripts/discourse/controllers/history_controller.js index 65f89de6a91..a62bd62b9d7 100644 --- a/app/assets/javascripts/discourse/controllers/history_controller.js +++ b/app/assets/javascripts/discourse/controllers/history_controller.js @@ -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) { diff --git a/app/assets/javascripts/discourse/templates/modal/history.js.handlebars b/app/assets/javascripts/discourse/templates/modal/history.js.handlebars index d01e42789c2..ca9df8eb507 100644 --- a/app/assets/javascripts/discourse/templates/modal/history.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/history.js.handlebars @@ -12,8 +12,10 @@
- - + {{#unless Discourse.Mobile.mobileView}} + + + {{/unless}}
diff --git a/app/assets/stylesheets/mobile/history.scss b/app/assets/stylesheets/mobile/history.scss index 86c4908aae0..cc849256e0b 100644 --- a/app/assets/stylesheets/mobile/history.scss +++ b/app/assets/stylesheets/mobile/history.scss @@ -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;}