Ejemplo n.º 1
0
 @Get
 @Route("/project/{id}/docs/{docId}/edit")
 public Result edit(@PathParam("id") Integer projectId, @PathParam("docId") Integer docId) {
   Project project = this.checkEntity(projectRepository.findById(projectId));
   Doc doc = this.checkEntity(docRepository.findById(docId));
   return Results.html().render("project", project).render("doc", doc);
 }
Ejemplo n.º 2
0
 @Get
 @Route("/project/{id}/docs")
 public Result index(@PathParam("id") Integer projectId) {
   Project project = this.checkEntity(projectRepository.findById(projectId));
   List<Doc> docs = docRepository.findByProject(projectId);
   return Results.html().render("docs", docs).render("project", project);
 }
Ejemplo n.º 3
0
  @Put
  @Route("/project/{id}/docs/{docId}")
  @Transactional
  public Result update(
      @PathParam("id") Integer projectId,
      @PathParam("docId") Integer docId,
      FlashScope flashScope,
      @Param("name") String name,
      @Param("content") String content) {

    Doc doc = this.checkEntity(docRepository.findById(docId));
    doc.setName(name);
    doc.setContent(content);
    docRepository.save(doc);
    flashScope.success("修改文档成功");
    return this.redirect("/project/" + projectId + "/docs");
  }
Ejemplo n.º 4
0
 @Post
 @Route("/project/{id}/docs")
 @Transactional
 public Result save(
     @PathParam("id") Integer projectId,
     FlashScope flashScope,
     @Param("name") String name,
     @Param("content") String content) {
   Doc doc = new Doc();
   doc.setProjectId(projectId);
   doc.setName(name);
   doc.setContent(content);
   docRepository.save(doc);
   flashScope.success("建立文档成功");
   return this.redirect("/project/" + projectId + "/docs");
 }