Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
f1nality committed Apr 10, 2017
2 parents b635566 + 31e18ce commit 45e9471
Show file tree
Hide file tree
Showing 56 changed files with 3,757 additions and 271 deletions.
4 changes: 4 additions & 0 deletions jet/dashboard/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.template import Context
from importlib import import_module
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
Expand Down Expand Up @@ -47,6 +48,9 @@ def __init__(self, context, **kwargs):
self.set_context(context)

def set_context(self, context):
if isinstance(context, Context):
context = context.flatten()

self.context = context
self.init_with_context(context)
self.load_modules()
Expand Down
53 changes: 53 additions & 0 deletions jet/management/commands/jet_side_menu_items_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
try:
from django.core.management.base import NoArgsCommand
except ImportError:
from django.core.management import BaseCommand as NoArgsCommand

from jet.utils import get_app_list, get_original_menu_items


class Command(NoArgsCommand):
help = 'Generates example of JET custom apps setting'
item_order = 0

def handle(self, *args, **options):
if args:
raise CommandError("Command doesn't accept any arguments")
return self.handle_noargs(**options)

def handle_noargs(self, **options):
class User:
is_active = True
is_staff = True
is_superuser = True

def has_module_perms(self, app):
return True

def has_perm(self, object):
return True

class Request:
user = User()

app_list = get_original_menu_items({
'request': Request(),
'user': None
})

self.stdout.write('# Add this to your settings.py to customize applications and models list')
self.stdout.write('JET_SIDE_MENU_ITEMS = [')

for app in app_list:
self.stdout.write(' {\'app_label\': \'%s\', \'models\': [' % (
app['app_label']
))

for model in app['models']:
self.stdout.write(' {\'name\': \'%s\'},' % (
model['name']
))

self.stdout.write(' ]},')

self.stdout.write(']')
1 change: 1 addition & 0 deletions jet/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Side menu
JET_SIDE_MENU_COMPACT = getattr(settings, 'JET_SIDE_MENU_COMPACT', False)
JET_SIDE_MENU_ITEMS = getattr(settings, 'JET_SIDE_MENU_ITEMS', None)
JET_SIDE_MENU_CUSTOM_APPS = getattr(settings, 'JET_SIDE_MENU_CUSTOM_APPS', None)

