add profile file upload preview, fix google maps error, amMap fix, etc.

pull/3/head
Nasta 2015-09-10 16:35:11 +03:00
parent 19d650b373
commit bba2e69506
41 changed files with 126 additions and 60 deletions

View File

@ -1,6 +1,6 @@
"use strict";
var app = angular.module('BlurAdmin', [
var blurAdminApp = angular.module('BlurAdmin', [
'ui.sortable',
'ngRoute',
'BlurAdmin.dashboard',

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('mainCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
blurAdminApp.controller('mainCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
$timeout(function () {
$scope.finishLoading = true;
}, 1000);

View File

@ -4,7 +4,7 @@
'use strict';
app.directive('animatedChange', ["$timeout", function ($timeout) {
blurAdminApp.directive('animatedChange', ["$timeout", function ($timeout) {
return {
link: function (scope, element) {
$timeout(function () {

View File

@ -3,7 +3,7 @@
*/
'use strict';
app.directive('autoExpand', function () {
blurAdminApp.directive('autoExpand', function () {
return {
restrict: 'A',
link: function ($scope, elem) {

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('autoFocus', ["$timeout", "$parse", function ($timeout, $parse) {
blurAdminApp.directive('autoFocus', ["$timeout", "$parse", function ($timeout, $parse) {
return {
link: function (scope, element, attrs) {
var model = $parse(attrs.autoFocus);

View File

@ -0,0 +1,10 @@
blurAdminApp.directive("ngFileSelect", function () {
return {
link: function ($scope, el) {
el.bind("change", function (e) {
$scope.file = (e.srcElement || e.target).files[0];
$scope.getFile();
})
}
}
});

View File

@ -4,7 +4,7 @@
'use strict';
app.directive('zoomIn', ['$timeout', function ($timeout) {
blurAdminApp.directive('zoomIn', ['$timeout', function ($timeout) {
return {
restrict: 'A',
link: function ($scope, elem) {

View File

@ -0,0 +1,55 @@
(function (blurAdminApp) {
blurAdminApp.factory("fileReader", fileReader);
fileReader.$inject = ["$q"];
function fileReader ($q) {
var onLoad = function(reader, deferred, scope) {
return function () {
scope.$apply(function () {
deferred.resolve(reader.result);
});
};
};
var onError = function (reader, deferred, scope) {
return function () {
scope.$apply(function () {
deferred.reject(reader.result);
});
};
};
var onProgress = function(reader, scope) {
return function (event) {
scope.$broadcast("fileProgress",
{
total: event.total,
loaded: event.loaded
});
};
};
var getReader = function(deferred, scope) {
var reader = new FileReader();
reader.onload = onLoad(reader, deferred, scope);
reader.onerror = onError(reader, deferred, scope);
reader.onprogress = onProgress(reader, scope);
return reader;
};
var readAsDataURL = function (file, scope) {
var deferred = $q.defer();
var reader = getReader(deferred, scope);
reader.readAsDataURL(file);
return deferred.promise;
};
return {
readAsDataUrl: readAsDataURL
};
}
}(blurAdminApp));

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('backTop', function () {
blurAdminApp.directive('backTop', function () {
return {
restrict: 'E',
controller: [function () {

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('msgCenter', function () {
blurAdminApp.directive('msgCenter', function () {
return {
restrict: 'E',
templateUrl: '/app/components/msgCenter/msgCenter.html'

View File

@ -8,7 +8,7 @@
</a>
<div class="dropdown-menu top-dropdown-menu profile-dropdown">
<i class="dropdown-arr"></i>
<a href><i class="fa fa-user"></i>Profile</a>
<a href="#/profile"><i class="fa fa-user"></i>Profile</a>
<a href><i class="fa fa-cog"></i>Settings</a>
<a href class="signout"><i class="fa fa-power-off"></i>Sign out</a>
</div>

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('pageTop', ["$location", function ($location) {
blurAdminApp.directive('pageTop', ["$location", function ($location) {
return {
restrict: 'E',
templateUrl: '/app/components/pageTop/pageTop.html',

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('pieCharts', function () {
blurAdminApp.directive('pieCharts', function () {
return {
restrict: 'E',
controller: ["$scope", "$element", "$window", "$timeout", function ($scope, $element, $window, $timeout) {

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('sidebar', function () {
blurAdminApp.directive('sidebar', function () {
return {
restrict: 'E',
templateUrl: '/app/components/sidebar/sidebar.html',

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('widgets', function () {
blurAdminApp.directive('widgets', function () {
return {
restrict: 'EA',
scope: {

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('areaChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
blurAdminApp.controller('areaChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
var id = $element[0].getAttribute('id');
var areaChart = AmCharts.makeChart(id, {
type: "serial",

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('barChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
blurAdminApp.controller('barChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
var id = $element[0].getAttribute('id');
var barChart = AmCharts.makeChart(id, {
type: "serial",

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('funnelChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
blurAdminApp.controller('funnelChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
var id = $element[0].getAttribute('id');
var funnelChart = AmCharts.makeChart(id, {
type: "funnel",

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('lineChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
blurAdminApp.controller('lineChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
var id = $element[0].getAttribute('id');
var lineChart = AmCharts.makeChart(id, {
type: "serial",

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('pieChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
blurAdminApp.controller('pieChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
var id = $element[0].getAttribute('id');
var pieChart = AmCharts.makeChart(id, {
type: "pie",

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('amChartCtrl', ['$scope', '$timeout', '$element', function ($scope, $timeout, $element) {
blurAdminApp.controller('amChartCtrl', ['$scope', '$timeout', '$element', function ($scope, $timeout, $element) {
var chartData = [
{ date: new Date(2011, 0), value: -30700},
{ date: new Date(2011, 1), value: -16800},

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('amMapCtrl', ['$scope', '$timeout', '$element', function ($scope, $timeout, $element) {
blurAdminApp.controller('amMapCtrl', ['$scope', '$timeout', '$element', function ($scope, $timeout, $element) {
var id = $element[0].getAttribute('id');
var map = AmCharts.makeChart(id, {
@ -109,7 +109,7 @@ app.controller('amMapCtrl', ['$scope', '$timeout', '$element', function ($scope,
id: "NL",
color: colorPrimary,
customData: "1 213",
groupId: "before2004"
groupId: "1"
},
{
title: "Portugal",

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('calendarCtrl', ['$scope', '$timeout', '$element', function ($scope, $timeout, $element) {
blurAdminApp.controller('calendarCtrl', ['$scope', '$timeout', '$element', function ($scope, $timeout, $element) {
$element.fullCalendar({
header: {
left: 'prev,next today',

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('trafficChartCtrl', [function () {
blurAdminApp.controller('trafficChartCtrl', [function () {
var doughnutData = [
{

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('timelineCtrl', [function () {
blurAdminApp.controller('timelineCtrl', [function () {
var timelineBlocks = $('.cd-timeline-block'),
offset = 0.8;

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('blurTodo', function () {
blurAdminApp.directive('blurTodo', function () {
return {
restrict: 'A',
controller: ["$scope", function ($scope) {

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('selectpicker', [function() {
blurAdminApp.directive('selectpicker', [function() {
return {
restrict: 'A',
link: function( $scope, elem) {

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('switch', ['$timeout', function ($timeout) {
blurAdminApp.directive('switch', ['$timeout', function ($timeout) {
return {
restrict: 'EA',
replace: true,

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('tagInput', [function() {
blurAdminApp.directive('tagInput', [function() {
return {
restrict: 'A',
link: function( $scope, elem, attr) {

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('googleMapsCtrl', ["$timeout", function ($timeout) {
blurAdminApp.controller('googleMapsCtrl', ["$timeout", function ($timeout) {
function initialize() {
var mapCanvas = document.getElementById('google-maps');
var mapOptions = {

View File

@ -1,20 +0,0 @@
window.google = window.google || {};
google.maps = google.maps || {};
(function() {
function getScript(src) {
document.write('<' + 'script src="' + src + '"><' + '/script>');
}
var modules = google.maps.modules = {};
google.maps.__gjsload__ = function(name, text) {
modules[name] = text;
};
google.maps.Load = function(apiLoad) {
delete google.maps.Load;
apiLoad([0.009999999776482582,[[["https://mts0.googleapis.com/vt?lyrs=m@318000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=m@318000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"m@318000000",["https://mts0.google.com/vt?lyrs=m@318000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.google.com/vt?lyrs=m@318000000\u0026src=api\u0026hl=en-US\u0026"]],[["https://khms0.googleapis.com/kh?v=183\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=183\u0026hl=en-US\u0026"],null,null,null,1,"183",["https://khms0.google.com/kh?v=183\u0026hl=en-US\u0026","https://khms1.google.com/kh?v=183\u0026hl=en-US\u0026"]],null,[["https://mts0.googleapis.com/vt?lyrs=t@132,r@318000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.googleapis.com/vt?lyrs=t@132,r@318000000\u0026src=api\u0026hl=en-US\u0026"],null,null,null,null,"t@132,r@318000000",["https://mts0.google.com/vt?lyrs=t@132,r@318000000\u0026src=api\u0026hl=en-US\u0026","https://mts1.google.com/vt?lyrs=t@132,r@318000000\u0026src=api\u0026hl=en-US\u0026"]],null,null,[["https://cbks0.googleapis.com/cbk?","https://cbks1.googleapis.com/cbk?"]],[["https://khms0.googleapis.com/kh?v=87\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=87\u0026hl=en-US\u0026"],null,null,null,null,"87",["https://khms0.google.com/kh?v=87\u0026hl=en-US\u0026","https://khms1.google.com/kh?v=87\u0026hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/ft?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/ft?hl=en-US\u0026"]],[["https://mts0.googleapis.com/vt?hl=en-US\u0026","https://mts1.googleapis.com/vt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/loom?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/loom?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/ft?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/ft?hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt/loom?hl=en-US\u0026","https://mts1.googleapis.com/mapslt/loom?hl=en-US\u0026"]]],["en-US","US",null,0,null,null,"https://maps.gstatic.com/mapfiles/","https://csi.gstatic.com","https://maps.googleapis.com","https://maps.googleapis.com",null,"https://maps.google.com","https://gg.google.com","https://maps.gstatic.com/maps-api-v3/api/images/","https://www.google.com/maps",0,"https://www.google.com"],["https://maps.googleapis.com/maps-api-v3/api/js/22/2","3.22.2"],[2083414771],1,null,null,null,null,null,"",null,null,1,"https://khms.googleapis.com/mz?v=183\u0026",null,"https://earthbuilder.googleapis.com","https://earthbuilder.googleapis.com",null,"https://mts.googleapis.com/vt/icon",[["https://mts0.googleapis.com/vt","https://mts1.googleapis.com/vt"],["https://mts0.googleapis.com/vt","https://mts1.googleapis.com/vt"],null,null,null,null,null,null,null,null,null,null,["https://mts0.google.com/vt","https://mts1.google.com/vt"],"/maps/vt",318000000,132],2,500,[null,"https://g0.gstatic.com/landmark/tour","https://g0.gstatic.com/landmark/config",null,"https://www.google.com/maps/preview/log204","","https://static.panoramio.com.storage.googleapis.com/photos/",["https://geo0.ggpht.com/cbk","https://geo1.ggpht.com/cbk","https://geo2.ggpht.com/cbk","https://geo3.ggpht.com/cbk"],"https://maps.googleapis.com/maps/api/js/GeoPhotoService.GetMetadata","https://maps.googleapis.com/maps/api/js/GeoPhotoService.SingleImageSearch"],["https://www.google.com/maps/api/js/master?pb=!1m2!1u22!2s2!2sen-US!3sUS!4s22/2","https://www.google.com/maps/api/js/widget?pb=!1m2!1u22!2s2!2sen-US"],null,0,null,"/maps/api/js/ApplicationService.GetEntityDetails",0,null,null,[null,null,null,null,null,null,null,null,null,[0,0],[0,null,1,"12300062","0","U","0","0","0","0"]]], loadScriptTime);
};
var loadScriptTime = (new Date).getTime();
getScript("https://maps.googleapis.com/maps-api-v3/api/js/22/2/main.js");
})();

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('leafletCtrl', ["$timeout", function ($timeout) {
blurAdminApp.controller('leafletCtrl', ["$timeout", function ($timeout) {
var map = L.map('leaflet-map').setView([51.505, -0.09], 13);
L.Icon.Default.imagePath = 'release/img';

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('mapBubblesCtrl', [function () {
blurAdminApp.controller('mapBubblesCtrl', [function () {
var latlong = {};
latlong["AD"] = {"latitude": 42.5, "longitude": 1.5};

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('mapLinesCtrl', [function () {
blurAdminApp.controller('mapLinesCtrl', [function () {
// svg path for target icon
var targetSVG = "M9,0C4.029,0,0,4.029,0,9s4.029,9,9,9s9-4.029,9-9S13.971,0,9,0z M9,15.93 c-3.83,0-6.93-3.1-6.93-6.93S5.17,2.07,9,2.07s6.93,3.1,6.93,6.93S12.83,15.93,9,15.93 M12.5,9c0,1.933-1.567,3.5-3.5,3.5S5.5,10.933,5.5,9S7.067,5.5,9,5.5 S12.5,7.067,12.5,9z";
// svg path for plane icon

View File

@ -1,6 +1,6 @@
'use strict';
app.controller('notificationsCtrl', ["$scope", "toastr", function ($scope, toastr) {
blurAdminApp.controller('notificationsCtrl', ["$scope", "toastr", function ($scope, toastr) {
$scope.showSuccessMsg = function() {
toastr.success('Your information has been saved successfully!');

View File

@ -69,18 +69,28 @@ h3.with-line {
height: 202px;
position: relative;
cursor: pointer;
.userpic-wrapper {
width: 200px;
height: 200px;
overflow: hidden;
}
img {
width: 100%;
}
i {
display: none;
position: absolute;
top: -15px;
right: -13px;
font-size: 32px;
background: #ffffff;
cursor: pointer;
color: $success;
top: -11px;
right: -11px;
height: 26px;
border-radius: 50%;
&:before {
line-height: 26px;
}
&:hover {
color: $danger;
}

View File

@ -19,10 +19,12 @@
<div class="col-sm-9">
<div class="userpic">
<img ng-src="{{ picture }}" ng-click="uploadPicture()">
<div class="userpic-wrapper">
<img ng-src="{{ picture }}" ng-click="uploadPicture()">
</div>
<i class="ion-ios-close-outline" ng-click="removePicture()" ng-if="!noPicture"></i>
<a href class="change-userpic" ng-click="uploadPicture()">Change Profile Picture</a>
<input type="file" ng-show="false" id="uploadFile">
<input type="file" ng-show="false" id="uploadFile" ng-file-select="onFileSelect($files)">
</div>
</div>
</div>

View File

@ -8,7 +8,7 @@ angular.module('BlurAdmin.profilePage', ['ngRoute'])
controller: 'profilePageCtrl'
});
}])
.controller('profilePageCtrl', ['$scope', function ($scope) {
.controller('profilePageCtrl', ['$scope', 'fileReader', function ($scope, fileReader) {
$scope.picture = "release/img/pic-profile.png";
$scope.removePicture = function () {
@ -19,6 +19,7 @@ angular.module('BlurAdmin.profilePage', ['ngRoute'])
$scope.uploadPicture = function () {
var fileInput = document.getElementById('uploadFile');
fileInput.click();
};
$scope.socialProfiles = [
@ -67,5 +68,12 @@ angular.module('BlurAdmin.profilePage', ['ngRoute'])
$('#profileModal').modal('show');
};
$scope.getFile = function () {
fileReader.readAsDataUrl($scope.file, $scope)
.then(function (result) {
$scope.picture = result;
});
};
$scope.switches = [true, true, false, true, true, false];
}]);

View File

@ -1,6 +1,6 @@
'use strict';
app.directive('profileModal', [function () {
blurAdminApp.directive('profileModal', [function () {
return {
restrict: 'EA',
replace: true,

View File

@ -8,6 +8,6 @@ angular.module('BlurAdmin.typographyPage', ['ngRoute'])
controller: 'typographyPageCtrl'
});
}])
.controller('typographyPageCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
.controller('typographyPageCtrl', [function () {
}]);

View File

@ -58,6 +58,7 @@
</div>
<script src="release/js/lib.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="release/js/bundle.min.js"></script>
</body>