Restyle Import page

- Changes Import link location in dropdown menu
- Makes design consistent with Invite People page (and extracts some
  common CSS into core.less)
- Selects the user's first blog by default in the dropdown
- Changes the copy a bit

Ref T609
pull/172/head
Matt Baer 5 years ago
parent e5671cd1e6
commit 5b7f37aed8
  1. 2
      account_import.go
  2. 18
      less/core.less
  3. 53
      templates/user/import.tmpl
  4. 4
      templates/user/include/header.tmpl
  5. 15
      templates/user/invite.tmpl

@ -18,7 +18,7 @@ import (
func viewImport(app *App, u *User, w http.ResponseWriter, r *http.Request) error { func viewImport(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
// Fetch extra user data // Fetch extra user data
p := NewUserPage(app, r, u, "Import", nil) p := NewUserPage(app, r, u, "Import Posts", nil)
c, err := app.db.GetCollections(u, app.Config().App.Host) c, err := app.db.GetCollections(u, app.Config().App.Host)
if err != nil { if err != nil {

@ -1317,6 +1317,24 @@ form {
font-size: 0.86em; font-size: 0.86em;
line-height: 2; line-height: 2;
} }
&.prominent {
margin: 1em 0;
label {
font-weight: bold;
}
input, select {
width: 100%;
}
select {
font-size: 1em;
padding: 0.5rem;
display: block;
border-radius: 0.25rem;
margin: 0.5rem 0;
}
}
} }
div.row { div.row {
display: flex; display: flex;

@ -1,37 +1,48 @@
{{define "import"}} {{define "import"}}
{{template "header" .}} {{template "header" .}}
<style>
input[type=file] {
padding: 0;
font-size: 0.86em;
display: block;
margin: 0.5rem 0;
}
label {
display: block;
margin: 1em 0;
}
</style>
<div class="snug content-container"> <div class="snug content-container">
<h1 id="import-header">Import posts</h1>
{{if .Message}} {{if .Message}}
<div class="alert {{if .InfoMsg}}info{{else}}success{{end}}"> <div class="alert {{if .InfoMsg}}info{{else}}success{{end}}">
<p>{{.Message}}</p> <p>{{.Message}}</p>
</div> </div>
{{end}} {{end}}
<h2 id="posts-header">Import</h2> {{if .Flashes}}
<p>Upload text or markdown files to import as posts.</p> <ul class="errors">
{{range .Flashes}}<li class="urgent">{{.}}</li>{{end}}
</ul>
{{end}}
<p>Publish plain text or Markdown files to your account by uploading them below.</p>
<div class="formContainer"> <div class="formContainer">
<form id="importPosts" class="import" enctype="multipart/form-data" action="/api/me/import" method="POST"> <form id="importPosts" class="prominent" enctype="multipart/form-data" action="/api/me/import" method="POST">
<label for="file" hidden>Browse files to upload</label> <label>Select some files to import:
<input class="fileInput" name="files" type="file" multiple accept="text/markdown, text/plain"/> <input class="fileInput" name="files" type="file" multiple accept="text/markdown, text/plain"/>
<br /> </label>
<label for="collection">Select a blog to import the posts under.</label> <label>
<select name="collection"> Import these posts to:
{{range $i, $el := .Collections}} <select name="collection">
<option value={{.Alias}}> {{range $i, $el := .Collections}}
{{if .Title}}{{.Title}}{{else}}{{.Alias}}{{end}} <option value="{{.Alias}}" {{if eq $i 0}}selected{{end}}>{{.DisplayTitle}}</option>
</option> {{end}}
{{end}} <option value="">Drafts</option>
<option value="" selected>drafts</option> </select>
</select> </label>
<br />
<input type="submit" value="Import" /> <input type="submit" value="Import" />
</form> </form>
</div> </div>
{{if .Flashes}}
<ul class="errors">
{{range .Flashes}}<li class="urgent">{{.}}</li>{{end}}
</ul>
{{end}}
</div> </div>
{{template "footer" .}} {{template "footer" .}}

@ -10,8 +10,8 @@
<li class="separator"><hr /></li> <li class="separator"><hr /></li>
{{if .IsAdmin}}<li><a href="/admin">Admin</a></li>{{end}} {{if .IsAdmin}}<li><a href="/admin">Admin</a></li>{{end}}
<li><a href="/me/settings">Settings</a></li> <li><a href="/me/settings">Settings</a></li>
<li><a href="/me/import">Import posts</a></li>
<li><a href="/me/export">Export</a></li> <li><a href="/me/export">Export</a></li>
<li><a href="/me/import">Import</a></li>
<li class="separator"><hr /></li> <li class="separator"><hr /></li>
<li><a href="/me/logout">Log out</a></li> <li><a href="/me/logout">Log out</a></li>
</ul></li> </ul></li>
@ -33,8 +33,8 @@
<ul><li><a>{{.Username}}</a> <img class="ic-18dp" src="/img/ic_down_arrow_dark@2x.png" /><ul> <ul><li><a>{{.Username}}</a> <img class="ic-18dp" src="/img/ic_down_arrow_dark@2x.png" /><ul>
{{if .IsAdmin}}<li><a href="/admin">Admin dashboard</a></li>{{end}} {{if .IsAdmin}}<li><a href="/admin">Admin dashboard</a></li>{{end}}
<li><a href="/me/settings">Account settings</a></li> <li><a href="/me/settings">Account settings</a></li>
<li><a href="/me/import">Import posts</a></li>
<li><a href="/me/export">Export</a></li> <li><a href="/me/export">Export</a></li>
<li><a href="/me/import">Import</a></li>
{{if .CanInvite}}<li><a href="/me/invites">Invite people</a></li>{{end}} {{if .CanInvite}}<li><a href="/me/invites">Invite people</a></li>{{end}}
<li class="separator"><hr /></li> <li class="separator"><hr /></li>
<li><a href="/me/logout">Log out</a></li> <li><a href="/me/logout">Log out</a></li>

@ -8,18 +8,7 @@
margin-left: 0.5em; margin-left: 0.5em;
margin-right: 0; margin-right: 0;
} }
label { table.classy {
font-weight: bold;
}
select {
font-size: 1em;
width: 100%;
padding: 0.5rem;
display: block;
border-radius: 0.25rem;
margin: 0.5rem 0;
}
input, table.classy {
width: 100%; width: 100%;
} }
table.classy.export a { table.classy.export a {
@ -34,7 +23,7 @@ table td {
<h1>Invite people</h1> <h1>Invite people</h1>
<p>Invite others to join <em>{{.SiteName}}</em> by generating and sharing invite links below.</p> <p>Invite others to join <em>{{.SiteName}}</em> by generating and sharing invite links below.</p>
<form style="margin: 2em 0" action="/api/me/invites" method="post"> <form style="margin: 2em 0" class="prominent" action="/api/me/invites" method="post">
<div class="row"> <div class="row">
<div class="half"> <div class="half">
<label for="uses">Maximum number of uses:</label> <label for="uses">Maximum number of uses:</label>

Loading…
Cancel
Save