1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Fixed Images & pools groups (added priority and enhaced visual on admin

This commit is contained in:
Adolfo Gómez García 2016-02-12 09:53:33 +01:00
parent fbd0a59a70
commit 07ed8b9762
8 changed files with 20 additions and 9 deletions

View File

@ -57,9 +57,9 @@ class Images(ModelHandler):
table_title = _('Image Gallery')
table_fields = [
{'thumb': {'title': _('Image'), 'visible': True, 'type': 'image', 'width': '96px' }},
{'name': {'title': _('Name')}},
{'size': {'title': _('Size')}},
{'thumb': {'title': _('Image'), 'visible': True, 'type': 'image'}},
]
def beforeSave(self, fields):

View File

@ -55,12 +55,14 @@ class ServicesPoolGroups(ModelHandler):
path = 'gallery'
model = ServicesPoolGroup
save_fields = ['name', 'comments', 'image_id']
save_fields = ['name', 'comments', 'image_id', 'priority']
table_title = _('Services Pool Groups')
table_fields = [
{'priority': {'title': _('Priority'), 'type': 'numeric', 'width': '6em'}},
{'thumb': {'title': _('Image'), 'visible': True, 'type': 'image', 'width': '96px' }},
{'name': {'title': _('Name')}},
{'thumb': {'title': _('Image'), 'visible': True, 'type': 'image'}},
{'comments': {'title': _('Comments')}},
]
def beforeSave(self, fields):
@ -76,7 +78,7 @@ class ServicesPoolGroups(ModelHandler):
# Gui related
def getGui(self, type_):
g = self.addDefaultFields([], ['name', 'comments'])
g = self.addDefaultFields([], ['name', 'comments', 'priority'])
for f in [{
'name': 'image_id',
@ -93,13 +95,17 @@ class ServicesPoolGroups(ModelHandler):
def item_as_dict(self, item):
return {
'id': item.uuid,
'priority': item.priority,
'name': item.name,
'comments': item.comments,
'image_id': item.image.uuid,
}
def item_as_dict_overview(self, item):
return {
'id': item.uuid,
'priority': item.priority,
'name': item.name,
'comments': item.comments,
'thumb': item.image.thumb64,
}

View File

@ -48,7 +48,7 @@ logger = logging.getLogger(__name__)
class Transports(ModelHandler):
model = Transport
save_fields = ['name', 'comments', 'tags', ' priority', 'nets_positive']
save_fields = ['name', 'comments', 'tags', 'priority', 'nets_positive']
table_title = _('Current Transports')
table_fields = [

View File

@ -19,6 +19,7 @@ class Migration(migrations.Migration):
('uuid', models.CharField(default=None, max_length=50, unique=True, null=True)),
('name', models.CharField(default='', max_length=128)),
('comments', models.CharField(default='', max_length=256)),
('priority', models.IntegerField(default=0, db_index=True)),
('image', models.ForeignKey(related_name='servicesPoolsGrou', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='uds.Image', null=True)),
],
options={

View File

@ -56,6 +56,7 @@ class ServicesPoolGroup(UUIDModel):
# pylint: disable=model-missing-unicode
name = models.CharField(max_length=128, default='')
comments = models.CharField(max_length=256, default='')
priority = models.IntegerField(default=0, db_index=True)
image = models.ForeignKey(Image, null=True, blank=True, related_name='servicesPoolsGrou', on_delete=models.SET_NULL)
class Meta(UUIDModel.Meta):

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

View File

@ -12,9 +12,9 @@ gui.sPoolGroups.link = ->
sPoolGroups: "sPoolGroups-placeholder"
)
gui.sPoolGroups.table
icon: 'sPoolGroups'
icon: 'spool-group'
container: "sPoolGroups-placeholder"
rowSelect: "single"
rowSelect: "multi"
buttons: [
"new"
"edit"

View File

@ -170,17 +170,18 @@
columns = [ {
orderable: false,
className: 'select-checkbox'
width: 32
width: "32px"
render: () -> return ''
} ]
$.each data.fields, (index, value) ->
for v of value
opts = value[v]
gui.doLog('***', opts, v, value)
column = data: v
column.title = opts.title
column.render = renderEmptyCell
column.width = opts.width if opts.width
column.width = opts.width if opts.width?
# column.width = "100px"
column.visible = (if not opts.visible? then true else opts.visible)
column.orderable = opts.sortable if opts.sortable?
@ -214,6 +215,8 @@
columns.push column
return
gui.doLog('** Colums', columns)
# Responsive style for tables, using tables.css and this code generates the "titles" for vertical display on small sizes
initTable = (data) ->