Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File manager #5

Merged
merged 14 commits into from
May 5, 2017
6 changes: 5 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
"ng-table": "1.0.0",
"font-awesome": "fontawesome#^4.7.0",
"angular-translate-storage-local": "^2.15.1",
"angular-translate-loader-partial": "^2.15.1"
"angular-translate-loader-partial": "^2.15.1",
"angular-bootstrap-contextmenu": "^0.9.9",
"ng-tags-input": "3.2.0",
"angular-aside": "1.2.1",
"bootstrap-tagsinput": "^0.8.0"
},
"devDependencies": {
"angular-mocks": "~1.5.3"
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/core.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
'pascalprecht.translate',
'ngAnimate',
'ngCookies',
'ngTouch',
'ngSanitize',
'ngMessages',
'ngAria',
'ngResource',
'ngTagsInput',
'ui.router',
'toastr',
'ui.bootstrap',
Expand Down
24 changes: 24 additions & 0 deletions src/app/core/directives/ng-right-click/ng-right-click.directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Created by george on 4/24/17.
*/

(function () {
'use strict';

angular
.module('app.core')
.directive('ngRightClick', ngRightClickFn);

/** @ngInject */
function ngRightClickFn($parse) {
return function (scope, element, attrs) {
var fn = $parse(attrs.ngRightClick);
element.bind('contextmenu', function (event) {
scope.$apply(function () {
event.preventDefault();
fn(scope, {$event: event});
});
});
};
}
})();
64 changes: 64 additions & 0 deletions src/app/core/directives/om-aside/om-aside.directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Created by george on 5/2/17.
*/
(function () {
'use strict';

angular
.module('app.core')
.controller('omAsideController', omAsideControllerFn)
.factory('omAside', omAsideFactoryFn)
.directive('omAside', omAsideFn);

/** @ngInject */
function omAsideControllerFn() {

// Data

// Methods

init();
function init() {

}
}

function omAsideFactoryFn() {
var asideConfig = {};
return {
open: open,
close: close,
toggle: toggle,
setAside: setAside
};

function open(id) {
asideConfig[id] != undefined ? angular.element("#" + id).removeClass('nav-closed-' + asideConfig[id].direction) : angular.element("#" + id).removeClass('nav-closed');
}

function close(id) {
asideConfig[id] != undefined ? angular.element("#" + id).addClass('nav-closed-' + asideConfig[id].direction) : angular.element("#" + id).addClass('nav-closed');
}

function toggle(id) {
asideConfig[id] != undefined ? angular.element("#" + id).toggleClass('nav-closed-' + asideConfig[id].direction) : angular.element("#" + id).toggleClass('nav-closed');
}

function setAside(id, config) {
asideConfig[id] = config;
config.direction != undefined ? angular.element("#" + id).addClass('nav-closed-' + config.direction) : angular.element("#" + id).addClass('nav-closed');
}
}

function omAsideFn(omAside) {
return {
restrict: 'A',
scope: {
direction: '@omSlideDirection'
},
link: function(scope, el){
omAside.setAside(el.attr('id'), {direction: scope.direction});
}
};
}
})();
33 changes: 33 additions & 0 deletions src/app/core/directives/om-tagsinput/om-tagsinput.directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Created by george on 4/28/17.
*/
(function () {
'use strict';

angular
.module('app.core')
.directive('omTagsinput', omTagsinputFn);

/** @ngInject */
function omTagsinputFn() {
return {
restrict: 'A',
scope: {
'ngModel': '='
},
link: function(scope, elem) {
var $el = $(elem);
$el
.val(scope.ngModel.join(","))
.tagsinput("items");


scope.$watch('ngModel', function() {
if (angular.isString(scope.ngModel)){
scope.ngModel = scope.ngModel.split(",");
}
});
}
};
}
})();
21 changes: 21 additions & 0 deletions src/app/core/filters/filesize.filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Created by george on 4/21/17.
*/

(function () {
'use strict';

angular
.module('app.core')
.filter('bytes', bytesFn);

function bytesFn() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
}
})();
17 changes: 9 additions & 8 deletions src/app/core/filters/trim.filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

