Commit 5cbf0d23 authored by Michael BAILLY's avatar Michael BAILLY

Initial commit of Gainde2000 customization module

parent 7679f837
# linagora.esn.seed
# linagora.esn.custom-g2k
Seed module as basis to create other modules
custom-g2k module as basis to create other modules
## Install
......@@ -11,7 +11,7 @@ While waiting for a npm-based dependency injection handler, you have to install
**1. Clone**
```bash
git clone https://ci.linagora.com/linagora/lgs/openpaas/linagora.esn.seed.git
git clone https://ci.linagora.com/linagora/lgs/openpaas/linagora.esn.custom-g2k.git
```
**2. Install it in OpenPaaS**
......@@ -23,7 +23,7 @@ There is two way to install the model in OpenPaaS, so choose one of them:
The modules must be available in the `$ESN/modules` folder:
```bash
ln -s path_to_module/linagora.esn.seed $ESN/modules/
ln -s path_to_module/linagora.esn.custom-g2k $ESN/modules/
```
- B. _Using npm link_
......@@ -37,7 +37,7 @@ There is two way to install the model in OpenPaaS, so choose one of them:
```bash
cd $ESN
npm link linagora.esn.seed
npm link linagora.esn.custom-g2k
npm install
```
......@@ -50,7 +50,7 @@ Copy the 'modules' array from `$ESN/config/default.json` into `$ESN/config/defau
"modules": [
"linagora.esn.core.webserver",
"linagora.esn.core.wsserver",
"linagora.esn.seed"
"linagora.esn.custom-g2k"
],
```
......
{
"Seed module" : "Seed module",
"custom-g2k module" : "custom-g2k module",
"My sidebar" : "My sidebar"
}
{
"Seed module" : "Le module seed",
"custom-g2k module" : "Le module custom-g2k",
"My sidebar" : "Ma barre latérale"
}
{
"Seed module" : "Mô-đun hạt mầm",
"custom-g2k module" : "Mô-đun hạt mầm",
"My sidebar" : "Thanh bên của tôi"
}
{
"name": "linagora.esn.seed",
"name": "linagora.esn.custom-g2k",
"main": "index.js",
"version": "0.0.1",
"authors": [
......
(function() {
'use strict';
var MODULE_NAME = 'linagora.esn.seed';
angular.module(MODULE_NAME)
.config(seedApplicationMenu);
function seedApplicationMenu(dynamicDirectiveServiceProvider) {
var home = new dynamicDirectiveServiceProvider.DynamicDirective(true, 'seed-application-menu');
dynamicDirectiveServiceProvider.addInjection('esn-application-menu', home);
}
})();
@import './home/seed-home';
@primaryColor: #BADA55;
@darkPrimaryColor: darken(@primaryColor, 10%);
@lightPrimaryColor: lighten(@primaryColor, 10%);
@textPrimaryColor: @m-white; // Text color for @primaryColor background
@accentColor: @m-amber;
@brand-primary: @primaryColor; // Override default bootstrap primary
@body-bg: darken(@m-white, 3%);
@fontName: "RobotoDraft","Roboto","Helvetica Neue",Helvetica,Arial,sans-serif;
@defaultFont: 14px @fontName;
@text-color: lighten(@m-black, 20%);
@secondaryTextColor: lighten(@text-color, 20%);
@lighterSecondaryTextColor: lighten(@secondaryTextColor, 20%);
@lightenBgColor: lighten(@body-bg, 5%);
@darkenBgColor: darken(@body-bg, 3%);
@black-alpha-10: rgba(0, 0, 0, 0.1);
@black-alpha-15: rgba(0, 0, 0, 0.15);
@white-alpha-10: rgba(255, 255, 255, 0.1);
(function() {
'use strict';
var MODULE_NAME = 'linagora.esn.seed';
var MODULE_NAME = 'linagora.esn.custom-g2k';
angular.module(MODULE_NAME, [
'ui.router',
'op.dynamicDirective',
'restangular'
]);
])
.directive('openpaasLogo', function() {
return {
restrict: 'C',
link: function(scope, element) {
if (element.closest('#header').length) {
element.attr('src', '/linagora.esn.custom-g2k/images/logo.png');
} else {
element.attr('src', '/linagora.esn.custom-g2k/images/logo-square.png');
}
}
};
});
})();
(function() {
'use strict';
var MODULE_NAME = 'linagora.esn.seed';
var MODULE_DIR_NAME = '/linagora.esn.seed';
angular.module(MODULE_NAME)
.config(function($stateProvider) {
$stateProvider
.state('example', {
url: '/example',
views: {
'': {
templateUrl: MODULE_DIR_NAME + '/app/home/seed-home.html'
},
'sidebar@example': {
templateUrl: MODULE_DIR_NAME + '/app/home/seed-sidebar.html'
}
},
deepStateRedirect: {
default: 'example.home',
fn: function() {
return { state: 'example.home' };
}
}
})
.state('example.home', {
url: '/home',
controller: 'seedHomeController',
controllerAs: 'ctrl',
views: {
'main@example': {
templateUrl: MODULE_DIR_NAME + '/app/home/seed-main.html'
}
}
});
});
})();
(function() {
'use strict';
var MODULE_NAME = 'linagora.esn.seed';
angular.module(MODULE_NAME)
.directive('seedApplicationMenu', seedApplicationMenu);
function seedApplicationMenu(applicationMenuTemplateBuilder) {
var directive = {
restrict: 'E',
template: applicationMenuTemplateBuilder('/#/example', 'mdi-emoticon-happy', 'Seed'),
replace: true
};
return directive;
}
})();
(function() {
'use strict';
var MODULE_NAME = 'linagora.esn.seed';
var MODULE_DIR_NAME = '/linagora.esn.seed';
angular.module(MODULE_NAME)
.factory('seedRestangular', seedRestangular);
function seedRestangular(Restangular) {
return Restangular.withConfig(function(RestangularConfigurer) {
RestangularConfigurer.setBaseUrl(MODULE_DIR_NAME + '/api');
RestangularConfigurer.setFullResponse(true);
});
}
})();
(function() {
'use strict';
var MODULE_NAME = 'linagora.esn.seed';
angular.module(MODULE_NAME)
.controller('seedHomeController', seedHomeController);
function seedHomeController() {
this.message = 'Seed home!';
}
})();
'use strict';
/* global chai: false */
var expect = chai.expect;
describe('the seedHomeController', function() {
var $rootScope, $scope, $controller;
beforeEach(function() {
angular.mock.module('linagora.esn.seed');
angular.mock.inject(function(_$rootScope_, _$controller_) {
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
$controller = _$controller_;
});
});
function initController() {
var bindings = {},
controller = $controller('seedHomeController',
{
$scope: $scope
},
bindings);
$scope.$digest();
return controller;
}
describe('the initialization', function() {
it('should set $scope.message on init', function() {
var ctrl = initController();
expect(ctrl.message).to.equal('Seed home!');
});
});
});
@seed-sidebar-width: 25%;
.seed-home {
.flex-shorthand(1);
position: relative;
top: 47px;
height: 70vh;
.seed-main {
.seed-main-content {
.flex-shorthand(1);
margin-left: 7px;
margin-right: 7px;
.seed-module-card {
.flex-horizontal-centered;
padding: 5px 10px;
background: @m-white;
}
}
}
.seed-sidebar {
height: 100%;
border-right: 1px solid lighten(@m-gray, 0%);
width: @seed-sidebar-width;
margin-top: 15px;
.seed-sidebar-content {
.flex-horizontal-centered;
}
}
}
.seed-subheader-content {
.flex-horizontal-centered;
font-size: 1.2em;
color: @m-white;
}
@media(min-width: @screen-md-min) {
.seed-home > .seed-main {
margin-top: 15px;
}
}
.seed-home
.col-md-3.seed-sidebar.hidden-xs.ui-view(name='sidebar')
.col-xs-12.col-md-8.seed-main.no-padding-xs.ui-view(name='main')
sub-header
seed-subheader
.seed-main-content
.seed-module-card
h1 #{__('Seed module')}
.seed-sidebar-content
.card-header
h1 #{__('My sidebar')}
(function() {
'use strict';
var MODULE_NAME = 'linagora.esn.seed';
var MODULE_DIR_NAME = '/linagora.esn.seed';
angular.module(MODULE_NAME)
.component('seedSubheader', seedSubheader());
function seedSubheader() {
var component = {
templateUrl: MODULE_DIR_NAME + '/app/home/seed-subheader.html'
};
return component;
}
})();
extends /modules/subheader/responsive-subheader.pug
block left
seed-burger-button.hidden-md
span.seed-subheader-content
| #{__('Seed module')}
block right
'use strict';
var MODULE_NAME = 'linagora.esn.seed';
var MODULE_DIR_NAME = '/linagora.esn.seed';
angular.module(MODULE_NAME)
.component('seedBurgerButton', {
templateUrl: MODULE_DIR_NAME + '/app/subheader/seed-burger-button.html'
});
.seed-button(contextual-sidebar, data-content-template="/linagora.esn.seed/app/home/seed-sidebar.html")
i.mdi.mdi-menu
'use strict';
var MODULE_NAME = 'linagora.esn.seed';
var MODULE_DIR_NAME = '/linagora.esn.seed';
angular.module(MODULE_NAME)
.component('seedSubheaderButton', {
templateUrl: MODULE_DIR_NAME + '/app/subheader/seed-subheader-button.html',
bindings: {
seedDisabled: '<?',
seedClick: '&?',
seedIconClass: '@?',
seedIconText: '@?',
seedIconPosition: '@?'
},
controllerAs: 'ctrl'
});
button.btn.btn-link.seed-button(ng-click= "ctrl.seedClick()", ng-disabled= "ctrl.seedDisabled", ng-switch = "ctrl.seedIconPosition")
.seed-button-icon-and-text(ng-switch-when= "right")
span {{ ctrl.seedIconText | translate }}
i.mdi(ng-class= "ctrl.seedIconClass")
.seed-button-icon-and-text(ng-switch-default)
i.mdi(ng-class= "ctrl.seedIconClass")
span {{ ctrl.seedIconText | translate }}
\ No newline at end of file
.seed-button {
.flex-vertical-centered;
.clickable;
text-transform: uppercase;
color: @m-white;
font-size: 1.1em;
font-weight: 500;
text-align: left;
.seed-button-icon-and-text {
.flex-vertical-centered;
span {
margin-right: 5px;
margin-left: 5px;
}
}
}
......@@ -5,7 +5,7 @@ const Dependency = AwesomeModule.AwesomeModuleDependency;
const path = require('path');
const glob = require('glob-all');
const FRONTEND_JS_PATH = __dirname + '/frontend/app/';
const AWESOME_MODULE_NAME = 'linagora.esn.seed';
const AWESOME_MODULE_NAME = 'linagora.esn.custom-g2k';
const awesomeModule = new AwesomeModule(AWESOME_MODULE_NAME, {
dependencies: [
......
{
"name": "linagora.esn.seed",
"name": "linagora.esn.custom-g2k",
"version": "0.0.1",
"description": "OpenPaaS Module sample to create new ones",
"main": "index.js",
......@@ -50,7 +50,7 @@
},
"repository": {
"type": "git",
"url": "https://ci.linagora.com/linagora/lgs/openpaas/linagora.esn.seed.git"
"url": "https://ci.linagora.com/linagora/lgs/openpaas/linagora.esn.custom-g2k.git"
},
"author": "Linagora R&D",
"license": "AGPL-3.0",
......
'use strict';
const MODULE_DIR_NAME = '/linagora.esn.seed';
const MODULE_DIR_NAME = '/linagora.esn.custom-g2k';
module.exports = function(config) {
config.set({
......
......@@ -7,7 +7,7 @@ const path = require('path');
const testConfig = require('../config/servers-conf');
const basePath = path.resolve(__dirname + '/../../node_modules/linagora-rse');
const backendPath = path.normalize(__dirname + '/../../backend');
const MODULE_NAME = 'linagora.esn.seed';
const MODULE_NAME = 'linagora.esn.custom-g2k';
let rse;
before(function(done) {
......
......@@ -2,7 +2,7 @@
const request = require('supertest');
const expect = require('chai').expect;
const MODULE_NAME = 'linagora.esn.seed';
const MODULE_NAME = 'linagora.esn.custom-g2k';
describe('The example API', function() {
let user, app;
......
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 to comment