Browse Source

HUE-5440 [home] Extract common home for normal and embeddable homes

Enrico Berti 9 năm trước cách đây
mục cha
commit
bb35a40

+ 210 - 0
desktop/core/src/desktop/templates/common_home.mako

@@ -0,0 +1,210 @@
+## Licensed to Cloudera, Inc. under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  Cloudera, Inc. licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+<%!
+  from desktop.views import commonheader, commonfooter, _ko
+  from desktop import conf
+  from django.utils.translation import ugettext as _
+%>
+
+<%namespace name="docBrowser" file="/document_browser.mako" />
+
+<%def name="homeJSModels()">
+  <script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }"></script>
+  <script src="${ static('desktop/ext/js/selectize.min.js') }"></script>
+  <script src="${ static('desktop/js/apiHelper.js') }"></script>
+  <script src="${ static('desktop/ext/js/knockout-sortable.min.js') }"></script>
+  <script src="${ static('desktop/js/ko.editable.js') }"></script>
+  <script src="${ static('desktop/js/ko.switch-case.js') }"></script>
+  <script src="${ static('desktop/js/jquery.huedatatable.js') }"></script>
+  <script src="${ static('desktop/ext/js/jquery/plugins/jquery.mousewheel.min.js') }"></script>
+  <script src="${ static('desktop/ext/js/jquery.mCustomScrollbar.concat.min.js') }"></script>
+  <script src="${ static('desktop/js/home2.vm.js') }"></script>
+
+  ${ docBrowser.docBrowser() }
+</%def>
+
+
+<%def name="navbar()">
+<div class="navbar navbar-inverse navbar-fixed-top nokids">
+  <div class="navbar-inner">
+    <div class="container-fluid">
+      <div class="nav-collapse">
+        <ul class="nav">
+          <li class="currentApp">
+            <a href="${ url('desktop.views.home2') }">
+              <img src="${ static('desktop/art/home.png') }" class="app-icon" />
+              ${ _('My documents') }
+            </a>
+           </li>
+        </ul>
+      </div>
+    </div>
+  </div>
+</div>
+</%def>
+
+<%def name="vm(is_embeddable=False)">
+<script type="text/html" id="document-template">
+  <tr>
+    <td style="width: 26px"></td>
+    <td><a data-bind="attr: { href: absoluteUrl }, html: name"></a></td>
+    <td data-bind="text: ko.mapping.toJSON($data)"></td>
+  </tr>
+</script>
+
+<script type="text/javascript" charset="utf-8">
+  (function () {
+    ko.options.deferUpdates = true;
+
+    var userGroups = [];
+    % for group in user.groups.all():
+      userGroups.push('${ group }');
+    % endfor
+
+    $(document).ready(function () {
+      var options = {
+        user: '${ user.username }',
+        userGroups: userGroups,
+        superuser: '${ user.is_superuser }' === 'True',
+        i18n: {
+          errorFetchingTableDetails: '${_('An error occurred fetching the table details. Please try again.')}',
+          errorFetchingTableFields: '${_('An error occurred fetching the table fields. Please try again.')}',
+          errorFetchingTableSample: '${_('An error occurred fetching the table sample. Please try again.')}',
+          errorRefreshingTableStats: '${_('An error occurred refreshing the table stats. Please try again.')}',
+          errorLoadingDatabases: '${ _('There was a problem loading the databases. Please try again.') }',
+          errorLoadingTablePreview: '${ _('There was a problem loading the table preview. Please try again.') }'
+        }
+      };
+
+      var viewModel = new HomeViewModel(options);
+
+      var loadUrlParam = function () {
+        if (location.getParameter('uuid')) {
+          viewModel.openUuid(location.getParameter('uuid'));
+        } else if (location.getParameter('path')) {
+          viewModel.openPath(location.getParameter('path'));
+        } else if (viewModel.activeEntry() && viewModel.activeEntry().loaded()) {
+          var rootEntry = viewModel.activeEntry();
+          while (rootEntry && ! rootEntry.isRoot()) {
+            rootEntry = rootEntry.parent;
+          }
+          viewModel.activeEntry(rootEntry);
+        } else {
+          viewModel.activeEntry().load(function () {
+            if (viewModel.activeEntry().entries().length === 1 && viewModel.activeEntry().entries()[0].definition().type === 'directory') {
+              viewModel.activeEntry(viewModel.activeEntry().entries()[0]);
+              viewModel.activeEntry().load();
+            }
+          });
+        }
+      };
+      window.onpopstate = loadUrlParam;
+      loadUrlParam();
+
+      %if not is_embeddable:
+      viewModel.activeEntry.subscribe(function (newEntry) {
+        if (typeof newEntry !== 'undefined' && newEntry.definition().uuid && ! newEntry.isRoot()) {
+          hueUtils.changeURL('/home?uuid=' + newEntry.definition().uuid);
+        } else if (typeof newEntry === 'undefined' || newEntry.isRoot()) {
+          hueUtils.changeURL('/home');
+        }
+      });
+      %endif
+
+      ko.applyBindings(viewModel, $('#documentList')[0]);
+
+      huePubSub.publish('init.tour');
+
+    });
+  })();
+
+  huePubSub.subscribe('init.tour', function(){
+    if ($.totalStorage("jHueTourHideModal") == null || $.totalStorage("jHueTourHideModal") == false) {
+      $("#jHueTourModal").modal();
+      $.totalStorage("jHueTourHideModal", true);
+      $("#jHueTourModalChk").attr("checked", "checked");
+      $("#jHueTourModalChk").on("change", function () {
+        $.totalStorage("jHueTourHideModal", $(this).is(":checked"));
+      });
+      $("#jHueTourModalClose").on("click", function () {
+        $("#jHueTourFlag").click();
+        $("#jHueTourModal").modal("hide");
+      });
+    }
+  });
+</script>
+</%def>
+
+<%def name="tour()">
+<div id="jHueTourModal" class="modal hide fade" tabindex="-1">
+  <div class="modal-header">
+    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+    <h3>${_('Did you know?')}</h3>
+  </div>
+  <div class="modal-body">
+    <ul class="nav nav-tabs" style="margin-bottom: 0">
+      <li class="active"><a href="#tourStep1" data-toggle="tab">${ _('Step 1:') } ${ _('Add data') }</a></li>
+      <li><a href="#tourStep2" data-toggle="tab">${ _('Step 2:') }  ${ _('Query data') }</a></li>
+      <li><a href="#tourStep3" data-toggle="tab">${ _('Step 3:') } ${_('Do more!') }</a></li>
+    </ul>
+
+    <div class="tab-content">
+      <div id="tourStep1" class="tab-pane active">
+        <div class="pull-left step-icon"><i class="fa fa-download"></i></div>
+        <div style="margin: 40px">
+          <p>
+            ${ _('With') }  <span class="badge badge-info"><i class="fa fa-file"></i> File Browser</span>
+            ${ _('and the apps in the') }  <span class="badge badge-info">Data Browsers <b class="caret"></b></span> ${ _('section, upload, view your data and create tables.') }
+          </p>
+          <p>
+            ${ _('Pre-installed samples are also already there.') }
+          </p>
+        </div>
+      </div>
+
+      <div id="tourStep2" class="tab-pane">
+          <div class="pull-left step-icon"><i class="fa fa-search"></i></div>
+          <div style="margin: 40px">
+            <p>
+              ${ _('Then query and visualize the data with the') } <span class="badge badge-info">Query Editors <b class="caret"></b></span>
+               ${ _('and') }  <span class="badge badge-info">Search <b class="caret"></b></span>
+            </p>
+          </div>
+      </div>
+
+      <div id="tourStep3" class="tab-pane">
+        <div class="pull-left step-icon"><i class="fa fa-flag-checkered"></i></div>
+        <div style="margin: 40px">
+          % if tours_and_tutorials:
+          <p>
+            ${ _('Tours were created to guide you around.') }
+            ${ _('You can see the list of tours by clicking on the checkered flag icon') } <span class="badge badge-info"><i class="fa fa-flag-checkered"></i></span>
+            ${ ('at the top right of this page.') }
+          </p>
+          % endif
+          <p>
+            ${ _('Additional documentation is available at') } <a href="http://learn.gethue.com">learn.gethue.com</a>.
+          </p>
+        </div>
+      </div>
+    </div>
+  </div>
+  <div class="modal-footer">
+    <label class="checkbox" style="float:left"><input id="jHueTourModalChk" type="checkbox" />${_('Do not show this dialog again')}</label>
+    <a id="jHueTourModalClose" href="#" class="btn btn-primary disable-feedback">${_('Got it!')}</a>
+  </div>
+</div>
+</%def>

