Show PDF button in toolbar if file tree is closed in PDF flat view

This commit is contained in:
James Allen 2014-08-12 13:18:22 +01:00
parent 93f2969be5
commit 6bfefea5cb
7 changed files with 47 additions and 19 deletions

View file

@ -46,14 +46,15 @@ aside#file-tree(ng-controller="FileTreeController").full-size
ng-class="{ 'no-toolbar': !permissions.write }"
)
div(ng-show="ui.pdfLayout == 'flat' && (ui.view == 'editor' || ui.view == 'pdf')")
div(ng-show="ui.pdfLayout == 'flat' && (ui.view == 'editor' || ui.view == 'pdf' || ui.view == 'file')")
ul.list-unstyled.file-tree-list
li(
ng-class="{ 'selected': ui.view == 'pdf' }"
ng-controller="PdfViewToggleController"
)
.entity
.entity-name(
ng-click="ui.view = 'pdf'"
ng-click="togglePdfView()"
)
i.fa.fa-fw.toggle
i.fa.fa-fw.fa-file-pdf-o

View file

@ -14,6 +14,17 @@ header.toolbar.toolbar-header(ng-cloak, ng-hide="state.loading")
tooltip-append-to-body="true"
)
i.fa.fa-fw.fa-level-up
span(ng-controller="PdfViewToggleController")
a(
href,
ng-show="ui.pdfLayout == 'flat' && fileTreeClosed",
tooltip="PDF",
tooltip-placement="bottom",
tooltip-append-to-body="true",
ng-click="togglePdfView()",
ng-class="{ 'active': ui.view == 'pdf' }"
)
i.fa.fa-file-pdf-o
.toolbar-center.project-name(ng-controller="ProjectNameController")
span.name(

View file

@ -1,5 +1,6 @@
define [
"ide/pdf/controllers/PdfController"
"ide/pdf/controllers/PdfViewToggleController"
"ide/pdf/directives/pdfJs"
], () ->
class PdfManager

View file

@ -0,0 +1,17 @@
define [
"base"
], (App) ->
App.controller "PdfViewToggleController", ($scope) ->
$scope.togglePdfView = () ->
if $scope.ui.view == "pdf"
$scope.ui.view = "editor"
else
$scope.ui.view = "pdf"
$scope.fileTreeClosed = false
$scope.$on "layout:main:resize", (e, state) ->
if state.west.initClosed
$scope.fileTreeClosed = true
else
$scope.fileTreeClosed = false
$scope.$apply()

View file

@ -72,7 +72,7 @@ aside#file-tree {
color: @link-color;
border-right: 4px solid @link-color;
font-weight: bold;
i.fa-folder-open, i.fa-folder, i.fa-file, i.fa-image {
i.fa-folder-open, i.fa-folder, i.fa-file, i.fa-image, i.fa-file-pdf-o {
color: @link-color;
}
padding-right: 32px;

View file

@ -74,20 +74,6 @@
}
.pdf .toolbar {
.log-btn {
&.active, &:active {
.label {
display: none;
}
color: white;
background-color: @link-color;
.box-shadow(inset 0 3px 5px rgba(0, 0, 0, 0.225));
&:hover {
color: white;
}
}
}
.toolbar-right {
margin-right: @line-height-computed / 2;
a {

View file

@ -16,14 +16,25 @@
a:not(.btn) {
display: inline-block;
color: @gray-light;
padding: 5px 12px 6px;
margin: 0;
padding: 4px 10px 5px;
margin: 1px 2px;
border-radius: @border-radius-small;
&:hover {
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
color: @gray-dark;
text-decoration: none;
}
&.active, &:active {
.label {
display: none;
}
color: white;
background-color: @link-color;
.box-shadow(inset 0 3px 5px rgba(0, 0, 0, 0.225));
&:hover {
color: white;
}
}
}
.btn-full-height {
@ -81,6 +92,7 @@
height: 32px;
a {
padding: 4px 2px 2px;
margin: 0;
margin-left: 6px;
}
.toolbar-right {