Skip to content

Commit

Permalink
Did 61 modification and make it work
Browse files Browse the repository at this point in the history
* Mise a jour de ldapjs

* Enlevé le paragraphe sur la promocarte

* Enlevé toute mention de la promocarte et de son prix

* Mise a jour du readme du changelog et de la version

* Use new connection logic from Mongoose 4.11

* Migrate webpack to 3.5.5

* Fix a typo

* Remove yargs dependency

* Update changelog to include other necessary changes

* Add myself as contributor

* Update nodemon

* Show admin in navbar only if user is admin

* Update FAQ to link to our charter on Tsunamì

* Update HISTORY.md

* Fix the website to work in prod

* Add myself and remove everyone else from the pages footer

* Add item in Changelog

* Update node from 0.12 to 8 #1

* Update README.md

* Update README.md

Bumped deps to work on Node 8, so update README

* Update contact details

* Fix some authorization tests

* First run for 62 promo

* Rebase Master

* Delete not use file
  • Loading branch information
Justin2997 authored Jul 25, 2019
1 parent a275cef commit f015139
Show file tree
Hide file tree
Showing 41 changed files with 25,945 additions and 6,675 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
sudo: false
language: node_js
node_js:
- "0.12"
- "iojs"
- "8"
services:
- mongodb
9 changes: 8 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#History
# History

## 61.0.0
- Update to 61e
- Chage versioning scheme (promo.major.minor)
- Dependencies update for Node v8
- Remove all mentions of the promocarte
- Remove admin link in navbar if user is not admin

## 0.8.0
- Update to 59e
Expand Down
23 changes: 4 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# Site des points Genie UdeS 2014
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/dozoisch/pointsgenie?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
# Site des points Genie UdeS

[![Build Status][travis.img]][travis.url]
[![Dependencies][deps.img]][deps.url]
[![Dev Dependencies][devdeps.img]][devdeps.url]
[![Tasks][tasks.img]][tasks.url]
This is the source code for the "Points Genie" site, created for the 57th promo of Engineering at UdeS. This is the version for the 61st promoition.

