config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/registration/:registrationId', {templateUrl: 'partials/registration.html', controller: RegistrationCtrl});
$routeProvider.when('/confirmation/:registrationId', {templateUrl: 'partials/confirmation.html', controller: RegistrationCtrl});
+ $routeProvider.when('/draft/:registrationId', {templateUrl: 'partials/draft.html', controller: RegistrationCtrl});
$routeProvider.when('/list', {templateUrl: 'partials/list.html', controller: ListCtrl});
- $routeProvider.when('/view2', {templateUrl: 'partials/partial2.html', controller: MyCtrl2});
$routeProvider.otherwise({redirectTo: '/registration/'});
}]);
$scope.$location = $location;
$scope.organizations = [];
- $scope.update = function(registration) {
+ $scope.update = function(registration, state) {
+
+ registration.state = state;
if ( ! $scope.has_work && registration.work ) {
delete( registration.work );
registration.$save( function(registration) {
$log.info("saved", registration);
- $log.info('id =', registration.id);
- if ( registration.id ) {
- $location.path( '/confirmation/' + registration.id );
+ $log.info('id =', registration.id, 'state = ', registration.state);
+ if ( registration.id && registration.state ) {
+ $location.path( '/' + registration.state + '/' + registration.id );
} else {
$log.error("can't find id in ", registration);
}
--- /dev/null
+<h1> Registracija i prijavljivanje izlaganja</h1>
+
+
+<div ng-controller="RegistrationCtrl" name="RegistrationForm">
+
+<div class="alert alert-success">
+<%= locale
+en => 'Your draft of registration is saved. Bookmark this page to access it later.',
+hr => 'Registracija privremeno spremljena. Dodajte stranicu u bookmark da bi je mogli kasnije mijenjati.' %>
+</div>
+
+<div class="well">
+%= include 'registration/view'
+</div>
+
+</div>
+
+% if ( $lang =~ m/-dev/ ) {
+<pre>
+user={{user}}
+
+$routeParams={{$routeParams}}
+
+{{RegistrationForm.$valid}}
+{{RegistrationForm.$error}}
+
+location={{$location}}
+
+</pre>
+% }
+
+</div>
+
+
</div><!-- user.registration_type == 'symposium' -->
-<button class="controls-row btn btn-primary" ng-click="update(registration)" ng-show="RegistrationForm.$valid"><%= locale en=>'Submit',hr=>'Pošalji' %></button>
+<button class="controls-row btn btn-primary" ng-click="update(registration,'confirmation')" ng-show="RegistrationForm.$valid"><%= locale en=>'Submit',hr=>'Pošalji' %></button>
<p class="well" style="color: red" ng-show="! RegistrationForm.$valid">
<%= locale
en => 'Please fill all required fields correctly. Fields with red border call for your attention.',
hr => 'Molimo ispunite sva obavezna polja označena crvenim okvirom.'
%>
-<button class="controls-row btn btn-info" ng-click="update(registration)" ng-show="RegistrationForm.$dirty"><%= locale en=>'Save draft',hr=>'Spremi privremeno' %></button>
+<button class="controls-row btn btn-info" ng-click="update(registration,'draft')" ng-show="RegistrationForm.$dirty"><%= locale en=>'Save draft',hr=>'Spremi privremeno' %></button>
</p>
<input style="float:right" title="validation errors" type=checkbox name=debug ng-click="debug = ! debug">
<a class="btn" href="#/registration/{{registration.id}}">edit</a>
{{registration.user.registration_type}}
{{registration._id | registration_date_time}}
- <a class="btn" href="#/{{registration.status}}/{{registration.id}}" title="{{registration.status}}"><tt>{{registration.id}}</tt></a>
- {{registration.status}}
+ <a class="btn" href="#/{{registration.state}}/{{registration.id}}" title="{{registration.state}}" ng-show="registration.state"><tt>{{registration.id}}</tt></a>
+ {{registration.state}}
% if ( $lang =~ m/-dev/ ) {
<a class="btn" href="<%= $couchdb_view %>/{{registration._id}}" target="couchdb">couchdb</a>
% }