+ 6 - 174
desktop/core/src/desktop/templates/home2.mako

@@ -20,26 +20,15 @@
 %>
 
 <%namespace name="assist" file="/assist.mako" />
-<%namespace name="docBrowser" file="/document_browser.mako" />
+<%namespace name="common_home" file="/common_home.mako" />
 
 ${ commonheader(_('Welcome Home'), "home", user, request) | n,unicode }
 
-<script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }"></script>
-<script src="${ static('desktop/ext/js/selectize.min.js') }"></script>
-<script src="${ static('desktop/js/apiHelper.js') }"></script>
-<script src="${ static('desktop/ext/js/knockout-sortable.min.js') }"></script>
-<script src="${ static('desktop/js/ko.editable.js') }"></script>
-<script src="${ static('desktop/js/ko.switch-case.js') }"></script>
-<script src="${ static('desktop/js/jquery.huedatatable.js') }"></script>
-<script src="${ static('desktop/ext/js/jquery/plugins/jquery.mousewheel.min.js') }"></script>
-<script src="${ static('desktop/ext/js/jquery.mCustomScrollbar.concat.min.js') }"></script>
-
 ${ assist.assistJSModels() }
 
-<script src="${ static('desktop/js/home2.vm.js') }"></script>
+${ common_home.homeJSModels() }
 
 ${ assist.assistPanel() }
