You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. 'use strict';
  2. /* App Module */
  3. var app = angular.module('app', [
  4. 'ui.bootstrap',
  5. 'ui.router',
  6. 'LocalStorageModule',
  7. 'dialogs.main',
  8. 'ngSanitize',
  9. 'luticateUtils',
  10. 'luticateAuth',
  11. 'appSdk'
  12. ]);
  13. app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider',
  14. function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) {
  15. //$locationProvider.html5Mode(true);
  16. $stateProvider.state('home',{
  17. url:'/',
  18. templateUrl:'views/home.html',
  19. controller:'HomeController'
  20. });
  21. $urlRouterProvider.otherwise('/');
  22. }])
  23. .directive('dateNow', ['$filter', function($filter) {
  24. return {
  25. link: function( $scope, $element, $attrs) {
  26. $element.text($filter('date')(new Date(), $attrs.dateNow));
  27. }
  28. };
  29. }])
  30. .run(['$rootScope', '$state',function ($rootScope, $state) {
  31. $rootScope.$on('$stateChangeError', function (e, curr, prev) {
  32. //$state.go('login');
  33. });
  34. }])
  35. .directive("dropzone", function() {
  36. return {
  37. restrict : "A",
  38. link: function (scope, elem) {
  39. function processEvent(evt)
  40. {
  41. if (evt != null) {
  42. evt.stopPropagation();
  43. evt.preventDefault();
  44. evt.dataTransfer.effectAllowed = 'copy';
  45. evt.dataTransfer.dropEffect = 'copy';
  46. }
  47. return false;
  48. }
  49. elem.bind('dragover', processEvent);
  50. elem.bind('dragenter', processEvent);
  51. elem.bind('dragstart', processEvent);
  52. elem.bind('drop', function(evt) {
  53. evt.stopPropagation();
  54. evt.preventDefault();
  55. var files = evt.dataTransfer.files;
  56. for (var i = 0, f; f = files[i]; i++) {
  57. var reader = new FileReader();
  58. reader.readAsText(f, 'ISO-8859-1');
  59. reader.onload = (function(file) {
  60. return function(e) {
  61. scope.$apply(function() {
  62. scope.setDraggedContent(e.target.result, file);
  63. });
  64. };
  65. })(f);
  66. }
  67. return false;
  68. });
  69. }
  70. }
  71. });