usethesource: Page titles, big buttons, sub-headings & edit link

This commit is contained in:
Ben Sturmfels 2024-01-30 23:19:42 +11:00
parent 3cccc3bdd9
commit 1b1e2b994f
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
5 changed files with 37 additions and 16 deletions

View file

@ -26,6 +26,7 @@ class CandidateAdmin(admin.ModelAdmin):
]
inlines = [CommentInline]
prepopulated_fields = {'slug': ['name']}
view_on_site = True
def save_model(self, request, obj, form, change):
send_email = obj.id is None

View file

@ -2,6 +2,7 @@ import uuid
from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
def gen_message_id():
@ -29,6 +30,9 @@ class Candidate(models.Model):
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('usethesource:candidate', kwargs={'slug': self.slug})
class Comment(models.Model):
"""A comment about experiences or learnings building the candidate."""

View file

@ -1,3 +1,3 @@
<div class="mt2" hx-target="this" hx-swap="outerHTML">
<button type="submit" class="f3 b white bg-green ph2" style="border: none" hx-get="{% url 'usethesource:add_comment' slug=candidate.slug %}">+</button>
<button type="submit" title="Add comment" class="f3 b white bg-light-silver ph2" style="border: none" hx-get="{% url 'usethesource:add_comment' slug=candidate.slug %}">+</button>
</div>

View file

@ -1,5 +1,7 @@
{% extends "usethesource/base.html" %}
{% block title %}{{ candidate.name }} - Software Freedom Conservancy{% endblock %}
{% block head %}
{{ block.super }}
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
@ -11,10 +13,14 @@
<section class="pa2 mt4 mb3">
<div style="display: flex; justify-content: space-between">
<div>
<h2 class="f2 lh-title ttu mt0">{{ candidate.name }}</h2>
<p><strong>Vendor</strong>: {{ candidate.vendor }}</em></p>
<p><strong>Device</strong>: {{ candidate.device }}</em></p>
<p><strong>Released</strong>: {{ candidate.release_date }}</em></p>
<div class="flex items-center">
<h2 class="f2 lh-title ttu mt0">{{ candidate.name }}</h2>
<a href="{% url 'admin:usethesource_candidate_change' object_id=candidate.id %}" title="Edit candidate" class="f3 white bg-light-silver db ph2 mh2 mb3" style="transform: scaleX(-1); text-decoration: none !important"></a>
</div>
<p><strong>Vendor</strong>: {{ candidate.vendor }}</p>
<p><strong>Device</strong>: {{ candidate.device }}</p>
<p><strong>Released</strong>: {{ candidate.release_date }}</p>
</div>
<div class="mt2">
<div><a href="{% url 'usethesource:download' slug=candidate.slug download_type='source' %}" class="white bg-green db pv2 ph3 mb2">Download source</a></div>
@ -22,12 +28,14 @@
</div>
</div>
<p>{{ candidate.description }}</p>
{{ candidate.description|linebreaks }}
<h3 class="f3 lh-title mt4">Comments</h3>
{% for comment in candidate.comment_set.all %}
{% include "usethesource/comment_partial.html" %}
{% endfor %}
{% with comments=candidate.comment_set.all %}
{% if comments or user.is_staff %}<h3 class="f3 lh-title mt4">Comments</h3>{% endif %}
{% for comment in comments %}
{% include "usethesource/comment_partial.html" %}
{% endfor %}
{% endwith %}
{% if user.is_staff %}
{% include "usethesource/add_comment_button_partial.html" %}

View file

@ -1,20 +1,28 @@
{% extends "usethesource/base.html" %}
{% block title %}Use the Source - Software Freedom Conservancy{% endblock %}
{% block content %}
{{ block.super }}
<section class="f4 pa2 mt4 mb3">
<p>Software Freedom Conservancy works to ensure that you have the right to repair and modify the software on your devices. <strong>Use The Source</strong> shows you one of the key steps in this process: how we evaluate the source code candidates that companies provide to you, as is required when they use Linux or other GPLed software (most do). Through the collaborative process shown in each candidate's comment threads, we highlight common issues in the below source candidates, and what steps need to be taken by the companies to fix them (i.e. to comply with software right to repair licenses like the GPL). You can also see examples of candidates already in compliance, which are no longer just candidates, but real "corresponding source code".</p>
<section class="f4 pv2 mt4 mb3">
<div class="flex flex-wrap mb4" style="gap: 1rem">
<a href="#candidates" class="db f3 ttu tc ph4 pv3 btn-orange mb2" style="flex-grow: 1">View the candidates</a>
<a href="#submit-a-candidate" class="db f3 ttu tc ph4 pv3 btn-orange mb2" style="flex-grow: 1">Submit a candidate</a>
</div>
<p>If you wish to let us know about a source code candidate (corresponding or not!) that you'd like us to take a look at, and possibly include in the list below, please upload the candidate to us using <a href="https://usl-upload.sfconservancy.org/s/4Ykmx7rSGMJ7s43">this form</a> and then email us at <a href="mailto:compliance@sfconservancy.org">compliance@sfconservancy.org</a> with the filename and any other information you have about the candidate. There are many other ways you can help, regardless of whether you're a developer or not - see our <a href="https://sfconservancy.org/copyleft-compliance/help.html">Help Defend Software Freedom and Rights</a> page for details!</p>
<p>Software Freedom Conservancy works to ensure that you have the right to repair and modify the software on your devices. <strong>Use The Source</strong> shows you one of the key steps in this process: how we evaluate the source code candidates that companies provide to you, as is required when they use Linux or other GPLed software (most do). Through the collaborative process shown in each candidate's comment threads, we highlight common issues in the below source candidates, and what steps need to be taken by the companies to fix them (i.e. to comply with software right to repair licenses like the GPL). You can also see examples of candidates already in compliance, which are no longer just candidates, but real "corresponding source code".</p>
</section>
<h2 id="submit-a-candidate" class="f2 lh-title ttu mt0 mb2">Submit a Candidate</h2>
<p>If you wish to let us know about a source code candidate (corresponding or not!) that you'd like us to take a look at, and possibly include in the list below, please upload the candidate to us using <a href="https://usl-upload.sfconservancy.org/s/4Ykmx7rSGMJ7s43">this form</a> and then email us at <a href="mailto:compliance@sfconservancy.org">compliance@sfconservancy.org</a> with the filename and any other information you have about the candidate. There are many other ways you can help, regardless of whether you're a developer or not - see our <a href="https://sfconservancy.org/copyleft-compliance/help.html">Help Defend Software Freedom and Rights</a> page for details!</p>
<section class="mb5">
<h2 class="f2 lh-title ttu mt0">Candidates</h2>
<h2 id="candidates" class="f2 lh-title ttu mt0 mb2">Source Candidates List</h2>
{% for candidate in candidates %}
<div class="mb4">
<div class="mb3">
<h3 class="f4 lh-title mt0"><a href="{% url 'usethesource:candidate' slug=candidate.slug %}">{{ candidate.name }}</a></h3>
<p><em>Released {{ candidate.release_date }}</em></p>
<p class="mb2"><em>Released {{ candidate.release_date }}</em></p>
<p>{{ candidate.description }}</p>
</div>
{% endfor %}