瀏覽代碼

HUE-7876 [presentation] Group the default toggle action inside the presentation mode

Romain Rigaux 7 年之前
父節點
當前提交
bf8494d
共有 1 個文件被更改,包括 17 次插入11 次删除
  1. 17 11
      desktop/libs/notebook/src/notebook/templates/editor_components.mako

+ 17 - 11
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -250,17 +250,23 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
   <div class="pull-right margin-right-10">
   % if ENABLE_PRESENTATION.get():
     <!-- ko with: selectedNotebook() -->
-    <div class="btn-group" data-bind="visible: $root.isPresentationMode() && $root.canSave()">
-      <a class="btn" title="${ _ko('Wether to open the document in presentation mode by default') }" data-bind="click: function() { isPresentationModeDefault(!isPresentationModeDefault()); }">
-        <i class="fa" data-bind="css: {'fa-toggle-on': isPresentationModeDefault(), 'fa-toggle-off': !isPresentationModeDefault()}"></i>
-      </a>
-    </div>
-    <div class="btn-group">
-      <a class="btn" title="${ _ko('View as a presentation') }" data-bind="click: function() { isPresentationMode(!isPresentationMode()); },
-        css: {'btn-inverse': $root.isPresentationMode()}">
-        <i class="fa fa-line-chart"></i>
-      </a>
-    </div>
+      <div class="btn-group">
+        <a class="btn" data-bind="click: function() { isPresentationMode(!isPresentationMode()); },
+        css: {'btn-inverse': $root.isPresentationMode()}, attr: {title: isPresentationMode() ? '${ _ko('Exit presentation') }' : '${ _ko('View as a presentation') }'}">
+          <i class="fa fa-line-chart"></i>
+        </a>
+
+        <!-- ko if: $root.isPresentationMode() && $root.canSave() -->
+        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
+        <ul class="dropdown-menu">
+          <li>
+            <a class="pointer" title="${ _ko('Wether to open in presentation or editor mode by default') }" data-bind="click: function() { isPresentationModeDefault(!isPresentationModeDefault()); }">
+              <i class="fa" data-bind="css: {'fa-toggle-on': isPresentationModeDefault(), 'fa-toggle-off': !isPresentationModeDefault()}"></i> ${ _('Open as presentation') }
+            </a>
+          </li>
+        </ul>
+        <!-- /ko -->
+      </div>
     <!-- /ko -->
   % endif