Skip to content

Commit

Permalink
Merge pull request #141 from AnotherCodeArtist/release-sprint-9
Browse files Browse the repository at this point in the history
Sprint 9: Release
  • Loading branch information
AnotherCodeArtist authored Nov 22, 2016
2 parents 1532d83 + 63c4ccf commit 83d6533
Show file tree
Hide file tree
Showing 12 changed files with 790 additions and 322 deletions.
275 changes: 178 additions & 97 deletions packages/core/system/public/po/de.po

Large diffs are not rendered by default.

282 changes: 177 additions & 105 deletions packages/core/system/public/po/template.pot

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,42 @@ app.controller 'FlowDetailCtrl',['$scope','TPAService','$q','$interval','$state'
]
)

$scope.updateEvents = () ->
$scope.$broadcast 'updateEvents'

TPAService.getEvents().then (res)->
$scope.events = res.data

$scope.regions = []
addedregions = []
for event in $scope.events
event.selected = true;
if addedregions.indexOf(event.region) is -1
$scope.regions.push {
name: event.region
selected: true
}
addedregions.push event.region

$scope.toggleRegion = (region) ->
for event in $scope.events
if event.region is region.name
event.selected = region.selected
$scope.updateEvents()

$scope.toggleTag = (tag) ->
for event in $scope.events
if event.tags.indexOf(tag.name) isnt -1
event.selected = tag.selected


TPAService.getEventTags().then (res) ->
tags = []
for tag in res.data
tags.push {
name: tag,
selected: true
}
$scope.tags = tags


angular.extend $scope.dtOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ angular.module 'mean.transparency'
name: 'transparency'

stateName = "index"
fieldsToStore = ['slider','periods','typesText']
fieldsToStore = ['slider','periods','typesText', 'orgTypes']

$scope.showSettings = true

