Added views for QOR admin
This commit is contained in:
44
app/views/qor/shared/action_item.tmpl
Normal file
44
app/views/qor/shared/action_item.tmpl
Normal file
@@ -0,0 +1,44 @@
|
||||
{{$action := .Action}}
|
||||
{{$result := .Result}}
|
||||
{{$context := .Context}}
|
||||
{{$resource := .Resource}}
|
||||
{{$bulkEdit := .BulkEdit}}
|
||||
|
||||
{{define "url" -}}
|
||||
{{ if .Action.URL }}
|
||||
{{- call .Action.URL .Result .Context -}}
|
||||
{{else if (and (not .Multiple) (not .BulkEdit))}}
|
||||
{{- join_url (url_for .Result .Resource) .Action.ToParam -}}
|
||||
{{else}}
|
||||
{{- join_url (url_for .Resource) "!action" .Action.ToParam -}}
|
||||
{{ end }}
|
||||
{{- end}}
|
||||
|
||||
{{if (and $action.URL (eq $action.Method "GET"))}}
|
||||
{{if (or (eq $action.URLOpenType "bottomsheet") (eq $action.URLOpenType "slideout"))}}
|
||||
<a class="{{if ne (print .Mode) "menu_item"}}mdl-button mdl-button--colored mdl-button--raised qor-action-button{{end}} qor-action-button--link" data-url="{{template "url" .}}" data-open-type="{{$action.URLOpenType}}">
|
||||
{{t (printf "%v.actions.%v" $resource.ToParam $action.Label) $action.Label}}
|
||||
</a>
|
||||
{{else}}
|
||||
<a class="{{if ne (print .Mode) "menu_item"}}mdl-button mdl-button--colored mdl-button--raised qor-action-button{{end}} qor-action-button--link" href="{{template "url" .}}" {{if $action.URLOpenType}}data-open-type="{{$action.URLOpenType}}"{{end}}>
|
||||
{{t (printf "%v.actions.%v" $resource.ToParam $action.Label) $action.Label}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<a class="{{if ne (print .Mode) "menu_item"}}mdl-button mdl-button--colored mdl-button--raised {{end -}} qor-action-button" type="button"
|
||||
data-url="{{template "url" .}}"
|
||||
data-error-no-item="{{t "qor_admin.actions.please_select_an_item" "Please select at least one item"}}"
|
||||
{{if $action.URLOpenType}}
|
||||
data-open-type="{{$action.URLOpenType}}"
|
||||
{{end}}
|
||||
{{if not $action.Resource}}
|
||||
data-dataType="json"
|
||||
data-ajax-form="true"
|
||||
data-from-index="{{$bulkEdit}}"
|
||||
data-confirm="{{t "qor_admin.form.are_you_sure" "Are you sure?"}}"
|
||||
data-confirm-ok="{{t "qor_admin.form.confirm.button.ok" "ok"}}" data-confirm-cancel="{{t "qor_admin.form.confirm.button.cancel" "cancel"}}"
|
||||
data-method="{{$action.Method}}"
|
||||
{{end}}>
|
||||
{{t (printf "%v.actions.%v" $resource.ToParam $action.Label) $action.Label}}
|
||||
</a>
|
||||
{{end}}
|
||||
17
app/views/qor/shared/errors.tmpl
Normal file
17
app/views/qor/shared/errors.tmpl
Normal file
@@ -0,0 +1,17 @@
|
||||
{{$formatted_errors := get_formatted_errors}}
|
||||
{{if $formatted_errors}}
|
||||
<ul class="qor-alert qor-error qor-alert__active" data-dismissible="true">
|
||||
<button type="button" class="mdl-button mdl-button--icon" data-dismiss="alert">
|
||||
<i class="material-icons">close</i>
|
||||
</button>
|
||||
{{range $formatted_error := $formatted_errors}}
|
||||
<li>
|
||||
<i class="material-icons">error</i>
|
||||
{{range $error := $formatted_error.Errors}}
|
||||
{{$message := escape $error}}
|
||||
<span>{{t (printf "qor_admin.errors.%v" $message) $message}}</span>
|
||||
{{end}}
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{end}}
|
||||
11
app/views/qor/shared/flashes.tmpl
Normal file
11
app/views/qor/shared/flashes.tmpl
Normal file
@@ -0,0 +1,11 @@
|
||||
{{range $flash := flashes}}
|
||||
<div class="qor-alert qor-alert--{{$flash.Type}} qor-alert__active" data-dismissible="true" role="alert" data-type="{{$flash.Type}}">
|
||||
<button type="button" class="mdl-button mdl-button--icon" data-dismiss="alert">
|
||||
<i class="material-icons">close</i>
|
||||
</button>
|
||||
|
||||
<span class="qor-alert-message">
|
||||
{{$flash.Message}}
|
||||
</span>
|
||||
</div>
|
||||
{{end}}
|
||||
14
app/views/qor/shared/menu.tmpl
Normal file
14
app/views/qor/shared/menu.tmpl
Normal file
@@ -0,0 +1,14 @@
|
||||
<ul class="qor-menu">
|
||||
{{range $_, $value := .Result}}
|
||||
{{if $value.SubMenus}}
|
||||
<li qor-icon-name="{{get_icon $value}}" {{if $value.Active}}class="active"{{end}}>
|
||||
<a href="{{if $value.URL}}{{$value.URL}}{{else}}javascript:void(0);{{end}}">{{t (printf "qor_admin.menus.%v" $value.Name) $value.Name}}</a>
|
||||
{{render "shared/menu" $value.SubMenus}}
|
||||
</li>
|
||||
{{else}}
|
||||
<li qor-icon-name="{{get_icon $value}}" {{if $value.Active}}class="active"{{end}}>
|
||||
{{link_to (t (printf "qor_admin.menus.%v" $value.Name) $value.Name) $value.URL}}
|
||||
</li>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</ul>
|
||||
27
app/views/qor/shared/sidebar.tmpl
Normal file
27
app/views/qor/shared/sidebar.tmpl
Normal file
@@ -0,0 +1,27 @@
|
||||
<div class="qor-layout__sidebar">
|
||||
<div class="sidebar-header">
|
||||
{{t "qor_admin.layout.logo" "<a href=\"{{.Prefix}}\"><span class=\"visuallyhidden\">QOR</span></a><a href=\"/\" target=\"_blank\">View Site <i class=\"material-icons md-14\" aria-hidden=\"true\">open_in_new</i></a>" .Admin.GetRouter}}
|
||||
</div>
|
||||
<div class="sidebar-userinfo">
|
||||
{{if .CurrentUser}}
|
||||
<div>
|
||||
<h5>{{.CurrentUser.DisplayName}}</h5>
|
||||
</div>
|
||||
{{end}}
|
||||
<a class="mdl-button mdl-js-button mdl-button--icon" href="{{logout_url}}" title="{{t "qor_admin.account.logout" "logout"}}" alt="{{t "qor_admin.account.logout" "logout"}}"><i class="material-icons">exit_to_app</i></a>
|
||||
</div>
|
||||
<div class="sidebar-body">
|
||||
<div class="qor-menu-container">
|
||||
{{if .GetSearchableResources }}
|
||||
<div qor-icon-name="Search">
|
||||
<span class="qor-global-search--show {{if (eq .Action "search_center")}}active{{end}}" data-placeholder="{{t "qor_admin.search_center.hint" "Search…"}}" data-action-url="{{search_center_path}}">{{t "qor_admin.search_center.title" "Search Center" }}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{render "shared/menu" get_menus}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sidebar-footer">
|
||||
{{t "qor_admin.layout.powered_by" "Powered by <a href=\"http://getqor.com\" target=\"_blank\">QOR</a>"}}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user