mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-17 07:41:26 +00:00
Add side nav toggle function for small screen
This commit is contained in:
@@ -657,6 +657,20 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
border-right:1px solid #eee;
|
border-right:1px solid #eee;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
.side-tabnav {
|
||||||
|
background: #f8f8f8;
|
||||||
|
width:300px;
|
||||||
|
position:fixed;
|
||||||
|
top:0;
|
||||||
|
bottom:0;
|
||||||
|
z-index:1;
|
||||||
|
padding:20px;
|
||||||
|
overflow-x:hidden;
|
||||||
|
overflow-y:auto;
|
||||||
|
border-right:1px solid #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
.side-tabnav .hd {
|
.side-tabnav .hd {
|
||||||
margin-bottom:0.5em;
|
margin-bottom:0.5em;
|
||||||
}
|
}
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
<div id="header" role="banner" class="navbar navbar-fixed-top">
|
<div id="header" role="banner" class="navbar navbar-fixed-top">
|
||||||
<div id="header-inner">
|
<div id="header-inner">
|
||||||
{% block notice_panel %}{% endblock %}
|
{% block notice_panel %}{% endblock %}
|
||||||
<a href="{{ SITE_ROOT }}" id="logo" class="fleft">
|
<a href="{{ SITE_ROOT }}" id="logo" class="hidden-sm-down fleft">
|
||||||
{% if seacloud_mode %}
|
{% if seacloud_mode %}
|
||||||
<img src="{{ MEDIA_URL }}img/seacloud_logo.png?t=1398068110" title="Seacloud" alt="logo" width="186" height="31" />
|
<img src="{{ MEDIA_URL }}img/seacloud_logo.png?t=1398068110" title="Seacloud" alt="logo" width="186" height="31" />
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -51,6 +51,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<button class="sf2-icon-list-view hidden-md-up" title="Side Nav Menu" id="js-toggle-side-nav" aria-label="{% trans "Side Nav Menu" %}"></button>
|
||||||
|
|
||||||
<div class="fright">
|
<div class="fright">
|
||||||
{% if has_file_search %}
|
{% if has_file_search %}
|
||||||
{% include 'snippets/search_form.html' %}
|
{% include 'snippets/search_form.html' %}
|
||||||
|
@@ -606,6 +606,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/template" id="side-nav-tmpl">
|
<script type="text/template" id="side-nav-tmpl">
|
||||||
|
<a href="#" class="sf2-icon-x2 fright hidden-md-up js-close-side-nav" title="{% trans "Close" %}" aria-label="{% trans "Close" %}"></a>
|
||||||
<h3 class="hd">{% trans "Files" %}</h3>
|
<h3 class="hd">{% trans "Files" %}</h3>
|
||||||
<ul class="side-tabnav-tabs">
|
<ul class="side-tabnav-tabs">
|
||||||
{% if user.permissions.can_add_repo %}
|
{% if user.permissions.can_add_repo %}
|
||||||
|
@@ -28,7 +28,14 @@ define([
|
|||||||
'can_add_repo': app.pageOptions.can_add_repo,
|
'can_add_repo': app.pageOptions.can_add_repo,
|
||||||
};
|
};
|
||||||
this.render();
|
this.render();
|
||||||
this.$el.show();
|
if ($(window).width() >= 768) {
|
||||||
|
this.$el.show();
|
||||||
|
}
|
||||||
|
var _this = this;
|
||||||
|
$('#js-toggle-side-nav').click(function() {
|
||||||
|
_this.show();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
@@ -38,7 +45,9 @@ define([
|
|||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click #group-nav a:first': 'toggleGroupList',
|
'click #group-nav a:first': 'toggleGroupList',
|
||||||
'click #enable-mods': 'enableMods'
|
'click #enable-mods': 'enableMods',
|
||||||
|
'click .js-close-side-nav': 'closeNav',
|
||||||
|
'click li > a': 'visitLink'
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleGroupList: function() {
|
toggleGroupList: function() {
|
||||||
@@ -139,7 +148,26 @@ define([
|
|||||||
error: function() {
|
error: function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
|
||||||
|
show: function() {
|
||||||
|
this.$el.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
closeNav: function() {
|
||||||
|
this.$el.hide();
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
visitLink: function(event) {
|
||||||
|
if ($(window).width() < 768) {
|
||||||
|
if ($(event.target).attr('href') !== "#") {
|
||||||
|
// except for groups toggle link
|
||||||
|
this.$el.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user