Change checkbox to radio when selecting form definition.

It has no sense to select more than one form definition while
composing a new Service Definition.

Change-Id: I459918acf75bd2fa17ed0950a59587913aadd8b2
This commit is contained in:
Timur Sufiev 2013-12-05 17:28:58 +04:00
parent 75b8d9a5f0
commit 56e0596846
3 changed files with 11 additions and 6 deletions

View File

@ -371,9 +371,7 @@ class TableWidget(floppyforms.widgets.Input):
return val and val == 'on'
elif col_cls == RadioColumn:
row_id = data.get("{0}@@@@{1}".format(name, col_id), False)
if row_id:
return int(row_id) == row_key
return False
return row_id == row_key
else:
return data.get("{0}@@{1}@@{2}".format(
name, row_key, col_id), None)

View File

@ -20,6 +20,7 @@ from horizon import tables, workflows, forms
from muranodashboard.environments.services.forms import UpdatableFieldsForm
from muranodashboard.environments.services.fields import TableField
from muranodashboard.environments.services.fields import Column, CheckColumn
from muranodashboard.environments.services.fields import RadioColumn
LOG = logging.getLogger(__name__)
@ -68,12 +69,17 @@ def define_tables(table_name, step_verbose_name):
def make_table_cls(field_name):
if field_name == 'ui':
column_cls = RadioColumn
else:
column_cls = CheckColumn
class MetadataObjectsTableNoActions(tables.DataTable):
filename = Column('filename', verbose_name=_('File Name'),
table_name=field_name)
path = Column('path', verbose_name=_('Path'), table_name=field_name)
selected = CheckColumn('selected', verbose_name=_('Selected'),
table_name=field_name)
selected = column_cls('selected', verbose_name=_('Selected'),
table_name=field_name)
class Meta:
template = 'common/form-fields/data-grid/data_table.html'

View File

@ -60,7 +60,8 @@ class EditManifestStep(workflows.Step):
# Workflow doesn't handle Media inner class of widgets for us, so we need
# to inject media directly to the step
class Media:
css = {'all': ('muranodashboard/css/checkbox.css',)}
css = {'all': ('muranodashboard/css/checkbox.css',
'muranodashboard/css/tablefield.css')}
js = ('muranodashboard/js/submit-disabled.js',)