$scope.$on 'isoChanged', (event, data) ->
$scope.federalState = gettextCatalog.getString(TPAService.staticData('findOneFederalState', data.iso)
Expand Down Expand Up @@ -49,7 +51,7 @@ angular.module 'mean.transparency'
params.to = $scope.periods[$scope.slider.to/5].period
types = (v.type for v in $scope.typesText when v.checked)
(params.pType = types) if types.length > 0
params.orgTypes = $scope.orgTypes if $scope.orgTypes.length > 0
params.orgTypes = (o.value for o in $scope.orgTypes when o.selected)
#TEST #params.orgTypes = ["city", "chamber"]
params

Expand All @@ -73,21 +75,20 @@ angular.module 'mean.transparency'

translate = ->
$scope.typesText.forEach (t) -> t.text = gettextCatalog.getString TPAService.decodeType t.type
$scope.orgTypes.forEach (o) -> o.name = gettextCatalog.getString(o.value)

$scope.$on 'gettextLanguageChanged', translate

$rootScope.$on '$stateChangeStart', (event,toState) ->
if toState.name isnt 'map'
TPAService.saveState stateName,fieldsToStore,$scope

registerWatchers = -> $scope.$watch('typesText',change,true)
registerWatchers = () ->
$scope.$watch('typesText',change,true)
$scope.$watch('orgTypes',change,true)


savedState = sessionStorage.getItem stateName
orgTypePromise = TPAService.organisationTypes()
orgTypePromise.then (res) ->
for orgTypeObject in res.data
$scope.orgTypes.push orgTypeObject.type

if savedState
TPAService.restoreState stateName, fieldsToStore, $scope
Expand All @@ -101,6 +102,10 @@ angular.module 'mean.transparency'
step:5
floor:0
onEnd: -> change(1,2)
orgTypePromise = TPAService.organisationTypes()
orgTypePromise.then (res) ->
for orgTypeObject in res.data
$scope.orgTypes.push(name: gettextCatalog.getString(orgTypeObject.type), value: orgTypeObject.type, selected: true)

pP = TPAService.periods()
pP.then (res) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ app.directive 'tpaQuartercomparison', ($rootScope, $window) ->
getCurrentLanguage: '&'
link: ($scope,element,attrs) ->
updateDiagram = (oldValue, newValue) ->
margin = {top: 30, right: 100, bottom: 75, left: 100}
margin = {top: 75, right: 100, bottom: 75, left: 100}
data = () ->
if $scope.data
result = [
Expand Down Expand Up @@ -62,39 +62,75 @@ app.directive 'tpaQuartercomparison', ($rootScope, $window) ->
result
svgNS = "http://www.w3.org/2000/svg";

drawText = (x, y, text, className) ->
drawText = (id, x, y, text, className) ->
newText = document.createElementNS(svgNS,"text");
newText.setAttributeNS(null,"x",x);
newText.setAttributeNS(null,"y",y);
newText.setAttributeNS(null, "class", "event eventText " + className);
newText.setAttributeNS(null, "class", "event eventText " + className + " id" + id);
textNode = document.createTextNode(text);
newText.appendChild(textNode);
document.getElementById("quarterComparison").appendChild(newText);

drawLine = (x, y1, y2, className) ->
drawLine = (id, x, y1, y2, className) ->
line = document.createElementNS(svgNS,"line");
line.setAttributeNS(null,"id","line");
line.setAttributeNS(null,"x1",x);
line.setAttributeNS(null,"x2",x);
line.setAttributeNS(null,"y1",y1);
line.setAttributeNS(null,"y2",y2);
line.setAttributeNS(null, "class", "event eventLine " + className);
line.setAttributeNS(null, "onclick", "for (let el of document.querySelectorAll('.id" + id + "')) el.style.visibility = (el.style.visibility === 'hidden') ? 'visible' : 'hidden';");
document.getElementById("quarterComparison").appendChild(line);

drawEventGuideline = (numericDate, date, bars, className, eventName, y1, y2, additionalText) ->
drawEventGuideline = (id, numericDate, date, bars, className, eventName, y1, y2, type) ->
#calculate containing bar
index = Math.floor((numericDate - (Number($scope.data[0].key) + $scope.data[0].values[0].x)) / 0.25)
x = margin.left
x += (bars[index].transform.animVal[0].matrix.e)
x += (bars[index].firstChild.width.animVal.value * ((((numericDate - (Number($scope.data[0].key) + $scope.data[0].values[0].x))/0.25)%1)))
drawLine(x, y1, y2, className)
if additionalText
drawText(x, y1 - margin.top + 12, additionalText + eventName, className)
else
drawText(x, y1 - margin.top + 12, eventName, className)
drawText(x, y1 - margin.top + 24, date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getFullYear(), className)


drawLine(id, x, y1, y2, className)
drawToggleLabel id, x, y1 - margin.top + 60, className
drawSymbol id, x, y1 - margin.top + 12, className
drawText(id, x, y1 - margin.top + 24, eventName, className)
drawText(id, x, y1 - margin.top + 36, date.getDate() + '.' + (date.getMonth() + 1), className)
drawSymbol id, x, y1 - margin.top + 48, className, type


drawSymbol = (id, x, y, className, type) ->
symbol = document.createElementNS(svgNS, "text");
symbol.setAttributeNS(null,"x",x);
symbol.setAttributeNS(null,"y",y);
symbol.setAttributeNS(null, 'font-family', 'Glyphicons Halflings')
symbol.setAttributeNS(null, 'font-size', '10pt')
if type and type is "start"
symbol.setAttributeNS(null, "class", "event eventText start " + className + " id" + id);
textNode = document.createTextNode(" " + String.fromCharCode(0xE077));
else if type and type is "end"
symbol.setAttributeNS(null, "class", "event eventText end " + className + " id" + id);
textNode = document.createTextNode(String.fromCharCode(0xE069) + " ");
else if type and type is "standard"
symbol.setAttributeNS(null, "class", "event eventText " + className + " id" + id);
textNode = document.createTextNode(String.fromCharCode(0xE077) + " " + String.fromCharCode(0xE069));
else if className is "predictable"
symbol.setAttributeNS(null, "class", "event eventText " + className + " id" + id);
textNode = document.createTextNode(String.fromCharCode(0xE023));
else if className is "inpredictable"
symbol.setAttributeNS(null, "class", "event eventText " + className + " id" + id);
textNode = document.createTextNode(String.fromCharCode(0xE162));

symbol.appendChild(textNode);
document.getElementById("quarterComparison").appendChild(symbol);

drawToggleLabel = (id, x, y, className) ->
circle = document.createElementNS(svgNS, "circle");
circle.setAttributeNS(null, "cx", x);
circle.setAttributeNS(null, "cy", y);
circle.setAttributeNS(null, "r", 4);
circle.setAttributeNS(null, "id", "id" + id);
circle.setAttributeNS(null, "class", "event labelToggle " + className + " circle" + id);
circle.setAttributeNS(null, "onclick", "for (let el of document.querySelectorAll('.id" + id + "')) el.style.visibility = (el.style.visibility === 'hidden') ? 'visible' : 'hidden';
for (let el of document.querySelectorAll('.circle" + id + "')) el.style.fill = (el.style.fill === 'transparent') ? '' : 'transparent';");
document.getElementById("quarterComparison").appendChild(circle);

drawEvents = (events) ->
groupOfBars = d3.select('.quartercomparison svg').selectAll('.nv-bar')
Expand All @@ -109,10 +145,10 @@ app.directive 'tpaQuartercomparison', ($rootScope, $window) ->
className = "inpredictable"

if !event.numericEndDate
drawEventGuideline event.numericStartDate, new Date(event.startDate), groupOfBars[0], className, event.name, y1, y2
drawEventGuideline event._id, event.numericStartDate, new Date(event.startDate), groupOfBars[0], className, event.name, y1, y2, "standard"
else
drawEventGuideline event.numericStartDate, new Date(event.startDate), groupOfBars[0], className, event.name, y1, y2, "Start: "
drawEventGuideline event.numericEndDate, new Date(event.endDate), groupOfBars[0], className, event.name, y1, y2, "End: "
drawEventGuideline event._id, event.numericStartDate, new Date(event.startDate), groupOfBars[0], className, event.name, y1, y2, "start"
drawEventGuideline event._id, event.numericEndDate, new Date(event.endDate), groupOfBars[0], className, event.name, y1, y2, "end"



Expand All @@ -138,7 +174,13 @@ app.directive 'tpaQuartercomparison', ($rootScope, $window) ->
)

if $scope.events and $scope.events.length > 0
drawEvents($scope.events)
events = []
for event in $scope.events
if event.selected
events.push event

drawEvents(events)
chart

$scope.$watch 'data', updateDiagram, true
$scope.$watch 'data', updateDiagram, true
$scope.$watch 'events', updateDiagram, true
Loading

0 comments on commit 83d6533

Please sign in to comment.