- updated styles
- added edit functionality
This commit is contained in:
Luke Vella 2015-01-12 12:09:00 +01:00
parent 2630cc237a
commit b72dfc474e
21 changed files with 136 additions and 52 deletions

View file

@ -18,6 +18,12 @@ exports.show = function(req, res, next){
});
}
exports.update = function(req, res){
Event.update({ '_id' : req.params.id }, req.body, function(){
return res.status(204).end();
});
}
exports.createParticipant = function(req, res, next){
var eventId = req.params.id;
var participant = req.body;

View file

@ -13,6 +13,7 @@ var EventSchema = new Schema({
title : String,
dates : [Date],
emails : [String],
location: String,
participants : [{
id : Schema.Types.ObjectId,
name : String,

View file

@ -7,5 +7,6 @@ var debug = require('debug')('api/event/index');
router.post('/', controller.create);
router.get('/:id', controller.show);
router.post('/:id/participant', controller.createParticipant);
router.put('/:id', controller.update);
router.delete('/:id/participant/:pid', controller.deleteParticipant);
module.exports = router;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

BIN
public/images/error@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
public/images/nope@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/images/tick@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

View file

@ -1,13 +1,22 @@
angular.module('rallly')
.controller('EventCtrl', function($scope, $http, $state, Event, Participant){
var id = $state.params.id;
$scope.event = Event.get({id:id});
$scope.deleteParticipant = function(pid){
Participant.remove({ id : id , pid : pid }, function(event){
$scope.event = event;
});
$scope.deleteParticipant = function(participant){
if (confirm("Are you sure you want to remove "+participant.name+"?")){
Participant.remove({ id : id , pid : participant._id }, function(event){
$scope.event = event;
});
}
}
$scope.edit = function(index){
}
$scope.update = function(participant){
Event.update({'_id':$scope.event.id}, $scope.event);
}
$scope.save = function(participant){
var participant = new Participant(participant);
participant.$save({id:id}, function(event){

View file

@ -1,9 +1,6 @@
angular.module('rallly')
.controller('NewEventCtrl', function($scope, $http, $state){
$scope.event = {};
$scope.templates = {
modal : 'templates/modal.html'
};
$scope.submit = function(){
$http.post('/api/event', $scope.event)
.success(function(event, status, headers, config){
@ -17,7 +14,6 @@ angular.module('rallly')
})
.error(function(data, status, headers, config){
$scope.errors = data.errors;
console.log(data.errors);
})
}
$scope.clearDates = null
@ -51,15 +47,4 @@ angular.module('rallly')
};
}
}
})
.directive('rallly-error', function(){
return {
restrict : 'A',
scope: {
'message': '='
},
controller : function($scope){
console.log($scope.message);
}
}
});

View file

@ -23,7 +23,9 @@ angular.module('rallly', ['ui.router','ngResource','ngFx'])
})
})
.factory('Event', function($resource){
return $resource('/api/event/:id', { id : '@_id' });
return $resource('/api/event/:id', { id : '@_id' }, {
'update' : { method : 'PUT' }
});
})
.factory('Participant', function($resource){
return $resource('/api/event/:id/participant/:pid', { id: '@_id', pid : '@pid'});

View file

@ -15,7 +15,7 @@
font-weight:600;
color: $dark-gray-clr;
text-decoration:none;
padding: em(10px) em(20px);
padding: em(8px) em(20px);
&:focus {
outline:0;
}

View file

@ -7,6 +7,7 @@
border-radius: 3px;
background:white;
padding: em(10px);
@include transition(border-color 0.1s ease-in-out);
table {
width:100%;
font-size: em($em-base);
@ -161,8 +162,17 @@
position:relative;
cursor:default;
background:white;
.dow {
font-size: em(6px);
margin-top:em(-24px);
background:white;
color: #aaa;
margin-bottom: em(4px);
font-weight:normal;
text-transform: uppercase;
}
.day {
font-size: em(24px);
font-size: em(20px);
font-weight:normal;
color: $red-clr;
line-height: em(16px);

View file

@ -1,39 +1,96 @@
.event-sidebar {
@include span-columns(4);
}
.event-main {
@include span-columns(7);
@include shift(1);
}
.event-author {
font-size: em(14px);
margin-top:em(-30px);
color: $body-clr;
margin-bottom:em(15px);
a {
color: $blue-clr;
text-decoration:none;
}
}
.event-description {
font-size: em(14px);
font-size: em(18px);
line-height: em(21px);
color: $body-clr;
white-space: pre-wrap;
}
.event-poll {
width:100%;
text-align:center;
margin-top:em(-10px);
margin-bottom: em(10px);
th {
text-align:center;
border-bottom:1px solid #ddd;
padding:em(10px);
padding-bottom:em(10px);
box-shadow: 0 3px 0 rgba(black, 0.05);
}
td {
&.center {
text-align:center;
}
padding: em(10px);
border-bottom:1px solid #ddd;
}
.event-poll-user {
text-align:left;
font-size: em(14px);
padding: em(15px) em(10px);
img {
margin-right: 5px;
}
input {
border:1px solid #ddd;
padding: em(5px) em(10px);
border-radius: 3px;
&:focus {
outline:0;
border-color: $primary-clr;
}
}
}
.event-poll-participants {
text-align:left;
padding:0 em(10px);
}
.event-entry-button {
font-size: em(12px);
text-decoration:none;
color: #aaa;
border-radius: 3px;
margin-left: em(5px);
&:hover {
color: $primary-clr;
&.danger {
color: $red-clr;
}
}
}
}
.event-poll-buttons {
text-align:right;
padding: 0 em(10px);
}
.event-detail-list {
list-style:none;
margin-top:em(-20px);
margin-bottom:em(20px);
padding:0;
color: $body-clr;
font-size: em(12px);
li {
display:inline-block;
margin-right: em(40px);
}
a {
color: $text-clr;
text-decoration:none;
&:hover {
color: $primary-clr;
}
}
}
.event-details {
margin-bottom: em(40px);
}
.event-button-tip {
font-size: em(11px);
color: #C4CAD2;
display:inline-block;
margin-right: em(10px);
}

View file

@ -0,0 +1,11 @@
.form-success {
text-align:center;
}
.form-success-url {
font-size: em(36px);
text-align:center;
border-radius: 3px;
border: 1px solid #eee;
color: $text-clr;
}

View file

@ -53,6 +53,7 @@
border-radius: 3px;
border: 1px solid #ddd;
font-size:em(18px);
@include transition(border-color 0.1s ease-in-out);
&:focus {
border-color: $primary-clr;
outline:none;
@ -66,6 +67,7 @@
}
&.error {
input.form-control, textarea.form-control {
border-color: $red-clr;
background: rgba($red-clr,0.02);
}
@ -75,6 +77,7 @@
}
textarea.form-control {
min-height: 100px;
font-size: em(14px);
padding: em(8px) em(10px);
}
}

View file

@ -1,8 +1,7 @@
.header {
border-bottom: 1px solid #ddd;
border-top: 5px solid $primary-clr;
@include row();
@include pad(em(20px) em(40px));
@include linear-gradient(white, transparent 50%, $fallback:transparent);
.primary-section {
@include span-columns(6);
}