[gen] Calendar field: bugfixes. CSS class 'noStyle' renamed to 'no'.

This commit is contained in:
Gaetan Delannay 2015-03-20 18:00:29 +01:00
parent 5beb7699ac
commit 7d4dbdd0f8
5 changed files with 42 additions and 25 deletions

View file

@ -555,7 +555,7 @@ class Field:
if 'cell' not in layouts:
layouts['cell'] = Table(other=layouts['view'], derivedType='cell')
# Put the required CSS classes in the layouts
layouts['cell'].addCssClasses('noStyle')
layouts['cell'].addCssClasses('no')
if self.focus:
# We need to make it flashy
layouts['view'].addCssClasses('focus')

View file

@ -200,21 +200,27 @@ class Calendar(Field):
# For timeline rendering, the row displaying month names
pxTimeLineMonths = Px('''
<tr><th></th> <!-- Names of months -->
<th for="mInfo in monthsInfos"
colspan=":mInfo.colspan">::mInfo.month</th><th></th></tr>''')
<tr>
<th class="no"></th>
<th for="mInfo in monthsInfos" colspan=":mInfo.colspan">::mInfo.month</th>
<th class="no"></th>
</tr>''')
# For timeline rendering, the row displaying day letters
pxTimelineDayLetters = Px('''
<tr><td></td> <!-- Days (letters) -->
<tr>
<td class="no"></td>
<td for="date in grid"><b>:namesOfDays[date.aDay()].name[0]</b></td>
<td></td></tr>''')
<td class="no"></td>
</tr>''')
# For timeline rendering, the row displaying day numbers
pxTimelineDayNumbers = Px('''
<tr><td></td> <!-- Days (numbers) -->
<tr>
<td class="no"></td>
<td for="date in grid"><b>:str(date.day()).zfill(2)</b></td>
<td></td></tr>''')
<td class="no"></td>
</tr>''')
# Legend for a timeline calendar
pxTimelineLegend = Px('''
@ -263,14 +269,14 @@ class Calendar(Field):
style="float:right" id=":'%s_tcs' % ajaxHookId"
var="totals=field.computeTotals('col', zobj, grid, others, \
preComputed)">
<!-- The column headers -->
<tr>
<tr for="i in range(2)"> <!-- 2 empty rows -->
<td for="col in field.totalCols" class="no">&nbsp;</td>
</tr>
<tr> <!-- The column headers -->
<th for="col in field.totalCols">
<acronym title=":_(col.label)">:col.name</acronym>
</th>
</tr>
<!-- 2 empty rows (correspond to month and day names) -->
<tr for="i in range(2)"><td>&nbsp;</td></tr>
<!-- Re-create one row for every other calendar -->
<x var="i=-1" for="otherGroup in others">
<tr for="other in otherGroup" var2="@i=i+1">
@ -280,9 +286,18 @@ class Calendar(Field):
<x if="not loop.otherGroup.last">::field.getOthersSep(\
len(field.totalCols))</x>
</x>
<!-- Repeat the 2 empty rows and add one for every total row -->
<tr for="i in range(2+len(field.totalRows))"><td>&nbsp;</td></tr>
<tr><th>&nbsp;</th></tr>
<!-- Add empty rows for every total row -->
<tr for="i in range(len(field.totalRows))">
<td for="col in field.totalCols">&nbsp;</td>
</tr>
<tr> <!-- Repeat the column headers -->
<th for="col in field.totalCols">
<acronym title=":_(col.label)">:col.name</acronym>
</th>
</tr>
<tr for="i in range(2)"> <!-- 2 empty rows -->
<td for="col in field.totalCols" class="no">&nbsp;</td>
</tr>
</table>''')
# Timeline view for a calendar
@ -1590,6 +1605,7 @@ class Calendar(Field):
def computeTotals(self, totalType, obj, grid, others, preComputed):
'''Compute the totals for every column (p_totalType == 'row') or row
(p_totalType == "col").'''
obj = obj.appy()
allTotals = getattr(self, 'total%ss' % totalType.capitalize())
if not allTotals: return
# Count other calendars and dates in the grid
@ -1605,11 +1621,11 @@ class Calendar(Field):
res[totals.name] = [Total(totals.initValue) \
for i in range(totalCount)]
# Get the status of validation checkboxes
status = self.getValidationCheckboxesStatus(obj.REQUEST)
status = self.getValidationCheckboxesStatus(obj.request)
# Walk every date within every calendar
indexes = {'i': -1, 'j': -1}
ii = (totalType == 'row') and 'i' or 'j'
jj = (totalType == 'row') and 'j' or 'i'
ii = isRow and 'i' or 'j'
jj = isRow and 'j' or 'i'
for other in sutils.IterSub(others):
indexes['i'] += 1
indexes['j'] = -1

View file

@ -35,7 +35,7 @@ class Dict(List):
<td for="info in subFields" if="info[1]" align="center"
var2="field=info[1];
fieldName='%s*%d' % (field.name, rowIndex);
tagCss='noStyle'">:field.pxRender</td>
tagCss='no'">:field.pxRender</td>
</tr>''')
# PX for rendering the dict (shared between pxView and pxEdit)

View file

@ -32,7 +32,7 @@ class List(Field):
<td for="info in subFields" if="info[1]" align="center"
var2="field=info[1];
fieldName='%s*%d' % (field.name, rowIndex);
tagCss='noStyle'">:field.pxRender</td>
tagCss='no'">:field.pxRender</td>
<!-- Icon for removing the row -->
<td if="layoutType=='edit'" align=":dright">
<img class="clickable" src=":url('delete')" title=":_('object_delete')"

View file

@ -117,8 +117,8 @@ td.search { padding-top: 8px }
.addFormMenu { display: inline; padding: 0 5px 0 3px }
.inline { display: inline }
.list { margin-bottom: 3px }
.list td, .list th { border: 3px solid #ededed; color: #555555;
padding: 3px 5px 3px 5px }
.list td, .list th {
border: 3px solid #ededed; color: #555555; padding: 3px 5px 3px 5px }
.list th { background-color: #e5e5e5; font-style: italic; font-weight: normal }
.compact { font-size: 90%; width: 100% }
.compact th, .compact td { padding: 0px 3px 0px 3px }
@ -139,8 +139,9 @@ td.search { padding-top: 8px }
font-weight: normal }
.cellGap { padding-right: 0.4em }
.cellDashed { border: 1px dashed grey !important }
.noStyle { border: 0 !important; padding: 0 !important; margin: 0 !important }
.noStyle td { border:0 !important; padding:0 !important; margin:0 !important }
.no, .no td, .no th {
border: 0 !important; padding: 0 !important; margin: 0 !important;
background-color: transparent !important }
.simpleLabel { text-transform: none }
.translationLabel { background-color: #EAEAEA; border-bottom: 1px dashed grey;
margin-top: 0.5em; margin-bottom: 0.5em }