Merge pull request #73 from alberanid/master

added awesomeness
This commit is contained in:
Davide Alberani 2015-05-05 22:09:17 +02:00
commit f55368fe89
8 changed files with 161 additions and 135 deletions

View file

@ -1,54 +1,63 @@
<!-- edit details of an Event -->
<div class="container">
<h1><span ng-if="!event.title">{{'New event' | translate}}</span>{{event.title}}&nbsp;
<button ng-if="event._id" ng-click="$state.go('event.info', {id: event._id})" class="btn btn-success">
<span class="glyphicon glyphicon-info-sign"></span>
{{'Info' | translate}}
</button>
</h1>
<form name="eventForm" ng-model="eventdetails" ng-submit="save()">
<div ng-class="{clearfix: true, alert: true, 'alert-success': !eventForm.$dirty, 'alert-danger': eventForm.$dirty}">
<button type="button" class="btn btn-default pull-right" ng-click="save($event)" ng-disabled="!eventForm.$dirty">{{'save' | translate}}</button>
<div class="panel panel-primary table-striped top5">
<div class="panel-heading">
<h1>
<button ng-if="event._id" ng-click="$state.go('event.info', {id: event._id})" class="btn btn-success">
<span class="fa fa-info-circle vcenter"></span>
{{'Info' | translate}}
</button>
&nbsp;<span ng-if="!event.title">{{'New event' | translate}}</span>{{event.title}}
</h1>
</div>
<div class="input-group input-group-lg">
<span class="input-group-addon min100">{{'Title' | translate}}</span>
<input type="text" class="form-control" placeholder="{{'Title' | translate}}" ng-model="event.title" ng-required="1">
</div>
<div class="input-group top5 well form-horizontal" ng-controller="DatetimePickerCtrl">
<div class="form-group">
<label for="begin-date" class="col-sm-3 control-label">{{'begin date:' | translate}}</label>
<div id="begin-date" class="input-group col-sm-9">
<input type="text" class="form-control" datepicker-popup="dd-MMMM-yyyy" ng-model="event['begin-date']" is-open="opened" ng-required="true" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
<div class="panel-body">
<form name="eventForm" ng-model="eventdetails" ng-submit="save()">
<div ng-class="{clearfix: true, alert: true, 'alert-success': !eventForm.$dirty, 'alert-danger': eventForm.$dirty}">
<button type="button" class="btn btn-default pull-right" ng-click="save($event)" ng-disabled="!eventForm.$dirty">
<span class="fa fa-floppy-o vcenter"></span>
{{'save' | translate}}
</button>
</div>
</div>
<div class="form-group">
<label for="begin-time" class="col-sm-3 control-label">{{'begin time:' | translate}}</label>
<timepicker id="begin-time" class="input-group" ng-model="event['begin-time']" show-meridian="false"></timepicker>
</div>
</div>
<div class="input-group top5 well form-horizontal" ng-controller="DatetimePickerCtrl">
<div class="form-group">
<label for="end-date" class="col-sm-3 control-label">{{'End date:' | translate}}</label>
<div id="end-date" class="input-group col-sm-9">
<input type="text" class="form-control" datepicker-popup="dd-MMMM-yyyy" ng-model="event['end-date']" is-open="opened" ng-required="true" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
<div class="input-group input-group-lg">
<span class="input-group-addon min100">{{'Title' | translate}}</span>
<input type="text" class="form-control" placeholder="{{'Title' | translate}}" ng-model="event.title" ng-required="1">
</div>
</div>
<div class="form-group">
<label for="end-time" class="col-sm-3 control-label">{{'End time:' | translate}}</label>
<timepicker id="end-time" class="input-group" ng-model="event['end-time']" show-meridian="false"></timepicker>
</div>
</div>
<input type="submit" class="outside-screen" />
</form>
<div class="input-group top5 well form-horizontal" ng-controller="DatetimePickerCtrl">
<div class="form-group">
<label for="begin-date" class="col-sm-3 control-label">{{'begin date:' | translate}}</label>
<div id="begin-date" class="input-group col-sm-9">
<input type="text" class="form-control" datepicker-popup="dd-MMMM-yyyy" ng-model="event['begin-date']" is-open="opened" ng-required="true" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)"><i class="fa fa-calendar"></i></button>
</span>
</div>
</div>
<div class="form-group">
<label for="begin-time" class="col-sm-3 control-label">{{'begin time:' | translate}}</label>
<timepicker id="begin-time" class="input-group" ng-model="event['begin-time']" show-meridian="false"></timepicker>
</div>
</div>
<div class="input-group top5 well form-horizontal" ng-controller="DatetimePickerCtrl">
<div class="form-group">
<label for="end-date" class="col-sm-3 control-label">{{'End date:' | translate}}</label>
<div id="end-date" class="input-group col-sm-9">
<input type="text" class="form-control" datepicker-popup="dd-MMMM-yyyy" ng-model="event['end-date']" is-open="opened" ng-required="true" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)"><i class="fa fa-calendar"></i></button>
</span>
</div>
</div>
<div class="form-group">
<label for="end-time" class="col-sm-3 control-label">{{'End time:' | translate}}</label>
<timepicker id="end-time" class="input-group" ng-model="event['end-time']" show-meridian="false"></timepicker>
</div>
</div>
<input type="submit" class="outside-screen" />
</form>
</div>
</div>
</div>

