[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: if 'cell' not in layouts:
layouts['cell'] = Table(other=layouts['view'], derivedType='cell') layouts['cell'] = Table(other=layouts['view'], derivedType='cell')
# Put the required CSS classes in the layouts # Put the required CSS classes in the layouts
layouts['cell'].addCssClasses('noStyle') layouts['cell'].addCssClasses('no')
if self.focus: if self.focus:
# We need to make it flashy # We need to make it flashy
layouts['view'].addCssClasses('focus') layouts['view'].addCssClasses('focus')

View file

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

View file

@ -35,7 +35,7 @@ class Dict(List):
<td for="info in subFields" if="info[1]" align="center" <td for="info in subFields" if="info[1]" align="center"
var2="field=info[1]; var2="field=info[1];
fieldName='%s*%d' % (field.name, rowIndex); fieldName='%s*%d' % (field.name, rowIndex);
tagCss='noStyle'">:field.pxRender</td> tagCss='no'">:field.pxRender</td>
</tr>''') </tr>''')
# PX for rendering the dict (shared between pxView and pxEdit) # 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" <td for="info in subFields" if="info[1]" align="center"
var2="field=info[1]; var2="field=info[1];
fieldName='%s*%d' % (field.name, rowIndex); fieldName='%s*%d' % (field.name, rowIndex);
tagCss='noStyle'">:field.pxRender</td> tagCss='no'">:field.pxRender</td>
<!-- Icon for removing the row --> <!-- Icon for removing the row -->
<td if="layoutType=='edit'" align=":dright"> <td if="layoutType=='edit'" align=":dright">
<img class="clickable" src=":url('delete')" title=":_('object_delete')" <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 } .addFormMenu { display: inline; padding: 0 5px 0 3px }
.inline { display: inline } .inline { display: inline }
.list { margin-bottom: 3px } .list { margin-bottom: 3px }
.list td, .list th { border: 3px solid #ededed; color: #555555; .list td, .list th {
padding: 3px 5px 3px 5px } border: 3px solid #ededed; color: #555555; padding: 3px 5px 3px 5px }
.list th { background-color: #e5e5e5; font-style: italic; font-weight: normal } .list th { background-color: #e5e5e5; font-style: italic; font-weight: normal }
.compact { font-size: 90%; width: 100% } .compact { font-size: 90%; width: 100% }
.compact th, .compact td { padding: 0px 3px 0px 3px } .compact th, .compact td { padding: 0px 3px 0px 3px }
@ -139,8 +139,9 @@ td.search { padding-top: 8px }
font-weight: normal } font-weight: normal }
.cellGap { padding-right: 0.4em } .cellGap { padding-right: 0.4em }
.cellDashed { border: 1px dashed grey !important } .cellDashed { border: 1px dashed grey !important }
.noStyle { border: 0 !important; padding: 0 !important; margin: 0 !important } .no, .no td, .no th {
.noStyle td { border:0 !important; padding:0 !important; margin:0 !important } border: 0 !important; padding: 0 !important; margin: 0 !important;
background-color: transparent !important }
.simpleLabel { text-transform: none } .simpleLabel { text-transform: none }
.translationLabel { background-color: #EAEAEA; border-bottom: 1px dashed grey; .translationLabel { background-color: #EAEAEA; border-bottom: 1px dashed grey;
margin-top: 0.5em; margin-bottom: 0.5em } margin-top: 0.5em; margin-bottom: 0.5em }