Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Dashboard and sidebar nav design issue fixed
  • Loading branch information
Manj Datt committed Nov 19, 2019
commit 5423df1959d0e4825ff52fdd11fe0df1af9d95bb
2 changes: 2 additions & 0 deletions djadmin/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
DJADMIN_MANAGE_FILE_NAME = getattr(settings, 'DJADMIN_MANAGE_FILE_NAME', 'manage.py')

ALLOW_STAFF_USER_AS_VISITOR = getattr(settings, 'DJADMIN_ALLOW_STAFF_USER_AS_VISITOR', True)

ALLOW_DASHBOARD_MODEL = getattr(settings, 'ALLOW_DASHBOARD_MODEL', False)
1 change: 1 addition & 0 deletions djadmin/static/admin/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ ul.side-nav li {
ul.side-nav.leftside-navigation li a {
font-size: 14px;
font-weight: 400;
height: auto;
}

.bold > a {
Expand Down
2 changes: 1 addition & 1 deletion djadmin/static/admin/css/materialize.min.css

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions djadmin/static/admin/js/materialize.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ a(this).remove()
width: "",
right: "",
left: "0"
}), e.velocity({left: -1 * (b.menuWidth + 10)}, {
}), e.velocity({left: -1 * (b.menuWidth + 80)}, {
duration: 200,
queue: !1,
easing: "easeOutCubic",
Expand All @@ -2453,7 +2453,7 @@ c === !0 && (e.removeAttr("style"), e.css("width", b.menuWidth))
width: "",
right: "0",
left: ""
}), e.velocity({right: -1 * (b.menuWidth + 10)}, {
}), e.velocity({right: -1 * (b.menuWidth + 80)}, {
duration: 200,
queue: !1,
easing: "easeOutCubic",
Expand All @@ -2466,8 +2466,8 @@ c === !0 && (e.removeAttr("style"), e.css("width", b.menuWidth))
var d = a(this), e = a("#" + d.attr("data-activates"));
240 != b.menuWidth && e.css("width", b.menuWidth);
var f = a('<div class="drag-target"></div>');
a("body").append(f), "left" == b.edge ? (e.css("left", -1 * (b.menuWidth + 10)), f.css({left: 0})) : (e.addClass("right-aligned").css("right", -1 * (b.menuWidth + 10)).css("left", ""), f.css({right: 0})), e.hasClass("fixed") && window.innerWidth > 992 && e.css("left", 0), e.hasClass("fixed") && a(window).resize(function () {
window.innerWidth > 992 ? 0 !== a("#sidenav-overlay").css("opacity") && h ? c(!0) : (e.removeAttr("style"), e.css("width", b.menuWidth)) : h === !1 && ("left" === b.edge ? e.css("left", -1 * (b.menuWidth + 10)) : e.css("right", -1 * (b.menuWidth + 10)))
a("body").append(f), "left" == b.edge ? (e.css("left", -1 * (b.menuWidth + 80)), f.css({left: 0})) : (e.addClass("right-aligned").css("right", -1 * (b.menuWidth + 80)).css("left", ""), f.css({right: 0})), e.hasClass("fixed") && window.innerWidth > 992 && e.css("left", 0), e.hasClass("fixed") && a(window).resize(function () {
window.innerWidth > 992 ? 0 !== a("#sidenav-overlay").css("opacity") && h ? c(!0) : (e.removeAttr("style"), e.css("width", b.menuWidth)) : h === !1 && ("left" === b.edge ? e.css("left", -1 * (b.menuWidth + 80)) : e.css("right", -1 * (b.menuWidth + 80)))
}), b.closeOnClick === !0 && e.on("click.itemclick", "a:not(.collapsible-header)", function () {
c()
});
Expand Down Expand Up @@ -2514,7 +2514,7 @@ easing: "easeOutQuad"
width: "50%",
right: 0,
left: ""
})) : (!h || d > .3) && (a("body").css("overflow", ""), e.velocity({left: -1 * (b.menuWidth + 10)}, {
})) : (!h || d > .3) && (a("body").css("overflow", ""), e.velocity({left: -1 * (b.menuWidth + 80)}, {
duration: 200,
queue: !1,
easing: "easeOutQuad"
Expand All @@ -2541,7 +2541,7 @@ easing: "easeOutQuad"
width: "50%",
right: "",
left: 0
})) : (!h || -.3 > d) && (a("body").css("overflow", ""), e.velocity({right: -1 * (b.menuWidth + 10)}, {
})) : (!h || -.3 > d) && (a("body").css("overflow", ""), e.velocity({right: -1 * (b.menuWidth + 80)}, {
duration: 200,
queue: !1,
easing: "easeOutQuad"
Expand Down
16 changes: 8 additions & 8 deletions djadmin/templates/admin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,34 +133,35 @@
<a class="{{ request.ADMIN_COLOR_THEME }}-text" href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a>
</li>
{% endif %}
<li class="li-hover hide-on-large-only"><a class="{{ request.ADMIN_COLOR_THEME }}-text" href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a></li>
<li class="li-hover hide-on-large-only">
<a class="{{ request.ADMIN_COLOR_THEME }}-text" href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a></li>
{% for app in available_apps %}
<div class="divider"></div>
<li class="li-hover"><a href="{{ app.app_url }}"
class="ultra-small {{ request.ADMIN_COLOR_THEME }} white-text margin more-tex center ">{{ app.app_label|capfirst }}</a>
</li>

{% for model in app.models %}
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li class="bold"><a class="{{ request.ADMIN_COLOR_THEME }}-text truncate collapsible-header waves-effect waves-cyan"><i
class="mdi-av-play-arrow"></i>{{ model.object_name }}</a>
class="mdi-av-play-arrow"></i>{% trans model.object_name %}</a>
<div class="collapsible-body">
<ul>
{% if model.admin_url %}
<li>
<a href="{{ model.admin_url }}" class="truncate">{% trans 'All' %} {{ model.name }}</a>
<a href="{{ model.admin_url }}" class="truncate">
{% trans 'All' %} {% trans model.name %}</a>
</li>
{% endif %}
{% if model.add_url %}
<li>
<a href="{{ model.add_url }}">{% trans 'Add' %} {{ model.name }}</a>
<a href="{{ model.add_url }}">{% trans 'Add' %} {% trans model.name %}</a>
</li>
{% endif %}
</ul>
</div>
</li>
</ul>
</li>

{% endfor %}
{% endfor %}
</ul>
Expand All @@ -186,7 +187,6 @@
<div class="row">
<div class="col s12 m12 l9">
{% block content %}

{{ content }}
{% endblock %}
</div>
Expand Down
15 changes: 10 additions & 5 deletions djadmin/templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
<div class="collapsible-body">
<div class="row">
{% for app in available_apps %}
<div class="collection collection-md">
<a href="{{ app.app_url }}" class="collection-item {{ request.ADMIN_COLOR_THEME }} white-text center">{{ app.app_label|capfirst }}</a>
{% for model in app.models %}

{% for model in app.models %}
{% allowed_dashboard_model model.object_name as allowed_model %}
{% if allowed_model %}
<div class="collection collection-md">
<a href="{{ model.admin_url }}">
<div class="col l3 m6 s12">
<div title=" {{ model.name }}" class="tooltip card hoverable {% cycle 'cyan' 'amber' 'green' 'pink' 'teal' 'red' 'light-blue' 'purple' 'indigo' 'blue-grey' as rowcolors %}">
Expand All @@ -39,8 +41,11 @@
</div>
</div>
</a>
{% endfor %}
</div>
</div>
{% endif %}
{% endfor %}


{% endfor %}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion djadmin/templates/admin/submit_line.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n admin_urls custom %}
{% admin_color_theme as ADMIN_COLOR_THEME %}
<div class="row">
<div class="col s8 right">
<div class="col s12 right">
{% if show_save %}<button type="submit" value="{% trans 'Save' %}" class="submit_pad btn {{ ADMIN_COLOR_THEME }} waves-effect waves-light" name="_save" >{% trans 'Save' %}</button>{% endif %}
{% if show_delete_link %}
{% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %}
Expand Down
7 changes: 7 additions & 0 deletions djadmin/templatetags/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,10 @@ def foreignkey_field_name(value):
related_names = value.split('__')
return " > ".join(related_names).replace('_',' ').title()

@register.simple_tag
def allowed_dashboard_model(model_name):
print(model_name)
if djadmin_settings.ALLOW_DASHBOARD_MODEL:
if model_name in djadmin_settings.ALLOW_DASHBOARD_MODEL:
return True
return False