diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/org/settings/navbar.tmpl | 5 | ||||
-rw-r--r-- | templates/org/settings/packages.tmpl | 14 | ||||
-rw-r--r-- | templates/org/settings/packages_cleanup_rules_edit.tmpl | 14 | ||||
-rw-r--r-- | templates/org/settings/packages_cleanup_rules_preview.tmpl | 13 | ||||
-rw-r--r-- | templates/package/shared/cleanup_rules/edit.tmpl | 73 | ||||
-rw-r--r-- | templates/package/shared/cleanup_rules/list.tmpl | 34 | ||||
-rw-r--r-- | templates/package/shared/cleanup_rules/preview.tmpl | 34 | ||||
-rw-r--r-- | templates/user/settings/navbar.tmpl | 5 | ||||
-rw-r--r-- | templates/user/settings/packages.tmpl | 9 | ||||
-rw-r--r-- | templates/user/settings/packages_cleanup_rules_edit.tmpl | 9 | ||||
-rw-r--r-- | templates/user/settings/packages_cleanup_rules_preview.tmpl | 8 |
11 files changed, 218 insertions, 0 deletions
diff --git a/templates/org/settings/navbar.tmpl b/templates/org/settings/navbar.tmpl index e7cbb87344..7df1c85903 100644 --- a/templates/org/settings/navbar.tmpl +++ b/templates/org/settings/navbar.tmpl @@ -17,6 +17,11 @@ {{.locale.Tr "settings.applications"}} </a> {{end}} + {{if .EnablePackages}} + <a class="{{if .PageIsSettingsPackages}}active{{end}} item" href="{{.OrgLink}}/settings/packages"> + {{.locale.Tr "packages.title"}} + </a> + {{end}} <a class="{{if .PageIsSettingsDelete}}active{{end}} item" href="{{.OrgLink}}/settings/delete"> {{.locale.Tr "org.settings.delete"}} </a> diff --git a/templates/org/settings/packages.tmpl b/templates/org/settings/packages.tmpl new file mode 100644 index 0000000000..bb5d95e107 --- /dev/null +++ b/templates/org/settings/packages.tmpl @@ -0,0 +1,14 @@ +{{template "base/head" .}} +<div class="page-content organization settings packages"> + {{template "org/header" .}} + <div class="ui container"> + <div class="ui grid"> + {{template "org/settings/navbar" .}} + <div class="twelve wide column content"> + {{template "base/alert" .}} + {{template "package/shared/cleanup_rules/list" .}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/org/settings/packages_cleanup_rules_edit.tmpl b/templates/org/settings/packages_cleanup_rules_edit.tmpl new file mode 100644 index 0000000000..8c3725f4d7 --- /dev/null +++ b/templates/org/settings/packages_cleanup_rules_edit.tmpl @@ -0,0 +1,14 @@ +{{template "base/head" .}} +<div class="page-content organization settings packages"> + {{template "org/header" .}} + <div class="ui container"> + <div class="ui grid"> + {{template "org/settings/navbar" .}} + <div class="twelve wide column content"> + {{template "base/alert" .}} + {{template "package/shared/cleanup_rules/edit" .}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/org/settings/packages_cleanup_rules_preview.tmpl b/templates/org/settings/packages_cleanup_rules_preview.tmpl new file mode 100644 index 0000000000..e0e4652c36 --- /dev/null +++ b/templates/org/settings/packages_cleanup_rules_preview.tmpl @@ -0,0 +1,13 @@ +{{template "base/head" .}} +<div class="page-content organization settings packages admin"> + {{template "org/header" .}} + <div class="ui container"> + <div class="ui grid"> + {{template "org/settings/navbar" .}} + <div class="twelve wide column content"> + {{template "package/shared/cleanup_rules/preview" .}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/package/shared/cleanup_rules/edit.tmpl b/templates/package/shared/cleanup_rules/edit.tmpl new file mode 100644 index 0000000000..f8525afb70 --- /dev/null +++ b/templates/package/shared/cleanup_rules/edit.tmpl @@ -0,0 +1,73 @@ +<h4 class="ui top attached header">{{if .IsEditRule}}{{.locale.Tr "packages.owner.settings.cleanuprules.edit"}}{{else}}{{.locale.Tr "packages.owner.settings.cleanuprules.add"}}{{end}}</h4> +<div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input name="id" type="hidden" value="{{.CleanupRule.ID}}"> + <div class="field"> + <div class="ui checkbox"> + <label>{{.locale.Tr "enabled"}}</label> + <input type="checkbox" name="enabled" {{if .CleanupRule.Enabled}}checked{{end}}> + </div> + </div> + <div class="{{if .IsEditRule}}disabled {{end}}field {{if .Err_Type}}error{{end}}"> + <label>{{.locale.Tr "packages.filter.type"}}</label> + <select class="ui selection dropdown" name="type"> + {{range $type := .AvailableTypes}} + <option{{if eq $.CleanupRule.Type $type}} selected="selected"{{end}} value="{{$type}}">{{$type.Name}}</option> + {{end}} + </select> + </div> + <div class="field"> + <div class="ui checkbox"> + <label>{{.locale.Tr "packages.owner.settings.cleanuprules.pattern_full_match"}}</label> + <input type="checkbox" name="match_full_name" {{if .CleanupRule.MatchFullName}}checked{{end}}> + </div> + </div> + <div class="ui divider"></div> + <p>{{.locale.Tr "packages.owner.settings.cleanuprules.keep.title"}}</p> + <div class="field {{if .Err_KeepCount}}error{{end}}"> + <label>{{.locale.Tr "packages.owner.settings.cleanuprules.keep.count"}}:</label> + <select class="ui selection dropdown" name="keep_count"> + <option{{if eq .CleanupRule.KeepCount 0}} selected="selected"{{end}} value="0"></option> + <option{{if eq .CleanupRule.KeepCount 1}} selected="selected"{{end}} value="1">{{.locale.Tr "packages.owner.settings.cleanuprules.keep.count.1"}}</option> + <option{{if eq .CleanupRule.KeepCount 5}} selected="selected"{{end}} value="5">{{.locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 5}}</option> + <option{{if eq .CleanupRule.KeepCount 10}} selected="selected"{{end}} value="10">{{.locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 10}}</option> + <option{{if eq .CleanupRule.KeepCount 25}} selected="selected"{{end}} value="25">{{.locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 25}}</option> + <option{{if eq .CleanupRule.KeepCount 50}} selected="selected"{{end}} value="50">{{.locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 50}}</option> + <option{{if eq .CleanupRule.KeepCount 100}} selected="selected"{{end}} value="100">{{.locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 100}}</option> + </select> + </div> + <div class="field {{if .Err_KeepPattern}}error{{end}}"> + <label>{{.locale.Tr "packages.owner.settings.cleanuprules.keep.pattern"}}:</label> + <input name="keep_pattern" type="text" value="{{.CleanupRule.KeepPattern}}"> + <p>{{.locale.Tr "packages.owner.settings.cleanuprules.keep.pattern.container" | Safe}}</p> + </div> + <div class="ui divider"></div> + <p>{{.locale.Tr "packages.owner.settings.cleanuprules.remove.title"}}</p> + <div class="field {{if .Err_RemoveDays}}error{{end}}"> + <label>{{.locale.Tr "packages.owner.settings.cleanuprules.remove.days"}}:</label> + <select class="ui selection dropdown" name="remove_days"> + <option{{if eq .CleanupRule.RemoveDays 0}} selected="selected"{{end}} value="0"></option> + <option{{if eq .CleanupRule.RemoveDays 7}} selected="selected"{{end}} value="7">{{.locale.Tr "tool.days" 7}}</option> + <option{{if eq .CleanupRule.RemoveDays 14}} selected="selected"{{end}} value="14">{{.locale.Tr "tool.days" 14}}</option> + <option{{if eq .CleanupRule.RemoveDays 30}} selected="selected"{{end}} value="30">{{.locale.Tr "tool.days" 30}}</option> + <option{{if eq .CleanupRule.RemoveDays 60}} selected="selected"{{end}} value="60">{{.locale.Tr "tool.days" 60}}</option> + <option{{if eq .CleanupRule.RemoveDays 90}} selected="selected"{{end}} value="90">{{.locale.Tr "tool.days" 90}}</option> + <option{{if eq .CleanupRule.RemoveDays 180}} selected="selected"{{end}} value="180">{{.locale.Tr "tool.days" 180}}</option> + </select> + </div> + <div class="field {{if .Err_RemovePattern}}error{{end}}"> + <label>{{.locale.Tr "packages.owner.settings.cleanuprules.remove.pattern"}}:</label> + <input name="remove_pattern" type="text" value="{{.CleanupRule.RemovePattern}}"> + </div> + <div class="field"> + {{if .IsEditRule}} + <button class="ui green button" name="action" value="save">{{.locale.Tr "save"}}</button> + <button class="ui red button" name="action" value="remove">{{.locale.Tr "remove"}}</button> + <a class="ui button" href="{{.Link}}/preview">{{.locale.Tr "packages.owner.settings.cleanuprules.preview"}}</a> + {{else}} + <button class="ui green button" name="action" value="save">{{.locale.Tr "add"}}</button> + {{end}} + </div> + </form> +</div> diff --git a/templates/package/shared/cleanup_rules/list.tmpl b/templates/package/shared/cleanup_rules/list.tmpl new file mode 100644 index 0000000000..09f95e4f4a --- /dev/null +++ b/templates/package/shared/cleanup_rules/list.tmpl @@ -0,0 +1,34 @@ +<h4 class="ui top attached header"> + {{.locale.Tr "packages.owner.settings.cleanuprules.title"}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{.Link}}/rules/add">{{.locale.Tr "packages.owner.settings.cleanuprules.add"}}</a> + </div> +</h4> +<div class="ui attached segment"> + <div class="ui key list"> + {{range .CleanupRules}} + <div class="item"> + <div class="right floated content"> + <div class="ui dropdown tiny basic button icon-button"> + {{svg "octicon-kebab-horizontal"}} + <div class="menu"> + <a class="item" href="{{$.Link}}/rules/{{.ID}}">{{$.locale.Tr "edit"}}</a> + <a class="item" href="{{$.Link}}/rules/{{.ID}}/preview">{{$.locale.Tr "packages.owner.settings.cleanuprules.preview"}}</a> + </div> + </div> + </div> + <i class="icon">{{svg .Type.SVGName 36}}</i> + <div class="content"> + <a class="item" href="{{$.Link}}/rules/{{.ID}}"><strong>{{.Type.Name}}</strong></a> + <div><i>{{if .Enabled}}{{$.locale.Tr "enabled"}}{{else}}{{$.locale.Tr "disabled"}}{{end}}</i></div> + {{if .KeepCount}}<div><i>{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.count"}}:</i> {{if eq .KeepCount 1}}{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.count.1"}}{{else}}{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" .KeepCount}}{{end}}</div>{{end}} + {{if .KeepPattern}}<div><i>{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.pattern"}}:</i> {{EllipsisString .KeepPattern 100}}</div>{{end}} + {{if .RemoveDays}}<div><i>{{$.locale.Tr "packages.owner.settings.cleanuprules.remove.days"}}:</i> {{$.locale.Tr "tool.days" .RemoveDays}}</div>{{end}} + {{if .RemovePattern}}<div><i>{{$.locale.Tr "packages.owner.settings.cleanuprules.remove.pattern"}}:</i> {{EllipsisString .RemovePattern 100}}</div>{{end}} + </div> + </div> + {{else}} + <div class="item">{{.locale.Tr "packages.owner.settings.cleanuprules.none"}}</div> + {{end}} + </div> +</div> diff --git a/templates/package/shared/cleanup_rules/preview.tmpl b/templates/package/shared/cleanup_rules/preview.tmpl new file mode 100644 index 0000000000..c59ad67f77 --- /dev/null +++ b/templates/package/shared/cleanup_rules/preview.tmpl @@ -0,0 +1,34 @@ +<h4 class="ui top attached header">{{.locale.Tr "packages.owner.settings.cleanuprules.preview"}}</h4> +<div class="ui attached segment"> + <p>{{.locale.Tr "packages.owner.settings.cleanuprules.preview.overview" (len .VersionsToRemove)}}</p> +</div> +<div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th>{{.locale.Tr "admin.packages.type"}}</th> + <th>{{.locale.Tr "admin.packages.name"}}</th> + <th>{{.locale.Tr "admin.packages.version"}}</th> + <th>{{.locale.Tr "admin.packages.creator"}}</th> + <th>{{.locale.Tr "admin.packages.size"}}</th> + <th>{{.locale.Tr "admin.packages.published"}}</th> + </tr> + </thead> + <tbody> + {{range .VersionsToRemove}} + <tr> + <td>{{.Package.Type.Name}}</td> + <td>{{.Package.Name}}</td> + <td><a href="{{.FullWebLink}}">{{.Version.Version}}</a></td> + <td><a href="{{.Creator.HomeLink}}">{{.Creator.Name}}</a></td> + <td>{{FileSize .CalculateBlobSize}}</td> + <td><span title="{{.Version.CreatedUnix.FormatLong}}"><time data-format="short-date" datetime="{{.Version.CreatedUnix.FormatLong}}">{{.Version.CreatedUnix.FormatShort}}</time></span></td> + </tr> + {{else}} + <tr> + <td colspan="6">{{.locale.Tr "packages.owner.settings.cleanuprules.preview.none"}}</td> + </tr> + {{end}} + </tbody> + </table> +</div> diff --git a/templates/user/settings/navbar.tmpl b/templates/user/settings/navbar.tmpl index 01ae055d79..d17494fc04 100644 --- a/templates/user/settings/navbar.tmpl +++ b/templates/user/settings/navbar.tmpl @@ -18,6 +18,11 @@ <a class="{{if .PageIsSettingsKeys}}active{{end}} item" href="{{AppSubUrl}}/user/settings/keys"> {{.locale.Tr "settings.ssh_gpg_keys"}} </a> + {{if .EnablePackages}} + <a class="{{if .PageIsSettingsPackages}}active{{end}} item" href="{{AppSubUrl}}/user/settings/packages"> + {{.locale.Tr "packages.title"}} + </a> + {{end}} <a class="{{if .PageIsSettingsOrganization}}active{{end}} item" href="{{AppSubUrl}}/user/settings/organization"> {{.locale.Tr "settings.organization"}} </a> diff --git a/templates/user/settings/packages.tmpl b/templates/user/settings/packages.tmpl new file mode 100644 index 0000000000..2612313454 --- /dev/null +++ b/templates/user/settings/packages.tmpl @@ -0,0 +1,9 @@ +{{template "base/head" .}} +<div class="page-content user settings packages"> + {{template "user/settings/navbar" .}} + <div class="ui container"> + {{template "base/alert" .}} + {{template "package/shared/cleanup_rules/list" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/settings/packages_cleanup_rules_edit.tmpl b/templates/user/settings/packages_cleanup_rules_edit.tmpl new file mode 100644 index 0000000000..4cf642b7e1 --- /dev/null +++ b/templates/user/settings/packages_cleanup_rules_edit.tmpl @@ -0,0 +1,9 @@ +{{template "base/head" .}} +<div class="page-content user settings packages"> + {{template "user/settings/navbar" .}} + <div class="ui container"> + {{template "base/alert" .}} + {{template "package/shared/cleanup_rules/edit" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/settings/packages_cleanup_rules_preview.tmpl b/templates/user/settings/packages_cleanup_rules_preview.tmpl new file mode 100644 index 0000000000..20041f9a42 --- /dev/null +++ b/templates/user/settings/packages_cleanup_rules_preview.tmpl @@ -0,0 +1,8 @@ +{{template "base/head" .}} +<div class="page-content user settings packages admin"> + {{template "user/settings/navbar" .}} + <div class="ui container"> + {{template "package/shared/cleanup_rules/preview" .}} + </div> +</div> +{{template "base/footer" .}} |