-${ docBrowser.docBrowser() }
 
 <style type="text/css">
   html {
@@ -167,22 +156,8 @@ ${ docBrowser.docBrowser() }
   }
 </style>
 
-<div class="navbar navbar-inverse navbar-fixed-top nokids">
-  <div class="navbar-inner">
-    <div class="container-fluid">
-      <div class="nav-collapse">
-        <ul class="nav">
-          <li class="currentApp">
-            <a href="${ url('desktop.views.home2') }">
-              <img src="${ static('desktop/art/home.png') }" class="app-icon" />
-              ${ _('My documents') }
-            </a>
-           </li>
-        </ul>
-      </div>
-    </div>
-  </div>
-</div>
+
+${ common_home.navbar() }
 
 <div id="documentList" class="main-content">
 ##   Uncomment to enable the assist panel
@@ -227,151 +202,8 @@ ${ docBrowser.docBrowser() }
   </div>
 </div>
 
-<script type="text/html" id="document-template">
-  <tr>
-    <td style="width: 26px"></td>
-    <td><a data-bind="attr: { href: absoluteUrl }, html: name"></a></td>
-    <td data-bind="text: ko.mapping.toJSON($data)"></td>
-  </tr>
-</script>
-
-<script type="text/javascript" charset="utf-8">
-  (function () {
-    ko.options.deferUpdates = true;
-
-    var userGroups = [];
-    % for group in user.groups.all():
-      userGroups.push('${ group }');
-    % endfor
-
-    $(document).ready(function () {
-      var options = {
-        user: '${ user.username }',
-        userGroups: userGroups,
-        superuser: '${ user.is_superuser }' === 'True',
-        i18n: {
-          errorFetchingTableDetails: '${_('An error occurred fetching the table details. Please try again.')}',
-          errorFetchingTableFields: '${_('An error occurred fetching the table fields. Please try again.')}',
-          errorFetchingTableSample: '${_('An error occurred fetching the table sample. Please try again.')}',
-          errorRefreshingTableStats: '${_('An error occurred refreshing the table stats. Please try again.')}',
-          errorLoadingDatabases: '${ _('There was a problem loading the databases. Please try again.') }',
-          errorLoadingTablePreview: '${ _('There was a problem loading the table preview. Please try again.') }'
-        }
-      };
-
-      var viewModel = new HomeViewModel(options);
-
-      var loadUrlParam = function () {
-        if (location.getParameter('uuid')) {
-          viewModel.openUuid(location.getParameter('uuid'));
-        } else if (location.getParameter('path')) {
-          viewModel.openPath(location.getParameter('path'));
-        } else if (viewModel.activeEntry() && viewModel.activeEntry().loaded()) {
-          var rootEntry = viewModel.activeEntry();
-          while (rootEntry && ! rootEntry.isRoot()) {
-            rootEntry = rootEntry.parent;
-          }
-          viewModel.activeEntry(rootEntry);
-        } else {
-          viewModel.activeEntry().load(function () {
-            if (viewModel.activeEntry().entries().length === 1 && viewModel.activeEntry().entries()[0].definition().type === 'directory') {
-              viewModel.activeEntry(viewModel.activeEntry().entries()[0]);
-              viewModel.activeEntry().load();
-            }
-          });
-        }
-      };
-      window.onpopstate = loadUrlParam;
-      loadUrlParam();
-
-      viewModel.activeEntry.subscribe(function (newEntry) {
-        if (typeof newEntry !== 'undefined' && newEntry.definition().uuid && ! newEntry.isRoot()) {
-          hueUtils.changeURL('/home?uuid=' + newEntry.definition().uuid);
-        } else if (typeof newEntry === 'undefined' || newEntry.isRoot()) {
-          hueUtils.changeURL('/home');
-        }
-      });
-
-      ko.applyBindings(viewModel, $('#documentList')[0]);
+${ common_home.vm() }
+${ common_home.tour() }
 
-      huePubSub.publish('init.tour');
-
-    });
-  })();
-
-  huePubSub.subscribe('init.tour', function(){
-    if ($.totalStorage("jHueTourHideModal") == null || $.totalStorage("jHueTourHideModal") == false) {
-      $("#jHueTourModal").modal();
-      $.totalStorage("jHueTourHideModal", true);
-      $("#jHueTourModalChk").attr("checked", "checked");
-      $("#jHueTourModalChk").on("change", function () {
-        $.totalStorage("jHueTourHideModal", $(this).is(":checked"));
-      });
-      $("#jHueTourModalClose").on("click", function () {
-        $("#jHueTourFlag").click();
-        $("#jHueTourModal").modal("hide");
-      });
-    }
-  });
-</script>
-
-<div id="jHueTourModal" class="modal hide fade" tabindex="-1">
-  <div class="modal-header">
-    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
-    <h3>${_('Did you know?')}</h3>
-  </div>
-  <div class="modal-body">
-    <ul class="nav nav-tabs" style="margin-bottom: 0">
-      <li class="active"><a href="#tourStep1" data-toggle="tab">${ _('Step 1:') } ${ _('Add data') }</a></li>
-      <li><a href="#tourStep2" data-toggle="tab">${ _('Step 2:') }  ${ _('Query data') }</a></li>
-      <li><a href="#tourStep3" data-toggle="tab">${ _('Step 3:') } ${_('Do more!') }</a></li>
-    </ul>
-
-    <div class="tab-content">
-      <div id="tourStep1" class="tab-pane active">
-        <div class="pull-left step-icon"><i class="fa fa-download"></i></div>
-        <div style="margin: 40px">
-          <p>
-            ${ _('With') }  <span class="badge badge-info"><i class="fa fa-file"></i> File Browser</span>
-            ${ _('and the apps in the') }  <span class="badge badge-info">Data Browsers <b class="caret"></b></span> ${ _('section, upload, view your data and create tables.') }
-          </p>
-          <p>
-            ${ _('Pre-installed samples are also already there.') }
-          </p>
-        </div>
-      </div>
-
-      <div id="tourStep2" class="tab-pane">
-          <div class="pull-left step-icon"><i class="fa fa-search"></i></div>
-          <div style="margin: 40px">
-            <p>
-              ${ _('Then query and visualize the data with the') } <span class="badge badge-info">Query Editors <b class="caret"></b></span>
-               ${ _('and') }  <span class="badge badge-info">Search <b class="caret"></b></span>
-            </p>
-          </div>
-      </div>
-
-      <div id="tourStep3" class="tab-pane">
-        <div class="pull-left step-icon"><i class="fa fa-flag-checkered"></i></div>
-        <div style="margin: 40px">
-          % if tours_and_tutorials:
-          <p>
-            ${ _('Tours were created to guide you around.') }
-            ${ _('You can see the list of tours by clicking on the checkered flag icon') } <span class="badge badge-info"><i class="fa fa-flag-checkered"></i></span>
-            ${ ('at the top right of this page.') }
-          </p>
-          % endif
-          <p>
-            ${ _('Additional documentation is available at') } <a href="http://learn.gethue.com">learn.gethue.com</a>.
-          </p>
-        </div>
-      </div>
-    </div>
-  </div>
-  <div class="modal-footer">
-    <label class="checkbox" style="float:left"><input id="jHueTourModalChk" type="checkbox" />${_('Do not show this dialog again')}</label>
-    <a id="jHueTourModalClose" href="#" class="btn btn-primary disable-feedback">${_('Got it!')}</a>
-  </div>
-</div>
 
 ${ commonfooter(request, messages) | n,unicode }

