Skip to content

Commit

Permalink
Fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
asm0dey committed Dec 2, 2018
1 parent 0d6c863 commit bd64dfc
Show file tree
Hide file tree
Showing 32 changed files with 215 additions and 5,152 deletions.
7 changes: 5 additions & 2 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ db {
user="crm"
password="crm"
}
application.secret="ZJPmn1iw0a7RQ8hot45KlWF/DHs3rK42m/wG0iw1bFIlzTkmTw0KRo26Lceh"
application {
secret="ZJPmn1iw0a7RQ8hot45KlWF/DHs3rK42m/wG0iw1bFIlzTkmTw0KRo26Lceh"
securePort = 8443
dateFormat = "dd/MM/yyyy"
}
freemarker.default_encoding = UTF-8
server.http2.enabled = true
application.securePort = 8443
crm {
allowedDegrees = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
allowedLetter = ["А", "Б", "В", "Г", "Д"]
Expand Down
113 changes: 58 additions & 55 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<http-client.version>4.5.6</http-client.version>
<!-- Startup class -->
<application.class>org.ort.school.app.SchoolCRMKt</application.class>
<postgresql.version>42.2.5</postgresql.version>
<postgresql.version>42.2.5</postgresql.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -89,7 +89,7 @@
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.4</version>
<version>0.4-atlassian-1</version>
</dependency>

<dependency>
Expand All @@ -101,10 +101,10 @@
<groupId>org.jooby</groupId>
<artifactId>jooby-csl</artifactId>
</dependency>
<dependency>
<groupId>org.jooby</groupId>
<artifactId>jooby-whoops</artifactId>
</dependency>
<dependency>
<groupId>org.jooby</groupId>
<artifactId>jooby-whoops</artifactId>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
Expand All @@ -115,19 +115,24 @@
<artifactId>jooby-rocker</artifactId>
</dependency>

<dependency>
<groupId>org.jooby</groupId>
<artifactId>jooby-metrics</artifactId>
</dependency>

<dependency>
<groupId>com.github.salomonbrys.kotson</groupId>
<artifactId>kotson</artifactId>
<version>2.5.0</version>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
<scope>runtime</scope>
</dependency>
<!-- REST client -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5.jre7</version>
<scope>runtime</scope>
</dependency>
<!-- REST client -->

<dependency>
<groupId>com.mashape.unirest</groupId>
Expand Down Expand Up @@ -161,7 +166,7 @@
<version>2.7.0</version>
</dependency>

<!-- tests -->
<!-- tests -->

<dependency>
<groupId>com.nhaarman</groupId>
Expand Down Expand Up @@ -232,6 +237,18 @@
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.fizzed</groupId>
<artifactId>rocker-maven-plugin</artifactId>
<configuration>
<discardLogicWhitespace>true</discardLogicWhitespace>
<optimize>true</optimize>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
Expand Down Expand Up @@ -331,14 +348,14 @@
</configuration>

<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
<scope>runtime</scope>
</dependency>

<dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
Expand Down Expand Up @@ -389,40 +406,26 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jooby</groupId>
<artifactId>jooby-maven-plugin</artifactId>
<configuration>
<mainClass>${application.class}</mainClass>
<commands>
</commands>
<compiler>on</compiler>
<fork>false</fork>
<vmArgs></vmArgs>
<debug>true</debug>
<includes>
<include>**/*.class</include>
<include>**/*.conf</include>
<include>**/*.properties</include>
</includes>
<excludes>
</excludes>
<srcExtensions>.java,.kt,.conf,.properties,.html</srcExtensions>
</configuration>
</plugin>
<plugin>
<groupId>org.jooby</groupId>
<artifactId>jooby-maven-plugin</artifactId>
<configuration>
<mainClass>${application.class}</mainClass>
<commands></commands>
<compiler>on</compiler>
<fork>false</fork>
<vmArgs></vmArgs>
<debug>true</debug>
<includes>
<include>**/*.class</include>
<include>**/*.conf</include>
<include>**/*.properties</include>
</includes>
<excludes></excludes>
<srcExtensions>.java,.kt,.conf,.properties,.html</srcExtensions>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.fizzed</groupId>
<artifactId>rocker-maven-plugin</artifactId>
<configuration>
<discardLogicWhitespace>true</discardLogicWhitespace>
<optimize>true</optimize>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
Expand Down
44 changes: 41 additions & 3 deletions public/views/index.rocker.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h1>Добро пожаловать</h1>
</div>
<input type="hidden" value='@locals.get("csrf")' name="csrf">
<div class="row">
<button class="btn waves-effect waves-light j_addchild">Добавить ребёнка
<button class="btn waves-effect waves-light j_addchild" type="button">Добавить ребёнка
<i class="material-icons right">add</i>
</button>
<button class="btn waves-effect waves-light" type="submit">Зарегистрировать
Expand All @@ -81,12 +81,49 @@ <h1>Добро пожаловать</h1>
<script>
let counter = 0;
const generateChildBlock = function (num) {
return "<div class=\"row j_child\"> <div class=\"input-field col s3\"> <input id=\"student-lastname[" + num + "]\" type=\"text\" class=\'validate\' required name=\"student[" + num + "]lastname\"> <label for=\"student-lastname[" + num + "]\">Фамилия ученика<span style=\"color: crimson\">*</span></label> </div> <div class=\"input-field col s3\"> <input id=\"student-firstname[" + num + "]\" type=\"text\" class=\'validate\' required name=\"student[" + num + "]firstname\"> <label for=\"student-firstname[" + num + "]\">Имя ученика<span style=\"color: crimson\">*</span></label> </div> <div class=\"input-field col s3\"> <input id=\"student-patronymic[" + num + "]\" type=\"text\" class=\'validate\' name=\"student[" + num + "]patronymic\"> <label for=\"student-patronymic[" + num + "]\">Отчество ученика</label> </div> <div class=\"input-field col s2\"> <select name=\"student[" + num + "]degreeNo\" id=\"classno[" + num + "]\" class=\'validate\' required> <option value=\"no\" disabled>Выберите номер класса</option> @for(degree:degrees){<option value=\"@degree.getFirst()\">@degree.getSecond()</option>} </select> <label for=\"classno[" + num + "]\">Класс<span style=\"color: crimson\">*</span></label> </div> <div class='input-field col s1'><btn onclick='deleteNode()' class='waves-effect waves-teal btn-flat btn-large'><i class='material-icons'>delete</i> </btn></div> </div>";
return `<div class="row j_child">
<div class="input-field col s3">
<input id="student-lastname[${num}]" type="text" class='validate' required name="student[${num}]lastname">
<label for="student-lastname[${num}]">Фамилия ученика<span style="color: crimson">*</span></label>
</div>
<div class="input-field col s2">
<input id="student-firstname[${num}]" type="text" class='validate' required name="student[${num}]firstname">
<label for="student-firstname[${num}]">Имя ученика<span style="color: crimson">*</span></label>
</div>
<div class="input-field col s3">
<input id="student-patronymic[${num}]" type="text" class='validate' name="student[${num}]patronymic">
<label for="student-patronymic[${num}]">Отчество ученика</label>
</div>
<div class="input-field col s2">
<label for="student-birthDate[${num}]">Дата рождения</label>
<input type="text" class="datepicker" name="student[${num}]birthDate" id="student-birthDate[${num}]">
</div>
<div class="input-field col s1">
<select name="student[${num}]degreeNo" id="classno[${num}]" class='validate' required>
<option value="no" disabled>Выберите номер класса</option>
@for(degree:degrees){
<option value="@degree.getFirst()">@degree.getSecond()</option>
}
</select>
<label for="classno[${num}]">Класс<span style="color: crimson">*</span></label>
</div>
<div class='input-field col s1'> <btn onclick='deleteNode()' class='waves-effect waves-teal btn-flat btn-large'><i class='material-icons'>delete</i></btn>
</div>
</div>`;
};
const initSelects = function () {
const selects = document.querySelectorAll('select');
M.FormSelect.init(selects);
};
const initPickers = function () {
var elems = document.querySelectorAll('.datepicker');
var instances = M.Datepicker.init(elems, {
autoClose: true,
format: 'dd/mm/yyyy',
firstDay: '1',
yearRange: 20
});
};
const addChild = function () {
u('.j_additional').before(generateChildBlock(counter++));
let children = u('.j_child btn.btn-flat');
Expand All @@ -95,6 +132,7 @@ <h1>Добро пожаловать</h1>
u(node).addClass('hide')
})
initSelects();
initPickers();
};
const deleteNode = function () {
u(u('.j_child').last()).remove();
Expand All @@ -119,7 +157,7 @@ <h1>Добро пожаловать</h1>
}
}
}
//@@formatter:om
//@@formatter:on
});
</script>
</body>
Expand Down
Loading

0 comments on commit bd64dfc

Please sign in to comment.