Added Docker stuff.
This commit is contained in:
111
components/dialect/dialect.component.js
Normal file
111
components/dialect/dialect.component.js
Normal file
@@ -0,0 +1,111 @@
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('sloDialectsApp')
|
||||
.component('dialectComponent', {
|
||||
templateUrl: 'components/dialect/dialect.template.html',
|
||||
bindings: {
|
||||
resolve: '<',
|
||||
close: '&',
|
||||
dismiss: '&',
|
||||
modalInstance: '<'
|
||||
},
|
||||
controller: ['$scope', '$rootScope', 'Config', function dialectController($scope, $rootScope, Config) {
|
||||
var vm = this;
|
||||
|
||||
vm.$onInit = function () {
|
||||
// injected resolve
|
||||
vm.dialectData = vm.resolve.dialectData;
|
||||
vm.dialectData.audio = Config.APP_PATH + vm.dialectData.audio;
|
||||
vm.analysisData = prepareAnalysisData(vm.resolve.analysisData);
|
||||
|
||||
// prepare print view
|
||||
$rootScope.printData = $rootScope.printData || {};
|
||||
$rootScope.printData.dialectData = vm.dialectData;
|
||||
$rootScope.printData.analysisData = vm.analysisData;
|
||||
|
||||
// injected modal result
|
||||
vm.modalInstance.result.then(function(){
|
||||
if(vm.wavesurfer){
|
||||
vm.wavesurfer.destroy(); // close button clicked (success)
|
||||
}
|
||||
}, function(){
|
||||
if(vm.wavesurfer){
|
||||
vm.wavesurfer.destroy(); // ESC key or backdrop click (fail)
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function prepareAnalysisData(analysis){
|
||||
var _analysisData = [];
|
||||
analysis.forEach(function(a){
|
||||
_analysisData[a.section] = _analysisData[a.section] || [];
|
||||
_analysisData[a.section].push({
|
||||
maintext: a.maintext,
|
||||
examples: a.examples
|
||||
});
|
||||
});
|
||||
return _analysisData;
|
||||
}
|
||||
|
||||
vm.ok = function(){
|
||||
vm.close();
|
||||
}
|
||||
|
||||
// wafesurfer //
|
||||
var activeUrl = null;
|
||||
|
||||
vm.paused = true;
|
||||
|
||||
$scope.$on('wavesurferInit', function (e, wavesurfer) {
|
||||
|
||||
vm.wavesurfer = vm.wavesurfer || wavesurfer;
|
||||
|
||||
/*
|
||||
wavesurfer.on('loading', function (percents) {
|
||||
document.getElementById('progress').value = percents;
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
wavesurfer.on('ready', function (percents) {
|
||||
document.getElementById('progress').style.display = 'none';
|
||||
$scope.$apply();
|
||||
});
|
||||
*/
|
||||
|
||||
vm.wavesurfer.on('play', function () {
|
||||
vm.paused = false;
|
||||
});
|
||||
|
||||
vm.wavesurfer.on('pause', function () {
|
||||
vm.paused = true;
|
||||
});
|
||||
|
||||
vm.wavesurfer.on('finish', function () {
|
||||
vm.paused = true;
|
||||
vm.wavesurfer.seekTo(0);
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
|
||||
vm.play = function (url) {
|
||||
if (!vm.wavesurfer) {
|
||||
return;
|
||||
}
|
||||
|
||||
activeUrl = url;
|
||||
|
||||
vm.wavesurfer.once('ready', function () {
|
||||
vm.wavesurfer.play();
|
||||
$scope.$apply();
|
||||
});
|
||||
|
||||
vm.wavesurfer.load(activeUrl);
|
||||
};
|
||||
|
||||
vm.isPlaying = function (url) {
|
||||
return url == activeUrl;
|
||||
};
|
||||
|
||||
}]
|
||||
});
|
||||
49
components/dialect/dialect.template.html
Normal file
49
components/dialect/dialect.template.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<div class="modal-header">
|
||||
|
||||
<button type="button" class="close" ng-click="$ctrl.ok();" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<button type="button" class="btn btn-primary" onclick="window.print();" style="float:right; margin-right:25px;">Natisni</button>
|
||||
<h4 class="modal-title">{{ $ctrl.dialectData.location_name }} ({{ $ctrl.dialectData.location_label }}) - {{ $ctrl.dialectData.dialect_key | nameDialect }}, {{ $ctrl.dialectData.dialect_key | nameDialectGroup }}</h4>
|
||||
<pre class="location-metadata">{{ $ctrl.dialectData.metadata }}</pre>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div id="play-pause" ng-click="$ctrl.wavesurfer.playPause()"></div>
|
||||
<ng-wavesurfer url="{{$ctrl.dialectData.audio}}" wave-color="#337ab7" progress-color="#23527c" height="128" scroll-parent="true" style="height:128px;">
|
||||
<!--<progress id="progress" class="progress progress-striped" value="0" max="100" style="width:100%;"></progress>-->
|
||||
</ng-wavesurfer>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<h4>Transkripcija</h4>
|
||||
<div id="transkripcija">{{ $ctrl.dialectData.transcription }}</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<h4>Poknjižitev</h4>
|
||||
<div id="poknjizitev">{{ $ctrl.dialectData.standard_slovene }}</div>
|
||||
</div>
|
||||
<div class="col-xs-12" ng-if="$ctrl.dialectData['analysis1']">
|
||||
<h4>Analiza</h4>
|
||||
|
||||
<table class="table table-bordered" id="analiza">
|
||||
<tbody ng-repeat="i in [1,2,3,4,5,6,7]">
|
||||
<tr class="tr-head">
|
||||
<td>{{i}}</td>
|
||||
<td colspan="2">{{ $ctrl.dialectData["analysis"+i] }}</td>
|
||||
</tr>
|
||||
<tr ng-repeat="a in $ctrl.analysisData[i]" class="analysis-items">
|
||||
<td>{{i}}.{{$index+1}}</td>
|
||||
<td>{{a.maintext}}</td>
|
||||
<td>{{a.examples}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" onclick="window.print();">Natisni</button>
|
||||
<button type="button" class="btn btn-default" ng-click="$ctrl.ok();">Zapri</button>
|
||||
</div>
|
||||
Reference in New Issue
Block a user