don't show priority and activity if corresponding data tables do not exist; translations
This commit is contained in:
		
							parent
							
								
									c824c0bdb5
								
							
						
					
					
						commit
						a565d750e3
					
				
					 6 changed files with 43 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -913,7 +913,7 @@ relates ISO country codes with the full name of the country.
 | 
			
		|||
  >>> sorted(adapted(concepts['countries']).data.items())
 | 
			
		||||
  [('at', ['Austria']), ('de', ['Germany'])]
 | 
			
		||||
 | 
			
		||||
  >>> countries.dataAsRecords
 | 
			
		||||
  >>> countries.dataAsRecords()
 | 
			
		||||
  [{'value': 'Austria', 'key': 'at'}, {'value': 'Germany', 'key': 'de'}]
 | 
			
		||||
 | 
			
		||||
  >>> countries.getRowsByValue('value', 'Germany')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -3,7 +3,7 @@ msgstr ""
 | 
			
		|||
 | 
			
		||||
"Project-Id-Version: 0.13.1\n"
 | 
			
		||||
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
 | 
			
		||||
"PO-Revision-Date: 2015-03-13 12:00 CET\n"
 | 
			
		||||
"PO-Revision-Date: 2015-03-17 12:00 CET\n"
 | 
			
		||||
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
 | 
			
		||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
 | 
			
		||||
"MIME-Version: 1.0\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -1009,6 +1009,21 @@ msgstr "Kalender"
 | 
			
		|||
msgid "Work Items"
 | 
			
		||||
msgstr "Aktivitäten"
 | 
			
		||||
 | 
			
		||||
msgid "Work Item Type"
 | 
			
		||||
msgstr "Art der Aktivität"
 | 
			
		||||
 | 
			
		||||
msgid "Unit of Work"
 | 
			
		||||
msgstr "Standard-Aktivität"
 | 
			
		||||
 | 
			
		||||
msgid "Scheduled Event"
 | 
			
		||||
msgstr "Termin"
 | 
			
		||||
 | 
			
		||||
msgid "Deadline"
 | 
			
		||||
msgstr "Deadline"
 | 
			
		||||
 | 
			
		||||
msgid "Check-up"
 | 
			
		||||
msgstr "Überprüfung"
 | 
			
		||||
 | 
			
		||||
msgid "Work Items for $title"
 | 
			
		||||
msgstr "Aktivitäten für $title"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1039,6 +1054,12 @@ msgstr "Dauer/Aufwand"
 | 
			
		|||
msgid "Duration / Effort (hh:mm)"
 | 
			
		||||
msgstr "Dauer / Aufwand (hh:mm)"
 | 
			
		||||
 | 
			
		||||
msgid "Priority"
 | 
			
		||||
msgstr "Priorität"
 | 
			
		||||
 | 
			
		||||
msgid "Activity"
 | 
			
		||||
msgstr "Tätigkeit"
 | 
			
		||||
 | 
			
		||||
msgid "Action"
 | 
			
		||||
msgstr "Aktion"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -549,13 +549,19 @@ class CreateWorkItemForm(ObjectForm, BaseTrackView):
 | 
			
		|||
 | 
			
		||||
    @Lazy
 | 
			
		||||
    def priorities(self):
 | 
			
		||||
        if 'priority' in self.workItemType.fields:
 | 
			
		||||
            prio = self.conceptManager.get('organize.work.priorities')
 | 
			
		||||
        return prio and adapted(prio).dataAsRecords or []
 | 
			
		||||
            if prio: 
 | 
			
		||||
                return adapted(prio).dataAsRecords()
 | 
			
		||||
        return []
 | 
			
		||||
 | 
			
		||||
    @Lazy
 | 
			
		||||
    def activities(self):
 | 
			
		||||
        if 'activity' in self.workItemType.fields:
 | 
			
		||||
            act = self.conceptManager.get('organize.work.activities')
 | 
			
		||||
        return act and adapted(act).dataAsRecords or []
 | 
			
		||||
            if act: 
 | 
			
		||||
                return adapted(act).dataAsRecords()
 | 
			
		||||
        return []
 | 
			
		||||
 | 
			
		||||
    @Lazy
 | 
			
		||||
    def duration(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -163,29 +163,30 @@
 | 
			
		|||
                 tal:attributes="value view/deadlineTime" />
 | 
			
		||||
        </div>
 | 
			
		||||
        <div id="priority-activity"
 | 
			
		||||
             tal:condition="python:'priority' in workItemType.fields or
 | 
			
		||||
                                   'activity' in workItemType.fields">
 | 
			
		||||
             tal:define="priorities view/priorities;
 | 
			
		||||
                         activities view/activities"
 | 
			
		||||
             tal:condition="python:priorities or activities">
 | 
			
		||||
          <table style="width: auto">
 | 
			
		||||
            <tr>
 | 
			
		||||
              <td tal:condition="python:'priority' in workItemType.fields">
 | 
			
		||||
              <td tal:condition="priorities">
 | 
			
		||||
                <label i18n:translate="" for="priority">Priority</label></td>
 | 
			
		||||
              <td tal:condition="python:'activity' in workItemType.fields">
 | 
			
		||||
              <td tal:condition="activities">
 | 
			
		||||
                <label i18n:translate="" for="activity">Activity</label></td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
              <td tal:condition="python:'priority' in workItemType.fields">
 | 
			
		||||
              <td tal:condition="priorities">
 | 
			
		||||
                <select name="priority" id="priority"
 | 
			
		||||
                        tal:define="value view/track/data/priority|nothing">
 | 
			
		||||
                  <option tal:repeat="prio view/priorities"
 | 
			
		||||
                  <option tal:repeat="prio priorities"
 | 
			
		||||
                          tal:attributes="value prio/name;
 | 
			
		||||
                                          selected python:prio['name'] == value"
 | 
			
		||||
                          tal:content="prio/title" />
 | 
			
		||||
                </select>
 | 
			
		||||
              </td>
 | 
			
		||||
              <td tal:condition="python:'activity' in workItemType.fields">
 | 
			
		||||
              <td tal:condition="activities">
 | 
			
		||||
                <select name="activity" id="activity"
 | 
			
		||||
                        tal:define="value view/track/data/activity|nothing">
 | 
			
		||||
                  <option tal:repeat="act view/activities"
 | 
			
		||||
                  <option tal:repeat="act activities"
 | 
			
		||||
                          tal:attributes="value act/name;
 | 
			
		||||
                                          selected python:act['name'] == value"
 | 
			
		||||
                          tal:content="act/title" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								table.py
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								table.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -93,7 +93,6 @@ class DataTable(AdapterBase):
 | 
			
		|||
        self.context._data = OOBTree(data)
 | 
			
		||||
    data = property(getData, setData)
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def dataAsRecords(self):
 | 
			
		||||
        result = []
 | 
			
		||||
        for k, v in sorted(self.data.items()):
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +106,7 @@ class DataTable(AdapterBase):
 | 
			
		|||
        return result
 | 
			
		||||
 | 
			
		||||
    def getRowsByValue(self, column, value):
 | 
			
		||||
        return [r for r in self.dataAsRecords if r[column] == value]
 | 
			
		||||
        return [r for r in self.dataAsRecords() if r[column] == value]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TypeInterfaceSourceList.typeInterfaces += (IDataTable,)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue