소스 검색

Move branding

Denis K 8 년 전
부모
커밋
465d5e2c40

+ 3 - 7
jet/static/jet/css/_header.scss

@@ -1,20 +1,16 @@
 @import "globals";
 
-
 /* HEADER */
 
-#header {
-  display: none;
-}
-
 #branding {
+  display: none;
   background-color: $sidebar-contrast-background-color;
   color: $sidebar-contrast-text-color;
   padding: 14px;
   text-align: center;
 
-  @include for-mobile {
-    display: none;
+  &.initialized {
+    display: block;
   }
 
   h1, h2 {

+ 2 - 3
jet/static/jet/css/_sidebar.scss

@@ -72,10 +72,9 @@
 
   &-close {
     display: none;
-    position: absolute;
-    top: 12px;
-    right: 18px;
+    float: right;
     padding: 4px;
+    margin: 12px 18px 0 12px;
     background: $sidebar-contrast-background-color;
     border-radius: 5px;
     z-index: 1;

+ 25 - 0
jet/static/jet/js/src/layout-updaters/branding.js

@@ -0,0 +1,25 @@
+var $ = require('jquery');
+
+var BrandingUpdater = function($branding) {
+    this.$branding = $branding;
+};
+
+BrandingUpdater.prototype = {
+    run: function() {
+        var $branding = this.$branding;
+
+        try {
+            $branding.detach().prependTo($('.sidebar-wrapper'));
+        } catch (e) {
+            console.error(e);
+        }
+
+        $branding.addClass('initialized');
+    }
+};
+
+$(document).ready(function() {
+    $('#branding').each(function() {
+        new BrandingUpdater($(this)).run();
+    });
+});

+ 1 - 0
jet/static/jet/js/src/main.js

@@ -14,6 +14,7 @@ require('./layout-updaters/tabular-inline');
 require('./layout-updaters/stacked-inline');
 require('./layout-updaters/related-widget-wrapper');
 require('./layout-updaters/delete-confirmation');
+require('./layout-updaters/branding');
 require('./features/sidebar/main');
 require('./features/filters');
 require('./features/changeform-tabs');

+ 0 - 3
jet/templates/admin/base.html

@@ -61,9 +61,6 @@
                 <a href="#" class="sidebar-close sidebar-toggle">
                     <span class="sidebar-close-icon icon-arrow-left"></span>
                 </a>
-                <div id="branding">
-                    {% block branding %}{% endblock %}
-                </div>
                 <div class="sidebar-section">
                     {% if user.is_active and user.is_staff %}
                         <div>