Skip to content
This repository has been archived by the owner on Jun 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #43 from industrydive/TECH-7721-UX-Changes
Browse files Browse the repository at this point in the history
TECH-7721 UX updates to source change form
  • Loading branch information
Eric authored Apr 20, 2020
2 parents 3071706 + 77fbc2e commit e384401
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 16 deletions.
10 changes: 10 additions & 0 deletions media/css/admin/change-link.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.object-tools a:link.change-link, .object-tools a:visited.change-link {
align-items: center;
background: #417690;
display: flex;
}

.object-tools .change-link img {
margin-right: 3px;
padding-bottom: 2px;
}
4 changes: 4 additions & 0 deletions sources/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ class PersonAdmin(admin.ModelAdmin, CreatedByMixin):
view_on_site = False # THIS DOES NOT WORK CURRENTLY
inlines = (InteractionInline, InteractionNewInline,)

class Media:
css = {
'all': ('css/admin/change-link.css',)
}

def email_address_semiprivate_display(self, obj):
display_text = 'Please contact <strong>{}</strong> for this information'.format(obj.created_by)
Expand Down
1 change: 1 addition & 0 deletions templates/admin/change_form.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends 'admin/change_form.html' %}
{% load static %}
{% load admin_urls %}

{% block extrahead %}

Expand Down
38 changes: 38 additions & 0 deletions templates/admin/sources/person/change_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% extends 'admin/change_form.html' %}
{% load static %}

{% block content_title %}
{% if request.GET.edit %}
<h1>Edit {{ opts.verbose_name }}</h1>
{% else %}
<h1>View {{ opts.verbose_name }}</h1>
{% endif %}
{% endblock %}

{% block object-tools-items %}
{{ block.super }}
{% if not '?edit=true' in request.get_full_path %}
<li>
<a href="{% url 'admin:sources_person_change' object_id %}?edit=true" class="change-link"/>
<img src="{% static 'img/admin/sources/icon-pencil.svg' %}" width="11px" height="11px" >
<span>Edit</span>
</a>
</li>
{% elif '?edit=true' in request.get_full_path %}
<li>
<a href="{% url 'admin:sources_person_change' object_id %}" class="change-link">
<span>View</span>
</a>
</li>
{% endif %}
{% endblock %}

{% comment %}
Keeping this empty removes the submit buttons
at the top of the page
{% endcomment %}
{% block submit_buttons_top %}
{% block submit-row %}

{% endblock %}
{% endblock %}
16 changes: 0 additions & 16 deletions templates/admin/submit_line.html

This file was deleted.

0 comments on commit e384401

Please sign in to comment.