# Improved usability
Expand Down
15 changes: 13 additions & 2 deletions jet/static/jet/css/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,24 @@ body {
/* PAGE STRUCTURE */

#container {
padding: 0 0 0 $sidebar-width;
padding: 0;
min-height: 100%;
transition: padding-left 0.3s;

@include for-mobile {
body.menu-pinned & {
padding-left: $sidebar-width;
}

body.menu-pinned.popup & {
padding-left: 0;
}

@include for-mobile {
&, body.menu-pinned & {
padding-left: 0;
}
}

.popup & {
padding-left: 0;
}
Expand Down
17 changes: 10 additions & 7 deletions jet/static/jet/css/_breadcrumbs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ div.breadcrumbs {
text-transform: uppercase;
line-height: $top-height;
color: $top-text-color;
padding: 20px 175px + 20px + 20px 20px 20px;
padding: 10px 175px + 20px + 20px 10px 20px;
visibility: hidden;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
min-height: 32px;

@include for-mobile {
padding: 20px 20px 10px 20px;
Expand Down Expand Up @@ -40,10 +41,12 @@ div.breadcrumbs {
}
}

.breadcrumbs-separator {
color: $top-separator-color;
margin: 0 6px 0 6px;
font-weight: bold !important;
font-size: 15px;
vertical-align: middle;
.breadcrumbs {
&-separator {
color: $top-separator-color;
margin: 0 6px 0 6px;
font-weight: bold !important;
font-size: 15px;
vertical-align: middle;
}
}
64 changes: 52 additions & 12 deletions jet/static/jet/css/_changeform.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@

label {
.required &, &.required {
font-weight: bold;

&:after {
content: "*";
}
Expand Down Expand Up @@ -124,6 +122,7 @@ form {
display: inline-block;
vertical-align: -3px;
padding: 0 0 5px 0;
line-height: 1.4;

& + p.help {
margin-top: -4px;
Expand Down Expand Up @@ -201,7 +200,7 @@ form .aligned {
}

.colM .aligned .vLargeTextField, .colM .aligned .vXMLLargeTextField {
width: 510px;
width: 610px;

@include for-mobile {
width: 100%;
Expand Down Expand Up @@ -536,7 +535,9 @@ body.popup .submit-row {
background: linear-gradient(to top, $content-background-color 0%, $content-contrast-background-color 100%);
font-weight: bold;
color: $text-color;
padding: 20px 30px 0 30px;
padding: 20px 24px 0 24px;
text-transform: uppercase;
font-size: 12px;

@include for-mobile {
padding: 20px 20px 0 20px;
Expand Down Expand Up @@ -620,13 +621,9 @@ body.popup .submit-row {
box-sizing: border-box;

h3 {
padding: 24px;
margin: 0;
padding: 2px 5px 3px 5px;
font-size: 11px;
text-align: left;
font-weight: bold;
background: #bcd;
color: #fff;
background: transparent;
}
}
}
Expand Down Expand Up @@ -870,8 +867,51 @@ form .related-widget-wrapper ul {
}

&-button {
font-weight: bold;
vertical-align: middle;
&, &:visited, &:hover {
width: 120px;
vertical-align: middle;
box-sizing: border-box;
}

&-icon {
font-weight: bold;
vertical-align: middle;
line-height: 32px;

&.left {
float: left;
}

&.right {
float: right;
}
}

&-label {
display: block;
opacity: 0.5;
transition: opacity $transitions-duration;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

&-icon.left + &-label {
margin-left: 16px;
}

&-icon.right + &-label {
margin-right: 16px;
}

&:hover &-label {
opacity: 1;
}

&.disabled:hover &-label {
opacity: 0.5;
}
}
}

Expand Down
12 changes: 9 additions & 3 deletions jet/static/jet/css/_changelist.scss
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
}
}

.label {
.label {
padding: 8px 0;
}

Expand Down Expand Up @@ -437,12 +437,17 @@

&.fixed {
position: fixed;
left: $sidebar-width + 20px;
left: 20px;
right: 20px;
bottom: 0;
border-top: 2px solid $content-border2-color;
transition: left 0.3s;

body.menu-pinned & {
left: $sidebar-width + 20px;
}

body.popup & {
body.menu-pinned.popup & {
left: 20px;
}

Expand All @@ -452,6 +457,7 @@
right: auto;
bottom: auto;
border-top: 0;
padding: 20px 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion jet/static/jet/css/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ul.actionlist li {

&-tools {
position: absolute;
top: 20px;
top: ($top-height + 10px * 2) / 2 - 30px / 2;
right: 20px + 175px + 20px;

@include for-mobile {
Expand Down
64 changes: 61 additions & 3 deletions jet/static/jet/css/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@
display: none;
background-color: $sidebar-contrast-background-color;
color: $sidebar-contrast-text-color;
padding: 14px;
padding: 14px 32px 14px 36px;
text-align: center;
position: relative;
min-height: 52px;
box-sizing: border-box;

@include for-mobile {
min-height: 0;
}

&.initialized {
display: block;
Expand All @@ -17,11 +24,20 @@
display: none;
}

&:before, &:after {
content: "";
display: inline-block;
vertical-align: middle;
height: 100%;
}

h1, h2 {
padding: 0;
display: inline-block;
padding: 0 10px;
margin: 0;
text-transform: uppercase;
font-size: 11px;
vertical-align: middle;
}

a, a:visited, a:hover {
Expand All @@ -31,6 +47,48 @@
a:hover {
color: $sidebar-hover-action-color;
}

&-pin {
position: absolute;
top: 50%;
right: 4px;
margin-top: -11px;
display: inline-block;
font-size: 22px;
cursor: pointer;
transition: transform 0.3s;
transform: rotate(-45deg);

body.menu-pinned & {
transform: rotate(45deg);
}

&:hover {
color: #fff;
}

@include for-mobile {
display: none;
}
}

&-menu {
position: absolute;
top: 50%;
left: 20px;
margin-top: -8px;
display: inline-block;
font-size: 16px;
cursor: pointer;

&:hover {
color: #fff;
}

@include for-mobile() {
display: none;
}
}
}

#user-tools {
Expand All @@ -44,7 +102,7 @@
.user-tools {
ul {
position: absolute;
top: $top-height - 12px;
top: ($top-height + 10px * 2) / 2 - 30px / 2;
right: 20px;
border: 1px solid $top-border-color;
border-radius: 4px;
Expand Down
6 changes: 6 additions & 0 deletions jet/static/jet/css/_helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
}
}

@mixin for-desktop {
@media only screen and (min-width: $mobile-max-width) {
@content;
}
}

@mixin for-mobile {
@include for-width($mobile-max-width) {
@content;
Expand Down
Loading

0 comments on commit 45e9471

Please sign in to comment.