Changeset 11254 for main/waeup.kofa/trunk/src/waeup/kofa/hostels
- Timestamp:
- 22 Feb 2014, 15:46:03 (11 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk
- Property svn:mergeinfo changed
-
main/waeup.kofa/trunk/src/waeup/kofa
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa merged eligible /main/waeup.kofa/branches/uli-autoinclude-less/src/waeup/kofa 8871-8888 /main/waeup.sirp/branches/uli-studentpw/src/waeup/kofa 6703-6755 /main/waeup.sirp/branches/ulif-extimgstore/src/waeup/kofa 7001-7062 /main/waeup.sirp/branches/ulif-schoolgrades/src/waeup/kofa 7761-7794
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py
r10771 r11254 26 26 NullValidator) 27 27 from waeup.kofa.browser.breadcrumbs import Breadcrumb 28 from waeup.kofa.browser.resources import datepicker, datatable, tabs, warning29 28 from waeup.kofa.browser.layout import default_primary_nav_template 30 29 from waeup.kofa.browser.pages import delSubobjects … … 134 133 _('Clear all hostels'), 135 134 _('Remove selected')] 136 137 def update(self):138 tabs.need()139 self.tab1 = self.tab2 = self.tab3 = self.tab4 = ''140 qs = self.request.get('QUERY_STRING', '')141 if not qs:142 qs = 'tab1'143 setattr(self, qs, 'active')144 warning.need()145 datatable.need()146 return super(HostelsContainerManagePage, self).update()147 135 148 136 # It's quite dangerous to remove entire hostels with its content (beds). … … 167 155 return 168 156 169 @jsaction(_('Clear all hostels') )157 @jsaction(_('Clear all hostels'), style='danger') 170 158 def clearHostels(self, **data): 171 159 self.context.clearAllHostels() 172 160 self.flash(_('All hostels cleared.')) 173 161 write_log_message(self, 'all hostels cleared') 174 self.redirect(self.url(self.context, '@@manage')+' ?tab2')162 self.redirect(self.url(self.context, '@@manage')+'#tab2') 175 163 return 176 164 … … 201 189 self.context.addHostel(hostel) 202 190 except KeyError: 203 self.flash(_('The hostel already exists.') )191 self.flash(_('The hostel already exists.'), type='warning') 204 192 return 205 193 self.flash(_('Hostel created.')) … … 251 239 return self.url(grok.getSite(),'students') 252 240 253 def update(self): 254 datepicker.need() # Enable jQuery datepicker in date fields. 255 tabs.need() 256 datatable.need() 257 warning.need() 258 self.tab1 = self.tab2 = '' 259 qs = self.request.get('QUERY_STRING', '') 260 if not qs: 261 qs = 'tab1' 262 setattr(self, qs, 'active') 263 super(HostelManageFormPage, self).update() 264 return 265 266 @action(_('Save')) 241 @action(_('Save'), style='primary') 267 242 def save(self, **data): 268 243 msave(self, **data) 269 244 return 270 245 271 @action(_('Update all beds') )246 @action(_('Update all beds'), style='primary') 272 247 def updateBeds(self, **data): 273 248 removed, added, modified, modified_beds = self.context.updateBeds() … … 280 255 self.flash(flash_message) 281 256 write_log_message(self, message) 282 self.redirect(self.url(self.context, '@@manage')+' ?tab2')257 self.redirect(self.url(self.context, '@@manage')+'#tab2') 283 258 return 284 259 … … 289 264 child_id = form['val_id'] 290 265 else: 291 self.flash(_('No item selected.') )292 self.redirect(self.url(self.context, '@@manage')+' ?tab2')266 self.flash(_('No item selected.'), type='warning') 267 self.redirect(self.url(self.context, '@@manage')+'#tab2') 293 268 return 294 269 if not isinstance(child_id, list): … … 310 285 mapping = {'a':m_translated})) 311 286 write_log_message(self, 'switched: %s' % message) 312 self.redirect(self.url(self.context, '@@manage')+' ?tab2')287 self.redirect(self.url(self.context, '@@manage')+'#tab2') 313 288 return 314 289 … … 319 294 child_id = form['val_id'] 320 295 else: 321 self.flash(_('No item selected.') )322 self.redirect(self.url(self.context, '@@manage')+' ?tab2')296 self.flash(_('No item selected.'), type='warning') 297 self.redirect(self.url(self.context, '@@manage')+'#tab2') 323 298 return 324 299 if not isinstance(child_id, list): … … 334 309 mapping = {'a':message})) 335 310 write_log_message(self, 'released: %s' % message) 336 self.redirect(self.url(self.context, '@@manage')+' ?tab2')311 self.redirect(self.url(self.context, '@@manage')+'#tab2') 337 312 else: 338 self.flash(_('No allocated bed selected.') )339 self.redirect(self.url(self.context, '@@manage')+' ?tab2')340 return 341 342 @jsaction(_('Clear hostel') )313 self.flash(_('No allocated bed selected.'), type='warning') 314 self.redirect(self.url(self.context, '@@manage')+'#tab2') 315 return 316 317 @jsaction(_('Clear hostel'), style='danger') 343 318 def clearHostel(self, **data): 344 319 self.context.clearHostel() 345 320 self.flash(_('Hostel cleared.')) 346 321 write_log_message(self, 'cleared') 347 self.redirect(self.url(self.context, '@@manage')+' ?tab2')322 self.redirect(self.url(self.context, '@@manage')+'#tab2') 348 323 return 349 324 … … 362 337 def save(self, **data): 363 338 if data['owner'] == NOT_OCCUPIED: 364 self.flash(_('No valid student id.') )339 self.flash(_('No valid student id.'), type='warning') 365 340 self.redirect(self.url(self.context)) 366 341 return 367 342 msave(self, **data) 368 self.redirect(self.url(self.context.__parent__, '@@manage')+' ?tab2')343 self.redirect(self.url(self.context.__parent__, '@@manage')+'#tab2') 369 344 return 370 345 … … 374 349 # Beds must be released first before they can be allocated to 375 350 # other students. 376 self.redirect(self.url(self.context.__parent__, '@@manage')+' ?tab2')377 return 351 self.redirect(self.url(self.context.__parent__, '@@manage')+'#tab2') 352 return -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser_templates/containermanagepage.pt
r8685 r11254 4 4 5 5 6 <ul class="tabs " data-tabs="tabs">7 <li tal:attributes="class view/tab1">8 <a href="#tab-1">9 <span i18n:translate="">Settings10 </ span></a>6 <ul class="tabs nav nav-tabs" data-tabs="tabs"> 7 <li class="active"> 8 <a href="#tab1" data-toggle="tab" i18n:translate=""> 9 Settings 10 </a> 11 11 </li> 12 <li tal:attributes="class view/tab2"> 13 <a href="#tab-2" i18n:translate="">Hostels</a> 12 <li> 13 <a href="#tab2" data-toggle="tab" i18n:translate=""> 14 Hostels 15 </a> 14 16 </li> 15 17 </ul> 16 18 17 19 <div class="tab-content"> 18 <div id="tab-1" tal:attributes="class view/tab1"> 20 <div id="tab1" class="active tab-pane"> 21 <br /> 19 22 <table class="form-table"> 20 23 <tbody> … … 29 32 </div> 30 33 </div> 31 <div id="tab-2" tal:attributes="class view/tab2"> <br /> 32 <table class="display dataTableManage"> 34 <div id="tab2" class="tab-pane"> 35 <br /> 36 <table class="kofa-data-table dataTableManage"> 33 37 <thead> 34 38 <tr> -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser_templates/containerpage.pt
r10674 r11254 16 16 </table> 17 17 18 <table i18n:domain="waeup.kofa" >18 <table i18n:domain="waeup.kofa" class="table"> 19 19 <thead> 20 20 <tr> -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser_templates/hostelmanagepage.pt
r9534 r11254 2 2 i18n:domain="waeup.kofa" enctype="multipart/form-data"> 3 3 4 <ul class="tabs" data-tabs="tabs"> 5 <li tal:attributes="class view/tab1"><a href="#tab-1"> 6 <span i18n:translate="">Hostel Data</span></a> 4 <ul class="tabs nav nav-tabs" data-tabs="tabs"> 5 <li class="active"> 6 <a href="#tab1" data-toggle="tab"> 7 <span i18n:translate="">Hostel Data</span> 8 </a> 7 9 </li> 8 <li tal:attributes="class view/tab2"><a href="#tab-2"> 9 <span i18n:translate="">Beds</span></a> 10 <li> 11 <a href="#tab2" data-toggle="tab"> 12 <span i18n:translate="">Beds</span> 13 </a> 10 14 </li> 11 15 </ul> 12 16 13 17 <div class="tab-content"> 14 <div id="tab-1" tal:attributes="class view/tab1"> 18 <div id="tab1" class="active tab-pane"> 19 <br /> 15 20 <table class="form-table"> 16 21 <tbody> … … 37 42 </div> 38 43 39 <div id="tab -2" tal:attributes="class view/tab2">40 < h3>Beds</h3>41 <table class=" displaydataTableManage">42 <thead>43 <tr>44 <th> </th>45 <th i18n:translate="">Id</th>46 <th i18n:translate="">Type</th>47 <th i18n:translate="">Number</th>48 <th i18n:translate="">Owner</th>49 </tr>50 </thead>51 <tbody>52 <tr tal:repeat="value context/values">53 <td>54 <input type="checkbox" name="val_id"55 tal:attributes="value value/__name__" />56 </td>57 <td tal:content="value/bed_id">ID</td>58 <td tal:content="value/bed_type">TYPE</td>59 <td tal:content="value/bed_number">NUMBER</td>60 <td>61 <a tal:condition="python: value.owner != view.not_occupied"62 tal:attributes="href python: '%s/%s/accommodation' %63 (view.students_url,value.owner)">64 <span tal:content="value/owner">OWNER</span>65 </a>66 <a tal:condition="python: value.owner == view.not_occupied"67 tal:attributes="href python: view.url(value)"68 i18n:translate="">69 [allocate student]70 </a>71 </td>72 </tr>73 </tbody>44 <div id="tab2" class="tab-pane"> 45 <br /> 46 <table class="kofa-data-table dataTableManage"> 47 <thead> 48 <tr> 49 <th> </th> 50 <th i18n:translate="">Id</th> 51 <th i18n:translate="">Type</th> 52 <th i18n:translate="">Number</th> 53 <th i18n:translate="">Owner</th> 54 </tr> 55 </thead> 56 <tbody> 57 <tr tal:repeat="value context/values"> 58 <td> 59 <input type="checkbox" name="val_id" 60 tal:attributes="value value/__name__" /> 61 </td> 62 <td tal:content="value/bed_id">ID</td> 63 <td tal:content="value/bed_type">TYPE</td> 64 <td tal:content="value/bed_number">NUMBER</td> 65 <td> 66 <a tal:condition="python: value.owner != view.not_occupied" 67 tal:attributes="href python: '%s/%s/accommodation' % 68 (view.students_url,value.owner)"> 69 <span tal:content="value/owner">OWNER</span> 70 </a> 71 <a tal:condition="python: value.owner == view.not_occupied" 72 tal:attributes="href python: view.url(value)" 73 i18n:translate=""> 74 [allocate student] 75 </a> 76 </td> 77 </tr> 78 </tbody> 74 79 </table> 75 80 -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r10683 r11254 368 368 self.browser.open(self.container_path + '/hall-1/hall-1_A_101_A') 369 369 self.assertEqual(self.browser.url, 370 self.container_path + '/hall-1/@@manage ?tab2')370 self.container_path + '/hall-1/@@manage#tab2') 371 371 # Updating the beds again will not affect the allocation and also 372 372 # the bed numbering remains the same
Note: See TracChangeset for help on using the changeset viewer.