+ 60 - 0
desktop/core/src/desktop/templates/home_embeddable.mako

@@ -0,0 +1,60 @@
+## Licensed to Cloudera, Inc. under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  Cloudera, Inc. licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+<%!
+  from desktop.views import commonheader, commonfooter, _ko
+  from desktop import conf
+  from django.utils.translation import ugettext as _
+%>
+
+<%namespace name="common_home" file="/common_home.mako" />
+
+${ common_home.homeJSModels() }
+
+<style type="text/css">
+
+  .step-icon {
+    color: #DDDDDD;
+    font-size: 116px;
+    margin: 10px;
+    margin-right: 20px;
+    width: 130px;
+  }
+
+  .nav-tabs > li.active {
+    padding: 0;
+  }
+</style>
+
+
+${ common_home.navbar() }
+
+<div id="documentList" class="main-content">
+  <div class="vertical-full container-fluid" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '0' : '20px' }">
+    <div class="vertical-full row-fluid panel-container">
+      <div class="content-panel home-container" data-bind="style: { 'padding-left' : $root.isLeftPanelVisible() ? '8px' : '0' }">
+        <div class="doc-browser" data-bind="component: {
+          name: 'doc-browser',
+          params: {
+            activeEntry: activeEntry
+          }
+        }"></div>
+      </div>
+    </div>
+  </div>
+</div>
+
+${ common_home.vm(True) }
+${ common_home.tour() }