angular
.module('app.core')
.filter('trim', function () {
return function (value) {
if (!angular.isString(value)) {
return value;
}
return value.replace(/^\s+|\s+$/g, ''); // you could use .trim, but it's not going to work in IE<9
};
});
.filter('trim', trimFn);

function trimFn() {
return function (value) {
if (!angular.isString(value)) {
return value;
}
return value.replace(/^\s+|\s+$/g, ''); // you could use .trim, but it's not going to work in IE<9
};
}
})();
37 changes: 37 additions & 0 deletions src/app/core/filters/typeToIcon.filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Created by george on 4/20/17.
*/

(function () {
'use strict';
angular
.module('app.core')
.filter('typeToIcon', typeToIcon);

/** @ngInject */
function typeToIcon() {
var map = {
'Folder': 'folder-open',
'Image': 'file-image-o',
'Word': 'file-word-o',
'Excel': 'file-excel-o',
'Pdf': 'file-pdf-o',
'Power Point': 'file-powerpoint-o',
'Video': 'file-video-o',
'Audio': 'file-audio-o',
'Javascript': 'NOTDEFINED',
'HTML': 'html5',
'Css': 'css3',
'C#': 'NOTDEFINED',
'XML': 'NOTDEFINED',
'Code': 'file-code-o',
'Archive': 'file-archive-o',
'Other': 'file-o',
'Document': 'file-text-o'
};
return function (type) {
return map[type];
}
}

})();
51 changes: 51 additions & 0 deletions src/app/core/less/tags-input.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*Author : @arboshiki*/

.bootstrap-tagsinput{
display: block;
width: 100%;
border-radius: 0;
margin-bottom: 0;
padding: @tags-input-padding-vertical @tags-input-padding-horizontal;
min-height: @tags-input-min-height;
border-width: @tags-input-border-width;
.tag{
position: relative;
border-radius: 0;
display: inline-block;
margin-top: @tags-input-tag-margin-vertical;
margin-bottom: @tags-input-tag-margin-vertical;
padding: @tags-input-tag-padding;
font-size: @tags-input-font-size;
[data-role=remove]{
display: block;
position: absolute;
top: 0;
right: 0;
height: 100%;
width: @tags-input-tag-close-width;
line-height: @tags-input-min-height - 2 * @tags-input-border-width - 2 * @tags-input-padding-vertical - 2 * @tags-input-tag-margin-vertical;
.transition(background-color @transition-duration);
&:after{
content: @fa-var-times-circle;
font-family: fontAwesome;
padding: 2px 1px;
font-size: @tags-input-tag-close-font-size;
text-align: center;
}
&:hover{
background-color: rgba(0, 0, 0, 0.4);
}
}
}
&:focus{
border-color: red;
}
input{
&,
&:hover,
&:focus{
border-color: transparent;
background-color: transparent;
}
}
}
2 changes: 2 additions & 0 deletions src/app/i18n/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"APP": {
"GLOBAL":{
"MONTHS": "months",
"MONTH": "month",
"DAY": "day",
"DAYS": "days",
"HR": "hr",
Expand Down
2 changes: 2 additions & 0 deletions src/app/i18n/ka.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"APP": {
"GLOBAL":{
"MONTHS": "თვის",
"MONTH": "თვის",
"DAY": "დღის",
"DAYS": "დღის",
"HR": "სთ",
Expand Down
15 changes: 3 additions & 12 deletions src/app/index.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,14 @@

angular
.module('angularLobiadmin', [
'ngAnimate',
'ngCookies',
'ngTouch',
'ngSanitize',
'ngMessages',
'ngAria',
'ngResource',
'ui.router',
'ui.bootstrap',
'toastr',
'pascalprecht.translate',
'ui.bootstrap.contextMenu',

'app.core',

'app.pages',

'app.dashboard'
'app.dashboard',
'app.fileManager'
]);

})();
Loading