From 103891e0c05876ad6fc23ea5ee11e331cda8cd11 Mon Sep 17 00:00:00 2001 From: lealife Date: Sat, 17 Oct 2015 19:36:49 +0800 Subject: [PATCH] wkhtmltopdf configuration --- .../admin/AdminSettingController.go | 10 +--- app/controllers/api/ApiNoteController.go | 1 + app/views/admin/nav.html | 12 ++++- app/views/admin/setting/export_pdf.html | 52 +++++++++++++++++++ .../{shareNote.html => share_note.html} | 0 public/admin/css/admin.css | 2 +- public/admin/css/admin.less | 2 +- 7 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 app/views/admin/setting/export_pdf.html rename app/views/admin/setting/{shareNote.html => share_note.html} (100%) diff --git a/app/controllers/admin/AdminSettingController.go b/app/controllers/admin/AdminSettingController.go index abda4b9..7a68416 100644 --- a/app/controllers/admin/AdminSettingController.go +++ b/app/controllers/admin/AdminSettingController.go @@ -73,15 +73,9 @@ func (c AdminSetting) DoDemo(demoUsername, demoPassword string) revel.Result { return c.RenderJson(re) } -// ToImage -// 长微博的bin路径phantomJs -func (c AdminSetting) ToImage() revel.Result { - c.RenderArgs["toImageBinPath"] = configService.GetGlobalStringConfig("toImageBinPath") - return c.RenderTemplate("admin/setting/toImage.html"); -} -func (c AdminSetting) DoToImage(toImageBinPath string) revel.Result { +func (c AdminSetting) ExportPdf(path string) revel.Result { re := info.NewRe() - re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "toImageBinPath", toImageBinPath) + re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "exportPdfBinPath", path) return c.RenderJson(re) } diff --git a/app/controllers/api/ApiNoteController.go b/app/controllers/api/ApiNoteController.go index e1b8e16..be344fa 100644 --- a/app/controllers/api/ApiNoteController.go +++ b/app/controllers/api/ApiNoteController.go @@ -585,6 +585,7 @@ func (c ApiNote) GetHistories(noteId string) revel.Result { // 0.2 新增 // 导出成PDF +// test localhost:9000/api/note/exportPdf?noteId=554f07bf05fcd15fa9000000&token=562211dc99c37ba6a7000001 func (c ApiNote) ExportPdf(noteId string) revel.Result { re := info.NewApiRe() userId := c.getUserId() diff --git a/app/views/admin/nav.html b/app/views/admin/nav.html index e2f2ffa..2b44c0a 100644 --- a/app/views/admin/nav.html +++ b/app/views/admin/nav.html @@ -13,7 +13,6 @@ -
  • @@ -157,7 +156,7 @@
  • - + Register Share Note @@ -171,6 +170,15 @@
  • + +
  • + + + Export PDF + + +
  • + diff --git a/app/views/admin/setting/export_pdf.html b/app/views/admin/setting/export_pdf.html new file mode 100644 index 0000000..ad5f78c --- /dev/null +++ b/app/views/admin/setting/export_pdf.html @@ -0,0 +1,52 @@ +{{template "admin/top.html" .}} +

    Export PDF

    + +
    + +
    +
    +
    +
    +
    + + + Leanote use wkhtmltopdf to export pdf. You should install it on your server. +
    + Please input the path that wkhtmltopdf installed, e.g. /usr/local/bin/wkhtmltopdf +
    +
    + +
    + +
    +
    +
    +
    + +
    + +{{template "admin/footer.html" .}} + + + +{{template "admin/end.html" .}} \ No newline at end of file diff --git a/app/views/admin/setting/shareNote.html b/app/views/admin/setting/share_note.html similarity index 100% rename from app/views/admin/setting/shareNote.html rename to app/views/admin/setting/share_note.html diff --git a/public/admin/css/admin.css b/public/admin/css/admin.css index 695d0b1..50a2f33 100644 --- a/public/admin/css/admin.css +++ b/public/admin/css/admin.css @@ -907,7 +907,7 @@ body { margin: 0; } a { - color: #2e3e4e; + color: #346EA9; text-decoration: none; } a:hover, diff --git a/public/admin/css/admin.less b/public/admin/css/admin.less index 04c9dca..8c4d863 100644 --- a/public/admin/css/admin.less +++ b/public/admin/css/admin.less @@ -1088,7 +1088,7 @@ body { } a { - color: #2e3e4e; + color: #346EA9; text-decoration: none; }