mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Add Markdown support for JournalEntry comments
This commit is contained in:
parent
ab612c1ca6
commit
0fae7504b3
@ -103,32 +103,6 @@ class ObjectChangeTable(BaseTable):
|
|||||||
fields = ('time', 'user_name', 'action', 'changed_object_type', 'object_repr', 'request_id')
|
fields = ('time', 'user_name', 'action', 'changed_object_type', 'object_repr', 'request_id')
|
||||||
|
|
||||||
|
|
||||||
class JournalEntryTable(BaseTable):
|
|
||||||
pk = ToggleColumn()
|
|
||||||
created = tables.DateTimeColumn(
|
|
||||||
format=settings.SHORT_DATETIME_FORMAT
|
|
||||||
)
|
|
||||||
assigned_object_type = ContentTypeColumn(
|
|
||||||
verbose_name='Object type'
|
|
||||||
)
|
|
||||||
assigned_object = tables.Column(
|
|
||||||
linkify=True,
|
|
||||||
orderable=False,
|
|
||||||
verbose_name='Object'
|
|
||||||
)
|
|
||||||
kind = ChoiceFieldColumn()
|
|
||||||
actions = ButtonsColumn(
|
|
||||||
model=JournalEntry,
|
|
||||||
buttons=('edit', 'delete')
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
|
||||||
model = JournalEntry
|
|
||||||
fields = (
|
|
||||||
'pk', 'created', 'created_by', 'assigned_object_type', 'assigned_object', 'kind', 'comments', 'actions'
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ObjectJournalTable(BaseTable):
|
class ObjectJournalTable(BaseTable):
|
||||||
"""
|
"""
|
||||||
Used for displaying a set of JournalEntries within the context of a single object.
|
Used for displaying a set of JournalEntries within the context of a single object.
|
||||||
@ -137,6 +111,9 @@ class ObjectJournalTable(BaseTable):
|
|||||||
format=settings.SHORT_DATETIME_FORMAT
|
format=settings.SHORT_DATETIME_FORMAT
|
||||||
)
|
)
|
||||||
kind = ChoiceFieldColumn()
|
kind = ChoiceFieldColumn()
|
||||||
|
comments = tables.TemplateColumn(
|
||||||
|
template_code='{% load helpers %}{{ value|render_markdown }}'
|
||||||
|
)
|
||||||
actions = ButtonsColumn(
|
actions = ButtonsColumn(
|
||||||
model=JournalEntry,
|
model=JournalEntry,
|
||||||
buttons=('edit', 'delete')
|
buttons=('edit', 'delete')
|
||||||
@ -145,3 +122,21 @@ class ObjectJournalTable(BaseTable):
|
|||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
model = JournalEntry
|
model = JournalEntry
|
||||||
fields = ('created', 'created_by', 'kind', 'comments', 'actions')
|
fields = ('created', 'created_by', 'kind', 'comments', 'actions')
|
||||||
|
|
||||||
|
|
||||||
|
class JournalEntryTable(ObjectJournalTable):
|
||||||
|
pk = ToggleColumn()
|
||||||
|
assigned_object_type = ContentTypeColumn(
|
||||||
|
verbose_name='Object type'
|
||||||
|
)
|
||||||
|
assigned_object = tables.Column(
|
||||||
|
linkify=True,
|
||||||
|
orderable=False,
|
||||||
|
verbose_name='Object'
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta(BaseTable.Meta):
|
||||||
|
model = JournalEntry
|
||||||
|
fields = (
|
||||||
|
'pk', 'created', 'created_by', 'assigned_object_type', 'assigned_object', 'kind', 'comments', 'actions'
|
||||||
|
)
|
||||||
|
@ -165,6 +165,9 @@ table.attr-table td:nth-child(1) {
|
|||||||
td.min-width {
|
td.min-width {
|
||||||
width: 1%;
|
width: 1%;
|
||||||
}
|
}
|
||||||
|
td p:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Paginator */
|
/* Paginator */
|
||||||
div.paginator {
|
div.paginator {
|
||||||
|
@ -18,10 +18,12 @@
|
|||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
{% render_field form.kind %}
|
{% render_field form.kind %}
|
||||||
{% render_field form.comments %}
|
{% render_field form.comments %}
|
||||||
</div>
|
<div class="row">
|
||||||
<div class="col-md-9 col-md-offset-3">
|
<div class="col-md-9 col-md-offset-3">
|
||||||
<button type="submit" class="btn btn-primary">Save</button>
|
<button type="submit" class="btn btn-primary">Save</button>
|
||||||
<a href="{{ object.get_absolute_url }}" class="btn btn-default">Cancel</a>
|
<a href="{{ object.get_absolute_url }}" class="btn btn-default">Cancel</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user