View file

@ -6,7 +6,7 @@
<div class="col-md-7 col-xs-7 vcenter">
<h1>{{event.title}}
<button ng-if="event._id" ng-click="$state.go('event.edit', {id: event._id})" class="btn btn-success">
<span class="glyphicon glyphicon-edit"></span>
<span class="fa fa-pencil-square-o vcenter"></span>
{{'Edit' | translate}}
</button>
</h1>
@ -56,18 +56,18 @@
<p ng-if="person.company || person.job_title"><i ng-if="person.job_title">{{person.job_title}}</i><span ng-if="person.company && person.job_title">&nbsp;@&nbsp;</span><i ng-if="person.company">{{person.company}}</i></p>
</td>
<td class="text-center">
<button class="btn btn-link" reset-focus name="switch-attended" ng-click="setPersonAttributeAndRefocus(person, 'attended', !person.attended)"><span class="glyphicon {{(person.attended) && 'glyphicon-ok-sign text-success' || 'glyphicon-remove-sign text-danger'}}"></span></button>
<button class="btn btn-link" reset-focus name="switch-attended" ng-click="setPersonAttributeAndRefocus(person, 'attended', !person.attended)"><span class="fa fa-lg {{(person.attended) && 'fa-check-circle text-success' || 'fa-times-circle text-danger'}}"></span></button>
</td>
<td class="text-center" ng-repeat="col in customFields">
<span ng-if="col.type == 'boolean'">
<button class="btn btn-link" ng-click="setPersonAttribute(person, col.key, !person[col.key])"><span class="glyphicon {{(person[col.key]) && 'glyphicon-ok-sign text-success' || 'glyphicon-remove-sign text-danger'}}"></span></button>
<button class="btn btn-link" ng-click="setPersonAttribute(person, col.key, !person[col.key])"><span class="fa fa-lg {{(person[col.key]) && 'fa-check-circle text-success' || 'da-times-circle text-danger'}}"></span></button>
</span>
<span ng-if="col.type != 'boolean'">
{{person[col.key]}}
</span>
</td>
<td class="text-center">
<button ng-click="removeAttendee(person)" type="button" class="btn btn-link glyphicon glyphicon-trash"></button>
<button ng-click="removeAttendee(person)" type="button" class="btn btn-link fa fa-lg fa-trash"></button>
</td>
</tr>
</tbody>
@ -104,7 +104,7 @@
</div>
<button reset-focus ng-disabled="!(newPerson.name && newPerson.surname)" ng-click="fastAddPerson(newPerson, true)" class="btn btn-success top5">
<span class="glyphicon glyphicon-plus-sign"></span>
<span class="fa fa-plus-circle vcenter"></span>
{{'Add' | translate}}
</button>
</form>
@ -129,7 +129,7 @@
{{person.email}}
</td>
<td class="text-left">
<button reset-focus ng-click="fastAddPerson(person)" type="button" class="btn btn-link glyphicon glyphicon-plus-sign"></button>
<button reset-focus ng-click="fastAddPerson(person)" type="button" class="btn btn-link fa fa-plus-circle vcenter"></button>
</td>
</tr>
</tbody>

View file

