Use jte template engine
This commit is contained in:
381
pom.xml
381
pom.xml
@@ -1,179 +1,218 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.7.5</version>
|
<version>2.7.5</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.github.russp</groupId>
|
<groupId>com.github.russp</groupId>
|
||||||
<artifactId>bpe</artifactId>
|
<artifactId>bpe</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>bpe</name>
|
<name>bpe</name>
|
||||||
<description>Bad-practice editor</description>
|
<description>Bad-practice editor</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<repackage.classifier/>
|
<jte.version>3.0.3</jte.version>
|
||||||
<spring-native.version>0.12.1</spring-native.version>
|
<repackage.classifier/>
|
||||||
</properties>
|
<spring-native.version>0.12.1</spring-native.version>
|
||||||
<dependencies>
|
</properties>
|
||||||
<dependency>
|
<dependencies>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<dependency>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
</dependency>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<dependency>
|
||||||
<artifactId>spring-boot-starter-mustache</artifactId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
</dependency>
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<dependency>
|
||||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
</dependency>
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<dependency>
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
<groupId>org.springframework.experimental</groupId>
|
||||||
</dependency>
|
<artifactId>spring-native</artifactId>
|
||||||
<dependency>
|
<version>${spring-native.version}</version>
|
||||||
<groupId>org.springframework.experimental</groupId>
|
</dependency>
|
||||||
<artifactId>spring-native</artifactId>
|
|
||||||
<version>${spring-native.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.11.0</version>
|
<version>2.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>gg.jte</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>jte</artifactId>
|
||||||
<scope>runtime</scope>
|
<version>${jte.version}</version>
|
||||||
<optional>true</optional>
|
</dependency>
|
||||||
</dependency>
|
<dependency>
|
||||||
<dependency>
|
<groupId>gg.jte</groupId>
|
||||||
<groupId>org.projectlombok</groupId>
|
<artifactId>jte-spring-boot-starter-2</artifactId>
|
||||||
<artifactId>lombok</artifactId>
|
<version>${jte.version}</version>
|
||||||
<optional>true</optional>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.projectreactor</groupId>
|
|
||||||
<artifactId>reactor-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
<dependency>
|
||||||
<plugins>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<plugin>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<scope>runtime</scope>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<optional>true</optional>
|
||||||
<configuration>
|
</dependency>
|
||||||
<excludes>
|
<dependency>
|
||||||
<exclude>
|
<groupId>org.projectlombok</groupId>
|
||||||
<groupId>org.projectlombok</groupId>
|
<artifactId>lombok</artifactId>
|
||||||
<artifactId>lombok</artifactId>
|
<optional>true</optional>
|
||||||
</exclude>
|
</dependency>
|
||||||
</excludes>
|
<dependency>
|
||||||
<classifier>${repackage.classifier}</classifier>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<image>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<builder>paketobuildpacks/builder:tiny</builder>
|
<scope>test</scope>
|
||||||
<env>
|
</dependency>
|
||||||
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
|
<dependency>
|
||||||
</env>
|
<groupId>io.projectreactor</groupId>
|
||||||
</image>
|
<artifactId>reactor-test</artifactId>
|
||||||
</configuration>
|
<scope>test</scope>
|
||||||
</plugin>
|
</dependency>
|
||||||
<plugin>
|
</dependencies>
|
||||||
<groupId>org.springframework.experimental</groupId>
|
|
||||||
<artifactId>spring-aot-maven-plugin</artifactId>
|
|
||||||
<version>${spring-native.version}</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>test-generate</id>
|
|
||||||
<goals>
|
|
||||||
<goal>test-generate</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
<execution>
|
|
||||||
<id>generate</id>
|
|
||||||
<goals>
|
|
||||||
<goal>generate</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>spring-releases</id>
|
|
||||||
<name>Spring Releases</name>
|
|
||||||
<url>https://repo.spring.io/release</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
<pluginRepositories>
|
|
||||||
<pluginRepository>
|
|
||||||
<id>spring-releases</id>
|
|
||||||
<name>Spring Releases</name>
|
|
||||||
<url>https://repo.spring.io/release</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</pluginRepository>
|
|
||||||
</pluginRepositories>
|
|
||||||
|
|
||||||
<profiles>
|
<build>
|
||||||
<profile>
|
<plugins>
|
||||||
<id>native</id>
|
<plugin>
|
||||||
<properties>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<repackage.classifier>exec</repackage.classifier>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<native-buildtools.version>0.9.13</native-buildtools.version>
|
<configuration>
|
||||||
</properties>
|
<excludes>
|
||||||
<dependencies>
|
<exclude>
|
||||||
<dependency>
|
<groupId>org.projectlombok</groupId>
|
||||||
<groupId>org.junit.platform</groupId>
|
<artifactId>lombok</artifactId>
|
||||||
<artifactId>junit-platform-launcher</artifactId>
|
</exclude>
|
||||||
<scope>test</scope>
|
</excludes>
|
||||||
</dependency>
|
<classifier>${repackage.classifier}</classifier>
|
||||||
</dependencies>
|
<image>
|
||||||
<build>
|
<builder>paketobuildpacks/builder:tiny</builder>
|
||||||
<plugins>
|
<env>
|
||||||
<plugin>
|
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
|
||||||
<groupId>org.graalvm.buildtools</groupId>
|
</env>
|
||||||
<artifactId>native-maven-plugin</artifactId>
|
</image>
|
||||||
<version>${native-buildtools.version}</version>
|
</configuration>
|
||||||
<extensions>true</extensions>
|
</plugin>
|
||||||
<executions>
|
<plugin>
|
||||||
<execution>
|
<groupId>org.springframework.experimental</groupId>
|
||||||
<id>test-native</id>
|
<artifactId>spring-aot-maven-plugin</artifactId>
|
||||||
<phase>test</phase>
|
<version>${spring-native.version}</version>
|
||||||
<goals>
|
<executions>
|
||||||
<goal>test</goal>
|
<execution>
|
||||||
</goals>
|
<id>test-generate</id>
|
||||||
</execution>
|
<goals>
|
||||||
<execution>
|
<goal>test-generate</goal>
|
||||||
<id>build-native</id>
|
</goals>
|
||||||
<phase>package</phase>
|
</execution>
|
||||||
<goals>
|
<execution>
|
||||||
<goal>build</goal>
|
<id>generate</id>
|
||||||
</goals>
|
<goals>
|
||||||
</execution>
|
<goal>generate</goal>
|
||||||
</executions>
|
</goals>
|
||||||
</plugin>
|
</execution>
|
||||||
</plugins>
|
</executions>
|
||||||
</build>
|
</plugin>
|
||||||
</profile>
|
<plugin>
|
||||||
</profiles>
|
<groupId>gg.jte</groupId>
|
||||||
|
<artifactId>jte-maven-plugin</artifactId>
|
||||||
|
<version>${jte.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<sourceDirectory>${basedir}/src/main/jte</sourceDirectory>
|
||||||
|
<contentType>Html</contentType>
|
||||||
|
<targetResourceDirectory>${project.build.directory}/classes</targetResourceDirectory>
|
||||||
|
<extensions>
|
||||||
|
<extension>
|
||||||
|
<className>gg.jte.nativeimage.NativeResourcesExtension</className>
|
||||||
|
</extension>
|
||||||
|
</extensions>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>jte-gen</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>generate</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>gg.jte</groupId>
|
||||||
|
<artifactId>jte-native-resources</artifactId>
|
||||||
|
<version>${jte.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spring-releases</id>
|
||||||
|
<name>Spring Releases</name>
|
||||||
|
<url>https://repo.spring.io/release</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>spring-releases</id>
|
||||||
|
<name>Spring Releases</name>
|
||||||
|
<url>https://repo.spring.io/release</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>native</id>
|
||||||
|
<properties>
|
||||||
|
<repackage.classifier>exec</repackage.classifier>
|
||||||
|
<native-buildtools.version>0.9.13</native-buildtools.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.platform</groupId>
|
||||||
|
<artifactId>junit-platform-launcher</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.graalvm.buildtools</groupId>
|
||||||
|
<artifactId>native-maven-plugin</artifactId>
|
||||||
|
<version>${native-buildtools.version}</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>test-native</id>
|
||||||
|
<phase>test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>test</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>build-native</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.github.russp.bpe.config;
|
||||||
|
|
||||||
|
import gg.jte.springframework.boot.autoconfigure.ReactiveJteAutoConfiguration;
|
||||||
|
import gg.jte.springframework.boot.autoconfigure.ReactiveJteViewResolver;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Configuration
|
||||||
|
@ImportAutoConfiguration(ReactiveJteAutoConfiguration.class)
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class JteConfiguration {
|
||||||
|
|
||||||
|
private final ReactiveJteViewResolver jteViewResolver;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void vr() {
|
||||||
|
log.info("ReactiveJteViewResolver created: {}", jteViewResolver);
|
||||||
|
jteViewResolver.resolveViewName("login", Locale.ENGLISH)
|
||||||
|
.log()
|
||||||
|
.block();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -72,7 +72,7 @@ public class BrowserController {
|
|||||||
model.addAttribute("breadcrumbs", breadcrumbs);
|
model.addAttribute("breadcrumbs", breadcrumbs);
|
||||||
model.addAttribute("selectedFile", path);
|
model.addAttribute("selectedFile", path);
|
||||||
|
|
||||||
model.addAttribute("selectedFileName", Paths.get(path).getFileName());
|
model.addAttribute("selectedFileName", Paths.get(path).getFileName().toString());
|
||||||
return "edit";
|
return "edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
@import java.util.List
|
||||||
|
@import com.github.russp.bpe.http.FileDto
|
||||||
|
|
||||||
|
@param List<FileDto> files
|
||||||
|
@param List<FileDto> breadcrumbs
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
<head>
|
<head>
|
||||||
@@ -26,9 +32,9 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<ul class="breadcrumbs">
|
<ul class="breadcrumbs">
|
||||||
<li><a href="/"><i class="fa fa-home"></i></a></li>
|
<li><a href="/"><i class="fa fa-home"></i></a></li>
|
||||||
{{#breadcrumbs}}
|
@for(FileDto breadcrumb : breadcrumbs)
|
||||||
<li><a href="/?path={{fullName}}">{{name}}</a></li>
|
<li><a href="/?path=${breadcrumb.getFullName()}">${breadcrumb.getName()}</a></li>
|
||||||
{{/breadcrumbs}}
|
@endfor
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
@@ -47,26 +53,25 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#files}}
|
@for(FileDto file : files)
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
{{#dir}}
|
@if(file.isDir())
|
||||||
<a href="/?path={{fullName}}">
|
<a href="/?path=${file.getFullName()}">
|
||||||
<i class="fa fa-folder"></i>
|
<i class="fa fa-folder"></i>
|
||||||
{{name}}
|
${file.getName()}
|
||||||
</a>
|
</a>
|
||||||
{{/dir}}
|
@else
|
||||||
{{^dir}}
|
<a href="/edit?path=${file.getFullName()}">
|
||||||
<a href="/edit?path={{fullName}}">
|
|
||||||
<i class="fa fa-file"></i>
|
<i class="fa fa-file"></i>
|
||||||
{{name}}
|
${file.getName()}
|
||||||
</a>
|
</a>
|
||||||
{{/dir}}
|
@endif
|
||||||
</th>
|
</th>
|
||||||
<td>{{modifiedAt}}</td>
|
<td>${file.getModifiedAt()}</td>
|
||||||
<td>{{size}}</td>
|
<td>${file.getSize()}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/files}}
|
@endfor
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</figure>
|
</figure>
|
||||||
@@ -87,7 +92,7 @@
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
<small>Built with <a href="https://picocss.com">Pico</a> • <a
|
<small>Built with <a href="https://picocss.com">Pico</a> • <a
|
||||||
href="https://github.com/picocss/examples/blob/master/basic-template/">Source code</a></small>
|
href="https://github.com/picocss/examples/blob/master/basic-template/">Source code</a></small>
|
||||||
</footer><!-- ./ Footer -->
|
</footer><!-- ./ Footer -->
|
||||||
|
|
||||||
|
|
||||||
@@ -1,3 +1,14 @@
|
|||||||
|
@import java.util.List
|
||||||
|
@import org.springframework.security.web.server.csrf.CsrfToken
|
||||||
|
@import com.github.russp.bpe.http.FileDto
|
||||||
|
|
||||||
|
@param String selectedFile
|
||||||
|
@param String selectedFileName
|
||||||
|
@param List<FileDto> breadcrumbs
|
||||||
|
|
||||||
|
@param CsrfToken _csrf
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
<head>
|
<head>
|
||||||
@@ -5,10 +16,10 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="description" content="Browser">
|
<meta name="description" content="Browser">
|
||||||
|
|
||||||
<meta name="_csrf" content="{{_csrf.token}}"/>
|
<meta name="_csrf" content="${_csrf.getToken()}"/>
|
||||||
<meta name="_csrf_header" content="{{_csrf.headerName}}"/>
|
<meta name="_csrf_header" content="${_csrf.getHeaderName()}"/>
|
||||||
|
|
||||||
<title>Edit {{selectedFileName}}</title>
|
<title>Edit ${selectedFileName}</title>
|
||||||
|
|
||||||
<link rel="shortcut icon" href="https://picocss.com/favicon.ico">
|
<link rel="shortcut icon" href="https://picocss.com/favicon.ico">
|
||||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css"
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css"
|
||||||
@@ -23,14 +34,14 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<header class="container">
|
<header class="container">
|
||||||
<h5>Edit {{selectedFileName}}</h5>
|
<h5>Edit ${selectedFileName}</h5>
|
||||||
<nav>
|
<nav>
|
||||||
<ul class="breadcrumbs">
|
<ul class="breadcrumbs">
|
||||||
<li><a href="/"><i class="fa fa-home"></i></a></li>
|
<li><a href="/"><i class="fa fa-home"></i></a></li>
|
||||||
{{#breadcrumbs}}
|
@for(FileDto breadcrumb : breadcrumbs)
|
||||||
<li><a href="/?path={{fullName}}">{{name}}</a></li>
|
<li><a href="/?path=${breadcrumb.getFullName()}">${breadcrumb.getName()}</a></li>
|
||||||
{{/breadcrumbs}}
|
@endfor
|
||||||
<li>{{selectedFileName}}</li>
|
<li>${selectedFileName}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="javascript:save()" role="button">Save</a></li>
|
<li><a href="javascript:save()" role="button">Save</a></li>
|
||||||
@@ -51,7 +62,7 @@
|
|||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<footer class="container">
|
<footer class="container">
|
||||||
<small>Built with <a href="https://picocss.com">Pico</a> • <a
|
<small>Built with <a href="https://picocss.com">Pico</a> • <a
|
||||||
href="https://github.com/picocss/examples/blob/master/basic-template/">Source code</a></small>
|
href="https://github.com/picocss/examples/blob/master/basic-template/">Source code</a></small>
|
||||||
</footer><!-- ./ Footer -->
|
</footer><!-- ./ Footer -->
|
||||||
|
|
||||||
|
|
||||||
@@ -71,51 +82,51 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
var modelist = require("ace/ext/modelist");
|
var modelist = require("ace/ext/modelist");
|
||||||
var mode = modelist.getModeForPath("{{selectedFileName}}");
|
var mode = modelist.getModeForPath("${selectedFileName}");
|
||||||
var editor = ace.edit("editor",
|
var editor = ace.edit("editor",
|
||||||
{
|
{
|
||||||
mode: mode.mode,
|
mode: mode.mode,
|
||||||
selectionStyle: "text",
|
selectionStyle: "text",
|
||||||
theme: "ace/theme/dracula"
|
theme: "ace/theme/dracula"
|
||||||
});
|
});
|
||||||
document.getElementById('editor').style.fontSize = '1.2em';
|
document.getElementById('editor').style.fontSize = '1.2em';
|
||||||
|
|
||||||
fetch('/content?path={{selectedFile}}')
|
fetch('/content?path=${selectedFile}')
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
return response.text()
|
return response.text()
|
||||||
})
|
})
|
||||||
.then(function (body) {
|
.then(function (body) {
|
||||||
editor.setValue(body);
|
editor.setValue(body);
|
||||||
editor.clearSelection();
|
editor.clearSelection();
|
||||||
editor.gotoLine(1);
|
editor.gotoLine(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
var blob = new Blob([editor.getValue()]);
|
var blob = new Blob([editor.getValue()]);
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.set("file", blob);
|
formData.set("file", blob);
|
||||||
fetch('/content?path={{selectedFile}}', {
|
fetch('/content?path=${selectedFile}', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
headers: {
|
headers: {
|
||||||
"{{_csrf.headerName}}": "{{_csrf.token}}"
|
"${_csrf.getHeaderName()}": "${_csrf.getToken()}"
|
||||||
},
|
},
|
||||||
body: formData,
|
body: formData,
|
||||||
})
|
})
|
||||||
.then(function(ok) {
|
.then(function(ok) {
|
||||||
Toastify({
|
Toastify({
|
||||||
text: "Saved",
|
text: "Saved",
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
close: true,
|
close: true,
|
||||||
gravity: "top",
|
gravity: "top",
|
||||||
position: "right",
|
position: "right",
|
||||||
stopOnFocus: true,
|
stopOnFocus: true,
|
||||||
style: {
|
style: {
|
||||||
background: "green",
|
background: "green",
|
||||||
},
|
},
|
||||||
onClick: function(){} // Callback after click
|
onClick: function(){} // Callback after click
|
||||||
}).showToast();
|
}).showToast();
|
||||||
}).catch(function(ex) {
|
}).catch(function(ex) {
|
||||||
Toastify({
|
Toastify({
|
||||||
text: "Error",
|
text: "Error",
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
@import org.springframework.security.web.server.csrf.CsrfToken
|
||||||
|
|
||||||
|
@param CsrfToken _csrf
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
<head>
|
<head>
|
||||||
@@ -14,7 +18,7 @@
|
|||||||
<!-- Pico.css -->
|
<!-- Pico.css -->
|
||||||
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
||||||
<!-- Custom template-->
|
<!-- Custom template-->
|
||||||
<!-- <link rel="stylesheet" href="/stylesheet.css">-->
|
<!-- <link rel="stylesheet" href="/stylesheet.css">-->
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
/* Grid */
|
/* Grid */
|
||||||
@@ -107,7 +111,7 @@
|
|||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="text" name="username" placeholder="Username" aria-label="Login" autocomplete="nickname" required>
|
<input type="text" name="username" placeholder="Username" aria-label="Login" autocomplete="nickname" required>
|
||||||
<input type="password" name="password" placeholder="Password" aria-label="Password" autocomplete="current-password" required>
|
<input type="password" name="password" placeholder="Password" aria-label="Password" autocomplete="current-password" required>
|
||||||
<input type="hidden" name="{{_csrf.parameterName}}" value="{{_csrf.token}}"/>
|
<input type="hidden" name="${_csrf.getParameterName()}" value="${_csrf.getToken()}"/>
|
||||||
<button type="submit" class="contrast">Login</button>
|
<button type="submit" class="contrast">Login</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -119,7 +123,7 @@
|
|||||||
<footer class="container">
|
<footer class="container">
|
||||||
|
|
||||||
<small>Built with <a href="https://picocss.com">Pico</a> • <a
|
<small>Built with <a href="https://picocss.com">Pico</a> • <a
|
||||||
href="https://github.com/picocss/examples/blob/master/basic-template/">Source code</a></small>
|
href="https://github.com/picocss/examples/blob/master/basic-template/">Source code</a></small>
|
||||||
</footer><!-- ./ Footer -->
|
</footer><!-- ./ Footer -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<header class="container">
|
|
||||||
<hgroup>
|
|
||||||
<h1>Basic template</h1>
|
|
||||||
<h2>A basic custom template for Pico using only CSS custom properties (variables).</h2>
|
|
||||||
</hgroup>
|
|
||||||
<nav>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<details role="list">
|
|
||||||
<summary aria-haspopup="listbox" role="button" class="secondary">Theme</summary>
|
|
||||||
<ul role="listbox">
|
|
||||||
<li><a href="#" data-theme-switcher="auto">Auto</a></li>
|
|
||||||
<li><a href="#" data-theme-switcher="light">Light</a></li>
|
|
||||||
<li><a href="#" data-theme-switcher="dark">Dark</a></li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<details role="list">
|
|
||||||
<summary aria-haspopup="listbox">Examples</summary>
|
|
||||||
<ul role="listbox">
|
|
||||||
<li><a href="../preview/">Preview</a></li>
|
|
||||||
<li><a href="../preview-rtl/">Right-to-left</a></li>
|
|
||||||
<li><a href="../classless/">Class-less</a></li>
|
|
||||||
<li><a href="../basic-template/">Basic template</a></li>
|
|
||||||
<li><a href="../company/">Company</a></li>
|
|
||||||
<li><a href="../google-amp/">Google Amp</a></li>
|
|
||||||
<li><a href="../sign-in/">Sign in</a></li>
|
|
||||||
<li><a href="../bootstrap-grid/">Bootstrap grid</a></li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
Reference in New Issue
Block a user