diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-01-02 22:04:48 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-01-02 22:04:48 -0800 |
commit | 320d1b016747ba4501da9417d9ce5f99368a5768 (patch) | |
tree | 1054d96afde6022951b76cc4a09b78e1e3f05058 /template | |
parent | c39f2e1a8d2de6d412bcc673d29eb0f7a2d1f5f7 (diff) |
Refactor packages to have more idiomatic code base
Diffstat (limited to 'template')
28 files changed, 3147 insertions, 0 deletions
diff --git a/template/common.go b/template/common.go new file mode 100644 index 0000000..7ec578f --- /dev/null +++ b/template/common.go @@ -0,0 +1,176 @@ +// Code generated by go generate; DO NOT EDIT. +// 2018-01-02 21:59:10.101985953 -0800 PST m=+0.029361282 + +package template + +var templateCommonMap = map[string]string{ + "entry_pagination": `{{ define "entry_pagination" }} +<div class="pagination"> + <div class="pagination-prev"> + {{ if .prevEntry }} + <a href="{{ .prevEntryRoute }}" title="{{ .prevEntry.Title }}" data-page="previous">{{ t "Previous" }}</a> + {{ else }} + {{ t "Previous" }} + {{ end }} + </div> + + <div class="pagination-next"> + {{ if .nextEntry }} + <a href="{{ .nextEntryRoute }}" title="{{ .nextEntry.Title }}" data-page="next">{{ t "Next" }}</a> + {{ else }} + {{ t "Next" }} + {{ end }} + </div> +</div> +{{ end }}`, + "layout": `{{ define "base" }} +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> + <meta name="mobile-web-app-capable" content="yes"> + <meta name="apple-mobile-web-app-title" content="Miniflux"> + <link rel="manifest" href="{{ route "webManifest" }}"> + + <meta name="robots" content="noindex,nofollow"> + <meta name="referrer" content="no-referrer"> + + <link rel="icon" type="image/png" href="{{ route "appIcon" "filename" "favicon.png" }}"> + <link rel="apple-touch-icon" href="{{ route "appIcon" "filename" "touch-icon-iphone.png" }}"> + <link rel="apple-touch-icon" sizes="72x72" href="{{ route "appIcon" "filename" "touch-icon-ipad.png" }}"> + <link rel="apple-touch-icon" sizes="114x114" href="{{ route "appIcon" "filename" "touch-icon-iphone-retina.png" }}"> + <link rel="apple-touch-icon" sizes="144x144" href="{{ route "appIcon" "filename" "touch-icon-ipad-retina.png" }}"> + <link rel="shortcut icon" type="image/x-icon" href="{{ route "favicon" }}"> + + {{ if .csrf }} + <meta name="X-CSRF-Token" value="{{ .csrf }}"> + {{ end }} + <title>{{template "title" .}} - Miniflux</title> + {{ if .user }} + <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .user.Theme }}"> + {{ else }} + <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" "white" }}"> + {{ end }} + <script type="text/javascript" src="{{ route "javascript" }}" defer></script> +</head> +<body data-entries-status-url="{{ route "updateEntriesStatus" }}"> + {{ if .user }} + <header class="header"> + <nav> + <div class="logo"> + <a href="{{ route "unread" }}">Mini<span>flux</span></a> + </div> + <ul> + <li {{ if eq .menu "unread" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g u" }}"> + <a href="{{ route "unread" }}" data-page="unread">{{ t "Unread" }}</a> + {{ if gt .countUnread 0 }} + <span class="unread-counter-wrapper">(<span class="unread-counter">{{ .countUnread }}</span>)</span> + {{ end }} + </li> + <li {{ if eq .menu "starred" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g b" }}"> + <a href="{{ route "starred" }}" data-page="starred">{{ t "Starred" }}</a> + </li> + <li {{ if eq .menu "history" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g h" }}"> + <a href="{{ route "history" }}" data-page="history">{{ t "History" }}</a> + </li> + <li {{ if eq .menu "feeds" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g f" }}"> + <a href="{{ route "feeds" }}" data-page="feeds">{{ t "Feeds" }}</a> + </li> + <li {{ if eq .menu "categories" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g c" }}"> + <a href="{{ route "categories" }}" data-page="categories">{{ t "Categories" }}</a> + </li> + <li {{ if eq .menu "settings" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g s" }}"> + <a href="{{ route "settings" }}" data-page="settings">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "logout" }}" title="Logged as {{ .user.Username }}">{{ t "Logout" }}</a> + </li> + </ul> + </nav> + </header> + {{ end }} + {{ if .flashMessage }} + <div class="flash-message alert alert-success">{{ .flashMessage }}</div> + {{ end }} + {{ if .flashErrorMessage }} + <div class="flash-error-message alert alert-error">{{ .flashErrorMessage }}</div> + {{ end }} + <main> + {{template "content" .}} + </main> + <template id="keyboard-shortcuts"> + <div id="modal-left"> + <a href="#" class="btn-close-modal">x</a> + <h3>{{ t "Keyboard Shortcuts" }}</h3> + + <div class="keyboard-shortcuts"> + <p>{{ t "Sections Navigation" }}</p> + <ul> + <li>{{ t "Go to unread" }} = <strong>g + u</strong></li> + <li>{{ t "Go to bookmarks" }} = <strong>g + b</strong></li> + <li>{{ t "Go to history" }} = <strong>g + h</strong></li> + <li>{{ t "Go to feeds" }} = <strong>g + f</strong></li> + <li>{{ t "Go to categories" }} = <strong>g + c</strong></li> + <li>{{ t "Go to settings" }} = <strong>g + s</strong></li> + <li>{{ t "Show keyboard shortcuts" }} = <strong>?</strong></li> + </ul> + + <p>{{ t "Items Navigation" }}</p> + <ul> + <li>{{ t "Go to previous item" }} = <strong>p or j or ◄</strong></li> + <li>{{ t "Go to next item" }} = <strong>n or k or ►</strong></li> + </ul> + + <p>{{ t "Pages Navigation" }}</p> + <ul> + <li>{{ t "Go to previous page" }} = <strong>h</strong></li> + <li>{{ t "Go to next page" }} = <strong>l</strong></li> + </ul> + + <p>{{ t "Actions" }}</p> + <ul> + <li>{{ t "Open selected item" }} = <strong>o</strong></li> + <li>{{ t "Open original link" }} = <strong>v</strong></li> + <li>{{ t "Toggle read/unread" }} = <strong>m</strong></li> + <li>{{ t "Mark current page as read" }} = <strong>A</strong></li> + <li>{{ t "Download original content" }} = <strong>d</strong></li> + <li>{{ t "Toggle bookmark" }} = <strong>f</strong></li> + <li>{{ t "Save article" }} = <strong>s</strong></li> + <li>{{ t "Close modal dialog" }} = <strong>Esc</strong></li> + </ul> + </div> + </div> + </template> +</body> +</html> +{{ end }}`, + "pagination": `{{ define "pagination" }} +<div class="pagination"> + <div class="pagination-prev"> + {{ if .ShowPrev }} + <a href="{{ .Route }}{{ if gt .PrevOffset 0 }}?offset={{ .PrevOffset }}{{ end }}" data-page="previous">{{ t "Previous" }}</a> + {{ else }} + {{ t "Previous" }} + {{ end }} + </div> + + <div class="pagination-next"> + {{ if .ShowNext }} + <a href="{{ .Route }}?offset={{ .NextOffset }}" data-page="next">{{ t "Next" }}</a> + {{ else }} + {{ t "Next" }} + {{ end }} + </div> +</div> +{{ end }} +`, +} + +var templateCommonMapChecksums = map[string]string{ + "entry_pagination": "f1465fa70f585ae8043b200ec9de5bf437ffbb0c19fb7aefc015c3555614ee27", + "layout": "83786d9e657a17cb531007b5639dc021b7cb2bff1a19162769b3a961a22e5087", + "pagination": "6ff462c2b2a53bc5448b651da017f40a39f1d4f16cef4b2f09784f0797286924", +} diff --git a/template/html/about.html b/template/html/about.html new file mode 100644 index 0000000..24c0f2c --- /dev/null +++ b/template/html/about.html @@ -0,0 +1,40 @@ +{{ define "title"}}{{ t "About" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "About" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + {{ if .user.IsAdmin }} + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + {{ end }} + </ul> +</section> + +<div class="panel"> + <h3>{{ t "Version" }}</h3> + <ul> + <li><strong>{{ t "Version:" }}</strong> {{ .version }}</li> + <li><strong>{{ t "Build Date:" }}</strong> {{ .build_date }}</li> + </ul> +</div> + +<div class="panel"> + <h3>{{ t "Authors" }}</h3> + <ul> + <li><strong>{{ t "Author:" }}</strong> Frédéric Guillot</li> + <li><strong>{{ t "License:" }}</strong> Apache 2.0</li> + </ul> +</div> + +{{ end }} diff --git a/template/html/add_subscription.html b/template/html/add_subscription.html new file mode 100644 index 0000000..b65dabb --- /dev/null +++ b/template/html/add_subscription.html @@ -0,0 +1,47 @@ +{{ define "title"}}{{ t "New Subscription" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "New Subscription" }}</h1> + <ul> + <li> + <a href="{{ route "feeds" }}">{{ t "Feeds" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + <li> + <a href="{{ route "import" }}">{{ t "Import" }}</a> + </li> + </ul> +</section> + +{{ if not .categories }} + <p class="alert alert-error">{{ t "There is no category. You must have at least one category." }}</p> +{{ else }} + <form action="{{ route "submitSubscription" }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-url">{{ t "URL" }}</label> + <input type="url" name="url" id="form-url" placeholder="https://domain.tld/" value="{{ .form.URL }}" required autofocus> + + <label for="form-category">{{ t "Category" }}</label> + <select id="form-category" name="category_id"> + {{ range .categories }} + <option value="{{ .ID }}">{{ .Title }}</option> + {{ end }} + </select> + + <label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "Fetch original content" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Find a subscription" }}</button> + </div> + </form> +{{ end }} + +{{ end }} diff --git a/template/html/categories.html b/template/html/categories.html new file mode 100644 index 0000000..c2d7850 --- /dev/null +++ b/template/html/categories.html @@ -0,0 +1,56 @@ +{{ define "title"}}{{ t "Categories" }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Categories" }} ({{ .total }})</h1> + <ul> + <li> + <a href="{{ route "createCategory" }}">{{ t "Create a category" }}</a> + </li> + </ul> +</section> + +{{ if not .categories }} + <p class="alert alert-error">{{ t "There is no category." }}</p> +{{ else }} + <div class="items"> + {{ range .categories }} + <article class="item"> + <div class="item-header"> + <span class="item-title"> + <a href="{{ route "categoryEntries" "categoryID" .ID }}">{{ .Title }}</a> + </span> + </div> + <div class="item-meta"> + <ul> + <li> + {{ if eq .FeedCount 0 }} + {{ t "No feed." }} + {{ else }} + {{ plural "plural.categories.feed_count" .FeedCount .FeedCount }} + {{ end }} + </li> + </ul> + <ul> + <li> + <a href="{{ route "editCategory" "categoryID" .ID }}">{{ t "Edit" }}</a> + </li> + {{ if eq .FeedCount 0 }} + <li> + <a href="#" + data-confirm="true" + data-label-question="{{ t "Are you sure?" }}" + data-label-yes="{{ t "yes" }}" + data-label-no="{{ t "no" }}" + data-label-loading="{{ t "Work in progress..." }}" + data-url="{{ route "removeCategory" "categoryID" .ID }}">{{ t "Remove" }}</a> + </li> + {{ end }} + </ul> + </div> + </article> + {{ end }} + </div> +{{ end }} + +{{ end }} diff --git a/template/html/category_entries.html b/template/html/category_entries.html new file mode 100644 index 0000000..ff73a16 --- /dev/null +++ b/template/html/category_entries.html @@ -0,0 +1,68 @@ +{{ define "title"}}{{ .category.Title }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ .category.Title }} ({{ .total }})</h1> + {{ if .entries }} + <ul> + <li> + <a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a> + </li> + </ul> + {{ end }} +</section> + +{{ if not .entries }} + <p class="alert">{{ t "There is no article in this category." }}</p> +{{ else }} + <div class="items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "categoryEntry" "categoryID" .Feed.Category.ID "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }} diff --git a/template/html/choose_subscription.html b/template/html/choose_subscription.html new file mode 100644 index 0000000..a1a8e68 --- /dev/null +++ b/template/html/choose_subscription.html @@ -0,0 +1,39 @@ +{{ define "title"}}{{ t "Choose a Subscription" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "New Subscription" }}</h1> + <ul> + <li> + <a href="{{ route "feeds" }}">{{ t "Feeds" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + <li> + <a href="{{ route "import" }}">{{ t "Import" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "chooseSubscription" }}" method="POST"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + <input type="hidden" name="category_id" value="{{ .categoryID }}"> + + <h3>{{ t "Choose a Subscription" }}</h3> + + {{ range .subscriptions }} + <div class="radio-group"> + <label title="{{ .URL }}"><input type="radio" name="url" value="{{ .URL }}"> {{ .Title }}</label> ({{ .Type }}) + <small title="Type = {{ .Type }}"><a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .URL }}</a></small> + </div> + {{ end }} + + <br> + <label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "Fetch original content" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Subscribe" }}</button> + </div> +</form> +{{ end }} diff --git a/template/html/common/entry_pagination.html b/template/html/common/entry_pagination.html new file mode 100644 index 0000000..6c9f29c --- /dev/null +++ b/template/html/common/entry_pagination.html @@ -0,0 +1,19 @@ +{{ define "entry_pagination" }} +<div class="pagination"> + <div class="pagination-prev"> + {{ if .prevEntry }} + <a href="{{ .prevEntryRoute }}" title="{{ .prevEntry.Title }}" data-page="previous">{{ t "Previous" }}</a> + {{ else }} + {{ t "Previous" }} + {{ end }} + </div> + + <div class="pagination-next"> + {{ if .nextEntry }} + <a href="{{ .nextEntryRoute }}" title="{{ .nextEntry.Title }}" data-page="next">{{ t "Next" }}</a> + {{ else }} + {{ t "Next" }} + {{ end }} + </div> +</div> +{{ end }}
\ No newline at end of file diff --git a/template/html/common/layout.html b/template/html/common/layout.html new file mode 100644 index 0000000..85f1df4 --- /dev/null +++ b/template/html/common/layout.html @@ -0,0 +1,124 @@ +{{ define "base" }} +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> + <meta name="mobile-web-app-capable" content="yes"> + <meta name="apple-mobile-web-app-title" content="Miniflux"> + <link rel="manifest" href="{{ route "webManifest" }}"> + + <meta name="robots" content="noindex,nofollow"> + <meta name="referrer" content="no-referrer"> + + <link rel="icon" type="image/png" href="{{ route "appIcon" "filename" "favicon.png" }}"> + <link rel="apple-touch-icon" href="{{ route "appIcon" "filename" "touch-icon-iphone.png" }}"> + <link rel="apple-touch-icon" sizes="72x72" href="{{ route "appIcon" "filename" "touch-icon-ipad.png" }}"> + <link rel="apple-touch-icon" sizes="114x114" href="{{ route "appIcon" "filename" "touch-icon-iphone-retina.png" }}"> + <link rel="apple-touch-icon" sizes="144x144" href="{{ route "appIcon" "filename" "touch-icon-ipad-retina.png" }}"> + <link rel="shortcut icon" type="image/x-icon" href="{{ route "favicon" }}"> + + {{ if .csrf }} + <meta name="X-CSRF-Token" value="{{ .csrf }}"> + {{ end }} + <title>{{template "title" .}} - Miniflux</title> + {{ if .user }} + <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .user.Theme }}"> + {{ else }} + <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" "white" }}"> + {{ end }} + <script type="text/javascript" src="{{ route "javascript" }}" defer></script> +</head> +<body data-entries-status-url="{{ route "updateEntriesStatus" }}"> + {{ if .user }} + <header class="header"> + <nav> + <div class="logo"> + <a href="{{ route "unread" }}">Mini<span>flux</span></a> + </div> + <ul> + <li {{ if eq .menu "unread" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g u" }}"> + <a href="{{ route "unread" }}" data-page="unread">{{ t "Unread" }}</a> + {{ if gt .countUnread 0 }} + <span class="unread-counter-wrapper">(<span class="unread-counter">{{ .countUnread }}</span>)</span> + {{ end }} + </li> + <li {{ if eq .menu "starred" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g b" }}"> + <a href="{{ route "starred" }}" data-page="starred">{{ t "Starred" }}</a> + </li> + <li {{ if eq .menu "history" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g h" }}"> + <a href="{{ route "history" }}" data-page="history">{{ t "History" }}</a> + </li> + <li {{ if eq .menu "feeds" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g f" }}"> + <a href="{{ route "feeds" }}" data-page="feeds">{{ t "Feeds" }}</a> + </li> + <li {{ if eq .menu "categories" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g c" }}"> + <a href="{{ route "categories" }}" data-page="categories">{{ t "Categories" }}</a> + </li> + <li {{ if eq .menu "settings" }}class="active"{{ end }} title="{{ t "Keyboard Shortcut: %s" "g s" }}"> + <a href="{{ route "settings" }}" data-page="settings">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "logout" }}" title="Logged as {{ .user.Username }}">{{ t "Logout" }}</a> + </li> + </ul> + </nav> + </header> + {{ end }} + {{ if .flashMessage }} + <div class="flash-message alert alert-success">{{ .flashMessage }}</div> + {{ end }} + {{ if .flashErrorMessage }} + <div class="flash-error-message alert alert-error">{{ .flashErrorMessage }}</div> + {{ end }} + <main> + {{template "content" .}} + </main> + <template id="keyboard-shortcuts"> + <div id="modal-left"> + <a href="#" class="btn-close-modal">x</a> + <h3>{{ t "Keyboard Shortcuts" }}</h3> + + <div class="keyboard-shortcuts"> + <p>{{ t "Sections Navigation" }}</p> + <ul> + <li>{{ t "Go to unread" }} = <strong>g + u</strong></li> + <li>{{ t "Go to bookmarks" }} = <strong>g + b</strong></li> + <li>{{ t "Go to history" }} = <strong>g + h</strong></li> + <li>{{ t "Go to feeds" }} = <strong>g + f</strong></li> + <li>{{ t "Go to categories" }} = <strong>g + c</strong></li> + <li>{{ t "Go to settings" }} = <strong>g + s</strong></li> + <li>{{ t "Show keyboard shortcuts" }} = <strong>?</strong></li> + </ul> + + <p>{{ t "Items Navigation" }}</p> + <ul> + <li>{{ t "Go to previous item" }} = <strong>p or j or ◄</strong></li> + <li>{{ t "Go to next item" }} = <strong>n or k or ►</strong></li> + </ul> + + <p>{{ t "Pages Navigation" }}</p> + <ul> + <li>{{ t "Go to previous page" }} = <strong>h</strong></li> + <li>{{ t "Go to next page" }} = <strong>l</strong></li> + </ul> + + <p>{{ t "Actions" }}</p> + <ul> + <li>{{ t "Open selected item" }} = <strong>o</strong></li> + <li>{{ t "Open original link" }} = <strong>v</strong></li> + <li>{{ t "Toggle read/unread" }} = <strong>m</strong></li> + <li>{{ t "Mark current page as read" }} = <strong>A</strong></li> + <li>{{ t "Download original content" }} = <strong>d</strong></li> + <li>{{ t "Toggle bookmark" }} = <strong>f</strong></li> + <li>{{ t "Save article" }} = <strong>s</strong></li> + <li>{{ t "Close modal dialog" }} = <strong>Esc</strong></li> + </ul> + </div> + </div> + </template> +</body> +</html> +{{ end }}
\ No newline at end of file diff --git a/template/html/common/pagination.html b/template/html/common/pagination.html new file mode 100644 index 0000000..4c6766a --- /dev/null +++ b/template/html/common/pagination.html @@ -0,0 +1,19 @@ +{{ define "pagination" }} +<div class="pagination"> + <div class="pagination-prev"> + {{ if .ShowPrev }} + <a href="{{ .Route }}{{ if gt .PrevOffset 0 }}?offset={{ .PrevOffset }}{{ end }}" data-page="previous">{{ t "Previous" }}</a> + {{ else }} + {{ t "Previous" }} + {{ end }} + </div> + + <div class="pagination-next"> + {{ if .ShowNext }} + <a href="{{ .Route }}?offset={{ .NextOffset }}" data-page="next">{{ t "Next" }}</a> + {{ else }} + {{ t "Next" }} + {{ end }} + </div> +</div> +{{ end }} diff --git a/template/html/create_category.html b/template/html/create_category.html new file mode 100644 index 0000000..7c4c93f --- /dev/null +++ b/template/html/create_category.html @@ -0,0 +1,27 @@ +{{ define "title"}}{{ t "New Category" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "New Category" }}</h1> + <ul> + <li> + <a href="{{ route "categories" }}">{{ t "Categories" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "saveCategory" }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-title">{{ t "Title" }}</label> + <input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Save" }}</button> {{ t "or" }} <a href="{{ route "categories" }}">{{ t "cancel" }}</a> + </div> +</form> +{{ end }} diff --git a/template/html/create_user.html b/template/html/create_user.html new file mode 100644 index 0000000..8faab49 --- /dev/null +++ b/template/html/create_user.html @@ -0,0 +1,44 @@ +{{ define "title"}}{{ t "New User" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "New User" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "saveUser" }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-username">{{ t "Username" }}</label> + <input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus> + + <label for="form-password">{{ t "Password" }}</label> + <input type="password" name="password" id="form-password" value="{{ .form.Password }}" required> + + <label for="form-confirmation">{{ t "Confirmation" }}</label> + <input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}" required> + + <label><input type="checkbox" name="is_admin" value="1" {{ if .form.IsAdmin }}checked{{ end }}> {{ t "Administrator" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Save" }}</button> {{ t "or" }} <a href="{{ route "users" }}">{{ t "cancel" }}</a> + </div> +</form> +{{ end }} diff --git a/template/html/edit_category.html b/template/html/edit_category.html new file mode 100644 index 0000000..2981fa4 --- /dev/null +++ b/template/html/edit_category.html @@ -0,0 +1,30 @@ +{{ define "title"}}{{ t "Edit Category: %s" .category.Title }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Edit Category: %s" .category.Title }}</h1> + <ul> + <li> + <a href="{{ route "categories" }}">{{ t "Categories" }}</a> + </li> + <li> + <a href="{{ route "createCategory" }}">{{ t "Create a category" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "updateCategory" "categoryID" .category.ID }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-title">{{ t "Title" }}</label> + <input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "categories" }}">{{ t "cancel" }}</a> + </div> +</form> +{{ end }} diff --git a/template/html/edit_feed.html b/template/html/edit_feed.html new file mode 100644 index 0000000..ebc9a02 --- /dev/null +++ b/template/html/edit_feed.html @@ -0,0 +1,77 @@ +{{ define "title"}}{{ t "Edit Feed: %s" .feed.Title }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ .feed.Title }}</h1> + <ul> + <li> + <a href="{{ route "feeds" }}">{{ t "Feeds" }}</a> + </li> + <li> + <a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + <li> + <a href="{{ route "import" }}">{{ t "Import" }}</a> + </li> + </ul> +</section> + +{{ if not .categories }} + <p class="alert alert-error">{{ t "There is no category!" }}</p> +{{ else }} + {{ if ne .feed.ParsingErrorCount 0 }} + <div class="alert alert-error"> + <h3>{{ t "Last Parsing Error" }}</h3> + {{ .feed.ParsingErrorMsg }} + </div> + {{ end }} + + <form action="{{ route "updateFeed" "feedID" .feed.ID }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-title">{{ t "Title" }}</label> + <input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus> + + <label for="form-site-url">{{ t "Site URL" }}</label> + <input type="url" name="site_url" id="form-site-url" placeholder="https://domain.tld/" value="{{ .form.SiteURL }}" required> + + <label for="form-feed-url">{{ t "Feed URL" }}</label> + <input type="url" name="feed_url" id="form-feed-url" placeholder="https://domain.tld/" value="{{ .form.FeedURL }}" required> + + <label for="form-scraper-rules">{{ t "Scraper Rules" }}</label> + <input type="text" name="scraper_rules" id="form-scraper-rules" value="{{ .form.ScraperRules }}"> + + <label for="form-rewrite-rules">{{ t "Rewrite Rules" }}</label> + <input type="text" name="rewrite_rules" id="form-rewrite-rules" value="{{ .form.RewriteRules }}"> + + <label for="form-category">{{ t "Category" }}</label> + <select id="form-category" name="category_id"> + {{ range .categories }} + <option value="{{ .ID }}" {{ if eq .ID $.form.CategoryID }}selected="selected"{{ end }}>{{ .Title }}</option> + {{ end }} + </select> + + <label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "Fetch original content" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "feeds" }}">{{ t "cancel" }}</a> + </div> + </form> + + <div class="panel"> + <ul> + <li><strong>{{ t "Last checked:" }} </strong><time datetime="{{ isodate .feed.CheckedAt }}" title="{{ isodate .feed.CheckedAt }}">{{ elapsed .feed.CheckedAt }}</time></li> + <li><strong>{{ t "ETag header:" }} </strong>{{ if .feed.EtagHeader }}{{ .feed.EtagHeader }}{{ else }}{{ t "None" }}{{ end }}</li> + <li><strong>{{ t "LastModified header:" }} </strong>{{ if .feed.LastModifiedHeader }}{{ .feed.LastModifiedHeader }}{{ else }}{{ t "None" }}{{ end }}</li> + </ul> + </div> +{{ end }} + +{{ end }}
\ No newline at end of file diff --git a/template/html/edit_user.html b/template/html/edit_user.html new file mode 100644 index 0000000..6611943 --- /dev/null +++ b/template/html/edit_user.html @@ -0,0 +1,47 @@ +{{ define "title"}}{{ t "Edit user: %s" .selected_user.Username }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Edit user %s" .selected_user.Username }}"</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + <li> + <a href="{{ route "createUser" }}">{{ t "Add user" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "updateUser" "userID" .selected_user.ID }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-username">{{ t "Username" }}</label> + <input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus> + + <label for="form-password">{{ t "Password" }}</label> + <input type="password" name="password" id="form-password" value="{{ .form.Password }}"> + + <label for="form-confirmation">{{ t "Confirmation" }}</label> + <input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}"> + + <label><input type="checkbox" name="is_admin" value="1" {{ if .form.IsAdmin }}checked{{ end }}> {{ t "Administrator" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "users" }}">{{ t "cancel" }}</a> + </div> +</form> +{{ end }} diff --git a/template/html/entry.html b/template/html/entry.html new file mode 100644 index 0000000..66d08fb --- /dev/null +++ b/template/html/entry.html @@ -0,0 +1,109 @@ +{{ define "title"}}{{ .entry.Title }}{{ end }} + +{{ define "content"}} +<section class="entry"> + <header class="entry-header"> + <h1> + <a href="{{ .entry.URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .entry.Title }}</a> + </h1> + <div class="entry-actions"> + <ul> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .entry.ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .entry.Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .entry.ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="#" + title="{{ t "Fetch original content" }}" + data-fetch-content-entry="true" + data-fetch-content-url="{{ route "fetchContent" "entryID" .entry.ID }}" + data-label-loading="{{ t "Loading..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Fetch original content" }}</a> + </li> + </ul> + </div> + <div class="entry-meta"> + <span class="entry-website"> + {{ if ne .entry.Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .entry.Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "feedEntries" "feedID" .entry.Feed.ID }}">{{ .entry.Feed.Title }}</a> + </span> + {{ if .entry.Author }} + <span class="entry-author"> + {{ if isEmail .entry.Author }} + - <a href="mailto:{{ .entry.Author }}">{{ .entry.Author }}</a> + {{ else }} + – <em>{{ .entry.Author }}</em> + {{ end }} + </span> + {{ end }} + <span class="category"> + <a href="{{ route "categoryEntries" "categoryID" .entry.Feed.Category.ID }}">{{ .entry.Feed.Category.Title }}</a> + </span> + </div> + <div class="entry-date"> + <time datetime="{{ isodate .entry.Date }}" title="{{ isodate .entry.Date }}">{{ elapsed .entry.Date }}</time> + </div> + </header> + {{ if gt (len .entry.Content) 120 }} + <div class="pagination-top"> + {{ template "entry_pagination" . }} + </div> + {{ end }} + <article class="entry-content"> + {{ noescape (proxyFilter .entry.Content) }} + </article> + {{ if .entry.Enclosures }} + <aside class="entry-enclosures"> + <h3>{{ t "Attachments" }}</h3> + {{ range .entry.Enclosures }} + <div class="entry-enclosure"> + {{ if hasPrefix .MimeType "audio/" }} + <div class="enclosure-audio"> + <audio controls preload="metadata"> + <source src="{{ .URL }}" type="{{ .MimeType }}"> + </audio> + </div> + {{ else if hasPrefix .MimeType "video/" }} + <div class="enclosure-video"> + <video controls preload="metadata"> + <source src="{{ .URL }}" type="{{ .MimeType }}"> + </video> + </div> + {{ else if hasPrefix .MimeType "image/" }} + <div class="enclosure-image"> + <img src="{{ proxyURL .URL }}" title="{{ .URL }} ({{ .MimeType }})" alt="{{ .URL }} ({{ .MimeType }})"> + </div> + {{ end }} + + <div class="entry-enclosure-download"> + <a href="{{ .URL }}" title="{{ .URL }} ({{ .MimeType }})" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ t "Download" }}</a> + <small>({{ .URL }})</small> + </div> + </div> + {{ end }} + </aside> + {{ end }} +</section> + +<div class="pagination-bottom"> + {{ template "entry_pagination" . }} +</div> +{{ end }} diff --git a/template/html/feed_entries.html b/template/html/feed_entries.html new file mode 100644 index 0000000..4317f88 --- /dev/null +++ b/template/html/feed_entries.html @@ -0,0 +1,79 @@ +{{ define "title"}}{{ .feed.Title }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ .feed.Title }} ({{ .total }})</h1> + <ul> + <li> + <a href="{{ route "refreshFeed" "feedID" .feed.ID }}">{{ t "Refresh" }}</a> + </li> + <li> + <a href="{{ route "editFeed" "feedID" .feed.ID }}">{{ t "Edit" }}</a> + </li> + {{ if .entries }} + <li> + <a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a> + </li> + {{ end }} + </ul> +</section> + +{{ if ne .feed.ParsingErrorCount 0 }} +<div class="alert alert-error"> + <h3>{{ t "There is a problem with this feed" }}</h3> + {{ .feed.ParsingErrorMsg }} +</div> +{{ else if not .entries }} + <p class="alert">{{ t "There is no article for this feed." }}</p> +{{ else }} + <div class="items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "feedEntry" "feedID" .Feed.ID "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }} diff --git a/template/html/feeds.html b/template/html/feeds.html new file mode 100644 index 0000000..5500c92 --- /dev/null +++ b/template/html/feeds.html @@ -0,0 +1,77 @@ +{{ define "title"}}{{ t "Feeds" }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Feeds" }} ({{ .total }})</h1> + <ul> + <li> + <a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + <li> + <a href="{{ route "import" }}">{{ t "Import" }}</a> + </li> + <li> + <a href="{{ route "refreshAllFeeds" }}">{{ t "Refresh all feeds in background" }}</a> + </li> + </ul> +</section> + +{{ if not .feeds }} + <p class="alert">{{ t "You don't have any subscription." }}</p> +{{ else }} + <div class="items"> + {{ range .feeds }} + <article class="item {{ if ne .ParsingErrorCount 0 }}feed-parsing-error{{ end }}"> + <div class="item-header"> + <span class="item-title"> + {{ if .Icon }} + <img src="{{ route "icon" "iconID" .Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "feedEntries" "feedID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"> + <a href="{{ route "categoryEntries" "categoryID" .Category.ID }}">{{ .Category.Title }}</a> + </span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ .SiteURL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ domain .SiteURL }}</a> + </li> + <li> + {{ t "Last check:" }} <time datetime="{{ isodate .CheckedAt }}" title="{{ isodate .CheckedAt }}">{{ elapsed .CheckedAt }}</time> + </li> + </ul> + <ul> + <li> + <a href="{{ route "refreshFeed" "feedID" .ID }}">{{ t "Refresh" }}</a> + </li> + <li> + <a href="{{ route "editFeed" "feedID" .ID }}">{{ t "Edit" }}</a> + </li> + <li> + <a href="#" + data-confirm="true" + data-label-question="{{ t "Are you sure?" }}" + data-label-yes="{{ t "yes" }}" + data-label-no="{{ t "no" }}" + data-label-loading="{{ t "Work in progress..." }}" + data-url="{{ route "removeFeed" "feedID" .ID }}">{{ t "Remove" }}</a> + </li> + </ul> + </div> + {{ if ne .ParsingErrorCount 0 }} + <div class="parsing-error"> + <strong title="{{ .ParsingErrorMsg }}" class="parsing-error-count">{{ plural "plural.feed.error_count" .ParsingErrorCount .ParsingErrorCount }}</strong> + <small class="parsing-error-message">({{ .ParsingErrorMsg }})</small> + </div> + {{ end }} + </article> + {{ end }} + </div> +{{ end }} + +{{ end }} diff --git a/template/html/history.html b/template/html/history.html new file mode 100644 index 0000000..5baa0df --- /dev/null +++ b/template/html/history.html @@ -0,0 +1,68 @@ +{{ define "title"}}{{ t "History" }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "History" }} ({{ .total }})</h1> + {{ if .entries }} + <ul> + <li> + <a href="{{ route "flushHistory" }}">{{ t "Flush history" }}</a> + </li> + </ul> + {{ end }} +</section> + +{{ if not .entries }} + <p class="alert alert-info">{{ t "There is no history at the moment." }}</p> +{{ else }} + <div class="items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "readEntry" "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }} diff --git a/template/html/import.html b/template/html/import.html new file mode 100644 index 0000000..dbdb9b0 --- /dev/null +++ b/template/html/import.html @@ -0,0 +1,34 @@ +{{ define "title"}}{{ t "Import" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Import" }}</h1> + <ul> + <li> + <a href="{{ route "feeds" }}">{{ t "Feeds" }}</a> + </li> + <li> + <a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "uploadOPML" }}" method="post" enctype="multipart/form-data"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-file">{{ t "OPML file" }}</label> + <input type="file" name="file" id="form-file"> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Import" }}</button> + </div> +</form> + +{{ end }} diff --git a/template/html/integrations.html b/template/html/integrations.html new file mode 100644 index 0000000..5005d68 --- /dev/null +++ b/template/html/integrations.html @@ -0,0 +1,112 @@ +{{ define "title"}}{{ t "Integrations" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Integrations" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + {{ if .user.IsAdmin }} + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + {{ end }} + <li> + <a href="{{ route "about" }}">{{ t "About" }}</a> + </li> + </ul> +</section> + +<form method="post" autocomplete="off" action="{{ route "updateIntegration" }}"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <h3>Fever</h3> + <div class="form-section"> + <label> + <input type="checkbox" name="fever_enabled" value="1" {{ if .form.FeverEnabled }}checked{{ end }}> {{ t "Activate Fever API" }} + </label> + + <label for="form-fever-username">{{ t "Fever Username" }}</label> + <input type="text" name="fever_username" id="form-fever-username" value="{{ .form.FeverUsername }}"> + + <label for="form-fever-password">{{ t "Fever Password" }}</label> + <input type="password" name="fever_password" id="form-fever-password" value="{{ .form.FeverPassword }}"> + </div> + + <h3>Pinboard</h3> + <div class="form-section"> + <label> + <input type="checkbox" name="pinboard_enabled" value="1" {{ if .form.PinboardEnabled }}checked{{ end }}> {{ t "Save articles to Pinboard" }} + </label> + + <label for="form-pinboard-token">{{ t "Pinboard API Token" }}</label> + <input type="password" name="pinboard_token" id="form-pinboard-token" value="{{ .form.PinboardToken }}"> + + <label for="form-pinboard-tags">{{ t "Pinboard Tags" }}</label> + <input type="text" name="pinboard_tags" id="form-pinboard-tags" value="{{ .form.PinboardTags }}"> + + <label> + <input type="checkbox" name="pinboard_mark_as_unread" value="1" {{ if .form.PinboardMarkAsUnread }}checked{{ end }}> {{ t "Mark bookmark as unread" }} + </label> + </div> + + <h3>Instapaper</h3> + <div class="form-section"> + <label> + <input type="checkbox" name="instapaper_enabled" value="1" {{ if .form.InstapaperEnabled }}checked{{ end }}> {{ t "Save articles to Instapaper" }} + </label> + + <label for="form-instapaper-username">{{ t "Instapaper Username" }}</label> + <input type="text" name="instapaper_username" id="form-instapaper-username" value="{{ .form.InstapaperUsername }}"> + + <label for="form-instapaper-password">{{ t "Instapaper Password" }}</label> + <input type="password" name="instapaper_password" id="form-instapaper-password" value="{{ .form.InstapaperPassword }}"> + </div> + + <h3>Wallabag</h3> + <div class="form-section"> + <label> + <input type="checkbox" name="wallabag_enabled" value="1" {{ if .form.WallabagEnabled }}checked{{ end }}> {{ t "Save articles to Wallabag" }} + </label> + + <label for="form-wallabag-url">{{ t "Wallabag API Endpoint" }}</label> + <input type="url" name="wallabag_url" id="form-wallabag-url" value="{{ .form.WallabagURL }}" placeholder="http://v2.wallabag.org/"> + + <label for="form-wallabag-client-id">{{ t "Wallabag Client ID" }}</label> + <input type="text" name="wallabag_client_id" id="form-wallabag-client-id" value="{{ .form.WallabagClientID }}"> + + <label for="form-wallabag-client-secret">{{ t "Wallabag Client Secret" }}</label> + <input type="password" name="wallabag_client_secret" id="form-wallabag-client-secret" value="{{ .form.WallabagClientSecret }}"> + + <label for="form-wallabag-username">{{ t "Wallabag Username" }}</label> + <input type="text" name="wallabag_username" id="form-wallabag-username" value="{{ .form.WallabagUsername }}"> + + <label for="form-wallabag-password">{{ t "Wallabag Password" }}</label> + <input type="password" name="wallabag_password" id="form-wallabag-password" value="{{ .form.WallabagPassword }}"> + </div> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> + </div> +</form> + +<div class="panel"> + <h3>{{ t "Bookmarklet" }}</h3> + <p>{{ t "This special link allows you to subscribe to a website directly by using a bookmark in your web browser." }}</p> + + <div class="bookmarklet"> + <a href="javascript:location.href='{{ baseURL }}{{ route "bookmarklet" }}?uri='+encodeURIComponent(window.location.href)">{{ t "Add to Miniflux" }}</a> + </div> + + <p>{{ t "Drag and drop this link to your bookmarks." }}</p> +</div> + +{{ end }} diff --git a/template/html/login.html b/template/html/login.html new file mode 100644 index 0000000..906458a --- /dev/null +++ b/template/html/login.html @@ -0,0 +1,28 @@ +{{ define "title"}}{{ t "Sign In" }}{{ end }} + +{{ define "content"}} +<section class="login-form"> + <form action="{{ route "checkLogin" }}" method="post"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-username">{{ t "Username" }}</label> + <input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus> + + <label for="form-password">{{ t "Password" }}</label> + <input type="password" name="password" id="form-password" value="{{ .form.Password }}" required> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Sign in" }}</button> + </div> + </form> + {{ if hasOAuth2Provider "google" }} + <div class="oauth2"> + <a href="{{ route "oauth2Redirect" "provider" "google" }}">{{ t "Sign in with Google" }}</a> + </div> + {{ end }} +</section> +{{ end }} diff --git a/template/html/sessions.html b/template/html/sessions.html new file mode 100644 index 0000000..6c76867 --- /dev/null +++ b/template/html/sessions.html @@ -0,0 +1,51 @@ +{{ define "title"}}{{ t "Sessions" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Sessions" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + <li> + <a href="{{ route "createUser" }}">{{ t "Add user" }}</a> + </li> + </ul> +</section> + +<table> + <tr> + <th>{{ t "Date" }}</th> + <th>{{ t "IP Address" }}</th> + <th>{{ t "User Agent" }}</th> + <th>{{ t "Actions" }}</th> + </tr> + {{ range .sessions }} + <tr {{ if eq .Token $.currentSessionToken }}class="row-highlighted"{{ end }}> + <td class="column-20" title="{{ isodate .CreatedAt }}">{{ elapsed .CreatedAt }}</td> + <td class="column-20" title="{{ .IP }}">{{ .IP }}</td> + <td title="{{ .UserAgent }}">{{ .UserAgent }}</td> + <td class="column-20"> + {{ if eq .Token $.currentSessionToken }} + {{ t "Current session" }} + {{ else }} + <a href="#" + data-confirm="true" + data-label-question="{{ t "Are you sure?" }}" + data-label-yes="{{ t "yes" }}" + data-label-no="{{ t "no" }}" + data-label-loading="{{ t "Work in progress..." }}" + data-url="{{ route "removeSession" "sessionID" .ID }}">{{ t "Remove" }}</a> + {{ end }} + </td> + </tr> + {{ end }} +</table> + +{{ end }} diff --git a/template/html/settings.html b/template/html/settings.html new file mode 100644 index 0000000..8e66a10 --- /dev/null +++ b/template/html/settings.html @@ -0,0 +1,82 @@ +{{ define "title"}}{{ t "Settings" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Settings" }}</h1> + <ul> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + {{ if .user.IsAdmin }} + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + {{ end }} + <li> + <a href="{{ route "about" }}">{{ t "About" }}</a> + </li> + </ul> +</section> + +<form method="post" autocomplete="off" action="{{ route "updateSettings" }}"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-username">{{ t "Username" }}</label> + <input type="text" name="username" id="form-username" value="{{ .form.Username }}" required> + + <label for="form-password">{{ t "Password" }}</label> + <input type="password" name="password" id="form-password" value="{{ .form.Password }}" autocomplete="off"> + + <label for="form-confirmation">{{ t "Confirmation" }}</label> + <input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}" autocomplete="off"> + + <label for="form-language">{{ t "Language" }}</label> + <select id="form-language" name="language"> + {{ range $key, $value := .languages }} + <option value="{{ $key }}" {{ if eq $key $.form.Language }}selected="selected"{{ end }}>{{ $value }}</option> + {{ end }} + </select> + + <label for="form-timezone">{{ t "Timezone" }}</label> + <select id="form-timezone" name="timezone"> + {{ range $key, $value := .timezones }} + <option value="{{ $key }}" {{ if eq $key $.form.Timezone }}selected="selected"{{ end }}>{{ $value }}</option> + {{ end }} + </select> + + <label for="form-theme">{{ t "Theme" }}</label> + <select id="form-theme" name="theme"> + {{ range $key, $value := .themes }} + <option value="{{ $key }}" {{ if eq $key $.form.Theme }}selected="selected"{{ end }}>{{ $value }}</option> + {{ end }} + </select> + + <label for="form-entry-direction">{{ t "Entry Sorting" }}</label> + <select id="form-entry-direction" name="entry_direction"> + <option value="asc" {{ if eq "asc" $.form.EntryDirection }}selected="selected"{{ end }}>{{ t "Older entries first" }}</option> + <option value="desc" {{ if eq "desc" $.form.EntryDirection }}selected="selected"{{ end }}>{{ t "Recent entries first" }}</option> + </select> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> + </div> +</form> + +{{ if hasOAuth2Provider "google" }} +<div class="panel"> + {{ if hasKey .user.Extra "google_id" }} + <a href="{{ route "oauth2Unlink" "provider" "google" }}">{{ t "Unlink my Google account" }}</a> + {{ else }} + <a href="{{ route "oauth2Redirect" "provider" "google" }}">{{ t "Link my Google account" }}</a> + {{ end }} +</div> +{{ end }} + +{{ end }} diff --git a/template/html/starred.html b/template/html/starred.html new file mode 100644 index 0000000..1ed1b13 --- /dev/null +++ b/template/html/starred.html @@ -0,0 +1,61 @@ +{{ define "title"}}{{ t "Favorites" }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Favorites" }} ({{ .total }})</h1> +</section> + +{{ if not .entries }} + <p class="alert alert-info">{{ t "There is no bookmark at the moment." }}</p> +{{ else }} + <div class="items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "starredEntry" "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }} diff --git a/template/html/unread.html b/template/html/unread.html new file mode 100644 index 0000000..feb5beb --- /dev/null +++ b/template/html/unread.html @@ -0,0 +1,68 @@ +{{ define "title"}}{{ t "Unread Items" }} {{ if gt .countUnread 0 }}({{ .countUnread }}){{ end }} {{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Unread" }} (<span class="unread-counter">{{ .countUnread }}</span>)</h1> + {{ if .entries }} + <ul> + <li> + <a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a> + </li> + </ul> + {{ end }} +</section> + +{{ if not .entries }} + <p class="alert">{{ t "There is no unread article." }}</p> +{{ else }} + <div class="items hide-read-items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "unreadEntry" "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }}
\ No newline at end of file diff --git a/template/html/users.html b/template/html/users.html new file mode 100644 index 0000000..40ca5e9 --- /dev/null +++ b/template/html/users.html @@ -0,0 +1,60 @@ +{{ define "title"}}{{ t "Users" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Users" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + <li> + <a href="{{ route "createUser" }}">{{ t "Add user" }}</a> + </li> + </ul> +</section> + +{{ if eq (len .users) 1 }} + <p class="alert">{{ t "You are the only user." }}</p> +{{ else }} + <table> + <tr> + <th class="column-20">{{ t "Username" }}</th> + <th>{{ t "Administrator" }}</th> + <th>{{ t "Last Login" }}</th> + <th>{{ t "Actions" }}</th> + </tr> + {{ range .users }} + {{ if ne .ID $.user.ID }} + <tr> + <td>{{ .Username }}</td> + <td>{{ if eq .IsAdmin true }}{{ t "Yes" }}{{ else }}{{ t "No" }}{{ end }}</td> + <td> + {{ if .LastLoginAt }} + <time datetime="{{ isodate .LastLoginAt }}" title="{{ isodate .LastLoginAt }}">{{ elapsed .LastLoginAt }}</time> + {{ else }} + {{ t "Never" }} + {{ end }} + </td> + <td> + <a href="{{ route "editUser" "userID" .ID }}">{{ t "Edit" }}</a>, + <a href="#" + data-confirm="true" + data-label-question="{{ t "Are you sure?" }}" + data-label-yes="{{ t "yes" }}" + data-label-no="{{ t "no" }}" + data-label-loading="{{ t "Work in progress..." }}" + data-url="{{ route "removeUser" "userID" .ID }}">{{ t "Remove" }}</a> + </td> + </tr> + {{ end }} + {{ end }} + </table> +{{ end }} + +{{ end }} diff --git a/template/template.go b/template/template.go new file mode 100644 index 0000000..60d4d85 --- /dev/null +++ b/template/template.go @@ -0,0 +1,149 @@ +// Copyright 2017 Frédéric Guilloe. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package template + +import ( + "bytes" + "html/template" + "io" + "net/mail" + "strings" + "time" + + "github.com/miniflux/miniflux/config" + "github.com/miniflux/miniflux/duration" + "github.com/miniflux/miniflux/errors" + "github.com/miniflux/miniflux/filter" + "github.com/miniflux/miniflux/http/route" + "github.com/miniflux/miniflux/locale" + "github.com/miniflux/miniflux/logger" + "github.com/miniflux/miniflux/url" + + "github.com/gorilla/mux" +) + +// Engine handles the templating system. +type Engine struct { + templates map[string]*template.Template + router *mux.Router + translator *locale.Translator + currentLocale *locale.Language + cfg *config.Config +} + +func (e *Engine) parseAll() { + funcMap := template.FuncMap{ + "baseURL": func() string { + return e.cfg.Get("BASE_URL", config.DefaultBaseURL) + }, + "hasOAuth2Provider": func(provider string) bool { + return e.cfg.Get("OAUTH2_PROVIDER", "") == provider + }, + "hasKey": func(dict map[string]string, key string) bool { + if value, found := dict[key]; found { + return value != "" + } + return false + }, + "route": func(name string, args ...interface{}) string { + return route.Path(e.router, name, args...) + }, + "noescape": func(str string) template.HTML { + return template.HTML(str) + }, + "proxyFilter": func(data string) string { + return filter.ImageProxyFilter(e.router, data) + }, + "proxyURL": func(link string) string { + if url.IsHTTPS(link) { + return link + } + + return filter.Proxify(e.router, link) + }, + "domain": func(websiteURL string) string { + return url.Domain(websiteURL) + }, + "isEmail": func(str string) bool { + _, err := mail.ParseAddress(str) + if err != nil { + return false + } + return true + }, + "hasPrefix": func(str, prefix string) bool { + return strings.HasPrefix(str, prefix) + }, + "contains": func(str, substr string) bool { + return strings.Contains(str, substr) + }, + "isodate": func(ts time.Time) string { + return ts.Format("2006-01-02 15:04:05") + }, + "elapsed": func(ts time.Time) string { + return duration.ElapsedTime(e.currentLocale, ts) + }, + "t": func(key interface{}, args ...interface{}) string { + switch key.(type) { + case string: + return e.currentLocale.Get(key.(string), args...) + case errors.LocalizedError: + err := key.(errors.LocalizedError) + return err.Localize(e.currentLocale) + case error: + return key.(error).Error() + default: + return "" + } + }, + "plural": func(key string, n int, args ...interface{}) string { + return e.currentLocale.Plural(key, n, args...) + }, + } + + commonTemplates := "" + for _, content := range templateCommonMap { + commonTemplates += content + } + + for name, content := range templateViewsMap { + logger.Debug("[Template] Parsing: %s", name) + e.templates[name] = template.Must(template.New("main").Funcs(funcMap).Parse(commonTemplates + content)) + } +} + +// SetLanguage change the language for template processing. +func (e *Engine) SetLanguage(language string) { + e.currentLocale = e.translator.GetLanguage(language) +} + +// Execute process a template. +func (e *Engine) Execute(w io.Writer, name string, data interface{}) { + tpl, ok := e.templates[name] + if !ok { + logger.Fatal("[Template] The template %s does not exists", name) + } + + var b bytes.Buffer + err := tpl.ExecuteTemplate(&b, "base", data) + if err != nil { + logger.Fatal("[Template] Unable to render template: %v", err) + } + + b.WriteTo(w) +} + +// NewEngine returns a new template Engine. +func NewEngine(cfg *config.Config, router *mux.Router, translator *locale.Translator) *Engine { + tpl := &Engine{ + templates: make(map[string]*template.Template), + router: router, + translator: translator, + cfg: cfg, + } + + tpl.parseAll() + return tpl +} diff --git a/template/views.go b/template/views.go new file mode 100644 index 0000000..8bc5c79 --- /dev/null +++ b/template/views.go @@ -0,0 +1,1356 @@ +// Code generated by go generate; DO NOT EDIT. +// 2018-01-02 21:59:10.091229271 -0800 PST m=+0.018604600 + +package template + +var templateViewsMap = map[string]string{ + "about": `{{ define "title"}}{{ t "About" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "About" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + {{ if .user.IsAdmin }} + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + {{ end }} + </ul> +</section> + +<div class="panel"> + <h3>{{ t "Version" }}</h3> + <ul> + <li><strong>{{ t "Version:" }}</strong> {{ .version }}</li> + <li><strong>{{ t "Build Date:" }}</strong> {{ .build_date }}</li> + </ul> +</div> + +<div class="panel"> + <h3>{{ t "Authors" }}</h3> + <ul> + <li><strong>{{ t "Author:" }}</strong> Frédéric Guillot</li> + <li><strong>{{ t "License:" }}</strong> Apache 2.0</li> + </ul> +</div> + +{{ end }} +`, + "add_subscription": `{{ define "title"}}{{ t "New Subscription" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "New Subscription" }}</h1> + <ul> + <li> + <a href="{{ route "feeds" }}">{{ t "Feeds" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + <li> + <a href="{{ route "import" }}">{{ t "Import" }}</a> + </li> + </ul> +</section> + +{{ if not .categories }} + <p class="alert alert-error">{{ t "There is no category. You must have at least one category." }}</p> +{{ else }} + <form action="{{ route "submitSubscription" }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-url">{{ t "URL" }}</label> + <input type="url" name="url" id="form-url" placeholder="https://domain.tld/" value="{{ .form.URL }}" required autofocus> + + <label for="form-category">{{ t "Category" }}</label> + <select id="form-category" name="category_id"> + {{ range .categories }} + <option value="{{ .ID }}">{{ .Title }}</option> + {{ end }} + </select> + + <label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "Fetch original content" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Find a subscription" }}</button> + </div> + </form> +{{ end }} + +{{ end }} +`, + "categories": `{{ define "title"}}{{ t "Categories" }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Categories" }} ({{ .total }})</h1> + <ul> + <li> + <a href="{{ route "createCategory" }}">{{ t "Create a category" }}</a> + </li> + </ul> +</section> + +{{ if not .categories }} + <p class="alert alert-error">{{ t "There is no category." }}</p> +{{ else }} + <div class="items"> + {{ range .categories }} + <article class="item"> + <div class="item-header"> + <span class="item-title"> + <a href="{{ route "categoryEntries" "categoryID" .ID }}">{{ .Title }}</a> + </span> + </div> + <div class="item-meta"> + <ul> + <li> + {{ if eq .FeedCount 0 }} + {{ t "No feed." }} + {{ else }} + {{ plural "plural.categories.feed_count" .FeedCount .FeedCount }} + {{ end }} + </li> + </ul> + <ul> + <li> + <a href="{{ route "editCategory" "categoryID" .ID }}">{{ t "Edit" }}</a> + </li> + {{ if eq .FeedCount 0 }} + <li> + <a href="#" + data-confirm="true" + data-label-question="{{ t "Are you sure?" }}" + data-label-yes="{{ t "yes" }}" + data-label-no="{{ t "no" }}" + data-label-loading="{{ t "Work in progress..." }}" + data-url="{{ route "removeCategory" "categoryID" .ID }}">{{ t "Remove" }}</a> + </li> + {{ end }} + </ul> + </div> + </article> + {{ end }} + </div> +{{ end }} + +{{ end }} +`, + "category_entries": `{{ define "title"}}{{ .category.Title }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ .category.Title }} ({{ .total }})</h1> + {{ if .entries }} + <ul> + <li> + <a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a> + </li> + </ul> + {{ end }} +</section> + +{{ if not .entries }} + <p class="alert">{{ t "There is no article in this category." }}</p> +{{ else }} + <div class="items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "categoryEntry" "categoryID" .Feed.Category.ID "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }} +`, + "choose_subscription": `{{ define "title"}}{{ t "Choose a Subscription" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "New Subscription" }}</h1> + <ul> + <li> + <a href="{{ route "feeds" }}">{{ t "Feeds" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + <li> + <a href="{{ route "import" }}">{{ t "Import" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "chooseSubscription" }}" method="POST"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + <input type="hidden" name="category_id" value="{{ .categoryID }}"> + + <h3>{{ t "Choose a Subscription" }}</h3> + + {{ range .subscriptions }} + <div class="radio-group"> + <label title="{{ .URL }}"><input type="radio" name="url" value="{{ .URL }}"> {{ .Title }}</label> ({{ .Type }}) + <small title="Type = {{ .Type }}"><a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .URL }}</a></small> + </div> + {{ end }} + + <br> + <label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "Fetch original content" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Subscribe" }}</button> + </div> +</form> +{{ end }} +`, + "create_category": `{{ define "title"}}{{ t "New Category" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "New Category" }}</h1> + <ul> + <li> + <a href="{{ route "categories" }}">{{ t "Categories" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "saveCategory" }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-title">{{ t "Title" }}</label> + <input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Save" }}</button> {{ t "or" }} <a href="{{ route "categories" }}">{{ t "cancel" }}</a> + </div> +</form> +{{ end }} +`, + "create_user": `{{ define "title"}}{{ t "New User" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "New User" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "saveUser" }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-username">{{ t "Username" }}</label> + <input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus> + + <label for="form-password">{{ t "Password" }}</label> + <input type="password" name="password" id="form-password" value="{{ .form.Password }}" required> + + <label for="form-confirmation">{{ t "Confirmation" }}</label> + <input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}" required> + + <label><input type="checkbox" name="is_admin" value="1" {{ if .form.IsAdmin }}checked{{ end }}> {{ t "Administrator" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Save" }}</button> {{ t "or" }} <a href="{{ route "users" }}">{{ t "cancel" }}</a> + </div> +</form> +{{ end }} +`, + "edit_category": `{{ define "title"}}{{ t "Edit Category: %s" .category.Title }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Edit Category: %s" .category.Title }}</h1> + <ul> + <li> + <a href="{{ route "categories" }}">{{ t "Categories" }}</a> + </li> + <li> + <a href="{{ route "createCategory" }}">{{ t "Create a category" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "updateCategory" "categoryID" .category.ID }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-title">{{ t "Title" }}</label> + <input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "categories" }}">{{ t "cancel" }}</a> + </div> +</form> +{{ end }} +`, + "edit_feed": `{{ define "title"}}{{ t "Edit Feed: %s" .feed.Title }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ .feed.Title }}</h1> + <ul> + <li> + <a href="{{ route "feeds" }}">{{ t "Feeds" }}</a> + </li> + <li> + <a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + <li> + <a href="{{ route "import" }}">{{ t "Import" }}</a> + </li> + </ul> +</section> + +{{ if not .categories }} + <p class="alert alert-error">{{ t "There is no category!" }}</p> +{{ else }} + {{ if ne .feed.ParsingErrorCount 0 }} + <div class="alert alert-error"> + <h3>{{ t "Last Parsing Error" }}</h3> + {{ .feed.ParsingErrorMsg }} + </div> + {{ end }} + + <form action="{{ route "updateFeed" "feedID" .feed.ID }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-title">{{ t "Title" }}</label> + <input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus> + + <label for="form-site-url">{{ t "Site URL" }}</label> + <input type="url" name="site_url" id="form-site-url" placeholder="https://domain.tld/" value="{{ .form.SiteURL }}" required> + + <label for="form-feed-url">{{ t "Feed URL" }}</label> + <input type="url" name="feed_url" id="form-feed-url" placeholder="https://domain.tld/" value="{{ .form.FeedURL }}" required> + + <label for="form-scraper-rules">{{ t "Scraper Rules" }}</label> + <input type="text" name="scraper_rules" id="form-scraper-rules" value="{{ .form.ScraperRules }}"> + + <label for="form-rewrite-rules">{{ t "Rewrite Rules" }}</label> + <input type="text" name="rewrite_rules" id="form-rewrite-rules" value="{{ .form.RewriteRules }}"> + + <label for="form-category">{{ t "Category" }}</label> + <select id="form-category" name="category_id"> + {{ range .categories }} + <option value="{{ .ID }}" {{ if eq .ID $.form.CategoryID }}selected="selected"{{ end }}>{{ .Title }}</option> + {{ end }} + </select> + + <label><input type="checkbox" name="crawler" value="1" {{ if .form.Crawler }}checked{{ end }}> {{ t "Fetch original content" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "feeds" }}">{{ t "cancel" }}</a> + </div> + </form> + + <div class="panel"> + <ul> + <li><strong>{{ t "Last checked:" }} </strong><time datetime="{{ isodate .feed.CheckedAt }}" title="{{ isodate .feed.CheckedAt }}">{{ elapsed .feed.CheckedAt }}</time></li> + <li><strong>{{ t "ETag header:" }} </strong>{{ if .feed.EtagHeader }}{{ .feed.EtagHeader }}{{ else }}{{ t "None" }}{{ end }}</li> + <li><strong>{{ t "LastModified header:" }} </strong>{{ if .feed.LastModifiedHeader }}{{ .feed.LastModifiedHeader }}{{ else }}{{ t "None" }}{{ end }}</li> + </ul> + </div> +{{ end }} + +{{ end }}`, + "edit_user": `{{ define "title"}}{{ t "Edit user: %s" .selected_user.Username }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Edit user %s" .selected_user.Username }}"</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + <li> + <a href="{{ route "createUser" }}">{{ t "Add user" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "updateUser" "userID" .selected_user.ID }}" method="post" autocomplete="off"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-username">{{ t "Username" }}</label> + <input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus> + + <label for="form-password">{{ t "Password" }}</label> + <input type="password" name="password" id="form-password" value="{{ .form.Password }}"> + + <label for="form-confirmation">{{ t "Confirmation" }}</label> + <input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}"> + + <label><input type="checkbox" name="is_admin" value="1" {{ if .form.IsAdmin }}checked{{ end }}> {{ t "Administrator" }}</label> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "users" }}">{{ t "cancel" }}</a> + </div> +</form> +{{ end }} +`, + "entry": `{{ define "title"}}{{ .entry.Title }}{{ end }} + +{{ define "content"}} +<section class="entry"> + <header class="entry-header"> + <h1> + <a href="{{ .entry.URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .entry.Title }}</a> + </h1> + <div class="entry-actions"> + <ul> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .entry.ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .entry.Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .entry.ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="#" + title="{{ t "Fetch original content" }}" + data-fetch-content-entry="true" + data-fetch-content-url="{{ route "fetchContent" "entryID" .entry.ID }}" + data-label-loading="{{ t "Loading..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Fetch original content" }}</a> + </li> + </ul> + </div> + <div class="entry-meta"> + <span class="entry-website"> + {{ if ne .entry.Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .entry.Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "feedEntries" "feedID" .entry.Feed.ID }}">{{ .entry.Feed.Title }}</a> + </span> + {{ if .entry.Author }} + <span class="entry-author"> + {{ if isEmail .entry.Author }} + - <a href="mailto:{{ .entry.Author }}">{{ .entry.Author }}</a> + {{ else }} + – <em>{{ .entry.Author }}</em> + {{ end }} + </span> + {{ end }} + <span class="category"> + <a href="{{ route "categoryEntries" "categoryID" .entry.Feed.Category.ID }}">{{ .entry.Feed.Category.Title }}</a> + </span> + </div> + <div class="entry-date"> + <time datetime="{{ isodate .entry.Date }}" title="{{ isodate .entry.Date }}">{{ elapsed .entry.Date }}</time> + </div> + </header> + {{ if gt (len .entry.Content) 120 }} + <div class="pagination-top"> + {{ template "entry_pagination" . }} + </div> + {{ end }} + <article class="entry-content"> + {{ noescape (proxyFilter .entry.Content) }} + </article> + {{ if .entry.Enclosures }} + <aside class="entry-enclosures"> + <h3>{{ t "Attachments" }}</h3> + {{ range .entry.Enclosures }} + <div class="entry-enclosure"> + {{ if hasPrefix .MimeType "audio/" }} + <div class="enclosure-audio"> + <audio controls preload="metadata"> + <source src="{{ .URL }}" type="{{ .MimeType }}"> + </audio> + </div> + {{ else if hasPrefix .MimeType "video/" }} + <div class="enclosure-video"> + <video controls preload="metadata"> + <source src="{{ .URL }}" type="{{ .MimeType }}"> + </video> + </div> + {{ else if hasPrefix .MimeType "image/" }} + <div class="enclosure-image"> + <img src="{{ proxyURL .URL }}" title="{{ .URL }} ({{ .MimeType }})" alt="{{ .URL }} ({{ .MimeType }})"> + </div> + {{ end }} + + <div class="entry-enclosure-download"> + <a href="{{ .URL }}" title="{{ .URL }} ({{ .MimeType }})" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ t "Download" }}</a> + <small>({{ .URL }})</small> + </div> + </div> + {{ end }} + </aside> + {{ end }} +</section> + +<div class="pagination-bottom"> + {{ template "entry_pagination" . }} +</div> +{{ end }} +`, + "feed_entries": `{{ define "title"}}{{ .feed.Title }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ .feed.Title }} ({{ .total }})</h1> + <ul> + <li> + <a href="{{ route "refreshFeed" "feedID" .feed.ID }}">{{ t "Refresh" }}</a> + </li> + <li> + <a href="{{ route "editFeed" "feedID" .feed.ID }}">{{ t "Edit" }}</a> + </li> + {{ if .entries }} + <li> + <a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a> + </li> + {{ end }} + </ul> +</section> + +{{ if ne .feed.ParsingErrorCount 0 }} +<div class="alert alert-error"> + <h3>{{ t "There is a problem with this feed" }}</h3> + {{ .feed.ParsingErrorMsg }} +</div> +{{ else if not .entries }} + <p class="alert">{{ t "There is no article for this feed." }}</p> +{{ else }} + <div class="items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "feedEntry" "feedID" .Feed.ID "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }} +`, + "feeds": `{{ define "title"}}{{ t "Feeds" }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Feeds" }} ({{ .total }})</h1> + <ul> + <li> + <a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + <li> + <a href="{{ route "import" }}">{{ t "Import" }}</a> + </li> + <li> + <a href="{{ route "refreshAllFeeds" }}">{{ t "Refresh all feeds in background" }}</a> + </li> + </ul> +</section> + +{{ if not .feeds }} + <p class="alert">{{ t "You don't have any subscription." }}</p> +{{ else }} + <div class="items"> + {{ range .feeds }} + <article class="item {{ if ne .ParsingErrorCount 0 }}feed-parsing-error{{ end }}"> + <div class="item-header"> + <span class="item-title"> + {{ if .Icon }} + <img src="{{ route "icon" "iconID" .Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "feedEntries" "feedID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"> + <a href="{{ route "categoryEntries" "categoryID" .Category.ID }}">{{ .Category.Title }}</a> + </span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ .SiteURL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ domain .SiteURL }}</a> + </li> + <li> + {{ t "Last check:" }} <time datetime="{{ isodate .CheckedAt }}" title="{{ isodate .CheckedAt }}">{{ elapsed .CheckedAt }}</time> + </li> + </ul> + <ul> + <li> + <a href="{{ route "refreshFeed" "feedID" .ID }}">{{ t "Refresh" }}</a> + </li> + <li> + <a href="{{ route "editFeed" "feedID" .ID }}">{{ t "Edit" }}</a> + </li> + <li> + <a href="#" + data-confirm="true" + data-label-question="{{ t "Are you sure?" }}" + data-label-yes="{{ t "yes" }}" + data-label-no="{{ t "no" }}" + data-label-loading="{{ t "Work in progress..." }}" + data-url="{{ route "removeFeed" "feedID" .ID }}">{{ t "Remove" }}</a> + </li> + </ul> + </div> + {{ if ne .ParsingErrorCount 0 }} + <div class="parsing-error"> + <strong title="{{ .ParsingErrorMsg }}" class="parsing-error-count">{{ plural "plural.feed.error_count" .ParsingErrorCount .ParsingErrorCount }}</strong> + <small class="parsing-error-message">({{ .ParsingErrorMsg }})</small> + </div> + {{ end }} + </article> + {{ end }} + </div> +{{ end }} + +{{ end }} +`, + "history": `{{ define "title"}}{{ t "History" }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "History" }} ({{ .total }})</h1> + {{ if .entries }} + <ul> + <li> + <a href="{{ route "flushHistory" }}">{{ t "Flush history" }}</a> + </li> + </ul> + {{ end }} +</section> + +{{ if not .entries }} + <p class="alert alert-info">{{ t "There is no history at the moment." }}</p> +{{ else }} + <div class="items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "readEntry" "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }} +`, + "import": `{{ define "title"}}{{ t "Import" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Import" }}</h1> + <ul> + <li> + <a href="{{ route "feeds" }}">{{ t "Feeds" }}</a> + </li> + <li> + <a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a> + </li> + <li> + <a href="{{ route "export" }}">{{ t "Export" }}</a> + </li> + </ul> +</section> + +<form action="{{ route "uploadOPML" }}" method="post" enctype="multipart/form-data"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-file">{{ t "OPML file" }}</label> + <input type="file" name="file" id="form-file"> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Import" }}</button> + </div> +</form> + +{{ end }} +`, + "integrations": `{{ define "title"}}{{ t "Integrations" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Integrations" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + {{ if .user.IsAdmin }} + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + {{ end }} + <li> + <a href="{{ route "about" }}">{{ t "About" }}</a> + </li> + </ul> +</section> + +<form method="post" autocomplete="off" action="{{ route "updateIntegration" }}"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <h3>Fever</h3> + <div class="form-section"> + <label> + <input type="checkbox" name="fever_enabled" value="1" {{ if .form.FeverEnabled }}checked{{ end }}> {{ t "Activate Fever API" }} + </label> + + <label for="form-fever-username">{{ t "Fever Username" }}</label> + <input type="text" name="fever_username" id="form-fever-username" value="{{ .form.FeverUsername }}"> + + <label for="form-fever-password">{{ t "Fever Password" }}</label> + <input type="password" name="fever_password" id="form-fever-password" value="{{ .form.FeverPassword }}"> + </div> + + <h3>Pinboard</h3> + <div class="form-section"> + <label> + <input type="checkbox" name="pinboard_enabled" value="1" {{ if .form.PinboardEnabled }}checked{{ end }}> {{ t "Save articles to Pinboard" }} + </label> + + <label for="form-pinboard-token">{{ t "Pinboard API Token" }}</label> + <input type="password" name="pinboard_token" id="form-pinboard-token" value="{{ .form.PinboardToken }}"> + + <label for="form-pinboard-tags">{{ t "Pinboard Tags" }}</label> + <input type="text" name="pinboard_tags" id="form-pinboard-tags" value="{{ .form.PinboardTags }}"> + + <label> + <input type="checkbox" name="pinboard_mark_as_unread" value="1" {{ if .form.PinboardMarkAsUnread }}checked{{ end }}> {{ t "Mark bookmark as unread" }} + </label> + </div> + + <h3>Instapaper</h3> + <div class="form-section"> + <label> + <input type="checkbox" name="instapaper_enabled" value="1" {{ if .form.InstapaperEnabled }}checked{{ end }}> {{ t "Save articles to Instapaper" }} + </label> + + <label for="form-instapaper-username">{{ t "Instapaper Username" }}</label> + <input type="text" name="instapaper_username" id="form-instapaper-username" value="{{ .form.InstapaperUsername }}"> + + <label for="form-instapaper-password">{{ t "Instapaper Password" }}</label> + <input type="password" name="instapaper_password" id="form-instapaper-password" value="{{ .form.InstapaperPassword }}"> + </div> + + <h3>Wallabag</h3> + <div class="form-section"> + <label> + <input type="checkbox" name="wallabag_enabled" value="1" {{ if .form.WallabagEnabled }}checked{{ end }}> {{ t "Save articles to Wallabag" }} + </label> + + <label for="form-wallabag-url">{{ t "Wallabag API Endpoint" }}</label> + <input type="url" name="wallabag_url" id="form-wallabag-url" value="{{ .form.WallabagURL }}" placeholder="http://v2.wallabag.org/"> + + <label for="form-wallabag-client-id">{{ t "Wallabag Client ID" }}</label> + <input type="text" name="wallabag_client_id" id="form-wallabag-client-id" value="{{ .form.WallabagClientID }}"> + + <label for="form-wallabag-client-secret">{{ t "Wallabag Client Secret" }}</label> + <input type="password" name="wallabag_client_secret" id="form-wallabag-client-secret" value="{{ .form.WallabagClientSecret }}"> + + <label for="form-wallabag-username">{{ t "Wallabag Username" }}</label> + <input type="text" name="wallabag_username" id="form-wallabag-username" value="{{ .form.WallabagUsername }}"> + + <label for="form-wallabag-password">{{ t "Wallabag Password" }}</label> + <input type="password" name="wallabag_password" id="form-wallabag-password" value="{{ .form.WallabagPassword }}"> + </div> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> + </div> +</form> + +<div class="panel"> + <h3>{{ t "Bookmarklet" }}</h3> + <p>{{ t "This special link allows you to subscribe to a website directly by using a bookmark in your web browser." }}</p> + + <div class="bookmarklet"> + <a href="javascript:location.href='{{ baseURL }}{{ route "bookmarklet" }}?uri='+encodeURIComponent(window.location.href)">{{ t "Add to Miniflux" }}</a> + </div> + + <p>{{ t "Drag and drop this link to your bookmarks." }}</p> +</div> + +{{ end }} +`, + "login": `{{ define "title"}}{{ t "Sign In" }}{{ end }} + +{{ define "content"}} +<section class="login-form"> + <form action="{{ route "checkLogin" }}" method="post"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-username">{{ t "Username" }}</label> + <input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus> + + <label for="form-password">{{ t "Password" }}</label> + <input type="password" name="password" id="form-password" value="{{ .form.Password }}" required> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Sign in" }}</button> + </div> + </form> + {{ if hasOAuth2Provider "google" }} + <div class="oauth2"> + <a href="{{ route "oauth2Redirect" "provider" "google" }}">{{ t "Sign in with Google" }}</a> + </div> + {{ end }} +</section> +{{ end }} +`, + "sessions": `{{ define "title"}}{{ t "Sessions" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Sessions" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + <li> + <a href="{{ route "createUser" }}">{{ t "Add user" }}</a> + </li> + </ul> +</section> + +<table> + <tr> + <th>{{ t "Date" }}</th> + <th>{{ t "IP Address" }}</th> + <th>{{ t "User Agent" }}</th> + <th>{{ t "Actions" }}</th> + </tr> + {{ range .sessions }} + <tr {{ if eq .Token $.currentSessionToken }}class="row-highlighted"{{ end }}> + <td class="column-20" title="{{ isodate .CreatedAt }}">{{ elapsed .CreatedAt }}</td> + <td class="column-20" title="{{ .IP }}">{{ .IP }}</td> + <td title="{{ .UserAgent }}">{{ .UserAgent }}</td> + <td class="column-20"> + {{ if eq .Token $.currentSessionToken }} + {{ t "Current session" }} + {{ else }} + <a href="#" + data-confirm="true" + data-label-question="{{ t "Are you sure?" }}" + data-label-yes="{{ t "yes" }}" + data-label-no="{{ t "no" }}" + data-label-loading="{{ t "Work in progress..." }}" + data-url="{{ route "removeSession" "sessionID" .ID }}">{{ t "Remove" }}</a> + {{ end }} + </td> + </tr> + {{ end }} +</table> + +{{ end }} +`, + "settings": `{{ define "title"}}{{ t "Settings" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Settings" }}</h1> + <ul> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + {{ if .user.IsAdmin }} + <li> + <a href="{{ route "users" }}">{{ t "Users" }}</a> + </li> + {{ end }} + <li> + <a href="{{ route "about" }}">{{ t "About" }}</a> + </li> + </ul> +</section> + +<form method="post" autocomplete="off" action="{{ route "updateSettings" }}"> + <input type="hidden" name="csrf" value="{{ .csrf }}"> + + {{ if .errorMessage }} + <div class="alert alert-error">{{ t .errorMessage }}</div> + {{ end }} + + <label for="form-username">{{ t "Username" }}</label> + <input type="text" name="username" id="form-username" value="{{ .form.Username }}" required> + + <label for="form-password">{{ t "Password" }}</label> + <input type="password" name="password" id="form-password" value="{{ .form.Password }}" autocomplete="off"> + + <label for="form-confirmation">{{ t "Confirmation" }}</label> + <input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}" autocomplete="off"> + + <label for="form-language">{{ t "Language" }}</label> + <select id="form-language" name="language"> + {{ range $key, $value := .languages }} + <option value="{{ $key }}" {{ if eq $key $.form.Language }}selected="selected"{{ end }}>{{ $value }}</option> + {{ end }} + </select> + + <label for="form-timezone">{{ t "Timezone" }}</label> + <select id="form-timezone" name="timezone"> + {{ range $key, $value := .timezones }} + <option value="{{ $key }}" {{ if eq $key $.form.Timezone }}selected="selected"{{ end }}>{{ $value }}</option> + {{ end }} + </select> + + <label for="form-theme">{{ t "Theme" }}</label> + <select id="form-theme" name="theme"> + {{ range $key, $value := .themes }} + <option value="{{ $key }}" {{ if eq $key $.form.Theme }}selected="selected"{{ end }}>{{ $value }}</option> + {{ end }} + </select> + + <label for="form-entry-direction">{{ t "Entry Sorting" }}</label> + <select id="form-entry-direction" name="entry_direction"> + <option value="asc" {{ if eq "asc" $.form.EntryDirection }}selected="selected"{{ end }}>{{ t "Older entries first" }}</option> + <option value="desc" {{ if eq "desc" $.form.EntryDirection }}selected="selected"{{ end }}>{{ t "Recent entries first" }}</option> + </select> + + <div class="buttons"> + <button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> + </div> +</form> + +{{ if hasOAuth2Provider "google" }} +<div class="panel"> + {{ if hasKey .user.Extra "google_id" }} + <a href="{{ route "oauth2Unlink" "provider" "google" }}">{{ t "Unlink my Google account" }}</a> + {{ else }} + <a href="{{ route "oauth2Redirect" "provider" "google" }}">{{ t "Link my Google account" }}</a> + {{ end }} +</div> +{{ end }} + +{{ end }} +`, + "starred": `{{ define "title"}}{{ t "Favorites" }} ({{ .total }}){{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Favorites" }} ({{ .total }})</h1> +</section> + +{{ if not .entries }} + <p class="alert alert-info">{{ t "There is no bookmark at the moment." }}</p> +{{ else }} + <div class="items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "starredEntry" "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }} +`, + "unread": `{{ define "title"}}{{ t "Unread Items" }} {{ if gt .countUnread 0 }}({{ .countUnread }}){{ end }} {{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Unread" }} (<span class="unread-counter">{{ .countUnread }}</span>)</h1> + {{ if .entries }} + <ul> + <li> + <a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a> + </li> + </ul> + {{ end }} +</section> + +{{ if not .entries }} + <p class="alert">{{ t "There is no unread article." }}</p> +{{ else }} + <div class="items hide-read-items"> + {{ range .entries }} + <article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}"> + <div class="item-header"> + <span class="item-title"> + {{ if ne .Feed.Icon.IconID 0 }} + <img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16"> + {{ end }} + <a href="{{ route "unreadEntry" "entryID" .ID }}">{{ .Title }}</a> + </span> + <span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span> + </div> + <div class="item-meta"> + <ul> + <li> + <a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a> + </li> + <li> + <time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time> + </li> + <li> + <a href="#" + title="{{ t "Save this article" }}" + data-save-entry="true" + data-save-url="{{ route "saveEntry" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-done="{{ t "Done!" }}" + >{{ t "Save" }}</a> + </li> + <li> + <a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a> + </li> + <li> + <a href="#" + data-toggle-bookmark="true" + data-bookmark-url="{{ route "toggleBookmark" "entryID" .ID }}" + data-label-loading="{{ t "Saving..." }}" + data-label-star="☆ {{ t "Star" }}" + data-label-unstar="★ {{ t "Unstar" }}" + data-value="{{ if .Starred }}star{{ else }}unstar{{ end }}" + >{{ if .Starred }}★ {{ t "Unstar" }}{{ else }}☆ {{ t "Star" }}{{ end }}</a> + </li> + </ul> + </div> + </article> + {{ end }} + </div> + {{ template "pagination" .pagination }} +{{ end }} + +{{ end }}`, + "users": `{{ define "title"}}{{ t "Users" }}{{ end }} + +{{ define "content"}} +<section class="page-header"> + <h1>{{ t "Users" }}</h1> + <ul> + <li> + <a href="{{ route "settings" }}">{{ t "Settings" }}</a> + </li> + <li> + <a href="{{ route "integrations" }}">{{ t "Integrations" }}</a> + </li> + <li> + <a href="{{ route "sessions" }}">{{ t "Sessions" }}</a> + </li> + <li> + <a href="{{ route "createUser" }}">{{ t "Add user" }}</a> + </li> + </ul> +</section> + +{{ if eq (len .users) 1 }} + <p class="alert">{{ t "You are the only user." }}</p> +{{ else }} + <table> + <tr> + <th class="column-20">{{ t "Username" }}</th> + <th>{{ t "Administrator" }}</th> + <th>{{ t "Last Login" }}</th> + <th>{{ t "Actions" }}</th> + </tr> + {{ range .users }} + {{ if ne .ID $.user.ID }} + <tr> + <td>{{ .Username }}</td> + <td>{{ if eq .IsAdmin true }}{{ t "Yes" }}{{ else }}{{ t "No" }}{{ end }}</td> + <td> + {{ if .LastLoginAt }} + <time datetime="{{ isodate .LastLoginAt }}" title="{{ isodate .LastLoginAt }}">{{ elapsed .LastLoginAt }}</time> + {{ else }} + {{ t "Never" }} + {{ end }} + </td> + <td> + <a href="{{ route "editUser" "userID" .ID }}">{{ t "Edit" }}</a>, + <a href="#" + data-confirm="true" + data-label-question="{{ t "Are you sure?" }}" + data-label-yes="{{ t "yes" }}" + data-label-no="{{ t "no" }}" + data-label-loading="{{ t "Work in progress..." }}" + data-url="{{ route "removeUser" "userID" .ID }}">{{ t "Remove" }}</a> + </td> + </tr> + {{ end }} + {{ end }} + </table> +{{ end }} + +{{ end }} +`, +} + +var templateViewsMapChecksums = map[string]string{ + "about": "ad2fb778fc73c39b733b3f81b13e5c7d689b041fadd24ee2d4577f545aa788ad", + "add_subscription": "053c920b0d7e109ea19dce6a448e304ce720db8633588ea04db16677f7209a7b", + "categories": "ca1280cd157bb527d4fc907da67b05a8347378f6dce965b9389d4bcdf3600a11", + "category_entries": "ce59529666520b8363c9588ce2c437de5a3f6d91941e5c46be25ca08f6900364", + "choose_subscription": "a325f9c976ca2b2dc148e25c8fef0cf6ccab0e04e86e604e7812bb18dc4cdde1", + "create_category": "2b82af5d2dcd67898dc5daa57a6461e6ff8121a6089b2a2a1be909f35e4a2275", + "create_user": "45e226df757126d5fe7c464e295e9a34f07952cfdb71e31e49839850d35af139", + "edit_category": "cee720faadcec58289b707ad30af623d2ee66c1ce23a732965463250d7ff41c5", + "edit_feed": "15f19ab44057fca1630c6860d5951d6073f82f83ad682a176c475591c6f26377", + "edit_user": "82d9749d76ddbd2352816d813c4b1f6d92f2222de678b4afe5821090246735c7", + "entry": "6b4405e0c8e4a7d31874659f8835f4e43e01dc3c20686091517ac750196dd70f", + "feed_entries": "ac93cb9a90f93ddd9dd8a67d7e160592ecb9f5e465ee9679bb14eecd8d4caf20", + "feeds": "65b0a47c4438810b9d51c60f3f3b2519690e56ff74029e6296c68626b83a470b", + "history": "abc7ea29f7d54f28f73fe14979bbd03dbc41fa6a7c86f95f56d6e94f7b09b9ba", + "import": "73b5112e20bfd232bf73334544186ea419505936bc237d481517a8622901878f", + "integrations": "3c14d7de904911aad7f3ebec6d1a20b50843287f58125c526e167f429f3d455d", + "login": "7d83c3067c02f1f6aafdd8816c7f97a4eb5a5a4bdaaaa4cc1e2fbb9c17ea65e8", + "sessions": "878dbe8f8ea783b44130c495814179519fa5c3aa2666ac87508f94d58dd008bf", + "settings": "ea2505b9d0a6d6bb594dba87a92079de19baa6d494f0651693a7685489fb7de9", + "starred": "33dd40d1a24739e9d05f9cc4b66497cfdb8c86a7abb209a66ca65c2fbafc7d87", + "unread": "f4eb7410925e174918f1b55414c9b0b81632f7e13ce649579c8593097bb0f1d7", + "users": "44677e28bb5347799ed0020c90ec785aadec4b1454446d92411cfdaf6e32110b", +} |