@ -2,7 +2,7 @@
<div class="container">
<h1>{{'Events' | translate}}
<button ng-click="$state.go('event.new')" class="btn btn-success">
<span class="glyphicon glyphicon-plus-sign"></span>
<span class="fa fa-plus-circle vcenter"></span>
{{'Add event' | translate}}
</button>
</h1>
@ -41,7 +41,7 @@
{{'Ends:' | translate}} {{event['end-date']}}</p>
</td>
<td>
<button ng-click="remove(event._id)" type="button" class="btn btn-link glyphicon glyphicon-trash"></button>
<button ng-click="remove(event._id)" type="button" class="btn btn-link fa fa-trash fa-lg"></button>
</td>
</tr>
</tbody>

View file

@ -51,7 +51,12 @@
<li ng-class="{active: n.isActive('/persons') || n.isActive('/person') || n.isActive('/import/persons')}"><a ui-sref="persons">{{'Persons' | translate}}</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="/logout">{{'logout' | translate}}</a></li>
<li>
<button class="btn btn-link">
<span class="fa fa-sign-out vcenter"></span>
<a href="/logout">{{'logout' | translate}}</a>
</button>
</li>
</ul>
</div>
</div>

View file

@ -82,8 +82,8 @@ eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', '$modal', '
);
eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person', 'EventUpdates', '$stateParams', 'Setting', '$log',
function ($scope, Event, Person, EventUpdates, $stateParams, Setting, $log) {
eventManControllers.controller('EventDetailsCtrl', ['$scope', '$state', 'Event', 'Person', 'EventUpdates', '$stateParams', 'Setting', '$log',
function ($scope, $state, Event, Person, EventUpdates, $stateParams, Setting, $log) {
$scope.personsOrder = ["name", "surname"];
$scope.countAttendees = 0;
$scope.message = {};
@ -101,20 +101,22 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
}
);
});
// Handle WebSocket connection used to update the list of persons.
$scope.EventUpdates = EventUpdates;
$scope.EventUpdates.open();
$scope.$watchCollection(function() {
return $scope.EventUpdates.data;
}, function(prev, old) {
if (!($scope.EventUpdates.data && $scope.EventUpdates.data.persons)) {
return;
}
$scope.event.persons = $scope.EventUpdates.data.persons;
}
);
$scope.allPersons = Person.all();
if ($state.is('event.info')) {
// Handle WebSocket connection used to update the list of persons.
$scope.EventUpdates = EventUpdates;
$scope.EventUpdates.open();
$scope.$watchCollection(function() {
return $scope.EventUpdates.data;
}, function(prev, old) {
if (!($scope.EventUpdates.data && $scope.EventUpdates.data.persons)) {
return;
}
$scope.event.persons = $scope.EventUpdates.data.persons;
}
);
}
}
$scope.updateOrded = function(key) {
@ -147,7 +149,7 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
} else {
$scope.event = Event.update(this_event);
}
$scope.eventForm.$dirty = false;
$scope.eventForm.$setPristine(false);
};
$scope.calcAttendees = function() {
@ -348,7 +350,7 @@ eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$stateParams', '
}
});
}
$scope.personForm.$dirty = false;
$scope.personForm.$setPristine(false);
};
$scope.setPersonAttributeAtEvent = function(evnt, key, value) {

View file

@ -1,59 +1,69 @@
<!-- show details of a Person -->
<div class="container">
<h1><span ng-if="!(person.name || person.surname)">{{'New person' | translate}}</span>{{person.name}} {{person.surname}}&nbsp;
<button ng-if="person._id" ng-click="$state.go('person.info', {id: person._id})" class="btn btn-success">
<span class="glyphicon glyphicon-info-sign"></span>
{{'Info' | translate}}
</button>
</h1>
<form name="personForm" ng-model="persondetails" ng-submit="save()">
<div ng-class="{clearfix: true, alert: true, 'alert-success': !personForm.$dirty, 'alert-danger': personForm.$dirty}">
<button type="button" class="btn btn-default pull-right" ng-click="save($event)" ng-disabled="!personForm.$dirty">{{'save' | translate}}</button>
<div class="panel panel-primary table-striped top5">
<div class="panel-heading">
<h1>
<button ng-if="person._id" ng-click="$state.go('person.info', {id: person._id})" class="btn btn-success">
<span class="fa fa-info-circle vcenter"></span>
{{'Info' | translate}}
</button>
&nbsp;<span ng-if="!(person.name || person.surname)">{{'New person' | translate}}</span>{{person.name}} {{person.surname}}
</h1>
</div>
<div class="panel-body">
<div class="input-group input-group-lg">
<span class="input-group-addon min120">{{'Name' | translate}}</span>
<input type="text" class="form-control" placeholder="{{'Name' | translate}}" ng-model="person.name" ng-required="1">
<form name="personForm" ng-model="persondetails" ng-submit="save()">
<div ng-class="{clearfix: true, alert: true, 'alert-success': !personForm.$dirty, 'alert-danger': personForm.$dirty}">
<button type="button" class="btn btn-default pull-right" ng-click="save($event)" ng-disabled="!personForm.$dirty">
<span class="fa fa-floppy-o vcenter"></span>
{{'save' | translate}}
</button>
</div>
<div class="input-group input-group-lg">
<span class="input-group-addon min120">{{'Name' | translate}}</span>
<input type="text" class="form-control" placeholder="{{'Name' | translate}}" ng-model="person.name" ng-required="1">
</div>
<div class="input-group input-group-lg top5">
<span class="input-group-addon min120">{{'Surname' | translate}}</span>
<input type="text" class="form-control" placeholder="{{'Surname' | translate}}" ng-model="person.surname">
</div>
<div class="input-group input-group-lg top5">
<span class="input-group-addon min120">{{'Email' | translate}}</span>
<input type="email" name="email" class="form-control" placeholder="{{'name.surname@example.com' | translate}}" ng-model="person.email">
</div>
<div class="input-group input-group-lg top5">
<span class="input-group-addon min120">{{'Company' | translate}}</span>
<input name="company" class="form-control" placeholder="{{'Acme Corporation' | translate}}" ng-model="person.company">
</div>
<div class="input-group input-group-lg top5">
<span class="input-group-addon min120">{{'Job' | translate}}</span>
<input name="job_title" class="form-control" placeholder="{{'Evil Ruler' | translate}}" ng-model="person.job_title">
</div>
<div class="form-group top5">
<label for="addToEvent">{{'Add to event:' | translate}}</label>
<select class="form-control" id="addToEvent" ng-model="addToEvent">
<option value=""></option>
<option ng-repeat="event in events | eventWithPersonData:false" value="{{event._id}}">{{event.title}}</option>
</select>
<option>
<tr ng-repeat="event in events | splittedFilter:query | orderBy:eventsOrderProp">
</div>
<div ng-repeat="custom in customFields" class="form-group top5">
<label for="custom_{{custom['key']}}">{{custom.label | translate}}</span>
<input ng-if="custom.type == 'boolean'" id="custom_{{custm['key']}}" type="checkbox" class="form-control" placeholder="{{custom.label | translate}}" ng-model="person[custom.key]">
<input ng-if="custom.type != 'boolean'" id="custom_{{custm['key']}}" type="text" class="form-control" placeholder="{{custom.label | translate}}" ng-model="person[custom.key]">
</div>
<input type="submit" class="outside-screen" />
</form>
</div>
<div class="input-group input-group-lg top5">
<span class="input-group-addon min120">{{'Surname' | translate}}</span>
<input type="text" class="form-control" placeholder="{{'Surname' | translate}}" ng-model="person.surname">
</div>
<div class="input-group input-group-lg top5">
<span class="input-group-addon min120">{{'Email' | translate}}</span>
<input type="email" name="email" class="form-control" placeholder="{{'name.surname@example.com' | translate}}" ng-model="person.email">
</div>
<div class="input-group input-group-lg top5">
<span class="input-group-addon min120">{{'Company' | translate}}</span>
<input name="company" class="form-control" placeholder="{{'Acme Corporation' | translate}}" ng-model="person.company">
</div>
<div class="input-group input-group-lg top5">
<span class="input-group-addon min120">{{'Job' | translate}}</span>
<input name="job_title" class="form-control" placeholder="{{'Evil Ruler' | translate}}" ng-model="person.job_title">
</div>
<div class="form-group top5">
<label for="addToEvent">{{'Add to event:' | translate}}</label>
<select class="form-control" id="addToEvent" ng-model="addToEvent">
<option value=""></option>
<option ng-repeat="event in events | eventWithPersonData:false" value="{{event._id}}">{{event.title}}</option>
</select>
<option>
<tr ng-repeat="event in events | splittedFilter:query | orderBy:eventsOrderProp">
</div>
<div ng-repeat="custom in customFields" class="form-group top5">
<label for="custom_{{custom['key']}}">{{custom.label | translate}}</span>
<input ng-if="custom.type == 'boolean'" id="custom_{{custm['key']}}" type="checkbox" class="form-control" placeholder="{{custom.label | translate}}" ng-model="person[custom.key]">
<input ng-if="custom.type != 'boolean'" id="custom_{{custm['key']}}" type="text" class="form-control" placeholder="{{custom.label | translate}}" ng-model="person[custom.key]">
</div>
<input type="submit" class="outside-screen" />
</form>
</div>
</div>

View file

@ -2,7 +2,7 @@
<div class="container">
<h1>{{person.name}} {{person.surname}}
<button ng-if="person._id" ng-click="$state.go('person.edit', {id: person._id})" class="btn btn-success">
<span class="glyphicon glyphicon-edit"></span>
<span class="fa fa-pencil-square-o vcenter"></span>
{{'Edit' | translate}}
</button>
</h1>
@ -28,18 +28,18 @@
<thead>
<tr>
<th>{{'Event' | translate}}</th>
<th>{{'Registered' | translate}}</th>
<th>{{'Attended' | translate}}</th>
<th class="text-center">{{'Registered' | translate}}</th>
<th class="text-center">{{'Attended' | translate}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="event in events | splittedFilter:query | orderBy:eventsOrderProp">
<td><strong><a ui-sref="event.info({id: event._id})">{{event.title}}</a></strong></td>
<td>
<button class="btn btn-link" name="switch-registered" ng-click="switchRegistered(event, person, !event.person_data.person_id)"><span class="glyphicon {{(event.person_data.person_id) && 'glyphicon-ok-sign text-success' || 'glyphicon-remove-sign text-danger'}}"></span></button>
<td class="text-center">
<button class="btn btn-link" name="switch-registered" ng-click="switchRegistered(event, person, !event.person_data.person_id)"><span class="fa fa-lg {{(event.person_data.person_id) && 'fa-check-circle text-success' || 'fa-times-circle text-danger'}}"></span></button>
</td>
<td>
<button ng-disabled="!event.person_data.person_id" class="btn btn-link" name="switch-attended" ng-click="setPersonAttributeAtEvent(event, 'attended', !event.person_data.attended)"><span class="glyphicon {{(event.person_data.attended) && 'glyphicon-ok-sign text-success' || 'glyphicon-remove-sign text-danger'}}"></span></button>
<td class="text-center">
<button ng-disabled="!event.person_data.person_id" class="btn btn-link" name="switch-attended" ng-click="setPersonAttributeAtEvent(event, 'attended', !event.person_data.attended)"><span class="fa fa-lg {{(event.person_data.attended) && 'fa-check-circle text-success' || 'fa-times-circle text-danger'}}"></span></button>
</td>
</tr>
</tbody>

View file

@ -5,11 +5,11 @@
<div class="col-md-7 col-xs-7 vcenter">
<h1>{{'Persons' | translate}}
<button ng-click="$state.go('person.new')" class="btn btn-success">
<span class="glyphicon glyphicon-plus-sign"></span>
<span class="fa fa-plus-circle vcenter"></span>
{{'Add person' | translate}}
</button>
<button ng-click="$state.go('import.persons')" class="btn btn-success">
<span class="glyphicon glyphicon-plus-sign"></span>
<span class="fa fa-download vcenter"></span>
{{'Import persons' | translate}}
</button>
</h1>
@ -53,14 +53,14 @@
</td>
<td ng-repeat="col in customFields" class="text-center">
<span ng-if="col.type == 'boolean'">
<button class="btn btn-link" ng-click="setAttribute(person, col.key, !person[col.key])"><span class="glyphicon {{(person[col.key]) && 'glyphicon-ok-sign text-success' || 'glyphicon-remove-sign text-danger'}}"></span></button>
<button class="btn btn-link" ng-click="setAttribute(person, col.key, !person[col.key])"><span class="fa fa-lg {{(person[col.key]) && 'fa-check-circle text-success' || 'fa-times-circle text-danger'}}"></span></button>
</span>
<span ng-if="col.type != 'boolean'">
{{person[col.key]}}
</span>
</td>
<td class="text-center">
<button ng-click="remove(person._id)" type="button" class="btn btn-link glyphicon glyphicon-trash"></button>
<button ng-click="remove(person._id)" type="button" class="btn btn-link fa fa-trash fa-lg"></button>
</td>
</tr>
</tbody>