This is the source code for the "Points Genie" site, created for the 57th promo of Engineering at UdeS
[![Build Status](https://travis-ci.org/NewLunarFire/pointsgenie.svg?branch=master)](https://travis-ci.org/NewLunarFire/pointsgenie)

## Basics

To install, first install npm, nodejs@0.11 and mongodb then do
To install, first install npm, nodejs@8 and mongodb then do

npm install

Expand All @@ -23,21 +19,10 @@ You can start the server in dev mode using two terminals
- First: `npm run hot-dev-server`
- Second: `LDAP_USER="uid=<CIP>" LDAP_PASSWORD="<PASSWORD>" npm start`


For production, make sure all the files are built using

npm run build

Then run

node --harmony server


[travis.img]: https://api.travis-ci.org/dozoisch/pointsgenie.svg
[travis.url]: https://travis-ci.org/dozoisch/pointsgenie
[deps.img]: https://david-dm.org/dozoisch/pointsgenie.svg
[deps.url]: https://david-dm.org/dozoisch/pointsgenie
[devdeps.img]: https://david-dm.org/dozoisch/pointsgenie/dev-status.svg
[devdeps.url]: https://david-dm.org/dozoisch/pointsgenie#info=devDependencies
[tasks.img]: https://badge.waffle.io/dozoisch/pointsgenie.svg?label=Current+Iteration&title=Current+Iteration
[tasks.url]: http://waffle.io/dozoisch/pointsgenie
4 changes: 2 additions & 2 deletions app/api/UserApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class UserApi extends ResourceApi {
return this._doPost(URL, data).then(res => this._singleResourceResponse(res));
}

assignPromocard(cip) {
const URL = `/promocard/${cip}`;
assignAuthorization(cip) {
const URL = `/authorization/${cip}`;
return this._doPost(URL).then(res => this._singleResourceResponse(res));
}

Expand Down
2 changes: 1 addition & 1 deletion app/apps/AdminApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const AdminApplication = React.createClass({
<ul className="nav nav-pills nav-stacked">
<li><Link to="list-events">Événements</Link></li>
<li><Link to="create-event">Créer un événement</Link></li>
<li><Link to="promocard">Attribuer une promocarte</Link></li>
<li><Link to="authorization">Autoriser un utilisateur</Link></li>
<li><Link to="adduser">Ajouter un usager</Link></li>
<li><Link to="list-users">Usagers</Link></li>
</ul>
Expand Down
7 changes: 3 additions & 4 deletions app/components/ApplyToEvent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const ApplyToEvent = React.createClass({
},

propTypes: {
promocard: PropTypes.shape({
price: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
authorization: PropTypes.shape({
date: PropTypes.instanceOf(Date),
}),
},
Expand Down Expand Up @@ -78,7 +77,7 @@ const ApplyToEvent = React.createClass({

render() {
this.updateEventsStatus();
if (this.props.promocard && this.props.promocard.date) {
if (this.props.authorization && this.props.authorization.date) {
return (
<ApplyToEventSelector ref="wrapper" eventList={this.props.events} isFormSubmitting={this.state.isFormSubmitting}
alert={this.state.alert} onAlertDismiss={this.handleAlertDismiss}
Expand All @@ -90,7 +89,7 @@ const ApplyToEvent = React.createClass({
<div className="apply-event">
<h3>Postuler pour un événement</h3>
<p>
Vous devez avoir une promocarte afin de pouvoir postuler à un événement.
Vous n'êtes pas autorisé à postuler
Veuillez contacter votre association étudiante
</p>
{this.renderPossibleEventList()}
Expand Down
39 changes: 39 additions & 0 deletions app/components/Authorization.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { PropTypes } from "react";
import { Input } from "react-bootstrap";

const Authorization = React.createClass({
displayName: "Authorization",

propTypes: {
authorization: PropTypes.shape({
date: PropTypes.instanceOf(Date)
}),
},

renderInner: function () {
var authMessage = "Non-autorisé";
var authDate = "";
if ("date" in this.props.authorization) {
authMessage = "Autorisé";
authDate = this.props.authorization.date.toLocaleDateString();
}
return (
<form className="form-horizontal">
<Input type="static" label="Statut" labelClassName="col-md-3"
wrapperClassName="col-md-6" value={authMessage} />
<Input type="static" label="Date" labelClassName="col-md-3"
wrapperClassName="col-md-6" value={authDate} />
</form>
);
},
render: function() {
return (
<div className="user-authorization-info">
<h4>Autorisation</h4>
{this.renderInner()}
</div>
);
},
});

export default Authorization;
40 changes: 0 additions & 40 deletions app/components/Promocard.js

This file was deleted.

4 changes: 2 additions & 2 deletions app/components/user-list-table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const ComponentUserListTable = React.createClass({
<td>{user.ringSize}</td>
<td>{this.renderUserPointsLink(user)}</td>
<td>
{ user.promocard && user.promocard.date ?
<Glyphicon glyph="credit-card" title="Possède une promocarte" /> : null }
{ user.authorization && user.authorization.date ?
<Glyphicon glyph="ok-sign" title="Est autorisé a postuler" /> : null }
{ user.isAdmin ? <Glyphicon glyph="star" title="Est administrateur" /> : null }
</td>
<td>
Expand Down
12 changes: 10 additions & 2 deletions app/layouts/NavbarLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,22 @@ const NavbarLayout = React.createClass({

renderAuthenticatedLinks() {
const username = this.props.user ? this.props.user.name : "";
const isAdmin = this.props.user ? this.props.user.isAdmin : false;

if (!username) {
return null;
}
return [

var arr = [
(<NavItemLink key="profile" to="profile"><Glyphicon glyph="user"/> {username}</NavItemLink>),
(<li key="admin"><a href="/admin#/"><Glyphicon glyph="star" /> Admin</a></li>),
(<NavItemLink key="sginout" to="signout"><Glyphicon glyph="off"/> Déconnexion</NavItemLink>),
];

if (isAdmin) {
arr.splice(1, 0, (<li key="admin"><a href="/admin#/"><Glyphicon glyph="star" /> Admin</a></li>));
}

return arr;
},
});

Expand Down
2 changes: 1 addition & 1 deletion app/less/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ body {
}

tfoot {
border-top-width: : 2px;
border-top-width: 2px;
}

.navbar-brand {
Expand Down
3 changes: 1 addition & 2 deletions app/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class User extends Model {
}
},
totalPoints: { type: Number },
promocard: { type: Object, shape: {
price: { type: Number },
authorization: { type: Object, shape: {
date: { type: Date },
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Input, Button } from "react-bootstrap";
import request from "../middlewares/request";
import UserStore from "../stores/user";

const AdminPromocard = React.createClass({
displayName: "AdminPromocard",
const AdminAuthorization = React.createClass({
displayName: "AdminAuthorization",

contextTypes: {
router: PropTypes.func
Expand All @@ -17,13 +17,13 @@ const AdminPromocard = React.createClass({

onSubmit(e) {
e.preventDefault();
UserStore.assignPromocard(this.state.cip, (err, res) => {
UserStore.assignAuthorization(this.state.cip, (err, res) => {
if (!err) {
if (!this.refs.addOther.getChecked()) {
return this.context.router.transitionTo("/users");
}
this.setState({
message: `La promocarte de ${this.state.cip} a ajouté avec succès!`,
message: `${this.state.cip} est autorisé avec succès!`,
cip: null,
})
} else {
Expand Down Expand Up @@ -51,15 +51,15 @@ const AdminPromocard = React.createClass({
renderSubmitButton() {
return (
<Button type="submit" disabled={!this.state.isValid || this.props.isSubmitting} bsStyle="success">
{ this.props.isSubmitting ? "En cours...": "Attribuer la promocarte" }
{ this.props.isSubmitting ? "En cours...": "Autoriser à postuler?" }
</Button>
);
},
render() {
const isValid = this.state.isValid;
return (
<div>
<h3>Attribuer une promocarte</h3>
<h3>Autoriser à postuler</h3>
<form className="form-horizontal" onSubmit={this.onSubmit}>
<Input type="text" label="Cip" ref="cip" onChange={this.onChange} value={this.state.cip}
labelClassName="col-md-3" wrapperClassName="col-md-4" help={this.state.message}
Expand All @@ -73,4 +73,4 @@ const AdminPromocard = React.createClass({
}
});

export default AdminPromocard;
export default AdminAuthorization;
22 changes: 11 additions & 11 deletions app/pages-admin/user-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ const AdminUserList = React.createClass({
UserStore.fetchProfile(id);
},

handleAssignPromocardClick(cip, e) {
handleAssignAuthorizationClick(cip, e) {
e.preventDefault();
if (confirm(`Êtes-vous sûr de vouloir attribuer une promocarte a ${cip}?`)) {
UserStore.assignPromocard(cip);
if (confirm(`Êtes-vous sûr de vouloir autoriser ${cip} à postuler?`)) {
UserStore.assignAuthorization(cip);
}
},

Expand Down Expand Up @@ -119,9 +119,9 @@ const AdminUserList = React.createClass({
},

generateListWithSeparator(s) {
let content = `cip${s}nom${s}courriel${s}jonc${s}points${s}isPromocard${s}isAdmin\n`;
let content = `cip${s}nom${s}courriel${s}jonc${s}points${s}isAuthorized${s}isAdmin\n`;
for(let user of this.state.users) {
content += `${user.cip}${s}${user.name}${s}${user.email}${s}${user.ringSize}${s}${user.totalPoints}${s}${user.promocard && user.promocard.date ? "true": "false"}${s}${user.isAdmin}\n`;
content += `${user.cip}${s}${user.name}${s}${user.email}${s}${user.ringSize}${s}${user.totalPoints}${s}${user.authorization && user.authorization.date ? "true": "false"}${s}${user.isAdmin}\n`;
}

return content;
Expand Down Expand Up @@ -167,7 +167,7 @@ const AdminUserList = React.createClass({
return (
<ul>
{this.renderFetchProfileLink(user)}
{this.renderAssignPromocardLink(user)}
{this.renderAssignAuthorizationLink(user)}
{this.renderAwardPointsLink(user)}
{this.renderMakeAdminLink(user)}
{this.renderAddEmailLink(user)}
Expand All @@ -193,12 +193,12 @@ const AdminUserList = React.createClass({
}
},

renderAssignPromocardLink(user) {
if (user.promocard && user.promocard.date) {
renderAssignAuthorizationLink(user) {
if (user.authorization && user.authorization.date) {
return null;
} else {
const boundOnClick = this.handleAssignPromocardClick.bind(this, user.cip);
return (<li><a href="#" onClick={boundOnClick}>Attribuer une promocarte</a></li>);
const boundOnClick = this.handleAssignAuthorizationClick.bind(this, user.cip);
return (<li><a href="#" onClick={boundOnClick}>Autoriser à postuler</a></li>);
}
},

Expand All @@ -218,7 +218,7 @@ const AdminUserList = React.createClass({
},

renderAwardPointsLink(user) {
if (user.promocard && user.promocard.date) {
if (user.authorization && user.authorization.date) {
let modal = (<AwardPointsModal user={user} onFormSubmit={this.handleAwardPointsSubmit} />);
return (
<li>
Expand Down
Loading

0 comments on commit f015139

Please sign in to comment.