1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-19 15:38:38 +00:00

Merge pull request #1771 from haiwen/file-view-ui

File view ui
This commit is contained in:
Daniel Pan 2017-08-31 12:12:55 +08:00 committed by GitHub
commit ba86d53b72
3 changed files with 49 additions and 12 deletions

View File

@ -2817,7 +2817,7 @@ button.sf-dropdown-toggle:focus {
border:1px solid #eee; border:1px solid #eee;
width:auto; width:auto;
height:auto; height:auto;
max-width:100%; max-width:calc(100% - 4px);
max-height:calc(100% - 4px); max-height:calc(100% - 4px);
font-size:0; font-size:0;
line-height:0; line-height:0;
@ -2882,7 +2882,7 @@ button.sf-dropdown-toggle:focus {
} }
.pdf-page { .pdf-page {
display:block; display:block;
max-width:950px; max-width:100%;
margin:0 auto 20px; margin:0 auto 20px;
} }
#doc-view { #doc-view {

View File

@ -16,11 +16,11 @@ function getOutputScale(ctx) {
} }
function setFileViewAreaHeight() { function setFileViewAreaHeight() {
$('body').css({'overflow':'auto'}); var $fileView = $('#file-view');
var file_view = $('#file-view').css({'height': 'auto'}); $fileView.css({
if ($(window).height() > file_view.outerHeight(true) + file_view.offset().top) { 'max-height': $(window).height() - $fileView.offset().top,
file_view.outerHeight($(window).height() - file_view.offset().top); 'overflow': 'auto'
} });
} }
try { try {

View File

@ -7,6 +7,24 @@
{% block extra_style %} {% block extra_style %}
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/file_view_extra.css" /> <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/file_view_extra.css" />
<style type="text/css">
#view-hd {
width:100%;
padding:0 15px 12px;
border-bottom:1px solid #c9c9c9;
}
#file-view {
border:none;
border-right:4px solid transparent;
margin-top:0;
-webkit-transition: margin-right 0.3s ease;
-moz-transition: margin-right 0.3s ease;
transition: margin-right 0.3s ease;
}
#file-discussions {
box-shadow:none;
}
</style>
{% endblock %} {% endblock %}
{% block header_css_class %}hide{% endblock %} {% block header_css_class %}hide{% endblock %}
@ -256,11 +274,11 @@ $(window).load(setToolbarPos).resize(setToolbarPos);
{% elif filetype == 'Image' and not err %} {% elif filetype == 'Image' and not err %}
{% else %} {% else %}
function setFileViewAreaHeight() { function setFileViewAreaHeight() {
$('body').css({'overflow':'auto'}); var $fileView = $('#file-view');
var file_view = $('#file-view').css({'height': 'auto'}); $('#file-view').css({
if ($(window).height() > file_view.outerHeight(true) + file_view.offset().top) { 'max-height': $(window).height() - $fileView.offset().top,
file_view.outerHeight($(window).height() - file_view.offset().top); 'overflow': 'auto'
} });
} }
$(window).load(setFileViewAreaHeight).resize(setFileViewAreaHeight); $(window).load(setFileViewAreaHeight).resize(setFileViewAreaHeight);
{% endif %} {% endif %}
@ -312,6 +330,7 @@ var fileDiscussions = {
init: function() { init: function() {
var _this = this; var _this = this;
this.setPosition();
this.setLocale(); this.setLocale();
// events // events
@ -343,6 +362,10 @@ var fileDiscussions = {
}, },
setPosition: function() {
this.$el.css({'top': $('#file-view').offset().top});
},
setLocale: function() { setLocale: function() {
var lang_code = '{{LANGUAGE_CODE}}'; var lang_code = '{{LANGUAGE_CODE}}';
var m_lang_code; var m_lang_code;
@ -372,11 +395,24 @@ var fileDiscussions = {
show: function() { show: function() {
this.render(); this.render();
this.$el.css({'right': 0}); this.$el.css({'right': 0});
$('#file-view').css({'margin-right': 400});
// pdf file view with pdf.js; text file view; #file-view-tip
$('#pdf, .CodeMirror, #file-view-tip').css({'width':'auto', 'margin':'0 10px'});
// encoding selector
$('#file-enc-cont').css({'width': 'auto', 'margin-right':'10px'});
this.setConHeight(); this.setConHeight();
this.getContent(); this.getContent();
}, },
hide: function() { hide: function() {
$('#file-view').css({'margin-right': 0});
// pdf file view with pdf.js; text file view; #file-view-tip
// encoding selector
$('#pdf, .CodeMirror, #file-enc-cont, #file-view-tip').removeAttr('style');
this.$el.css({'right': '-400px'}); this.$el.css({'right': '-400px'});
this.$el.empty(); this.$el.empty();
}, },
@ -489,6 +525,7 @@ var fileDiscussions = {
setConHeight: function() { setConHeight: function() {
$('.file-discussions-con', this.$el).css({ $('.file-discussions-con', this.$el).css({
'max-height': $(window).height() 'max-height': $(window).height()
- this.$el.offset().top
- $('.file-discussions-hd', this.$el).outerHeight(true) - $('.file-discussions-hd', this.$el).outerHeight(true)
- $('.file-discussions-footer', this.$el).outerHeight(true) - $('.file-discussions-footer', this.$el).outerHeight(true)
}); });