controller logic to show submission and registration radio buttons
[angular-drzb] / app / partials / registration.html.ep
index 86404d7..24e1364 100644 (file)
@@ -7,13 +7,13 @@
 %= include( "drzb2013/intro.$lang" );
 </div>
 
-<form ng-controller="RegistrationCtrl" name="RegistrationForm">
+<form ng-controller="RegistrationCtrl" name="RegistrationForm" class="span12">
 
-<fieldset class="controls">
+<fieldset class="controls" ng-show="show_submission_type()">
 
 <legend><%= locale
        en => 'Registration type',
-       hr => 'Odaberite tip registracije'
+       hr => 'Odaberite tip prijave'
 %></legend>
 
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="lecture" ><%= locale
@@ -21,7 +21,7 @@
        hr => 'Prijava usmenog izlaganja',
 %></label>
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="poster" ><%= locale
-       en => 'Poster prezentation',
+       en => 'Poster presentation',
        hr => 'Prijava poster prezentacije'
 %></label>
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="symposium" ><%= locale
     en => 'Round table',
        hr => 'Prijava okruglog stola',
 %></label>
-<hr />
+
+</fieldset>
+
+<fieldset class="controls" ng-show="show_registration_type()">
+
+<legend><!-- show line -->
+</legend>
+
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="participant" ><%= locale
     en => 'Registration',
        hr => 'Registracija'
 %></label>
+
 <label class="radio"><input type="radio" ng-model="user.registration_type" value="accomp" ><%= locale
     en => 'Registration for accompanying persons',
        hr => 'Registracija za osobe u pratnji' %>
 </label>
+
 </fieldset>
 
 <fieldset ng-show="user.registration_type">
@@ -55,33 +64,31 @@ hr => 'Registracija - kontakt podaci'
 % my $Organization = locale( en => 'Organization', hr => 'Organizacija' );
 % my $Email = locale( en => 'E-mail', hr => 'E-pošta' );
 
-<div class="controls controls-row">
+<div class="controls-row">
  <input class="my-input span5" ng-model="user.firstname" placeholder="<%= $Name %>" ng-required="true" />
  <input class="my-input span5" ng-model="user.surname"   placeholder="<%= $Surname %>" ng-required="true" />
 </div>
 
-<div class="controls controls-row">
- <input class="my-input span10" ng-model="user.organization" placeholder="<%= $Organization %>" >
+<div class="controls-row">
+ <input class="my-input span10" ng-model="user.organization" placeholder="<%= $Organization %>" bs-typeahead="organizations" data-items="10" >
 </div>
 
 % my $Address = locale en => 'Address', hr => 'Adresa';
-<div class="controls controls-row">
+<div class="controls-row">
  <input class="my-input span10" ng-model="user.address" placeholder="<%= $Address %>" >
 </div>
 
-<div class="controls controls-row">
+<div class="controls-row">
  <input class="my-input span3" ng-model="user.city" placeholder="<%= locale en => 'City', hr => 'Grad' %>" ng-required="true" >
  <input class="my-input span3" ng-model="user.zip_code" placeholder="<%= locale en => 'ZIP', hr => 'Poštanski br.' %>" >
  <input class="my-input span4" ng-model="user.country" placeholder="<%= locale en => 'Country', hr => 'Zemlja' %>" >
 </div>
 
-<div class="controls controls-row">
+<div class="controls-row">
  <input class="my-input span5" ng-model="user.email" type="email" placeholder="<%= $Email %>" ng-required="true" />
  <input class="my-input span5" ng-model="user.phone" placeholder="<%= locale en => 'Phone number', hr => 'Tel. broj' %>" />
 </div>
 
-<legend>
-</legend>
 <label class="checkbox">
  <input ng-model="user.student" type="checkbox" ng-change="change_student()">
  <%= locale 
@@ -91,7 +98,7 @@ hr => 'Označite ako ste student' %>
 
 <div ng-show="! user.student">
 
-%# FIXME: skip for en
+% if ( $lang =~ m/hr/ ) {
 
 <label class="checkbox">
  <input ng-model="user.hpd_member" type="checkbox">
@@ -113,11 +120,14 @@ en => 'Organization contact details',
 hr => 'Organizacija koja uplaćuje R-1 račun' %>
 </legend>
 
-<input class="my-input span10" ng-model="user.r1.organization" ng-required="user.r1.required" placeholder="<%= $Organization %>">
+<input class="my-input span10" ng-model="user.r1.organization" ng-required="user.r1.required" placeholder="<%= $Organization %>" bs-typeahead="organizations" >
 <input class="my-input span10" ng-model="user.r1.address" ng-required="user.r1.required" placeholder="<%= $Address %>">
 <input class="my-input span5" ng-model="user.r1.OIB" ng-required="user.r1.required" placeholder="OIB">
 
 </div><!-- r1.required -->
+
+% } # $lang ne 'en'
+
 </div><!-- ! user.student -->
 
 % my $Yes = locale( en => 'Yes', hr => 'Da' );
@@ -154,8 +164,7 @@ hr => 'Večera je uključena u kotizaciju.' %>
 
 </fieldset><!-- selected registration_type -->
 
-
-<div ng-show="has_work">
+<fieldset ng-show="has_work">
 
 <div ng-switch on="work.type">
 <h2 ng-switch-when="lecture"><%= locale en=>'Oral presentation submission', hr=>'Prijava usmenog izlaganja' %></h2>
