persistent modals, almost perfect

parent 599f91b1
...@@ -173,7 +173,7 @@ dashboardControllers.controller('AddPictoCtrl', function ( ...@@ -173,7 +173,7 @@ dashboardControllers.controller('AddPictoCtrl', function (
}; };
$scope.addOwnPicto = function () { $scope.addOwnPicto = function () {
console.log($scope.picFile);
$scope.progress = 0; $scope.progress = 0;
var modalInstance = $modal.open({ var modalInstance = $modal.open({
animation: true, animation: true,
...@@ -186,7 +186,7 @@ dashboardControllers.controller('AddPictoCtrl', function ( ...@@ -186,7 +186,7 @@ dashboardControllers.controller('AddPictoCtrl', function (
progress: () => {return $scope.progress;} progress: () => {return $scope.progress;}
} }
}); });
modalInstance.result.then(function () {}); modalInstance.result.then(function () {$scope.picFile=null;});
}; };
/** /**
...@@ -212,7 +212,7 @@ dashboardControllers.controller('AddPictoCtrl', function ( ...@@ -212,7 +212,7 @@ dashboardControllers.controller('AddPictoCtrl', function (
picto.expressions = []; picto.expressions = [];
$scope.open_exp(picto, () => { $scope.open_exp(picto, () => {
$scope.pictos.push(picto); $scope.pictos.push(picto);
load_own_pictos(); $scope.load_own_pictos();
cb(); cb();
}); });
}); });
......
...@@ -369,6 +369,9 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -369,6 +369,9 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Returned data from the modal window // Returned data from the modal window
modalInstance.result.then(function (pictoId) { modalInstance.result.then(function (pictoId) {
if(!pictoId)
return;
// Send the picto to the server // Send the picto to the server
$http.post(config.backend + '/stu/' + $scope.studentData.id + '/picto/' + pictoId, { $http.post(config.backend + '/stu/' + $scope.studentData.id + '/picto/' + pictoId, {
attributes: { attributes: {
......
<div> <div>
<div class="modal-header">
<div class="modal-header">
<button type="button" class="close" ng-click="close()"> <button type="button" class="close" ng-click="close()">
<span aria-hidden="true">&times;</span><span class="sr-only" translate>close</span> <span aria-hidden="true">&times;</span><span class="sr-only" translate>close</span>
</button> </button>
<h4 class="modal-title" id="myModalLabel" translate ng-show="!onlyOwn">add_picto</h4> <h4 class="modal-title" id="myModalLabel" translate ng-show="!onlyOwn">add_picto</h4>
<h4 class="modal-title" id="myModalLabel" translate ng-show="onlyOwn">own_pictos</h4> <h4 class="modal-title" id="myModalLabel" translate ng-show="onlyOwn">own_pictos</h4>
...@@ -18,10 +19,12 @@ ...@@ -18,10 +19,12 @@
<span class="glyphicon glyphicon-picture"></span> {{ 'own_pictos' | translate }} <span class="glyphicon glyphicon-picture"></span> {{ 'own_pictos' | translate }}
</button> </button>
</div> </div>
</div>
</div><!-- /modal-header -->
<div class="modal-body"> <div class="modal-body">
<!-- Bread and categories -->
<div id="bread_and_categories" ng-show="source == 'symbolstx' && !onlyOwn" class="panel panel-default"> <div id="bread_and_categories" ng-show="source == 'symbolstx' && !onlyOwn" class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<div class="pull-left" ng-repeat="b in breadcrumbs"> <div class="pull-left" ng-repeat="b in breadcrumbs">
...@@ -44,56 +47,62 @@ ...@@ -44,56 +47,62 @@
<alert ng-show="alert.show" ng-model="alert" type="{{alert.type}}" close="closeAlert()">{{alert.msg | translate}}</alert> <alert ng-show="alert.show" ng-model="alert" type="{{alert.type}}" close="closeAlert()">{{alert.msg | translate}}</alert>
</div> </div>
<div id="collections" class="col-md-12 category-collection" <!-- Collections row -->
ng-class="{ 'category-collection-loading': loadingCatPictos }" <div class="row">
data-loading="{{ 'loading_pictos' | translate }}">
<form ng-submit="search()" ng-show="!onlyOwn"> <!-- Collections -->
<div class="input-group" id="search_pictos_box"> <div id="collections" class="col-md-12 category-collection"
<input type="text" class="form-control" placeholder="{{ 'filter' | translate }}" ng-class="{ 'category-collection-loading': loadingCatPictos }"
id="srch_term_picto" name="srch_term_picto" ng-model="srch_term_picto"> data-loading="{{ 'loading_pictos' | translate }}">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary"> <!-- Filter form -->
<i class="fa fa-search" aria-hidden="true"></i> {{ 'search' | translate }} <form ng-submit="search()" ng-show="!onlyOwn">
</button> <div class="input-group" id="search_pictos_box">
</span> <input type="text" class="form-control" placeholder="{{ 'filter' | translate }}"
</div> id="srch_term_picto" name="srch_term_picto" ng-model="srch_term_picto">
</form> <span class="input-group-btn">
<div ng-show="source == 'ownpictos'" class="input-group"> <button type="submit" class="btn btn-primary">
<button class="btn btn-success" ngf-select ng-model="picFile" accept="image/*" ngf-change="addOwnPicto()"> <i class="fa fa-search" aria-hidden="true"></i> {{ 'search' | translate }}
<span class="glyphicon glyphicon-folder-open"></span> {{ 'new_img' | translate }} </button>
</button> </span>
</div>
<!-- Galería de pictos -->
<div id="clearfix-infiniteScroll-parent" infinite-scroll="scroll()"
infinite-scroll-container="'#collections'">
<div
class="picto_peq pull-left"
ng-repeat="p in pictos" >
<img ng-src="{{p.uri}}" popover="{{p.expressions[0].text}}" popover-trigger="mouseenter" />
<div class="picto_options">
<!-- Options to remove picto (Only for own pictos) -->
<a ng-click="remove_own_picto(p.id)" class="picto_remove" title="{{ 'delete' | translate}}" ng-show="source == 'ownpictos'">
<span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span>
</a>
<a ng-show="!onlyOwn"
ng-click="close(p.id)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<span class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></span>
</a>
</div> </div>
</form>
<!-- Add new image -->
<div ng-show="source == 'ownpictos'" class="input-group">
<button class="btn btn-success" ngf-select ng-model="picFile" accept="image/*" ngf-change="addOwnPicto()">
<span class="glyphicon glyphicon-folder-open"></span> {{ 'new_img' | translate }}
</button>
</div> </div>
<div class="clearfix"></div> <!-- Picto galery -->
<div id="clearfix-infiniteScroll-parent" infinite-scroll="scroll()" infinite-scroll-container="'#collections'">
</div><!-- /collections --> <div class="picto_peq pull-left" ng-repeat="p in pictos" >
<img ng-src="{{p.uri}}" popover="{{p.expressions[0].text}}" popover-trigger="mouseenter" />
<!-- Options to remove picto (Only for own pictos) -->
<div class="picto_options">
<a ng-click="remove_own_picto(p.id)" class="picto_remove" title="{{ 'delete' | translate}}" ng-show="source == 'ownpictos'">
<span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span>
</a>
<a ng-show="!onlyOwn"
ng-click="close(p.id)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<span class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></span>
</a>
</div><!-- /picto-options -->
</div><!-- /each picto -->
</div><!-- /row --> <div class="clearfix"></div>
</div> <!-- /modal-body --> </div><!-- /picto galery -->
</div><!-- /collections -->
</div><!-- /collections row -->
</div><!-- /modal-body -->
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-primary" ng-click="cancel()">{{ 'close' | translate }}</button> <button class="btn btn-primary" ng-click="cancel()">{{ 'close' | translate }}</button>
</div> </div><!-- /modal-footer -->
</div> </div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment