server-side templates using localization
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 8 Jan 2013 20:15:13 +0000 (21:15 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 8 Jan 2013 20:45:10 +0000 (21:45 +0100)
app/drzb2013.html.ep [new file with mode: 0644]
app/partials/registration.html.ep [new file with mode: 0644]

diff --git a/app/drzb2013.html.ep b/app/drzb2013.html.ep
new file mode 100644 (file)
index 0000000..712c77d
--- /dev/null
@@ -0,0 +1,70 @@
+<!doctype html>
+<html lang="<%= $lang %>" ng-app="myApp" xmlns:ng="http://angularjs.org">
+<head>
+  <meta charset="utf-8">
+  <title><%= locale
+       en => 'Conference registration',
+       hr => 'Registracija za konferenciju'
+  %></title>
+
+  <!-- Twtitter bootstrap -->
+  <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css" />
+  <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap-responsive.min.css" />
+
+  <link rel="stylesheet" href="/css/app.css"/>
+  <link rel="stylesheet" href="/css/drzb2013.css"/>
+
+    <!--[if lte IE 8]>
+      <script>
+        document.createElement('ng-include');
+        document.createElement('ng-pluralize');
+        document.createElement('ng-view');
+        // Optionally these for CSS
+        document.createElement('ng:include');
+        document.createElement('ng:pluralize');
+        document.createElement('ng:view');
+      </script>
+    <![endif]-->
+
+</head>
+<body>
+
+% if ( param('admin') ) {
+  <ul class="menu">
+    <li><a href="#/registration">registation</a></li>
+    <li><a href="#/list">list</a></li>
+  </ul>
+% }
+
+  <!--[if lt IE 8]>
+       <div style="color:red">
+               Your browser is too old to support this application.
+               <hr>
+               Vaš web preglednik je prestar da bi podržao ovu aplikaciju.
+               <hr>
+               Download:
+               <a href="http://www.google.com/search?q=download firefox">Firefox</a>
+               <a href="http://www.google.com/search?q=download google chrome">Chrome</a>
+               <a href="http://www.google.com/search?q=download ie8">Internet Explorer 8</a>
+       </div>
+  <![endif]-->
+
+%= include( "drzb2013/header.$lang" );
+
+  <div class="container" ng-view></div>
+<!--
+  <div>Angular seed app: v<span app-version></span></div>
+-->
+  <!-- In production use:
+  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script>
+  -->
+  <script src="/lib/angular/angular.js"></script>
+  <script src="/lib/angular/angular-resource.js"></script>
+  <script src="/js/app.js"></script>
+  <script src="/js/services.js"></script>
+  <script src="/js/controllers.js"></script>
+  <script src="/js/filters.js"></script>
+  <script src="/js/directives.js"></script>
+</body>
+</html>
diff --git a/app/partials/registration.html.ep b/app/partials/registration.html.ep
new file mode 100644 (file)
index 0000000..0282179
--- /dev/null
@@ -0,0 +1,246 @@
+<h1><%= locale
+       en => 'Registration and proposal submission',
+       hr => 'Registracija i prijavljivanje izlaganja'
+%></h1>
+
+<div class="intro">
+%= include( "drzb2013/intro.$lang" );
+</div>
+
+<form ng-controller="RegistrationCtrl" name="RegistrationForm">
+
+<fieldset class="controls">
+
+<legend><%= locale
+       en => 'Registration type',
+       hr => 'Odaberite tip registracije'
+%></legend>
+
+<label class="radio"><input type="radio" ng-model="user.registration_type" value="lecture" ><%= locale
+       en => 'Oral presentation',
+       hr => 'Prijava usmenog izlaganja',
+%></label>
+<label class="radio"><input type="radio" ng-model="user.registration_type" value="poster" ><%= locale
+       en => 'Poster prezentation',
+       hr => 'Prijava poster prezentacije'
+%></label>
+<label class="radio"><input type="radio" ng-model="user.registration_type" value="symposium" ><%= locale
+    en => 'Symposium',
+       hr => 'Prijava simpozija'
+%></label>
+<label class="radio"><input type="radio" ng-model="user.registration_type" value="round" ><%= locale
+    en => 'Round table',
+       hr => 'Prijava okruglog stola',
+%></label>
+<hr />
+<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">
+
+<legend><%= locale
+en => 'Registration - contact information',
+hr => 'Registracija - kontakt podaci'
+%></legend>
+
+% my $Name = locale( en => 'Name', hr => 'Ime' );
+% my $Surname = locale( en => 'Surname', hr => 'Prezime' );
+% my $Organization = locale( en => 'Organization', hr => 'Organizacija' );
+% my $Email = locale( en => 'E-mail', hr => 'E-pošta' );
+
+<div class="controls 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>
+
+% my $Address = locale en => 'Address', hr => 'Adresa';
+<div class="controls controls-row">
+ <input class="my-input span10" ng-model="user.address" placeholder="<%= $Address %>" >
+</div>
+
+<div class="controls 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">
+ <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>
+%= locale( en => 'Options', hr => '' );
+</legend>
+<label class="checkbox">
+ <input ng-model="user.student" type="checkbox" ng-change="change_student()">
+ <%= locale 
+en => 'Check this box if you are student',
+hr => 'Označite ako ste student' %>
+</label>
+
+<div ng-show="! user.student">
+
+%# FIXME: skip for en
+
+<label class="checkbox">
+ <input ng-model="user.hpd_member" type="checkbox">
+<%= locale
+en => 'Check this box if you are HPD member',
+hr => 'Označite ako ste član HPD-a' %>
+</label>
+
+<label class="checkbox">
+<input type="checkbox" ng-model="user.r1.required">
+<%= locale
+en => 'Check this box if you need invoice',
+hr => 'Trebam R-1 račun' %>
+</label>
+
+<div ng-show="user.r1.required">
+<legend><%= locale
+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.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 -->
+</div><!-- ! user.student -->
+
+% my $Yes = locale( en => 'Yes', hr => 'Da' );
+% my $No  = locale( en => 'No',  hr => 'Ne' );
+
+<legend>
+</legend>
+<strong>
+<%= locale
+en => 'Will you join us for the welcome reception?',
+hr => 'Hoćete li biti na domjenku dobrodošlice?' %>
+</strong>
+<label class="radio"><input type="radio" name="user.reception" ng-model="user.reception" value="yes" ng-required="true"><%= $Yes %></label>
+<label class="radio"><input type="radio" name="user.reception" ng-model="user.reception" value="no"  ng-required="true"><%= $No %></label>
+
+<div ng-show="! user.student">
+
+<legend>
+</legend>
+<strong>
+<%= locale
+en => 'Will you join us for the conference dinner?',
+hr => 'Hoćete li biti na zajedničkoj večeri?' %>
+</strong>
+<%= locale
+en => 'Dinner is included in the regostration fee.',
+hr => 'Večera je uključena u kotizaciju.' %>
+<label class="radio"><input type="radio" name="user.dinner" ng-model="user.dinner" value="yes" ng-required="! user.student && ! user.dinner"><%= $Yes %></label>
+<label class="radio"><input type="radio" name="user.dinner" ng-model="user.dinner" value="no"  ng-required="! user.student && ! user.dinner"><%= $No %></label>
+
+
+</div><!-- not student -->
+
+
+</fieldset><!-- selected registration_type -->
+
+
+<div 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>
+<h2 ng-switch-when="poster"><%= locale en=>'Poster presentation submission', hr=>'Prijava poster prezentacije' %></h2>
+<h2 ng-switch-when="symposium"><%= locale en=>'Symposium', hr=>'Prijava teme simpozija' %></h2>
+<h2 ng-switch-when="round"><%= locale en=>'Round table', hr=>'Prijava teme okruglog stola' %></h2>
+<b ng-switch-default>Has unknown work type {{work.type}} to submit</b>
+</div>
+
+% my $Title = locale( en => 'Title', hr => 'Naslov' );
+
+% 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>
+
+% if ( $has_h3_note ) {
+<h3 ng-show="user.registration_type == 'symposium'">
+<%= locale
+en => 'Symposium organizer',
+hr => 'Organizator simpozija' %>
+</h3>
+% }
+
+
+<div ng-repeat="person in work.persons" class="controls 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="span3 my-input" ng-model="person.organization" placeholder="<%= $Organization %>" >
+       <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>
+<a class="btn" href="" ng-click="addPerson(work.persons)"><%= locale en=>'add person',hr=>'dodaj osobu' %></a>
+<div class="controls">
+ <label>
+<%= 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)'
+%>
+ </label>
+ <textarea class="span10" ng-model="work.abstract" ng-maxlength="2000" rows="10" cols="80" ng-required="has_work" ></textarea>
+</div>
+% end
+
+<%= $WorkTemplate->(1) %>
+
+</div><!-- has_work -->
+
+<div ng-show="user.registration_type == 'symposium'">
+
+<h2><%= locale hr=>'Prijava radova unutar simpozija {{work.title}}' %></h2>
+
+<div ng-repeat="work in work.symposium_works">
+
+<h3><%= locale hr=>'{{$index + 1}}. rad na simpoziju' %></h3>
+
+<%= $WorkTemplate->(0) %>
+
+</div><!-- ng-repeat symposium_works  -->
+
+<a class="btn" href="" ng-click="add_symposium_work(work.symposium_works)">Add one more work to the symposium</a>
+
+</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>
+
+<p class="left" 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.'
+%>
+</p>
+</div>
+
+<!--
+<pre>
+{{RegistrationForm.$valid}}
+{{RegistrationForm.$error}}
+
+location={{$location.path()}}
+
+</pre>
+-->
+</form>
+