@@ -169,8 +178,8 @@ hr => 'Večera je uključena u kotizaciju.' %>
 
 % my $WorkTemplate = begin
        % my $has_h3_note = shift;
-<div class="controls controls-row">
- <input class="span10 my-input" ng-model="work.title" placeholder="<%= $Title %>" ng-required="has_work" >
+<div class="controls-row">
+ <input class="span10 my-input" ng-model="work.title" placeholder="<%= $Title %>" ng-required="has_work" />
 </div>
 
 % if ( $has_h3_note ) {
@@ -182,41 +191,52 @@ hr => 'Organizator simpozija' %>
 % }
 
 
-<div ng-repeat="person in work.persons" class="controls controls-row">
+<div ng-repeat="person in work.persons" class="controls-row">
        <input class="span2 my-input" ng-model="person.firstname" placeholder="<%= $Name %>" ng-required="has_work" />
        <input class="span2 my-input" ng-model="person.surname"   placeholder="<%= $Surname %>" ng-required="has_work" />
-       <input class="span2 my-input" ng-model="person.organization" placeholder="<%= $Organization %>" >
+       <input class="span4 my-input" ng-model="person.organization" placeholder="<%= $Organization %>" bs-typeahead="organizations" />
        <input class="span2 my-input" ng-model="person.email" type="email" placeholder="<%= $Email %>" ng-required="has_work" />
-       <a class="controls span1 btn btn-danger" href="" ng-click="removePerson(work.persons,person)"><%= locale en => 'delete', hr => 'obriši' %></a>
+       <div class="span1"><label>&nbsp;</label>
+     <input type="button" class="btn btn-danger" ng-click="removePerson(work.persons,person)" value="<%= locale en => 'delete', hr => 'obriši' %>" />
+    </div>
+</div>
+<div class="controls-row">
+<input type="button" class="btn" ng-click="addPerson(work.persons)" value="<%= locale en=>'add person',hr=>'dodaj osobu' %>" />
 </div>
-<a class="btn" href="" ng-click="addPerson(work.persons)"><%= locale en=>'add person',hr=>'dodaj osobu' %></a>
-<div class="controls">
- <label>
+
+<div class="controls-row">
+<label class="{{class = abstract_class(work)}}">
 <%= locale
-en => 'Abstract ({{work.abstract.length || 0}}  from max. 2000 characters with spaces)',
-hr => 'Sažetak ({{work.abstract.length || 0}}  od maks. 2000 znakova s razmacima)'
+en => 'Abstract ({{abstract_length(work)}}  from max. 2000 characters with spaces)',
+hr => 'Sažetak ({{abstract_length(work)}}  od maks. 2000 znakova s razmacima)'
 %>
- </label>
- <textarea class="span10" ng-model="work.abstract" ng-maxlength="2000" rows="10" cols="80" ng-required="has_work" ></textarea>
+<textarea class="controls-row span11 {{class}}" ng-model="work.abstract" ng-minlength="2" rows="10" cols="80" ng-required="has_work"></textarea>
+<input type="text" ng-maxlength="2000" ng-model="work.abstract" style="display: none">
+</label>
 </div>
+
 % end
 
 <%= $WorkTemplate->(1) %>
 
-</div><!-- has_work -->
+</fieldset><!-- has_work -->
 
-<div ng-show="user.registration_type == 'symposium'">
+<div ng-show="user.registration_type == 'symposium'" id="symposium-works">
 
 <h2><%= locale
 en=>'Submission of works for the symposium {{work.title}}',
 hr=>'Prijava radova unutar simpozija {{work.title}}' %>
 </h2>
 
-<div ng-repeat="work in work.symposium_works">
+<div ng-repeat="work in work.symposium_works" class="control-row work">
 
 <h3><%= locale
 en=>'{{$index + 1}}. symposium work',
 hr=>'{{$index + 1}}. rad na simpoziju' %>
+<a class="btn btn-danger" href="" ng-click="symposium_work_remove($index)" ng-show="$index > 3"><%= locale
+en => 'delete this symposum work',
+hr => 'obriši rad na simpoziju' %>
+</a>
 </h3>
 
 <%= $WorkTemplate->(0) %>
@@ -230,25 +250,30 @@ hr => 'Dodaj još jedan rad na simpoziju' %>
 
 </div><!-- user.registration_type == 'symposium' -->
 
-<div class="form-actions">
- <button class="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" id="update-registration" ng-click="update(registration,'confirmation')" ng-show="RegistrationForm.$valid"><%= locale en=>'Submit',hr=>'Pošalji' %></button>
 
-<p class="left" style="color: red" ng-show="! RegistrationForm.$valid">
+<p class="well" style="color: red" ng-show="! RegistrationForm.$valid && RegistrationForm.$dirty">
 <%= 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" id="update-draft" ng-click="update(registration,'draft')" ng-show="RegistrationForm.$dirty"><%= locale en=>'Save draft',hr=>'Spremi privremeno' %></button>
 </p>
-</div>
 
-<!--
-<pre>
+<input style="float:right" title="validation errors" type=checkbox name=debug ng-click="debug = ! debug">
+<pre ng-show="debug">
 {{RegistrationForm.$valid}}
 {{RegistrationForm.$error}}
+</pre>
 
+% if ( $lang =~ m/-dev/ ) {
+<pre class="controls-row">
 location={{$location.path()}}
+location={{$location}}
 
+{{registration}}
 </pre>
--->
+% }
+
 </form>