+ 47 - 2
desktop/core/src/desktop/templates/responsive.mako

@@ -69,6 +69,47 @@
     var IS_S3_ENABLED = '${ is_s3_enabled }' === 'True';
     var HAS_OPTIMIZER = '${ has_optimizer() }' === 'True';
 
+    // jHue plugins global configuration
+    jHueFileChooserGlobals = {
+      labels: {
+        BACK: "${_('Back')}",
+        SELECT_FOLDER: "${_('Select this folder')}",
+        CREATE_FOLDER: "${_('Create folder')}",
+        FOLDER_NAME: "${_('Folder name')}",
+        CANCEL: "${_('Cancel')}",
+        FILE_NOT_FOUND: "${_('The file has not been found')}",
+        UPLOAD_FILE: "${_('Upload a file')}",
+        FAILED: "${_('Failed')}"
+      },
+      user: "${ user.username }"
+    };
+
+    jHueHdfsTreeGlobals = {
+      labels: {
+        CREATE_FOLDER: "${_('Create folder')}",
+        FOLDER_NAME: "${_('Folder name')}",
+        CANCEL: "${_('Cancel')}"
+      }
+    };
+
+    jHueTableExtenderGlobals = {
+      labels: {
+        GO_TO_COLUMN: "${_('Go to column:')}",
+        PLACEHOLDER: "${_('column name...')}",
+        LOCK: "${_('Click to lock this row')}",
+        UNLOCK: "${_('Click to unlock this row')}"
+      }
+    };
+
+    jHueTourGlobals = {
+      labels: {
+        AVAILABLE_TOURS: "${_('Available tours')}",
+        NO_AVAILABLE_TOURS: "${_('None for this page.')}",
+        MORE_INFO: "${_('Read more about it...')}",
+        TOOLTIP_TITLE: "${_('Demo tutorials')}"
+      }
+    };
+
     ApiHelperGlobals = {
       i18n: {
         errorLoadingDatabases: '${ _('There was a problem loading the databases') }',
@@ -91,7 +132,7 @@ ${ hueIcons.symbols() }
         <span class="hamburger-inner"></span>
       </span>
       </a>
-      <a class="nav-tooltip pull-left" title="${_('Homepage')}" rel="navigator-tooltip"  href="#" data-bind="click: function(){ ko.dataFor($('.page-content')[0]).currentApp('editor') }">
+      <a class="nav-tooltip pull-left" title="${_('Homepage')}" rel="navigator-tooltip"  href="#" data-bind="click: function(){ ko.dataFor($('.page-content')[0]).currentApp('home') }">
         <svg style="margin-top:12px;margin-left:8px;height: 24px;width:120px;display: inline-block;">
           <use xlink:href="#hue-logo"></use>
         </svg>
@@ -264,6 +305,7 @@ ${ hueIcons.symbols() }
       <div id="embeddable_oozie_wf" class="embeddable"></div>
       <div id="embeddable_jobbrowser" class="embeddable"></div>
       <div id="embeddable_filebrowser" class="embeddable"></div>
+      <div id="embeddable_home" class="embeddable"></div>
     </div>
 
     <div id="rightResizer" class="resizer" data-bind="visible: rightAssistVisible(), splitFlexDraggable : {
@@ -342,12 +384,14 @@ ${ hueIcons.symbols() }
 <script src="${ static('desktop/js/ko.editable.js') }"></script>
 <script src="${ static('desktop/js/ko.hue-bindings.js') }"></script>
 <script src="${ static('desktop/js/jquery.scrollup.js') }"></script>
+<script src="${ static('desktop/js/jquery.tour.js') }"></script>
 <script src="${ static('desktop/js/sqlFunctions.js') }"></script>
 
 ${ koComponents.all() }
 ${ assist.assistJSModels() }
 ${ assist.assistPanel() }
 
+
 <script type="text/javascript" charset="utf-8">
 
   $(document).ready(function () {
@@ -379,7 +423,8 @@ ${ assist.assistPanel() }
           search: '/search/embeddable/new_search',
           oozie_wf: '/oozie/editor/workflow/new/?is_embeddable=true',
           jobbrowser: '/jobbrowser/apps?is_embeddable=true',
-          filebrowser: '/filebrowser/?is_embeddable=true'
+          filebrowser: '/filebrowser/?is_embeddable=true',
+          home: '/home_embeddable',
         };
 
         self.embeddable_cache = {};

+ 2 - 1
desktop/core/src/desktop/urls.py

@@ -63,7 +63,8 @@ dynamic_patterns = patterns('desktop.auth.views',
 if USE_NEW_EDITOR.get():
   dynamic_patterns += patterns('desktop.views',
     (r'^home$','home2'),
-    (r'^home2$','home')
+    (r'^home2$','home'),
+    (r'^home_embeddable$','home_embeddable'),
   )
 else:
   dynamic_patterns += patterns('desktop.views',

+ 9 - 2
desktop/core/src/desktop/views.py

@@ -106,7 +106,7 @@ def home(request):
   })
 
 
-def home2(request):
+def home2(request, is_embeddable=False):
   try:
     converter = DocumentConverter(request.user)
     converter.convert()
@@ -115,11 +115,18 @@ def home2(request):
 
   apps = appmanager.get_apps_dict(request.user)
 
-  return render('home2.mako', request, {
+  template = 'home2.mako'
+  if is_embeddable:
+    template = 'home_embeddable.mako'
+
+  return render(template, request, {
     'apps': apps,
     'tours_and_tutorials': Settings.get_settings().tours_and_tutorials
   })
 
+def home_embeddable(request):
+  return home2(request, True)
+
 
 @access_log_level(logging.WARN)
 def log_view(request):