target: {
src: '<%= yeoman.client %>/index.html',
ignorePath: '<%= yeoman.client %>/',
- exclude: [/bootstrap-sass-official/, /bootstrap.js/]
+ exclude: [/bootstrap-sass-official/]
}
},
{
- "name": "ocre",
- "version": "0.0.0",
- "dependencies": {
- "angular": ">=1.2.*",
- "json3": "~3.3.1",
- "es5-shim": "~3.0.1",
- "jquery": "~1.11.0",
- "bootstrap-sass-official": "~3.1.1",
- "bootstrap": "~3.1.1",
- "angular-resource": ">=1.2.*",
- "angular-cookies": ">=1.2.*",
- "angular-sanitize": ">=1.2.*",
- "angular-bootstrap": "~0.11.0",
- "font-awesome": ">=4.1.0",
- "lodash": "~2.4.1",
- "angular-socket-io": "~0.6.0",
- "angular-ui-router": "~0.2.10"
- },
- "devDependencies": {
- "angular-mocks": ">=1.2.*",
- "angular-scenario": ">=1.2.*"
- }
+ "name": "ocre",
+ "version": "0.0.0",
+ "dependencies": {
+ "angular": ">=1.2.*",
+ "json3": "~3.3.1",
+ "es5-shim": "~3.0.1",
+ "jquery": "~1.11.0",
+ "bootstrap-sass-official": "~3.1.1",
+ "bootstrap": "~3.1.1",
+ "angular-resource": ">=1.2.*",
+ "angular-cookies": ">=1.2.*",
+ "angular-sanitize": ">=1.2.*",
+ "angular-bootstrap": "~0.11.0",
+ "font-awesome": ">=4.1.0",
+ "lodash": "~2.4.1",
+ "angular-socket-io": "~0.6.0",
+ "angular-ui-router": "~0.2.10",
+ "angular-ui-tinymce": "latest",
+ "tinymce":"4.0.0"
+ },
+ "devDependencies": {
+ "angular-mocks": ">=1.2.*",
+ "angular-scenario": ">=1.2.*"
+ },
+ "resolutions": {
+ "tinymce": "4.0.0"
+ }
}
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .controller('AboutCtrl', function ($scope) {
+ $scope.message = 'Hello';
+ });
--- /dev/null
+'use strict';
+
+describe('Controller: AboutCtrl', function () {
+
+ // load the controller's module
+ beforeEach(module('ocreApp'));
+
+ var AboutCtrl, scope;
+
+ // Initialize the controller and a mock scope
+ beforeEach(inject(function ($controller, $rootScope) {
+ scope = $rootScope.$new();
+ AboutCtrl = $controller('AboutCtrl', {
+ $scope: scope
+ });
+ }));
+
+ it('should ...', function () {
+ expect(1).toEqual(1);
+ });
+});
--- /dev/null
+<div ng-include="'components/navbar/navbar.html'"></div>
+
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <h1>
+ <i class="fa fa-info-circle fa-lg"></i> A propos d'OCRE
+ </h1>
+ <p class="lead">
+ La plate-forme citoyenne de crowdsourcing et crowdfunding.
+ </p>
+ </div>
+</header>
+
+<hr>
+<div class="container">
+ <h2>Comment ça marche ?</h2>
+ <p>
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.
+ </p>
+ <p>
+ Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.
+ </p>
+
+ <h2>Proposer un projet sur OCRE</h2>
+ <p>
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.
+ </p>
+ <h2>Qui est concerné ?</h2>
+ <p>
+ Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.
+ </p>
+ <h2>Qui peut participer ?</h2>
+ <p>
+ Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.
+ </p>
+ <h2>...</h2>
+</div>
+<div ng-include="'components/footer/footer.html'"></div>
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .config(function ($stateProvider) {
+ $stateProvider
+ .state('about', {
+ url: '/about',
+ templateUrl: 'app/about/about.html',
+ controller: 'AboutCtrl'
+ });
+ });
\ No newline at end of file
<div ng-include="'components/navbar/navbar.html'"></div>
-<div class="container" style="margin-top:50px;">
- <div class="row">
- <div class="col-sm-12">
- <h1>Login</h1>
- <p>Accounts are reset on server restart from <code>server/config/seed.js</code>. Default account is <code>test@test.com</code> / <code>test</code></p>
- <p>Admin account is <code>admin@admin.com</code> / <code>admin</code></p>
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <h1>
+ <i class="fa fa-child"></i>
+ Connexion
+ </h1>
+ <p class="lead">
+ Vous nous manquiez déjà ...
+ </p>
</div>
- <div class="col-sm-12">
- <form class="form" name="form" ng-submit="login(form)" novalidate>
-
- <div class="form-group">
- <label>Email</label>
-
- <input type="text" name="email" class="form-control" ng-model="user.email">
- </div>
-
- <div class="form-group">
- <label>Password</label>
-
- <input type="password" name="password" class="form-control" ng-model="user.password">
- </div>
-
- <div class="form-group has-error">
- <p class="help-block" ng-show="form.email.$error.required && form.password.$error.required && submitted">
- Please enter your email and password.
- </p>
- <p class="help-block">{{ errors.other }}</p>
- </div>
+</header>
- <div>
- <button class="btn btn-ochre btn-lg btn-login" type="submit">
- Login
- </button>
- <a class="btn btn-default btn-lg btn-register" href="/signup">
- Register
- </a>
+<div class="container" style="margin-top:50px;">
+ <div class="row">
+ <div class="col-md-6 col-md-offset-3">
+ <div class="page-header">
+ <h2>Se connecter</h2>
+ </div>
+ <p>Accounts are reset on server restart from <code>server/config/seed.js</code>. Default account is <code>test@test.com</code> / <code>test</code></p>
+ <p>Admin account is <code>admin@admin.com</code> / <code>admin</code></p>
+
+ <form class="form-horizontal" name="form" ng-submit="login(form)" novalidate>
+
+ <div class="form-group">
+ <label for="inputLogEmail" class="col-sm-2 control-label">E-mail</label>
+ <div class="col-sm-10">
+ <input id="inputLogEmail" type="text" name="email" class="form-control" ng-model="user.email">
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="inputLogPassword" class="col-sm-2 control-label">Mot de passe</label>
+
+ <div class="col-sm-10">
+ <input id="inputLogPassword" type="password" name="password" class="form-control" ng-model="user.password">
+ <p><a href="#">Mot de passe oublié ?</a></p>
+ </div>
+
+ <div class="form-group has-error">
+ <p class="help-block" ng-show="form.email.$error.required && form.password.$error.required && submitted">
+ Entrez votre adresse e-mail et/ou votre mot de passe.
+ </p>
+ <p class="help-block">{{ errors.other }}</p>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="col-sm-offset-2 col-sm-10">
+ <button type="submit" class="btn btn-warning">Se connecter</button>
+ ou
+ <a href="/signup" class="btn btn-default">Créer un compte</a>
+ </div>
+ </div>
+ </form>
</div>
-
-
- </form>
+ </div>
</div>
- </div>
- <hr>
-</div>
\ No newline at end of file
+
+<div ng-include="'components/footer/footer.html'"></div>
\ No newline at end of file
if(form.$valid) {
Auth.changePassword( $scope.user.oldPassword, $scope.user.newPassword )
.then( function() {
- $scope.message = 'Password successfully changed.';
+ $scope.message = 'Votre mot de passe a bien été modifié.';
})
.catch( function() {
form.password.$setValidity('mongoose', false);
- $scope.errors.other = 'Incorrect password';
+ $scope.errors.other = 'Mot de passe incorrect';
$scope.message = '';
});
}
<div class="container">
<div class="row">
<div class="col-sm-12">
- <h1>Change Password</h1>
+ <h1>Modification du Mot de passe</h1>
</div>
<div class="col-sm-12">
<form class="form" name="form" ng-submit="changePassword(form)" novalidate>
<div class="form-group">
- <label>Current Password</label>
+ <label>Mot de passe actuel</label>
<input type="password" name="password" class="form-control" ng-model="user.oldPassword"
mongoose-error/>
</div>
<div class="form-group">
- <label>New Password</label>
+ <label>Nouveau mot de passe</label>
<input type="password" name="newPassword" class="form-control" ng-model="user.newPassword"
ng-minlength="3"
required/>
<p class="help-block"
ng-show="(form.newPassword.$error.minlength || form.newPassword.$error.required) && (form.newPassword.$dirty || submitted)">
- Password must be at least 3 characters.
+ Le mot de passe doit comprendre au moins 3 lettres.
</p>
</div>
<p class="help-block"> {{ message }} </p>
- <button class="btn btn-lg btn-primary" type="submit">Save changes</button>
+ <button class="btn btn-lg btn-warning" type="submit">Enregistrer les modifications</button>
</form>
</div>
</div>
<div ng-include="'components/navbar/navbar.html'"></div>
-<div class="container" style="margin-top:50px;">
- <div class="row">
- <div class="col-sm-12">
- <h1>Sign up</h1>
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <h1>
+ <i class="fa fa-pencil"></i>
+ Inscription
+ </h1>
+ <p class="lead">
+ Bienvenue dans le monde du libre. Et merci d'avance de vouloir y contribuer en proposant des idees ou en soutenant ceux qui en ont ;)
+ </p>
</div>
- <div class="col-sm-12">
- <form class="form" name="form" ng-submit="register(form)" novalidate>
+</header>
- <div class="form-group" ng-class="{ 'has-success': form.name.$valid && submitted,
- 'has-error': form.name.$invalid && submitted }">
- <label>Name</label>
+<hr>
- <input type="text" name="name" class="form-control" ng-model="user.name"
- required/>
- <p class="help-block" ng-show="form.name.$error.required && submitted">
- A name is required
- </p>
- </div>
+<div class="container">
+ <div class="row">
+ <div class="col-md-offset-3 col-md-6">
+ <div class="page-header">
+ <h2>S'enregistrer</h2>
+ </div>
- <div class="form-group" ng-class="{ 'has-success': form.email.$valid && submitted,
- 'has-error': form.email.$invalid && submitted }">
- <label>Email</label>
+ <form class="form-horizontal" name="form" ng-submit="register(form)" novalidate>
- <input type="email" name="email" class="form-control" ng-model="user.email"
- required
- mongoose-error/>
- <p class="help-block" ng-show="form.email.$error.email && submitted">
- Doesn't look like a valid email.
- </p>
- <p class="help-block" ng-show="form.email.$error.required && submitted">
- What's your email address?
- </p>
- <p class="help-block" ng-show="form.email.$error.mongoose">
- {{ errors.email }}
- </p>
- </div>
+ <div class="form-group" ng-class="{ 'has-success': form.name.$valid && submitted,
+ 'has-error': form.name.$invalid && submitted }">
+ <label for="inputSignPseudo" class="col-sm-2 control-label">Nom</label>
+ <div class="col-sm-10">
+ <input id="inputSignPseudo" type="text" name="name" class="form-control" ng-model="user.name" required placeholder="Votre nom ou pseudo">
+ <p class="help-block" ng-show="form.name.$error.required && submitted">
+ Un nom est requis.
+ </p>
+ </div>
+ </div>
- <div class="form-group" ng-class="{ 'has-success': form.password.$valid && submitted,
- 'has-error': form.password.$invalid && submitted }">
- <label>Password</label>
+ <div class="form-group" ng-class="{ 'has-success': form.email.$valid && submitted,
+ 'has-error': form.email.$invalid && submitted }">
+ <label for="inputSignEmail" class="col-sm-2 control-label">E-mail</label>
+ <div class="col-sm-10">
+ <input id="inputSignEmail" type="email" name="email" class="form-control" ng-model="user.email" required mongoose-error>
+ <p class="help-block" ng-show="form.email.$error.email && submitted">
+ L'adresse E-mail est invalide.
+ </p>
+ <p class="help-block" ng-show="form.email.$error.required && submitted">
+ Quelle est votre adresse E-mail?
+ </p>
+ <p class="help-block" ng-show="form.email.$error.mongoose">
+ {{ errors.email }}
+ </p>
+ </div>
+ </div>
- <input type="password" name="password" class="form-control" ng-model="user.password"
- ng-minlength="3"
- required
- mongoose-error/>
- <p class="help-block"
- ng-show="(form.password.$error.minlength || form.password.$error.required) && submitted">
- Password must be at least 3 characters.
- </p>
- <p class="help-block" ng-show="form.password.$error.mongoose">
- {{ errors.password }}
- </p>
+ <div class="form-group" ng-class="{ 'has-success': form.password.$valid && submitted,
+ 'has-error': form.password.$invalid && submitted }">
+ <label for="inputSignPassword" class="col-sm-2 control-label">Mot de passe</label>
+ <div class="col-sm-10">
+ <input id="inputSignPassword" type="password" name="password" class="form-control" ng-model="user.password" ng-minlength="3" required mongoose-error/>
+ <p class="help-block" ng-show="(form.password.$error.minlength || form.password.$error.required) && submitted">
+ Le Mot de passe doit comprendre au moins 3 lettres.
+ </p>
+ <p class="help-block" ng-show="form.password.$error.mongoose">
+ {{ errors.password }}
+ </p>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="col-sm-offset-2 col-sm-10">
+ <button type="submit" class="btn btn-warning">S'enregister</button>
+ ou
+ <a href="/login" class="btn btn-default">Se connecter</a>
+ </div>
+ </div>
+ </form>
</div>
-
- <div>
- <button class="btn btn-ochre btn-lg btn-login" type="submit">
- Sign up
- </button>
- <a class="btn btn-default btn-lg btn-register" href="/login">
- Login
- </a>
- </div>
- </form>
</div>
- </div>
-</div>
\ No newline at end of file
+</div>
+
+<div ng-include="'components/footer/footer.html'"></div>
\ No newline at end of file
/* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) {
.container {
- max-width: 730px;
+ max-width: 1080px;
}
}
\ No newline at end of file
'use strict';
angular.module('ocreApp', [
- 'ngCookies',
- 'ngResource',
- 'ngSanitize',
- 'ui.bootstrap',
- 'btford.socket-io',
- 'ui.router'
+ 'ngCookies',
+ 'ngResource',
+ 'ngSanitize',
+ 'ui.bootstrap',
+ 'btford.socket-io',
+ 'ui.router',
+ 'ui.tinymce'
])
- .config(function ($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {
+.config(function ($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {
$urlRouterProvider
- .otherwise('/');
+ .otherwise('/');
$locationProvider.html5Mode(true);
$httpProvider.interceptors.push('authInterceptor');
- })
+})
- .factory('authInterceptor', function ($rootScope, $q, $cookieStore, $location) {
+.factory('authInterceptor', function ($rootScope, $q, $cookieStore, $location) {
return {
- // Add authorization token to headers
- request: function (config) {
- config.headers = config.headers || {};
- if ($cookieStore.get('token')) {
- config.headers.Authorization = 'Bearer ' + $cookieStore.get('token');
- }
- return config;
- },
+ // Add authorization token to headers
+ request: function (config) {
+ config.headers = config.headers || {};
+ if ($cookieStore.get('token')) {
+ config.headers.Authorization = 'Bearer ' + $cookieStore.get('token');
+ }
+ return config;
+ },
- // Intercept 401s and redirect you to login
- responseError: function(response) {
- if(response.status === 401) {
- $location.path('/login');
- // remove any stale tokens
- $cookieStore.remove('token');
- return $q.reject(response);
- }
- else {
- return $q.reject(response);
+ // Intercept 401s and redirect you to login
+ responseError: function(response) {
+ if(response.status === 401) {
+ $location.path('/login');
+ // remove any stale tokens
+ $cookieStore.remove('token');
+ return $q.reject(response);
+ }
+ else {
+ return $q.reject(response);
+ }
}
- }
};
- })
+})
- .run(function ($rootScope, $location, Auth) {
+.run(function ($rootScope, $location, Auth) {
// Redirect to login if route requires auth and you're not logged in
$rootScope.$on('$stateChangeStart', function (event, next) {
- if (next.authenticate && !Auth.isLoggedIn()) {
- $location.path('/login');
- }
+ if (next.authenticate && !Auth.isLoggedIn()) {
+ $location.path('/login');
+ }
});
- });
\ No newline at end of file
+});
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .controller('ContactsCtrl', function ($scope) {
+ $scope.message = 'Hello';
+ });
--- /dev/null
+'use strict';
+
+describe('Controller: ContactsCtrl', function () {
+
+ // load the controller's module
+ beforeEach(module('ocreApp'));
+
+ var ContactsCtrl, scope;
+
+ // Initialize the controller and a mock scope
+ beforeEach(inject(function ($controller, $rootScope) {
+ scope = $rootScope.$new();
+ ContactsCtrl = $controller('ContactsCtrl', {
+ $scope: scope
+ });
+ }));
+
+ it('should ...', function () {
+ expect(1).toEqual(1);
+ });
+});
--- /dev/null
+<div ng-include="'components/navbar/navbar.html'"></div>
+
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <h1>
+ <i class="fa fa-envelope"></i> Contacts
+ </h1>
+ <p class="lead">
+ Comment prendre contact avec l'équipe!
+ </p>
+ </div>
+</header>
+
+<div class="container">
+ <h2>Article en cours d'écriture...</h2>
+</div>
+
+<div ng-include="'components/footer/footer.html'"></div>
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .config(function ($stateProvider) {
+ $stateProvider
+ .state('contacts', {
+ url: '/contacts',
+ templateUrl: 'app/contacts/contacts.html',
+ controller: 'ContactsCtrl'
+ });
+ });
\ No newline at end of file
'use strict';
angular.module('ocreApp')
-.controller('MainCtrl', function ($scope, $http, $window, $location, $anchorScroll, socket) {
+.controller('MainCtrl', function ($scope, $rootScope, $http, $window, $location, $anchorScroll, socket) {
- /**
- *
- * @function setStyles
- * @description Setting styles in scope
- *
- **/
- var setStyles = function () {
-
- // Main section style
- $scope.sectionStyle = {
- marginTop : 50,
- height : $window.innerHeight
- };
-
- // Carousel style
- $scope.carouselStyle = {
- width : $scope.sectionStyle.width,
- height : $scope.sectionStyle.height * 0.85 - 50
- };
-
- // Carousel > Image style
- $scope.imgStyle = {
- width : $scope.sectionStyle.width,
- height : $scope.sectionStyle.height * 0.85 - 50
- };
-
- // Carousel banner style
- $scope.bannerStyle = {
- backgroundColor : '#cc7722',
- height : $scope.sectionStyle.height * 0.15,
- textAlign : 'center'
- };
- };
-
- // Initializing styles
- setStyles();
+ $scope.myInterval = 5000;
+ $scope.slides = [];
+ $scope.slides.push({
+ title : 'Bienvenue sur OCRE',
+ text: "L'application Open Source d'aide à la conception et au financement participatif !",
+ about : "/about"
+ });
- // Listening to window resize events
- angular.element($window).bind('resize', function() {
- // Resetting styles on resize
- setStyles();
- // Applying to scope - refresh the scope
- $scope.$apply();
+ $scope.slides.push({
+ title : 'Participez au projet OCRE!',
+ text : "Vous êtes développeur? Venez soutenir la plate-forme sur la forge!",
+ about : "https://bitbucket.org/genonin/ocre",
});
- // Initializing slides used by carousel
- var slides = $scope.slides = [];
+ $scope.projects = [];
+ $http.get('/api/projects').success(function(projects) {
+ $scope.projects = projects;
+ var j = 0;
+ var k = 0;
+ $scope.cfProjects = [];
+ $scope.csProjects = [];
+ for (var i in $scope.projects) {
+ if (j < 3) {
+ if ($scope.projects[i].state === "En financement") {
+ $scope.cfProjects.push($scope.projects[i]);
+ j++;
+ }
+ }
+
+ if (k < 3) {
+ if ($scope.projects[i].state === "En développement") {
+ $scope.csProjects.push($scope.projects[i]);
+ k++;
+ }
+ }
- // Setting carousel interval between slides
- $scope.myInterval = 5000;
+ }
+ });
- /**
- *
- * @function addSlide
- * @description Adding slide in slides array
- *
- **/
- $scope.addSlide = function() {
- slides.push({
- image: 'http://placekitten.com/1600/1200',
- text: ['More','Extra','Lots of','Surplus'][slides.length % 4] + ' ' +
- ['Cats', 'Kittys', 'Felines', 'Cutes'][slides.length % 4]
- });
- };
- // Adding 4 slides in slides array
- for (var i=0; i<4; i++) {
- $scope.addSlide();
+ $scope.convertToLocaleDate = function(date) {
+ return new Date(date).toLocaleDateString();
}
/**
* @description Scrolling to anchor position defined by route
*
**/
- $scope.scrollTo= function(route) {
+ $scope.scrollTo = function(route) {
// Getting location by id
$location.hash(route);
// Scrolling to anchor
$anchorScroll();
};
-
- $scope.projects = [];
-
- $scope.projects.push({
- title : 'Projet 1',
- author : 'Romain Monin',
- category : 'Informatique',
- informations : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam quis bibendum dui, sit amet vehicula odio. Ut dictum lobortis elementum. Donec cursus, dui in fermentum euismod, nibh nunc aliquet dui, quis elementum neque mauris sed felis. Suspendisse facilisis adipiscing felis, sed iaculis tellus molestie at. Cras euismod, nibh vitae congue ultricies, ligula justo imperdiet ante, vitae dictum ante dolor eget tellus. In cursus vehicula lorem, at tristique metus. Vestibulum vel dui accumsan, hendrerit augue eget, dignissim elit. Nullam hendrerit a elit vitae sodales. Fusce id vestibulum nulla. Nulla odio lacus, lacinia eget eleifend eget, porta sit amet justo. Sed aliquet adipiscing nulla, in luctus velit porta vel. Curabitur egestas porta nulla, eget faucibus neque consectetur quis. Mauris venenatis consectetur interdum. Fusce fermentum et erat vitae auctor. Sed quis scelerisque nisi. Vestibulum cursus libero eros, ornare dignissim mi facilisis et.',
- image : 'http://placekitten.com/200/100',
- beginningDate : 14092014,
- endingDate : 30092014,
- url : '/projet1',
- likes : 32,
- comments : 2,
- askedDonations : 20000,
- currentDonations : 11249
- });
-/* $scope.awesomeThings = [];
-
-
- $http.get('/api/things').success(function(awesomeThings) {
- $scope.awesomeThings = awesomeThings;
- socket.syncUpdates('thing', $scope.awesomeThings);
- });
+ /**
+ *
+ * @function goto
+ * @parameters String route, String projectId
+ * @description Going to route and adding projectId to rootScope
+ *
+ **/
+ $scope.goto = function(route, projectId) {
+ $rootScope.project_id = projectId;
+ $location.path(route);
- $scope.addThing = function() {
- if($scope.newThing === '') {
- return;
- }
- $http.post('/api/things', { name: $scope.newThing });
- $scope.newThing = '';
- };
+ }
- $scope.deleteThing = function(thing) {
- $http.delete('/api/things/' + thing._id);
- };
+ $scope.goto2 = function(route, profileId) {
+ $rootScope.profile_id = profileId;
+ $location.path(route);
- $scope.$on('$destroy', function () {
- socket.unsyncUpdates('thing');
- });*/
+ }
});
\ No newline at end of file
}
#banner {
+ background-color:#f0ad4e;
border-bottom: none;
margin-top: -20px;
}
}
.footer {
- text-align: center;
padding: 15px 0;
- margin-top: 70px;
+ margin-top: 25px;
border-top: 1px solid #E5E5E5;
+}
+
+.panel-fixed {
+ height: 500px;
+}
+
+.panel-fixed .description {
+ min-height: 200px;
+ max-height: 200px;
+ height: 200px;
+ overflow: hidden;
}
\ No newline at end of file
<div ng-include="'components/navbar/navbar.html'"></div>
<!--<div class="row">-->
-<div ng-style="sectionStyle">
- <carousel interval="myInterval" ng-style="carouselStyle">
- <slide ng-repeat="slide in slides" active="slide.active">
- <img ng-src="{{slide.image}}" ng-style="imgStyle">
- <div class="carousel-caption">
- </div>
- </slide>
- </carousel>
- <div class="col-md-12" ng-style="bannerStyle">
- <div class="btn btn-lg btn-warning col-md-6 col-md-offset-3" style="top:30%; height:40%;" ng-click="scrollTo('projects')">Plus de projets...</div>
- </div>
+<!--<header class="hero-unit" id="banner">
+<div class="container">
+<h1>Bienvenue sur OCRE</h1>
+<p class="lead">L'application Open Source d'aide à la conception et au financement participatif !</p>
+<a class="btn btn-default btn-lg" href="/about">En savoir plus</a>
</div>
-<!--</div>-->
+</header>-->
+
+<carousel class="hero-unit" id="banner" interval="myInterval">
+ <slide ng-repeat="slide in slides" active="slide.active">
+ <h1>{{slide.title}}</h1>
+ <p class="lead">{{slide.text}}</p>
+ <a class="btn btn-default btn-lg" href="{{slide.about}}">En savoir plus</a>
+ <div style="height:30px"></div>
+ </slide>
+</carousel>
-<div id="projects" class="container">
+<div class="container-fluid">
<div class="row">
- <div id="projects" class="col-md-12">
- <h1 class="page-header">Projets:</h1>
- <div class="col-md-3" style="height:200px;" ng-repeat="project in projects">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">{{project.title}}</h3>
- <p style="font-size:10px">Par {{project.author}}</p>
- </div>
- <div class="panel-body">
- <a href={{project.url}} class="thumbnail">
- <img src={{project.image}} alt="...">
- </a>
+ <div class="col-md-9">
+ <div class="page-header">
+ <h2>Projets populaires <span class="pull-right"><a class="btn btn-default" href="#projects">Tout afficher</a></span></h2>
+ </div>
+
+ <div class="row">
+ <div class="col-md-4" ng-repeat="cfProject in cfProjects">
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">{{cfProject.title}} <em class="pull-right">( <a href="" ng-click="goto2('user_profile', cfProject.profile_id)">{{cfProject.author}}</a> )</em></div>
+ <div class="panel-body panel-fixed">
+ <p class="text-center">
+ <img src="{{cfProject.image}}" class="img-rounded" alt="...">
+ </p>
+ <p>
+ <span ng-repeat="category in cfProject.categories">
+ <a href="#" class="label label-warning">{{category}}</a>
+ </span>
+ </p>
+ <p class="description" style="text-align:justify">
+ {{cfProject.shortDescription}}
+ </p>
+ <p class="text-right"><em><a href="" ng-click="goto('project_view', cfProject._id)">En savoir plus</a></em></p>
+ </div>
+ <div class="panel-footer">
+ <div class="progress">
+ <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="{{cfProject.currentDonations/cfProject.askedDonations*100}}" aria-valuemin="0" aria-valuemax="100" style="width: {{cfProject.currentDonations/cfProject.askedDonations*100}}%;">
+ <span class="sr-only">{{cfProject.currentDonations/cfProject.askedDonations*100}}% Complete</span>
+ </div>
+ </div>
+ <span class="pull-left"><em>Objectif : {{cfProject.currentDonations}} / {{cfProject.askedDonations}} €</em></span>
+ <span class="pull-right"><em>Fin : {{convertToLocaleDate(cfProject.endingDate)}}</em></span>
+ <div class="clearfix"></div>
+ </div>
</div>
- <div class="panel-footer">
+ </div>
+ </div>
+
+ <div class="page-header">
+ <h2>Projets en développement <span class="pull-right"><a class="btn btn-default" href="#projects">Tout afficher</a></span></h2>
+ </div>
+ <div class="row">
+ <div class="col-md-4" ng-repeat="csProject in csProjects">
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">{{csProject.title}} <em class="pull-right">( <a href="" ng-click="goto2('user_profile', csProject.profile_id)">{{csProject.author}}</a> )</em></div>
+ <div class="panel-body panel-fixed">
+ <p class="text-center">
+ <img src="{{csProject.image}}" class="img-rounded" alt="...">
+ </p>
+ <p>
+ <span ng-repeat="category in csProject.categories">
+ <a href="#" class="label label-warning">{{category}}</a>
+ </span>
+ </p>
+ <p class="description" style="text-align:justify">
+ {{csProject.shortDescription}}
+ </p>
+ <p class="text-right"><em><a href="" ng-click="goto('project_view', csProject._id)">En savoir plus</a></em></p>
+ </div>
+ <div class="panel-footer">
+ <p class="pull-left"><strong>{{csProject.ideas}} idées</strong></p>
+ <a class="btn btn-warning pull-right" href="#">Proposez la votre !</a>
+ <div class="clearfix"></div>
+ </div>
</div>
</div>
</div>
</div>
- </div>
-<!-- <form class="thing-form">
- <label>Syncs in realtime across clients</label>
- <p class="input-group">
- <input type="text" class="form-control" placeholder="Add a new thing here." ng-model="newThing">
- <span class="input-group-btn">
- <button type="submit" class="btn btn-ochre" ng-click="addThing()">Add New</button>
- </span>
- </p>
- </form>-->
-</div>
+ <div class="col-md-3">
+ <h2 class="page-header h3">Catégories</h2>
+ <p>
+ <a href="#" class="label label-warning">Default</a>
+ <a href="#" class="label label-warning">Dummy</a>
+ <a href="#" class="label label-warning">Tag</a>
+ <a href="#" class="label label-warning">Fun</a>
+ <a href="#" class="label label-warning">TooLongTagToRead</a>
+ <a href="#" class="label label-warning">Other</a>
+ </p>
+ <p class="text-center">
+ <a class="btn btn-default" href="#">Voir toutes les catégories</a>
+ </p>
-<footer class="footer">
- <div class="container">
- <p>Projet OCRE |
- <a href="https://bitbucket.org/genonin/ocre" target="_blank">Participer</a></p>
+ <h2 class="page-header h3">Rechercher</h2>
+ <form>
+ <div class="input-group">
+ <input type="text" class="form-control" placeholder="Rechercher">
+ <span class="input-group-btn">
+ <button class="btn btn-default" type="button"><i class="fa fa-search"></i></button>
+ </span>
+ </div><!-- /input-group -->
+ <a href="#" class="pull-right">Recherche avancée</a>
+ </form>
+
+ <h2 class="page-header h3">Statistiques</h2>
+ <dl class="dl-horizontal">
+ <dt>Projets</dt>
+ <dd>Deux</dd>
+ <dt>Idées</dt>
+ <dd>Plein</dd>
+ <dt>Donations</dt>
+ <dd>Vin 3 Milliards de Dollars</dd>
+ </dl>
+ </div>
</div>
-</footer>
+</div>
+
+
+<div ng-include="'components/footer/footer.html'"></div>
+
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .controller('MentionsCtrl', function ($scope) {
+ $scope.message = 'Hello';
+ });
--- /dev/null
+'use strict';
+
+describe('Controller: MentionsCtrl', function () {
+
+ // load the controller's module
+ beforeEach(module('ocreApp'));
+
+ var MentionsCtrl, scope;
+
+ // Initialize the controller and a mock scope
+ beforeEach(inject(function ($controller, $rootScope) {
+ scope = $rootScope.$new();
+ MentionsCtrl = $controller('MentionsCtrl', {
+ $scope: scope
+ });
+ }));
+
+ it('should ...', function () {
+ expect(1).toEqual(1);
+ });
+});
--- /dev/null
+<div ng-include="'components/navbar/navbar.html'"></div>
+
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <h1>
+ <i class="fa fa-suitcase"></i> Mentions légales
+ </h1>
+ </div>
+</header>
+
+<div class="container">
+ <h2>Article en cours d'écriture...</h2>
+</div>
+
+<div ng-include="'components/footer/footer.html'"></div>
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .config(function ($stateProvider) {
+ $stateProvider
+ .state('mentions', {
+ url: '/mentions',
+ templateUrl: 'app/mentions/mentions.html',
+ controller: 'MentionsCtrl'
+ });
+ });
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+.controller('ProjectCreateCtrl', function ($scope, $rootScope, $http, $location, socket, User) {
+ $scope.currentUser = User.get();
+/* $http.get('/api/projects').success(function(projects) {
+ for (var i in projects) {
+ $http.delete('/api/projects/' + projects[i]._id);
+ }
+ });*/
+
+ $scope.project = {
+ user_id : '',
+ profile_id : '',
+ title : '',
+ author : '',
+ state : '',
+ categories : [],
+ shortDescription : '',
+ content : '',
+ image : '',
+ beginningDate : "",
+ endingDate : "",
+ url : '',
+ likes : 0,
+ dislikes : 0,
+ comments : 0,
+ askedDonations : 0,
+ currentDonations : 0,
+ details : '',
+ };
+
+ $scope.states = [
+ 'En financement',
+ 'En développement'
+ ]
+
+ $scope.categories = [
+ "Informatique",
+ "Musique",
+ "Sports",
+ "Autre"
+ ]
+
+ $scope.tinymceOptions = {
+ plugins: "image",
+ paste_data_images: true
+ }
+
+ $scope.toggleMin = function() {
+ $scope.minDate = $scope.minDate ? null : new Date();
+ };
+ $scope.toggleMin();
+
+ $scope.launchProject = function () {
+ $scope.project.user_id = $scope.currentUser._id;
+ $scope.project.profile_id = $scope.currentUser.profile_id;
+ $scope.project.author = $scope.currentUser.name;
+ $scope.project.beginningDate = new Date();
+
+ $http.post('/api/projects', $scope.project).success(function(project) {
+ $rootScope.project_id = project._id;
+ $location.path('project_view');
+ });
+
+ }
+});
--- /dev/null
+'use strict';
+
+describe('Controller: ProjectCreateCtrl', function () {
+
+ // load the controller's module
+ beforeEach(module('ocreApp'));
+
+ var ProjectCreateCtrl, scope;
+
+ // Initialize the controller and a mock scope
+ beforeEach(inject(function ($controller, $rootScope) {
+ scope = $rootScope.$new();
+ ProjectCreateCtrl = $controller('ProjectCreateCtrl', {
+ $scope: scope
+ });
+ }));
+
+ it('should ...', function () {
+ expect(1).toEqual(1);
+ });
+});
--- /dev/null
+<div ng-include="'components/navbar/navbar.html'"></div>
+
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <h1>
+ <i class="fa fa-space-shuttle fa-2x"></i>
+ <br>
+ Lancement d'un projet
+ </h1>
+ <p class="lead">
+ Parce que vous voulez concrétiser un projet qui vous tiens a coeur mais vous n'avez pas le financement.<br>
+ Cette page est faite pour vous !
+ </p>
+ </div>
+</header>
+
+<hr>
+
+<div class="container">
+
+ <form class="form-horizontal" role="form">
+ <div class="form-group">
+ <label for="inputTitle" class="col-sm-2 control-label">Intitulé</label>
+ <div class="col-sm-10">
+ <input type="text" class="form-control" id="inputTitle" ng-model="project.title">
+ <p class="help-block">Le nom officiel de votre projet.</p>
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="inputShortDescription" class="col-sm-2 control-label">Description rapide</label>
+ <div class="col-sm-10">
+ <textarea maxlength="200" class="form-control" id="inputShortDescription" ng-model="project.shortDescription" rows="4"></textarea>
+ <p class="help-block">200 caractères max.</p>
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="inputImage" class="col-sm-2 control-label">Image</label>
+ <div class="col-sm-10">
+ <input type="text" class="form-control" id="inputImage" ng-model="project.image">
+ <p class="help-block">Taille maximale 300x200 pixels.</p>
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="status" class="col-sm-2 control-label">Statut</label>
+ <div class="col-sm-10">
+ <select class="form-control" ng-model="project.state">
+ <option ng-repeat="state in states">{{state}}</option>
+ </select>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-sm-2 control-label">Catégories</label>
+ <div class="col-sm-10">
+ <select multiple class="form-control" ng-model="project.categories">
+ <option ng-repeat="category in categories">{{category}}</option>
+ </select>
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="content" class="col-sm-2 control-label">Présentation de votre projet</label>
+ <div class="col-sm-10">
+ <p class="help-block"><strong>NB :</strong> Vous pouvez éditer la description plus tard.</p>
+ <textarea ui-tinymce="tinymceOptions" class="form-control" ng-model="project.content" rows="25"></textarea>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label for="inputBudget" class="col-sm-2 control-label">Budget</label>
+ <div class="col-sm-10">
+ <div class="input-group">
+ <input type="text" class="form-control" ng-model="project.askedDonations">
+ <span class="input-group-addon"><i class="fa fa-eur"></i></span>
+ </div>
+ <p class="help-block">Le budget peut être une simple estimation au départ.</p>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label for="inputEndingDate" class="col-sm-2 control-label">Date de fin</label>
+ <div class="col-sm-10">
+ <div style="display:inline-block; min-height:290px;">
+ <datepicker ng-model="project.endingDate" min-date="minDate" show-weeks="true" class="well well-sm"></datepicker>
+ </div>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="col-sm-offset-2 col-sm-10">
+ <button type="submit" class="btn btn-warning" ng-click="launchProject()">Lancement !</button>
+ </div>
+ </div>
+ </form>
+</div>
+
+<div ng-include="'components/footer/footer.html'"></div>
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .config(function ($stateProvider) {
+ $stateProvider
+ .state('project_create', {
+ url: '/project_create',
+ templateUrl: 'app/project_create/project_create.html',
+ controller: 'ProjectCreateCtrl'
+ });
+ });
\ No newline at end of file
--- /dev/null
+<div class="row" ng-show="isOwner">
+ <div class="col-md-12" style="height:30px;">
+ <span class="pull-right">
+ <a data-toggle="modal" data-target="#editBlog_Modal">
+ <i class="fa fa-edit fa-lg"></i> Modifier
+ </a>
+ </span>
+ </div>
+</div>
+
+<div class="row">
+ <div class="col-md-12" ng-bind-html="blog.content">
+ </div>
+</div>
+
+<!-- Modal -->
+<div class="modal fade" id="editBlog_Modal" tabindex="-1" role="dialog" aria-labelledby="editPresentation_ModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <h4 class="modal-title" id="myModalLabel">Ajoutez des news</h4>
+ </div>
+ <div class="modal-body">
+ <form novalidate role="form">
+ <div class="form-group">
+ <label for="description">Votre blog</label>
+ <textarea ui-tinymce class="form-control" rows="25" ng-model="blog.content"></textarea>
+ </div>
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-warning" data-dismiss="modal" ng-click="save('blog')">Enregistrer</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+<div class="list-group" ng-repeat="comment in comments | orderBy:-date:false">
+ <span class="list-group-item">
+ <h4 class="list-group-item-heading">{{comment.content}}<small class="pull-right">{{comment.date}}</small></h4>
+ <p class="list-group-item-text">par {{comment.author}}</p>
+ </span>
+</div>
+<hr>
+<p>
+ <button class="btn btn-warning" ng-click="toggleCommentForm()" ng-hide="displayCommentForm">Ajouter un commentaire</button>
+</p>
+
+<div>
+ <form novalidate role="form" ng-show="displayCommentForm">
+ <div class="form-group">
+ <label for="title">Commenter :</label>
+ <input type="text" class="form-control" placeholder="Commentaire" ng-model="comment.content">
+ </div>
+ <button class="btn btn-warning" ng-click="addComment()">Enregistrer</button>
+ </form>
+</div>
\ No newline at end of file
--- /dev/null
+<div class="row">
+ <div class="col-md-12" style="height:30px;">
+ <span class="pull-left text-muted">
+ <em>
+ <a href="" ng-click="goto('user_profile', project.profile_id)">{{project.author}}
+ </a>
+ </em>
+ - {{convertToLocaleDate(project.beginningDate)}} -
+
+ </span>
+ <span>
+
+ <i class="fa fa-lightbulb-o"></i> {{project.ideas}}
+ -
+ <i class="fa fa-comment"></i> {{project.comments}}
+ </span>
+ <span class="label label-success">{{project.state}}</span>
+ <span class="pull-right" ng-show="isOwner">
+ <a data-toggle="modal" data-target="#editPresentation_Modal">
+ <i class="fa fa-edit fa-lg"></i> Modifier
+ </a>
+ </span>
+ </div>
+ <div class="col-md-6">
+ <hr>
+ <div ng-show="project.state === 'En financement'">
+ <div class="progress">
+ <div ng-show=" project.askedDonations > project.currentDonations">
+ <div class="progress-bar progress-bar-warning" role="progressbar" style="width: {{project.currentDonations/project.askedDonations*100}}%;">
+ {{Math.round(project.currentDonations/project.askedDonations*100)}}%
+ </div>
+ </div>
+ <div ng-show="project.currentDonations > project.askedDonations">
+ <div class="progress-bar progress-bar-warning" role="progressbar" style="width: {{project.askedDonations/project.currentDonations*100}}%;">
+ 100%
+ </div>
+ <div class="progress-bar progress-bar-success" role="progressbar" style="width: {{(project.currentDonations - project.askedDonations)/project.currentDonations*100}}%;">
+ {{Math.round(project.currentDonations/project.askedDonations*100)}}%
+ </div>
+ </div>
+ </div>
+ <p><em><b>Objectif</b> : {{project.currentDonations}} / {{project.askedDonations}} €</em>
+ <em class="pull-right text-muted"><b>Fin</b> : {{convertToLocaleDate(project.endingDate)}}</em></p>
+ </div>
+ <div ng-show="project.state !== 'En financement'">
+ <div class="progress">
+ </div>
+ <p><strong>Estimation :</strong>
+ {{project.askedDonations}} €
+ </p>
+ </div>
+ <hr>
+
+ <div ng-show="project.state !== 'Abandon'">
+ <div class="pull-left">
+ <button class="btn btn-success">
+ <i class="fa fa-thumbs-up"></i>
+ </button>
+ </div>
+ <div class="pull-right">
+ <button class="btn btn-danger">
+ <i class="fa fa-thumbs-down"></i>
+ </button>
+ </div>
+ </div>
+ <div ng-show="project.state === 'Abandon'">
+ <div class="pull-left">
+ <button class="btn btn-success disabled">
+ <i class="fa fa-thumbs-up"></i>
+ </button>
+ </div>
+ <div class="pull-right">
+ <button class="btn btn-danger disabled">
+ <i class="fa fa-thumbs-down"></i>
+ </button>
+ </div>
+ </div>
+
+ <div class="center-block" style="width:70%; padding-top:6px;">
+ <div class="progress ">
+ <div class="progress-bar progress-bar-success" style="width: {{project.likes / (project.likes + project.dislikes) * 100}}%">
+ {{project.likes}}
+ </div>
+ <div class="progress-bar progress-bar-danger" style="width: {{project.dislikes / (project.likes + project.dislikes) * 100}}%">
+ {{project.dislikes}}
+ </div>
+ </div>
+ </div>
+ <hr>
+ <p>
+ <span ng-repeat="category in project.categories">
+ <a href="#" class="label label-warning">{{category}}</a>
+ </span>
+ </p>
+ </div>
+ <div class="col-md-6">
+ <a href="#" class="thumbnail">
+ <img src="{{project.image}}">
+ </a>
+ </div>
+</div>
+<div class="row">
+ <div class="col-md-12" ng-bind-html="project.content">
+ </div>
+</div>
+
+<!-- Modal -->
+<div class="modal fade" id="editPresentation_Modal" tabindex="-1" role="dialog" aria-labelledby="editPresentation_ModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <h4 class="modal-title" id="myModalLabel">Modifiez votre présentation</h4>
+ </div>
+ <div class="modal-body">
+ <form novalidate role="form">
+ <div class="form-group">
+ <label for="title">Titre</label>
+ <input type="text" class="form-control" placeholder="Titre" ng-model="project.title">
+ </div>
+ <div class="form-group">
+ <label for="description">Description (200 caractères max.)</label>
+ <textarea class="form-control" rows="2" maxlength="200" ng-model="project.shortDescription"></textarea>
+ </div>
+ <div class="form-group">
+ <label for="inputImage">Image</label>
+ <input type="file" id="inputImage" ng-model="project.image">
+ <p class="help-block">Taille maximale 300x200 pixels. {{project.image}}</p>
+ </div>
+ <div class="form-group">
+ <label for="description">Catégories</label>
+ <select multiple class="form-control" ng-model="project.categories">
+ <option ng-repeat="category in categories">{{category}}</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="description">Statut</label>
+ <select class="form-control" ng-model="project.state">
+ <option ng-repeat="state in states">{{state}}</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="description">Présentation de votre projet</label>
+ <textarea ui-tinymce="tinymceOptions" class="form-control" rows="5" ng-model="project.content"></textarea>
+ </div>
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-warning" data-dismiss="modal" ng-click="save('presentation')">Enregistrer</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+<div>
+ <accordion close-others="oneAtATime">
+ <accordion-group heading="Ici, le titre de votre idée!" is-open="status.isFirstOpen" is-disabled="status.isFirstDisabled">
+ Et là , votre description! Essayez!
+ </accordion-group>
+ <accordion-group heading="{{idea.title}}" ng-repeat="idea in ideas">
+ <div ng-bind-html="idea.description"></div>
+ </accordion-group>
+ </accordion>
+</div>
+
+<!-- Button trigger modal -->
+<button class="btn btn-warning btn-lg" data-toggle="modal" data-target="#sb_Modal">
+ <i class="fa fa-plus"></i>
+</button>
+
+<!-- Modal -->
+<div class="modal fade" id="sb_Modal" tabindex="-1" role="dialog" aria-labelledby="sb_ModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <h4 class="modal-title" id="myModalLabel"><i class="fa fa-lightbulb-o"></i> Proposez votre idée!</h4>
+ </div>
+ <div class="modal-body">
+ <form novalidate role="form">
+ <div class="form-group">
+ <label for="title">Titre</label>
+ <input type="text" class="form-control" placeholder="Titre" ng-model="idea.title">
+ </div>
+ <div class="form-group">
+ <label for="description">Description</label>
+ <textarea ui-tinymce="tinymceOptions" class="form-control" rows="3" ng-model="idea.description"></textarea>
+ </div>
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-warning" data-dismiss="modal" ng-click="save('idea')">Enregistrer</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+.controller('ProjectViewCtrl', function ($scope, $rootScope, $window, $modal, $http, User) {
+
+ $scope.currentUser = User.get();
+ $scope.isOwner = true;
+ console.log($scope.currentUser);
+
+ $scope.displayCommentForm = false;
+ $scope.project = {};
+ $scope.Math = window.Math;
+
+ $scope.comment = {
+ content : "",
+ //author : userId,
+ date : ""
+ }
+
+ $scope.tinymceOptions = {
+ plugins: "image",
+ paste_data_images: true
+ }
+
+ $scope.categories = [
+ "Informatique",
+ "Musique",
+ "Sports",
+ "Autre"
+ ]
+
+ $scope.states = [
+ 'En financement',
+ 'En développement',
+ 'Abandon'
+ ]
+
+ $scope.blog = {
+ id : 'IHR329',
+ user_id : '98239824',
+ project_id : '893DJQD3',
+ content : ''
+ }
+
+ if (typeof $rootScope.project_id !== 'undefined') {
+ $http.get('/api/projects/' + $rootScope.project_id).success(function(project) {
+ $scope.project = project;
+ console.log(project);
+
+ if ($scope.project.state !== 'En développement') {
+ $scope.tabs[2].disabled = true;
+ }
+ });
+ } else {
+ $http.get('/api/projects').success(function(projects) {
+ $scope.project = projects[0];
+
+ if ($scope.project.state !== 'En développement') {
+ $scope.tabs[2].disabled = true;
+ }
+ });
+ }
+
+ $scope.oneAtATime = true;
+ $scope.ideas = [];
+
+ $scope.comments = [
+ {
+ author : 'Jean GENOT',
+ content : "C'est trop bien",
+ date : "17/9/2014 22:54:15",
+ },
+ {
+ author : 'Luc DEBENE',
+ content : 'Cool!',
+ date : "17/9/2014 22:54:13",
+ }
+ ];
+
+ $scope.tabs = [
+ { title:'Présentation', name:'presentation', content : 'app/project_view/navtabs_fragments/project_view_presentation.html' },
+ { title:'Blog', name:'blog', content: 'app/project_view/navtabs_fragments/project_view_blog.html' },
+ { title:'Boîte à idées', name:'suggestionbox', content:'app/project_view/navtabs_fragments/project_view_suggestionbox.html', disabled: false },
+ { title:'Commentaires', name:'comments', content:'app/project_view/navtabs_fragments/project_view_comments.html'}
+ ];
+
+ $scope.give = function () {
+ confirm("Tu veux vraiment donner ça?");
+ }
+
+ $scope.display = function (option) {
+ angular.forEach($scope.tabs, function(tab) {
+ if ((tab.name === option) && (tab.disabled != true)) {
+ tab.active = true;
+ }
+ });
+ }
+
+ $scope.save = function(option) {
+ switch (option) {
+ case 'idea' :
+ $scope.ideas.push(angular.copy($scope.idea));
+ case 'presentation' :
+ //$scope.project = angular.copy($scope.project);
+ if ($scope.project.state !== 'En développement') {
+ $scope.tabs[2].disabled = true;
+ }
+ }
+
+ };
+
+ $scope.toggleCommentForm = function () {
+ $scope.displayCommentForm = !$scope.displayCommentForm;
+ }
+
+ $scope.addComment = function() {
+ var d = new Date();
+ var date = d.toLocaleDateString() +" "+ d.toLocaleTimeString();
+ $scope.comment.date = date;
+ $scope.comments.push($scope.comment);
+ $scope.comment = {
+ content : "",
+ //author : userId,
+ date : ""
+ };
+ }
+
+ $scope.convertToLocaleDate = function(date) {
+ return new Date(date).toLocaleDateString();
+ }
+
+ var interval = setInterval(function () {
+ if (typeof $scope.currentUser.profile_id !== 'undefined') {
+/* console.log($scope.project.profile_id);
+ console.log($scope.currentUser.profile_id);*/
+ if ($scope.currentUser.profile_id === $scope.project.profile_id) {
+ $scope.isOwner = true;
+ } else {
+ $scope.isOwner = false;
+ }
+ }
+ }, 300);
+});
\ No newline at end of file
--- /dev/null
+'use strict';
+
+describe('Controller: ProjectViewCtrl', function () {
+
+ // load the controller's module
+ beforeEach(module('ocreApp'));
+
+ var ProjectViewCtrl, scope;
+
+ // Initialize the controller and a mock scope
+ beforeEach(inject(function ($controller, $rootScope) {
+ scope = $rootScope.$new();
+ ProjectViewCtrl = $controller('ProjectViewCtrl', {
+ $scope: scope
+ });
+ }));
+
+ it('should ...', function () {
+ expect(1).toEqual(1);
+ });
+});
--- /dev/null
+<div ng-include="'components/navbar/navbar.html'"></div>
+
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <div class="col-md-9" style="text-align:justify">
+ <h1><i class="fa fa-clipboard"></i> {{project.title}}</h1>
+ <p class="lead">{{project.shortDescription}}</p>
+ </div>
+ <div class="col-md-3 thumbnail">
+ <img src="{{project.image}}">
+ </div>
+ </div>
+</header>
+<hr>
+<div class="container">
+ <div class="row">
+ <div class="col-md-8">
+ <tabset type="pills">
+ <tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disabled="tab.disabled">
+ <hr>
+ <div class="well">
+ <ng-include src="tab.content"></ng-include>
+ </div>
+ </tab>
+ </tabset>
+ </div>
+ <div class="col-md-4">
+ <div class="panel panel-warning" ng-show="project.state === 'En financement'">
+ <div class="panel-heading">
+ <i class="fa fa-eur"></i> Faites un don
+ </div>
+ <div class="panel-body">
+ <form>
+ <div class="input-group">
+ <input type="text" class="form-control">
+ <span class="input-group-addon">€</span>
+ <span class="input-group-btn">
+ <button class="btn btn-default" type="button" ng-click="give()">Go!</button>
+ </span>
+ </div>
+ </form>
+ <hr>
+ <div class="progress">
+ <div ng-show=" project.askedDonations > project.currentDonations">
+ <div class="progress-bar progress-bar-warning" role="progressbar" style="width: {{project.currentDonations/project.askedDonations*100}}%;">
+ {{Math.round(project.currentDonations/project.askedDonations*100)}}%
+ </div>
+ </div>
+ <div ng-show="project.currentDonations > project.askedDonations">
+ <div class="progress-bar progress-bar-warning" role="progressbar" style="width: {{project.askedDonations/project.currentDonations*100}}%;">
+ 100%
+ </div>
+ <div class="progress-bar progress-bar-success" role="progressbar" style="width: {{(project.currentDonations - project.askedDonations)/project.currentDonations*100}}%;">
+ {{Math.round(project.currentDonations/project.askedDonations*100)}}%
+ </div>
+ </div>
+ </div>
+ <p><em><b>Objectif</b> : {{project.currentDonations}} / {{project.askedDonations}} €</em></p>
+ <p><em><b>Fin</b> : {{convertToLocaleDate(project.endingDate)}}</em></p>
+ </div>
+ </div>
+
+ <div class="panel panel-warning" ng-show="project.state === 'En financement'">
+ <!-- Default panel contents -->
+ <div class="panel-heading">
+ <i class="fa fa-users"></i> Liste des donateurs
+ </div>
+ <!-- List group -->
+ <div class="list-group">
+ <a href="#" class="list-group-item">Jean GENOT <span class="badge">50</span></a>
+ <a href="#" class="list-group-item">Romain MONIN<span class="badge">45</span></a>
+ <a href="#" class="list-group-item">Luc DEBENE <span class="badge">30</span></a>
+ </div>
+ </div>
+
+ <div class="panel panel-warning" ng-show="project.state === 'En développement'">
+ <div class="panel-heading">
+ <i class="fa fa-inbox"></i> Envoyez-moi vos idées!
+ </div>
+ <div class="panel-body" ng-click="display('suggestionbox')">
+ <div align="center">
+ <i class="fa fa-lightbulb-o fa-spin fa-5x"></i>
+ </div>
+ </div>
+ </div>
+
+ <div class="panel panel-info">
+ <!-- Default panel contents -->
+ <div class="panel-heading">
+ <i class="fa fa-star"></i> Objectifs
+ <span class="pull-right" ng-show="isOwner">
+ <a data-toggle="modal" data-target="#editObjectives_Modal">
+ <i class="fa fa-edit fa-lg"></i> Modifier
+ </a>
+ </span>
+ </div>
+ <!-- <div class="panel-body">
+<p>Les paliers suivants permettent de débloquer : </p>
+</div> -->
+ <ul class="list-group">
+ <li class="list-group-item success">
+ <p><span class="h4">Un palier de fou</span> <em>( <span class="text-warning">500 €</span> )</em></p>
+ <p>Lorem ipsum dolor isset.</p>
+ </li>
+ <li class="list-group-item bg-warning">
+ Dapibus ac facilisis in
+ </li>
+ <li class="list-group-item">
+ Morbi leo risus
+ </li>
+ <li class="list-group-item">
+ Porta ac consectetur ac
+ </li>
+ <li class="list-group-item">
+ Vestibulum at eros
+ </li>
+ </ul>
+ <!-- Table -->
+ <!-- <table class="table">
+ <thead>
+ <tr>
+ <th>Palier</th>
+ <th>Nom</th>
+ <th>Montant</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td>1</td>
+ <td>John</td>
+ <td>Carter</td>
+ </tr>
+
+ <tr>
+ <td>2</td>
+ <td>John</td>
+ <td>Carter</td>
+ </tr>
+
+ <tr>
+ <td>3</td>
+ <td>John</td>
+ <td>Carter</td>
+ </tr>
+ </tbody>
+ </table> -->
+ </div>
+
+ <!-- Modal -->
+ <div class="modal fade" id="editObjectives_Modal" tabindex="-1" role="dialog" aria-labelledby="editObjectives_ModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <h4 class="modal-title" id="myModalLabel">Modification des objectifs</h4>
+ </div>
+ <div class="modal-body">
+ ...
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-warning" data-dismiss="modal" ng-click="save('objectives')">Enregistrer</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="panel panel-info">
+ <!-- Default panel contents -->
+ <div class="panel-heading">
+ <i class="fa fa-gift"></i> Contreparties
+ <span class="pull-right" ng-show="isOwner">
+ <a data-toggle="modal" data-target="#editGifts_Modal">
+ <i class="fa fa-edit fa-lg"></i> Modifier
+ </a>
+ </span>
+ </div>
+ <!-- <div class="panel-body">
+<p>Les paliers suivants permettent de débloquer : </p>
+</div> -->
+ <ul class="list-group">
+ <li class="list-group-item success">
+ <p><span class="h4">Une super contrepartie</span> <em>( <span class="text-warning">5 €</span> )</em></p>
+ <p>Lorem ipsum dolor isset.</p>
+ <p class="text-muted"><em>Ilimite</em></p>
+ </li>
+ <li class="list-group-item bg-warning">
+ <p><span class="h4">Une contrepartie encore mieux</span> <em>( <span class="text-warning">10 €</span> )</em></p>
+ <p>Lorem ipsum dolor isset.</p>
+ <p class="text-muted"><em>15 restants</em></p>
+ </li>
+ <li class="list-group-item">
+ Morbi leo risus
+ </li>
+ <li class="list-group-item">
+ Porta ac consectetur ac
+ </li>
+ <li class="list-group-item">
+ Vestibulum at eros
+ </li>
+ </ul>
+ <!-- Table -->
+ <!-- <table class="table">
+ <thead>
+ <tr>
+ <th>Palier</th>
+ <th>Nom</th>
+ <th>Montant</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td>1</td>
+ <td>John</td>
+ <td>Carter</td>
+ </tr>
+
+ <tr>
+ <td>2</td>
+ <td>John</td>
+ <td>Carter</td>
+ </tr>
+
+ <tr>
+ <td>3</td>
+ <td>John</td>
+ <td>Carter</td>
+ </tr>
+ </tbody>
+ </table> -->
+ </div>
+
+ <!-- Modal -->
+ <div class="modal fade" id="editGifts_Modal" tabindex="-1" role="dialog" aria-labelledby="editGifts_ModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <h4 class="modal-title" id="myModalLabel">Modification des contreparties</h4>
+ </div>
+ <div class="modal-body">
+ ...
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-warning" data-dismiss="modal" ng-click="save('gifts')">Enregistrer</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
+</div>
+
+<div ng-include="'components/footer/footer.html'"></div>
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .config(function ($stateProvider) {
+ $stateProvider
+ .state('project_view', {
+ url: '/project_view',
+ templateUrl: 'app/project_view/project_view.html',
+ controller: 'ProjectViewCtrl'
+ });
+ });
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+.controller('ProjectsCtrl', function ($scope, $rootScope, $location, $http) {
+
+ $scope.projects = [];
+ $http.get('/api/projects').success(function(projects) {
+ $scope.projects = projects;
+ $scope.cfProjects = [];
+ $scope.csProjects = [];
+ for (var i in $scope.projects) {
+ if ($scope.projects[i].state === "En financement") {
+ $scope.cfProjects.push($scope.projects[i]);
+ }
+
+ if ($scope.projects[i].state === "En développement") {
+ $scope.csProjects.push($scope.projects[i]);
+ }
+ }
+ });
+
+
+ $scope.convertToLocaleDate = function(date) {
+ return new Date(date).toLocaleDateString();
+ }
+
+ /**
+ *
+ * @function goto
+ * @parameters String route, String projectId
+ * @description Going to route and adding projectId to rootScope
+ *
+ **/
+ $scope.goto = function(route, projectId) {
+ $rootScope.project_id = projectId;
+ $location.path(route);
+
+ }
+
+ /**
+ *
+ * @function goto2
+ * @parameters String route, String profileId
+ * @description Going to route and adding profileId to rootScope
+ *
+ **/
+ $scope.goto2 = function(route, profileId) {
+ $rootScope.profile_id = profileId;
+ $location.path(route);
+ }
+});
--- /dev/null
+'use strict';
+
+describe('Controller: ProjectsCtrl', function () {
+
+ // load the controller's module
+ beforeEach(module('ocreApp'));
+
+ var ProjectsCtrl, scope;
+
+ // Initialize the controller and a mock scope
+ beforeEach(inject(function ($controller, $rootScope) {
+ scope = $rootScope.$new();
+ ProjectsCtrl = $controller('ProjectsCtrl', {
+ $scope: scope
+ });
+ }));
+
+ it('should ...', function () {
+ expect(1).toEqual(1);
+ });
+});
--- /dev/null
+<div ng-include="'components/navbar/navbar.html'"></div>
+
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <h1>
+ <i class="fa fa-folder"></i> Liste des projets
+ </h1>
+ <p class="lead">
+ Collection des projets OCRE.
+ </p>
+ </div>
+</header>
+<hr>
+
+<div class="container">
+
+ <form class="form-inline" role="form">
+ <fieldset>
+ <legend>Filtre de recherche</legend>
+ <div class="form-group">
+ <label class="sr-only" for="exampleInputEmail2">Mot clé</label>
+ <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Mot clé">
+ </div>
+ <div class="checkbox">
+ <label>
+ <input type="checkbox"> Terminés
+ </label>
+ </div>
+ <div class="checkbox">
+ <label>
+ <input type="checkbox"> En financement
+ </label>
+ </div>
+ <div class="checkbox">
+ <label>
+ <input type="checkbox"> En développement
+ </label>
+ </div>
+ <div class="checkbox">
+ <label>
+ <input type="checkbox"> Abandonnés
+ </label>
+ </div>
+ <div class="pull-right">
+ <button type="submit" class="btn btn-default">Go !</button>
+ </div>
+ </fieldset>
+ </form>
+
+ <hr>
+ <div class="text-center">
+ <ul class="pagination">
+ <li class="disabled"><a href="#">«</a></li>
+ <li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
+ <li><a href="#">2</a></li>
+ <li><a href="#">3</a></li>
+ <li><a href="#">4</a></li>
+ <li><a href="#">5</a></li>
+ <li><a href="#">»</a></li>
+ </ul>
+ </div>
+
+ <div class="row">
+ <div class="col-md-4" ng-repeat="cfProject in cfProjects">
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">{{cfProject.title}} <em class="pull-right">( <a href="" ng-click="goto2('user_profile', cfProject.profile_id)">{{cfProject.author}}</a> )</em></div>
+ <div class="panel-body panel-fixed">
+ <p class="text-center">
+ <img src="{{cfProject.image}}" class="img-rounded" alt="...">
+ </p>
+ <p>
+ <span ng-repeat="category in cfProject.categories">
+ <a href="#" class="label label-warning">{{category}}</a>
+ </span>
+ </p>
+ <p class="description" style="text-align:justify">
+ {{cfProject.shortDescription}}
+ </p>
+ <p class="text-right"><em><a href="" ng-click="goto('project_view', cfProject._id)">En savoir plus</a></em></p>
+ </div>
+ <div class="panel-footer">
+ <div class="progress">
+ <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="{{cfProject.currentDonations/cfProject.askedDonations*100}}" aria-valuemin="0" aria-valuemax="100" style="width: {{cfProject.currentDonations/cfProject.askedDonations*100}}%;">
+ <span class="sr-only">{{cfProject.currentDonations/cfProject.askedDonations*100}}% Complete</span>
+ </div>
+ </div>
+ <span class="pull-left"><em>Objectif : {{cfProject.currentDonations}} / {{cfProject.askedDonations}} €</em></span>
+ <span class="pull-right"><em>Fin : {{convertToLocaleDate(cfProject.endingDate)}}</em></span>
+ <div class="clearfix"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="col-md-4" ng-repeat="csProject in csProjects">
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">{{csProject.title}} <em class="pull-right">( <a href="" ng-click="goto2('user_profile', csProject.profile_id)">{{csProject.author}}</a> )</em></div>
+ <div class="panel-body panel-fixed">
+ <p class="text-center">
+ <img src="{{csProject.image}}" class="img-rounded" alt="...">
+ </p>
+ <p>
+ <span ng-repeat="category in csProject.categories">
+ <a href="#" class="label label-warning">{{category}}</a>
+ </span>
+ </p>
+ <p class="description" style="text-align:justify">
+ {{csProject.shortDescription}}
+ </p>
+ <p class="text-right"><em><a href="" ng-click="goto('project_view', csProject._id)">En savoir plus</a></em></p>
+ </div>
+ <div class="panel-footer">
+ <p class="pull-left"><strong>{{csProject.ideas}} idées</strong></p>
+ <a class="btn btn-warning pull-right" href="#">Proposez la votre !</a>
+ <div class="clearfix"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+ <div class="text-center">
+ <ul class="pagination">
+ <li class="disabled"><a href="#">«</a></li>
+ <li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
+ <li><a href="#">2</a></li>
+ <li><a href="#">3</a></li>
+ <li><a href="#">4</a></li>
+ <li><a href="#">5</a></li>
+ <li><a href="#">»</a></li>
+ </ul>
+ </div>
+</div>
+
+<div ng-include="'components/footer/footer.html'"></div>
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .config(function ($stateProvider) {
+ $stateProvider
+ .state('projects', {
+ url: '/projects',
+ templateUrl: 'app/projects/projects.html',
+ controller: 'ProjectsCtrl'
+ });
+ });
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .controller('RulesCtrl', function ($scope) {
+ $scope.message = 'Hello';
+ });
--- /dev/null
+'use strict';
+
+describe('Controller: RulesCtrl', function () {
+
+ // load the controller's module
+ beforeEach(module('ocreApp'));
+
+ var RulesCtrl, scope;
+
+ // Initialize the controller and a mock scope
+ beforeEach(inject(function ($controller, $rootScope) {
+ scope = $rootScope.$new();
+ RulesCtrl = $controller('RulesCtrl', {
+ $scope: scope
+ });
+ }));
+
+ it('should ...', function () {
+ expect(1).toEqual(1);
+ });
+});
--- /dev/null
+<div ng-include="'components/navbar/navbar.html'"></div>
+
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <h1>
+ <i class="fa fa-flag"></i> Conditions Générales d'Utilisation
+ </h1>
+ </div>
+</header>
+
+<div class="container">
+ <h2>Article en cours d'écriture...</h2>
+</div>
+
+<div ng-include="'components/footer/footer.html'"></div>
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .config(function ($stateProvider) {
+ $stateProvider
+ .state('rules', {
+ url: '/rules',
+ templateUrl: 'app/rules/rules.html',
+ controller: 'RulesCtrl'
+ });
+ });
\ No newline at end of file
--- /dev/null
+<div class="container-fluid">
+ <div class="row">
+ <div class="col-md-12">
+ <div class="page-header">
+ <h2>Projets favoris</h2>
+ </div>
+
+ <div class="row">
+ <div class="col-md-6" ng-repeat="cfProject in cfProjects">
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">{{cfProject.title}} <em class="pull-right">( <a href="/user_profile">{{cfProject.author}}</a> )</em></div>
+ <div class="panel-body panel-fixed">
+ <p class="text-center">
+ <img src="{{cfProject.image}}" class="img-rounded" alt="...">
+ </p>
+ <p>
+ <span ng-repeat="category in cfProject.categories">
+ <a href="#" class="label label-warning">{{category}}</a>
+ </span>
+ </p>
+ <p class="description" style="text-align:justify">
+ {{cfProject.shortDescription}}
+ </p>
+ <p class="text-right"><em><a href="" ng-click="goto('project_view', 'project.id')">En savoir plus</a></em></p>
+ </div>
+ <div class="panel-footer">
+ <div class="progress">
+ <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="{{cfProject.currentDonations/cfProject.askedDonations*100}}" aria-valuemin="0" aria-valuemax="100" style="width: {{cfProject.currentDonations/cfProject.askedDonations*100}}%;">
+ <span class="sr-only">{{cfProject.currentDonations/cfProject.askedDonations*100}}% Complete</span>
+ </div>
+ </div>
+ <span class="pull-left"><em>Objectif : {{cfProject.currentDonations}} / {{cfProject.askedDonations}} €</em></span>
+ <span class="pull-right"><em>Fin : {{cfProject.endingDate}}</em></span>
+ <div class="clearfix"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+<p class="pull-right" ng-show="isOwner">
+ <a data-toggle="modal" data-target="#EditModalProfile">
+ <i class="fa fa-edit fa-lg"></i> Modifier
+ </a>
+</p>
+
+<!-- Modal -->
+<div class="modal fade" id="EditModalProfile" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Fermer</span></button>
+ <h4 class="modal-title" id="myModalLabel">Edition du profil</h4>
+ </div>
+ <form role="form">
+ <div class="modal-body">
+ <div class="form-group">
+ <label for="inputPseudo">Pseudonyme</label>
+ <input type="text" class="form-control" id="inputPseudo" ng-model="user.name">
+ </div>
+ <div class="form-group">
+ <label for="inputName">Prénom</label>
+ <input type="text" class="form-control" id="inputName" ng-model="user.firstName">
+ </div>
+ <div class="form-group">
+ <label for="inputSurname">Nom</label>
+ <input type="text" class="form-control" id="inputSurname" ng-model="user.lastName">
+ </div>
+ <div class="form-group">
+ <label for="inputFile">Image</label>
+ <input type="file" id="inputFile">
+ <p class="help-block">Taille conseillée : 750 x 300 pixels</p>
+ </div>
+ <div class="form-group">
+ <label for="textTagLine">Tag Line</label>
+ <p class="help-block">200 caractères max.</p>
+ <textarea class="form-control" rows="2" id="textTagLine" maxlength="200" ng-model="user.tagLine"></textarea>
+ </div>
+ <div class="form-group">
+ <label for="textDescription">Description</label>
+ <p class="help-block">500 caractères max.</p>
+ <textarea class="form-control" rows="5" id="textDescription" maxlength="500" ng-model="user.description"></textarea>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-warning" data-dismiss="modal" ng-click="save('profile')">Enregistrer les modifications</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+
+
+<p class="text-center">
+ <img class="img-thumbnail" src="http://lorempixel.com/800/250/nature/">
+</p>
+
+<h2>Informations générales</h2>
+
+<dl class="dl-horizontal">
+ <dt>Pseudonyme</dt>
+ <dd>{{user.name}}</dd>
+
+ <dt>Nom Prénom</dt>
+ <dd>{{user.lastName}} {{user.firstName}}</dd>
+
+ <dt>Date d'inscription</dt>
+ <dd>11 / Sep / 2001</dd>
+
+</dl>
+<h2>Description</h2>
+<p class="text-justify">
+ {{user.description}}
+</p>
+
--- /dev/null
+<div class="container-fluid">
+ <div class="row">
+ <div class="col-md-12">
+ <div class="page-header">
+ <h2>Projets en financement</h2>
+ </div>
+
+ <div class="row">
+ <div class="col-md-6" ng-repeat="cfProject in cfProjects">
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">{{cfProject.title}} <em class="pull-right">( <a href="/user_profile">{{cfProject.author}}</a> )</em></div>
+ <div class="panel-body panel-fixed">
+ <p class="text-center">
+ <img src="{{cfProject.image}}" class="img-rounded" alt="...">
+ </p>
+ <p>
+ <span ng-repeat="category in cfProject.categories">
+ <a href="#" class="label label-warning">{{category}}</a>
+ </span>
+ </p>
+ <p class="description" style="text-align:justify">
+ {{cfProject.shortDescription}}
+ </p>
+ <p class="text-right"><em><a href="" ng-click="goto('project_view', 'project.id')">En savoir plus</a></em></p>
+ </div>
+ <div class="panel-footer">
+ <div class="progress">
+ <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="{{cfProject.currentDonations/cfProject.askedDonations*100}}" aria-valuemin="0" aria-valuemax="100" style="width: {{cfProject.currentDonations/cfProject.askedDonations*100}}%;">
+ <span class="sr-only">{{cfProject.currentDonations/cfProject.askedDonations*100}}% Complete</span>
+ </div>
+ </div>
+ <span class="pull-left"><em>Objectif : {{cfProject.currentDonations}} / {{cfProject.askedDonations}} €</em></span>
+ <span class="pull-right"><em>Fin : {{cfProject.endingDate}}</em></span>
+ <div class="clearfix"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="page-header">
+ <h2>Projets en développement </h2>
+ </div>
+ <div class="row">
+ <div class="col-md-6" ng-repeat="csProject in csProjects">
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">{{csProject.title}} <em class="pull-right">( <a href="/user_profile">{{csProject.author}}</a> )</em></div>
+ <div class="panel-body panel-fixed">
+ <p class="text-center">
+ <img src="{{csProject.image}}" class="img-rounded" alt="...">
+ </p>
+ <p>
+ <span ng-repeat="category in csProject.categories">
+ <a href="#" class="label label-warning">{{category}}</a>
+ </span>
+ </p>
+ <p class="description" style="text-align:justify">
+ {{csProject.shortDescription}}
+ </p>
+ <p class="text-right"><em><a href="" ng-click="goto('project_view', 'project.id')">En savoir plus</a></em></p>
+ </div>
+ <div class="panel-footer">
+ <p class="pull-left"><strong>{{csProject.ideas}} idées</strong></p>
+ <a class="btn btn-warning pull-right" href="#">Proposez la votre !</a>
+ <div class="clearfix"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="page-header">
+ <h2>Projets refusés </h2>
+ </div>
+ <div class="row">
+ <div class="col-md-6" ng-repeat="failedProject in failedProjects">
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">{{failedProject.title}} <em class="pull-right">( <a href="/user_profile">{{failedProject.author}}</a> )</em></div>
+ <div class="panel-body panel-fixed">
+ <p class="text-center">
+ <img src="{{failedProject.image}}" class="img-rounded" alt="...">
+ </p>
+ <p>
+ <span ng-repeat="category in failedProject.categories">
+ <a href="#" class="label label-warning">{{category}}</a>
+ </span>
+ </p>
+ <p class="description" style="text-align:justify">
+ {{failedProject.shortDescription}}
+ </p>
+ <p class="text-right"><em><a href="" ng-click="goto('project_view', 'project.id')">En savoir plus</a></em></p>
+ </div>
+ <div class="panel-footer">
+ <p class="pull-left"><strong>{{failedProject.ideas}} idées</strong></p>
+ <a class="btn btn-warning pull-right" href="#">Proposez la votre !</a>
+ <div class="clearfix"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+.controller('UserProfileCtrl', function ($scope, $rootScope, $http, User) {
+ $scope.isOwner = false;
+ $scope.currentUser = User.get();
+ $scope.tabs = [
+ { title:'Profil', name:'profile', content : 'app/user_profile/navtabs_fragments/user_profile_profile.html' },
+ { title:'Projets personnels', name:'owned_projects', content:'app/user_profile/navtabs_fragments/user_profile_projects.html' },
+ { title:'Projets favoris', name:'favorites_projects', content:'app/user_profile/navtabs_fragments/user_profile_favorites.html' }
+ ]
+
+ $scope.user =Â {
+ name : 'Pseudo',
+ firstName : 'Prénom',
+ lastName : 'Nom',
+ tagLine : 'Décrivez-vous brièvement!',
+ birthday : 'Entrez votre date de naissance',
+ };
+
+ if (typeof $rootScope.profile_id !== 'undefined') {
+ $http.get('/api/profiles/' + $rootScope.profile_id).success(function(profile) {
+ $scope.user = profile;
+ if ($scope.currentUser.profile_id === $rootScope.profile_id) {
+ $scope.isOwner = true;
+ } else {
+ $scope.isOwner = false;
+ }
+ });
+ } else {
+ var interval = setInterval(function () {
+ if (typeof $scope.currentUser.profile_id !== 'undefined') {
+ $http.get('/api/profiles/' + $scope.currentUser.profile_id).success(function(profile) {
+ $scope.user = profile;
+ $scope.isOwner = true;
+ });
+ clearInterval(interval);
+ }
+ }, 300);
+ }
+
+
+
+ /* $scope.user = {
+ name : 'Lolwenn Neroy',
+ firstName : 'Lolwenn',
+ lastName : 'Neroy',
+ tagLine : 'Chanteuse de variété',
+ description : 'Une description...',
+ birthday : '31/12/1991',
+ registerDate : '12/08/2014',
+ crowdfundedProjects : ['pid1982', 'pid429823'],
+ crowdsourcedProjects : ['pid1992', 'pid429893'],
+ failedProjects : ['pid133', 'pid423'],
+ favoritesProjects : ['pid248932', 'pid402383'],
+ bankDetails : 'bd193482',
+ givenDonations : ['gd23983','gd84592','gd893242','gd72134'],
+ suggestions : ['sb7241','sb1741794','sb28540']
+ }*/
+
+ $scope.cfProjects = [];
+
+ $scope.cfProjects.push({
+ id : 'PMESLFOWKJB1',
+ title : 'Projet_crowdfund_1',
+ author : 'Jean Genot',
+ categories : ["Informatique","Dummy"],
+ shortDescription : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam quis bibendum dui, sit amet vehicula odio. Ut dictum lobortis elementum. Donec cursus, dui in fermentum euismod, nibh nunc aliquet dui, quis elementum neque mauris sed felis. Suspendisse facilisis adipiscing felis, sed iaculis tellus molestie at. Cras euismod, nibh vitae congue ultricies, ligula justo imperdiet ante, vitae dictum ante dolor eget tellus. In cursus vehicula lorem, at tristique metus. Vestibulum vel dui accumsan, hendrerit augue eget, dignissim elit. Nullam hendrerit a elit vitae sodales. Fusce id vestibulum nulla. Nulla odio lacus, lacinia eget eleifend eget, porta sit amet justo. Sed aliquet adipiscing nulla, in luctus velit porta vel. Curabitur egestas porta nulla, eget faucibus neque consectetur quis. Mauris venenatis consectetur interdum. Fusce fermentum et erat vitae auctor. Sed quis scelerisque nisi. Vestibulum cursus libero eros, ornare dignissim mi facilisis et.',
+ image : 'http://lorempixel.com/250/125/sports/4',
+ beginningDate : "14-09-2014",
+ endingDate : "30-09-2014",
+ url : '/projet1',
+ likes : 32,
+ comments : 2,
+ askedDonations : 20000,
+ currentDonations : 11249,
+ details : "url",
+ });
+
+ $scope.csProjects = [];
+
+ $scope.csProjects.push({
+ id : 'PMESLFOWKJB1',
+ title : 'Projet_crowdsource_1',
+ author : 'Jean Genot',
+ categories : ["Informatique","Dummy"],
+ shortDescription : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam quis bibendum dui, sit amet vehicula odio. Ut dictum lobortis elementum. Donec cursus, dui in fermentum euismod, nibh nunc aliquet dui, quis elementum neque mauris sed felis. Suspendisse facilisis adipiscing felis, sed iaculis tellus molestie at. Cras euismod, nibh vitae congue ultricies, ligula justo imperdiet ante, vitae dictum ante dolor eget tellus. In cursus vehicula lorem, at tristique metus. Vestibulum vel dui accumsan, hendrerit augue eget, dignissim elit. Nullam hendrerit a elit vitae sodales. Fusce id vestibulum nulla. Nulla odio lacus, lacinia eget eleifend eget, porta sit amet justo. Sed aliquet adipiscing nulla, in luctus velit porta vel. Curabitur egestas porta nulla, eget faucibus neque consectetur quis. Mauris venenatis consectetur interdum. Fusce fermentum et erat vitae auctor. Sed quis scelerisque nisi. Vestibulum cursus libero eros, ornare dignissim mi facilisis et.',
+ image : 'http://lorempixel.com/250/125/sports/2',
+ beginningDate : "14-09-2014",
+ endingDate : "30-09-2014",
+ url : '/projet1',
+ likes : 32,
+ comments : 2,
+ ideas : 31,
+ details : "url",
+ });
+
+ $scope.failedProjects = [];
+
+ $scope.failedProjects.push({
+ id : 'PMESLFOWKJB1',
+ title : 'Projet_failed_1',
+ author : 'Jean Genot',
+ categories : ["Informatique","Dummy"],
+ shortDescription : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam quis bibendum dui, sit amet vehicula odio. Ut dictum lobortis elementum. Donec cursus, dui in fermentum euismod, nibh nunc aliquet dui, quis elementum neque mauris sed felis. Suspendisse facilisis adipiscing felis, sed iaculis tellus molestie at. Cras euismod, nibh vitae congue ultricies, ligula justo imperdiet ante, vitae dictum ante dolor eget tellus. In cursus vehicula lorem, at tristique metus. Vestibulum vel dui accumsan, hendrerit augue eget, dignissim elit. Nullam hendrerit a elit vitae sodales. Fusce id vestibulum nulla. Nulla odio lacus, lacinia eget eleifend eget, porta sit amet justo. Sed aliquet adipiscing nulla, in luctus velit porta vel. Curabitur egestas porta nulla, eget faucibus neque consectetur quis. Mauris venenatis consectetur interdum. Fusce fermentum et erat vitae auctor. Sed quis scelerisque nisi. Vestibulum cursus libero eros, ornare dignissim mi facilisis et.',
+ image : 'http://lorempixel.com/250/125/sports/3',
+ beginningDate : "14-09-2014",
+ endingDate : "30-09-2014",
+ url : '/projet1',
+ likes : 32,
+ comments : 2,
+ ideas : 31,
+ details : "url",
+ });
+
+
+ $scope.save = function(option) {
+ switch (option) {
+ case 'profile' :
+ $http.put('/api/profiles/' + $scope.currentUser.profile_id, $scope.user).success(function(profile) {
+ $scope.user = profile;
+ });
+ }
+
+ }
+});
--- /dev/null
+'use strict';
+
+describe('Controller: UserProfileCtrl', function () {
+
+ // load the controller's module
+ beforeEach(module('ocreApp'));
+
+ var UserProfileCtrl, scope;
+
+ // Initialize the controller and a mock scope
+ beforeEach(inject(function ($controller, $rootScope) {
+ scope = $rootScope.$new();
+ UserProfileCtrl = $controller('UserProfileCtrl', {
+ $scope: scope
+ });
+ }));
+
+ it('should ...', function () {
+ expect(1).toEqual(1);
+ });
+});
--- /dev/null
+<div ng-include="'components/navbar/navbar.html'"></div>
+
+<header class="hero-unit" id="banner">
+ <div class="container">
+ <h1>
+ <i class="fa fa-user fa-lg"></i>
+ <br>
+ {{user.firstName}} {{user.lastName}} ({{user.name}})
+ </h1>
+ <p class="lead">
+ {{user.tagLine}}
+ </p>
+ </div>
+</header>
+
+<hr>
+<div class="container">
+ <div class="row">
+ <div class="col-md-8">
+ <tabset type="pills">
+ <tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disabled="tab.disabled">
+ <hr>
+ <div>
+ <ng-include src="tab.content"></ng-include>
+ </div>
+ </tab>
+ </tabset>
+ </div>
+ <div class="col-md-4">
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">Liste des dons</div>
+ <!-- List group -->
+ <ul class="list-group">
+ <li class="list-group-item" ng-repeat="givenDonation in givenDonations"><a href="#"><strong>{{givenDonation.projectTitle}}</strong></a> <span class="pull-right">{{givenDonation.amount}}</span></li>
+ </ul>
+ </div>
+
+ <div class="panel panel-warning">
+ <!-- Default panel contents -->
+ <div class="panel-heading">Liste des idées proposées</div>
+ <!-- List group -->
+ <ul class="list-group">
+ <li class="list-group-item" ng-repeat="suggestion in suggestions"><a href="#"><strong>{{suggestion.title}}</strong></a> <span class="pull-right">{{suggestion.projectTitle}}</span></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+</div>
+<div ng-include="'components/footer/footer.html'"></div>
\ No newline at end of file
--- /dev/null
+'use strict';
+
+angular.module('ocreApp')
+ .config(function ($stateProvider) {
+ $stateProvider
+ .state('user_profile', {
+ url: '/user_profile',
+ templateUrl: 'app/user_profile/user_profile.html',
+ controller: 'UserProfileCtrl'
+ });
+ });
\ No newline at end of file
--- /dev/null
+<footer class="footer">
+ <div class="container-fluid">
+ <p class="pull-left">
+ Crée par : <a href="#user_profile">Jean Genot</a> & <a href="#user_profile">Romain Monin</a> <em>( <a href="https://bitbucket.org/genonin/ocre">Sources</a> )</em> sous GNU GPL v3.
+ </p>
+ <ul class="list-inline pull-right">
+ <li><a href="/contacts">Contact</a></li>
+ <li><a href="/about">A propos</a></li>
+ <li><a href="/mentions">Mentions Légales</a></li>
+ <li><a href="/rules">Conditions d'Utilisation</a></li>
+ </ul>
+ </div>
+</footer>
\ No newline at end of file
'use strict';
angular.module('ocreApp')
- .controller('NavbarCtrl', function ($scope, $location, Auth) {
- $scope.menu = [{
- 'title': 'Accueil',
- 'link': '/'
- }];
+.controller('NavbarCtrl', function ($scope, $rootScope, $location, Auth) {
+ $scope.menu = [
+ {
+ 'title': 'Découvrir les projets',
+ 'link': '/projects'
+ },
+ {
+ 'title': 'Proposez votre projet',
+ 'link': '/project_create'
+ }
+ ];
$scope.isCollapsed = true;
$scope.isLoggedIn = Auth.isLoggedIn;
$scope.getCurrentUser = Auth.getCurrentUser;
$scope.logout = function() {
- Auth.logout();
- $location.path('/login');
+ Auth.logout();
+ $location.path('/login');
};
$scope.isActive = function(route) {
- return route === $location.path();
+ return route === $location.path();
};
- });
\ No newline at end of file
+
+ /**
+ *
+ * @function goto
+ * @parameters String route, String profileId
+ * @description Going to route and adding profileId to rootScope
+ *
+ **/
+ $scope.goto = function(route, profileId) {
+ $rootScope.profile_id = profileId;
+ $location.path(route);
+
+ }
+
+
+});
\ No newline at end of file
-<div id="topNav" class="navbar navbar-default navbar-fixed-top" ng-controller="NavbarCtrl">
-<!-- <div class="container">-->
+<div id="topNav" class="navbar navbar-default navbar-static-top" ng-controller="NavbarCtrl">
+ <div class="container-fluid">
<div class="navbar-header">
<button class="navbar-toggle" type="button" ng-click="isCollapsed = !isCollapsed">
<span class="sr-only">Afficher la barre de navigation</span>
<li ng-show="isAdmin()" ng-class="{active: isActive('/admin')}"><a href="/admin">Administrateur</a></li>
</ul>
- <ul class="nav navbar-nav pull-right">
+ <ul class="nav navbar-nav navbar-right">
<li ng-hide="isLoggedIn()" ng-class="{active: isActive('/signup')}"><a href="/signup">S'inscrire</a></li>
<li ng-hide="isLoggedIn()" ng-class="{active: isActive('/login')}"><a href="/login">Se connecter</a></li>
- <li ng-show="isLoggedIn()"><p class="navbar-text">Salut {{ getCurrentUser().name }}</p> </li>
+ <li ng-show="isLoggedIn()">
+ <p class="navbar-text">Salut
+ <a href="" ng-click="goto('user_profile', getCurrentUser().profile_id)"><em>{{ getCurrentUser().name }}</em></a>
+ </p>
+ </li>
<li ng-show="isLoggedIn()" ng-class="{active: isActive('/settings')}"><a href="/settings"><span class="glyphicon glyphicon-cog"></span></a></li>
<li ng-show="isLoggedIn()" ng-class="{active: isActive('/logout')}"><a href="" ng-click="logout()">Se déconnecter</a></li>
</ul>
</div>
-<!-- </div>-->
+ </div>
</div>
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
- <head>
+<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<base href="/">
<meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css(client) app/vendor.css -->
- <!-- bower:css -->
- <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
- <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.css" />
- <!-- endbower -->
+ <!-- bower:css -->
+ <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
+ <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.css" />
+ <!-- endbower -->
<!-- endbuild -->
<!-- build:css({.tmp,client}) app/app.css -->
<link rel="stylesheet" href="app/app.css">
- <!-- injector:css -->
- <link rel="stylesheet" href="app/account/login/login.css">
- <link rel="stylesheet" href="app/admin/admin.css">
- <link rel="stylesheet" href="app/app.css">
- <link rel="stylesheet" href="app/main/main.css">
- <!-- endinjector -->
+ <!-- injector:css -->
+ <link rel="stylesheet" href="app/about/about.css">
+ <link rel="stylesheet" href="app/account/login/login.css">
+ <link rel="stylesheet" href="app/admin/admin.css">
+ <link rel="stylesheet" href="app/app.css">
+ <link rel="stylesheet" href="app/contacts/contacts.css">
+ <link rel="stylesheet" href="app/main/main.css">
+ <link rel="stylesheet" href="app/mentions/mentions.css">
+ <link rel="stylesheet" href="app/project_create/project_create.css">
+ <link rel="stylesheet" href="app/project_view/project_view.css">
+ <link rel="stylesheet" href="app/projects/projects.css">
+ <link rel="stylesheet" href="app/rules/rules.css">
+ <link rel="stylesheet" href="app/user_profile/user_profile.css">
+ <!-- endinjector -->
<!-- endbuild -->
- </head>
- <body ng-app="ocreApp">
+</head>
+<body ng-app="ocreApp">
<!--[if lt IE 7]>
- <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
- <![endif]-->
+<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
+<![endif]-->
<!-- Add your site or application content here -->
<div ui-view=""></div>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
- <script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
- ga('create', 'UA-XXXXX-X');
- ga('send', 'pageview');
+ ga('create', 'UA-XXXXX-X');
+ ga('send', 'pageview');
</script>
<!--[if lt IE 9]>
- <script src="bower_components/es5-shim/es5-shim.js"></script>
- <script src="bower_components/json3/lib/json3.min.js"></script>
- <![endif]-->
+<script src="bower_components/es5-shim/es5-shim.js"></script>
+<script src="bower_components/json3/lib/json3.min.js"></script>
+<![endif]-->
<script src="socket.io/socket.io.js"></script>
+ <script src="bower_components/tinymce/tinymce.min.js"></script>
<!-- build:js(client) app/vendor.js -->
- <!-- bower:js -->
- <script src="bower_components/jquery/dist/jquery.js"></script>
- <script src="bower_components/angular/angular.js"></script>
- <script src="bower_components/json3/lib/json3.js"></script>
- <script src="bower_components/angular-resource/angular-resource.js"></script>
- <script src="bower_components/angular-cookies/angular-cookies.js"></script>
- <script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
- <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
- <script src="bower_components/lodash/dist/lodash.compat.js"></script>
- <script src="bower_components/angular-socket-io/socket.js"></script>
- <script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
- <!-- endbower -->
+ <!-- bower:js -->
+ <script src="bower_components/jquery/dist/jquery.js"></script>
+ <script src="bower_components/angular/angular.js"></script>
+ <script src="bower_components/json3/lib/json3.js"></script>
+ <script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
+ <script src="bower_components/angular-resource/angular-resource.js"></script>
+ <script src="bower_components/angular-cookies/angular-cookies.js"></script>
+ <script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
+ <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
+ <script src="bower_components/lodash/dist/lodash.compat.js"></script>
+ <script src="bower_components/angular-socket-io/socket.js"></script>
+ <script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
+ <script src="bower_components/angular-ui-tinymce/src/tinymce.js"></script>
+ <!-- endbower -->
+ <!-- endbuild -->
+ <!-- build:js({.tmp,client}) app/app.js -->
+ <script src="app/app.js"></script>
+ <!-- injector:js -->
+ <script src="app/about/about.controller.js"></script>
+ <script src="app/about/about.js"></script>
+ <script src="app/account/account.js"></script>
+ <script src="app/account/login/login.controller.js"></script>
+ <script src="app/account/settings/settings.controller.js"></script>
+ <script src="app/account/signup/signup.controller.js"></script>
+ <script src="app/admin/admin.controller.js"></script>
+ <script src="app/admin/admin.js"></script>
+ <script src="app/contacts/contacts.controller.js"></script>
+ <script src="app/contacts/contacts.js"></script>
+ <script src="app/main/main.controller.js"></script>
+ <script src="app/main/main.js"></script>
+ <script src="app/mentions/mentions.controller.js"></script>
+ <script src="app/mentions/mentions.js"></script>
+ <script src="app/project_create/project_create.controller.js"></script>
+ <script src="app/project_create/project_create.js"></script>
+ <script src="app/project_view/project_view.controller.js"></script>
+ <script src="app/project_view/project_view.js"></script>
+ <script src="app/projects/projects.controller.js"></script>
+ <script src="app/projects/projects.js"></script>
+ <script src="app/rules/rules.controller.js"></script>
+ <script src="app/rules/rules.js"></script>
+ <script src="app/user_profile/user_profile.controller.js"></script>
+ <script src="app/user_profile/user_profile.js"></script>
+ <script src="components/auth/auth.service.js"></script>
+ <script src="components/auth/user.service.js"></script>
+ <script src="components/mongoose-error/mongoose-error.directive.js"></script>
+ <script src="components/navbar/navbar.controller.js"></script>
+ <script src="components/socket/socket.service.js"></script>
+ <!-- endinjector -->
<!-- endbuild -->
-
- <!-- build:js({.tmp,client}) app/app.js -->
- <script src="app/app.js"></script>
- <!-- injector:js -->
- <script src="app/account/account.js"></script>
- <script src="app/account/login/login.controller.js"></script>
- <script src="app/account/settings/settings.controller.js"></script>
- <script src="app/account/signup/signup.controller.js"></script>
- <script src="app/admin/admin.controller.js"></script>
- <script src="app/admin/admin.js"></script>
- <script src="app/main/main.controller.js"></script>
- <script src="app/main/main.js"></script>
- <script src="components/auth/auth.service.js"></script>
- <script src="components/auth/user.service.js"></script>
- <script src="components/mongoose-error/mongoose-error.directive.js"></script>
- <script src="components/navbar/navbar.controller.js"></script>
- <script src="components/socket/socket.service.js"></script>
- <!-- endinjector -->
- <!-- endbuild -->
</body>
</html>
'use strict';
var User = require('./user.model');
+var Profile = require('../profile/profile.model');
var passport = require('passport');
var config = require('../../config/environment');
var jwt = require('jsonwebtoken');
var validationError = function(res, err) {
- return res.json(422, err);
+ return res.json(422, err);
};
/**
* restriction: 'admin'
*/
exports.index = function(req, res) {
- User.find({}, '-salt -hashedPassword', function (err, users) {
- if(err) return res.send(500, err);
- res.json(200, users);
- });
+ User.find({}, '-salt -hashedPassword', function (err, users) {
+ if(err) return res.send(500, err);
+ res.json(200, users);
+ });
};
/**
* Creates a new user
*/
exports.create = function (req, res, next) {
- var newUser = new User(req.body);
- newUser.provider = 'local';
- newUser.role = 'user';
- newUser.save(function(err, user) {
- if (err) return validationError(res, err);
- var token = jwt.sign({_id: user._id }, config.secrets.session, { expiresInMinutes: 60*5 });
- res.json({ token: token });
- });
+ var newUser = new User(req.body);
+ var newProfile = new Profile();
+ newUser.provider = 'local';
+ newUser.role = 'user';
+ newUser.profile_id = newProfile._id;
+ newUser.save(function(err, user) {
+ if (err) return validationError(res, err);
+ var token = jwt.sign({_id: user._id }, config.secrets.session, { expiresInMinutes: 60*5 });
+ res.json({ token: token });
+ });
+ newProfile.save(function(err) {
+ if (err) { return handleError(err); }
+ });
};
/**
* Get a single user
*/
exports.show = function (req, res, next) {
- var userId = req.params.id;
+ var userId = req.params.id;
- User.findById(userId, function (err, user) {
- if (err) return next(err);
- if (!user) return res.send(401);
- res.json(user.profile);
- });
+ User.findById(userId, function (err, user) {
+ if (err) return next(err);
+ if (!user) return res.send(401);
+ res.json(user.profile);
+ });
};
/**
* restriction: 'admin'
*/
exports.destroy = function(req, res) {
- User.findByIdAndRemove(req.params.id, function(err, user) {
- if(err) return res.send(500, err);
- return res.send(204);
- });
+ User.findByIdAndRemove(req.params.id, function(err, user) {
+ if(err) return res.send(500, err);
+ return res.send(204);
+ });
};
/**
* Change a users password
*/
exports.changePassword = function(req, res, next) {
- var userId = req.user._id;
- var oldPass = String(req.body.oldPassword);
- var newPass = String(req.body.newPassword);
+ var userId = req.user._id;
+ var oldPass = String(req.body.oldPassword);
+ var newPass = String(req.body.newPassword);
- User.findById(userId, function (err, user) {
- if(user.authenticate(oldPass)) {
- user.password = newPass;
- user.save(function(err) {
- if (err) return validationError(res, err);
- res.send(200);
- });
- } else {
- res.send(403);
- }
- });
+ User.findById(userId, function (err, user) {
+ if(user.authenticate(oldPass)) {
+ user.password = newPass;
+ user.save(function(err) {
+ if (err) return validationError(res, err);
+ res.send(200);
+ });
+ } else {
+ res.send(403);
+ }
+ });
};
/**
* Get my info
*/
exports.me = function(req, res, next) {
- var userId = req.user._id;
- User.findOne({
- _id: userId
- }, '-salt -hashedPassword', function(err, user) { // don't ever give out the password or salt
- if (err) return next(err);
- if (!user) return res.json(401);
- res.json(user);
- });
+ var userId = req.user._id;
+ User.findOne({
+ _id: userId
+ }, '-salt -hashedPassword', function(err, user) { // don't ever give out the password or salt
+ if (err) return next(err);
+ if (!user) return res.json(401);
+ res.json(user);
+ });
};
/**
* Authentication callback
*/
exports.authCallback = function(req, res, next) {
- res.redirect('/');
+ res.redirect('/');
};
var authTypes = ['github', 'twitter', 'facebook', 'google'];
var UserSchema = new Schema({
- name: String,
- email: { type: String, lowercase: true },
- role: {
- type: String,
- default: 'user'
- },
- hashedPassword: String,
- provider: String,
- salt: String,
- facebook: {},
- twitter: {},
- github: {},
- google: {}
+ name: String,
+ profile_id : String,
+ email: { type: String, lowercase: true },
+ role: {
+ type: String,
+ default: 'user'
+ },
+ hashedPassword: String,
+ provider: String,
+ salt: String,
+ facebook: {},
+ twitter: {},
+ github: {},
+ google: {},
});
/**
* Virtuals
*/
UserSchema
- .virtual('password')
- .set(function(password) {
+.virtual('password')
+.set(function(password) {
this._password = password;
this.salt = this.makeSalt();
this.hashedPassword = this.encryptPassword(password);
- })
- .get(function() {
+})
+.get(function() {
return this._password;
- });
+});
// Public profile information
UserSchema
- .virtual('profile')
- .get(function() {
+.virtual('profile')
+.get(function() {
return {
- 'name': this.name,
- 'role': this.role
+ 'name': this.name,
+ 'role': this.role
};
- });
+});
// Non-sensitive info we'll be putting in the token
UserSchema
- .virtual('token')
- .get(function() {
+.virtual('token')
+.get(function() {
return {
- '_id': this._id,
- 'role': this.role
+ '_id': this._id,
+ 'role': this.role
};
- });
+});
/**
* Validations
// Validate empty email
UserSchema
- .path('email')
- .validate(function(email) {
+.path('email')
+.validate(function(email) {
// if you are authenticating by any of the oauth strategies, don't validate
if (authTypes.indexOf(this.provider) !== -1) return true;
return email.length;
- }, 'Email cannot be blank');
+}, 'Email cannot be blank');
// Validate empty password
UserSchema
- .path('hashedPassword')
- .validate(function(hashedPassword) {
+.path('hashedPassword')
+.validate(function(hashedPassword) {
// if you are authenticating by any of the oauth strategies, don't validate
if (authTypes.indexOf(this.provider) !== -1) return true;
return hashedPassword.length;
- }, 'Password cannot be blank');
+}, 'Password cannot be blank');
// Validate email is not taken
UserSchema
- .path('email')
- .validate(function(value, respond) {
+.path('email')
+.validate(function(value, respond) {
var self = this;
this.constructor.findOne({email: value}, function(err, user) {
- if(err) throw err;
- if(user) {
- if(self.id === user.id) return respond(true);
- return respond(false);
- }
- respond(true);
+ if(err) throw err;
+ if(user) {
+ if(self.id === user.id) return respond(true);
+ return respond(false);
+ }
+ respond(true);
});
}, 'The specified email address is already in use.');
var validatePresenceOf = function(value) {
- return value && value.length;
+ return value && value.length;
};
/**
* Pre-save hook
*/
UserSchema
- .pre('save', function(next) {
+.pre('save', function(next) {
if (!this.isNew) return next();
if (!validatePresenceOf(this.hashedPassword) && authTypes.indexOf(this.provider) === -1)
- next(new Error('Invalid password'));
+ next(new Error('Invalid password'));
else
- next();
- });
+ next();
+});
/**
* Methods
*/
UserSchema.methods = {
- /**
+ /**
* Authenticate - check if the passwords are the same
*
* @param {String} plainText
* @return {Boolean}
* @api public
*/
- authenticate: function(plainText) {
- return this.encryptPassword(plainText) === this.hashedPassword;
- },
+ authenticate: function(plainText) {
+ return this.encryptPassword(plainText) === this.hashedPassword;
+ },
- /**
+ /**
* Make salt
*
* @return {String}
* @api public
*/
- makeSalt: function() {
- return crypto.randomBytes(16).toString('base64');
- },
+ makeSalt: function() {
+ return crypto.randomBytes(16).toString('base64');
+ },
- /**
+ /**
* Encrypt password
*
* @param {String} password
* @return {String}
* @api public
*/
- encryptPassword: function(password) {
- if (!password || !this.salt) return '';
- var salt = new Buffer(this.salt, 'base64');
- return crypto.pbkdf2Sync(password, salt, 10000, 64).toString('base64');
- }
+ encryptPassword: function(password) {
+ if (!password || !this.salt) return '';
+ var salt = new Buffer(this.salt, 'base64');
+ return crypto.pbkdf2Sync(password, salt, 10000, 64).toString('base64');
+ }
};
module.exports = mongoose.model('User', UserSchema);
});
// Insert sockets below
+ require('../api/profile/profile.socket').register(socket);
+ require('../api/project/project.socket').register(socket);
require('../api/thing/thing.socket').register(socket);
}
module.exports = function(app) {
// Insert routes below
+ app.use('/api/profiles', require('./api/profile'));
+ app.use('/api/projects', require('./api/project'));
app.use('/api/things', require('./api/thing'));
app.use('/api/users', require('./api/user'));