Added views for QOR admin

This commit is contained in:
Nedim
2023-09-07 13:04:34 +02:00
parent 40c6366608
commit f02e5e49cb
180 changed files with 18556 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
<advanced-filter-group class="qor-field clearfix">
{{ $opt := .Context.Request.URL.Query.Get (print .InputNamePrefix ".Value") }}
<label class="qor-field__label">
{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}
</label>
<div class="qor-field__flexbox">
<select name="{{.InputNamePrefix}}.Value" data-toggle="qor.selector" data-allow-clear="true" placeholder="{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}">
<option></option>
<option value="t" {{if (eq $opt "t")}}selected{{end}}>{{t "qor_admin.filter.checkbox.true" "True"}}</option>
<option value="f" {{if (eq $opt "f")}}selected{{end}}>{{t "qor_admin.filter.checkbox.false" "False"}}</option>
<option disabled>---</option>
<option value="present" {{if (eq $opt "present")}}selected{{end}}>{{t "qor_admin.filter.checkbox.is_present" "Is Present"}}</option>
<option value="blank" {{if (eq $opt "blank")}}selected{{end}}>{{t "qor_admin.filter.checkbox.is_blank" "Is Blank"}}</option>
</select>
</div>
</advanced-filter-group>

View File

@@ -0,0 +1,45 @@
<div class="qor-field clearfix" type="filter-datetime">
<label class="qor-field__label">
{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}
</label>
{{ $start := .Context.Request.URL.Query.Get (print .InputNamePrefix ".Start") }}
<advanced-filter-group>
<div class="qor-field__edit qor-field__datetimepicker" data-picker-type="datetime">
<div class="mdl-textfield mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label"></label>
<input class="mdl-textfield__input qor-datetimepicker__input" placeholder="{{t (printf "%v.filter.%v.start" .Resource.ToParam .Filter.Name) " Start "}}" type="text" name="{{.InputNamePrefix}}.Start" value="{{$start}}" filter-required>
</div>
<div>
<button data-toggle="qor.datepicker" class="mdl-button mdl-js-button mdl-button--icon qor-action__datepicker" type="button">
<i class="material-icons">date_range</i>
</button>
<button data-toggle="qor.timepicker" class="mdl-button mdl-js-button mdl-button--icon qor-action__timepicker" type="button">
<i class="material-icons">access_time</i>
</button>
</div>
</div>
</advanced-filter-group>
<span> - </span>
{{ $end := .Context.Request.URL.Query.Get (print .InputNamePrefix ".End") }}
<advanced-filter-group>
<div class="qor-field__edit qor-field__datetimepicker" data-picker-type="datetime">
<div class="mdl-textfield mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label"></label>
<input class="mdl-textfield__input qor-datetimepicker__input" placeholder="{{t (printf "%v.filter.%v.end" .Resource.ToParam .Filter.Name) " End "}}" type="text" name="{{.InputNamePrefix}}.End" value="{{$end}}" filter-required>
</div>
<div>
<button data-toggle="qor.datepicker" class="mdl-button mdl-js-button mdl-button--icon qor-action__datepicker" type="button">
<i class="material-icons">date_range</i>
</button>
<button data-toggle="qor.timepicker" class="mdl-button mdl-js-button mdl-button--icon qor-action__timepicker" type="button">
<i class="material-icons">access_time</i>
</button>
</div>
</div>
</advanced-filter-group>
</div>

View File

@@ -0,0 +1,22 @@
<advanced-filter-group class="qor-field clearfix" type="filter-number">
<label class="qor-field__label">
{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}
</label>
<div class="qor-field__flexbox">
{{ $opt := .Context.Request.URL.Query.Get (print .InputNamePrefix ".Operation") }}
<select name="{{.InputNamePrefix}}.Operation" data-toggle="qor.selector" placeholder="{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}">
<option value="eq" {{if (or (eq $opt "eq") (eq $opt ""))}}selected{{end}}>{{t "qor_admin.filter.number.eq" "Equals"}}</option>
<option value="gt" {{if (eq $opt "gt")}}selected{{end}}>{{t "qor_admin.filter.number.gt" "Greater than"}}</option>
<option value="lt" {{if (eq $opt "lt")}}selected{{end}}>{{t "qor_admin.filter.number.lt" "Less than"}}</option>
</select>
{{ $value := .Context.Request.URL.Query.Get (print .InputNamePrefix ".Value") }}
<div class="qor-field__edit">
<div class="mdl-textfield mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label"></label>
<input class="mdl-textfield__input" type="text" name="{{.InputNamePrefix}}.Value" value="{{$value}}" filter-required>
</div>
</div>
</div>
</advanced-filter-group>

View File

@@ -0,0 +1,36 @@
{{if .Filter.Config.Select2ResultTemplate}}
<script name="select2-result-template" type="x-tmpl-mustache">
{{.Filter.Config.Select2ResultTemplate}}
</script>
{{end}}
{{if .Filter.Config.Select2SelectionTemplate}}
<script name="select2-selection-template" type="x-tmpl-mustache">
{{.Filter.Config.Select2SelectionTemplate}}
</script>
{{end}}
{{$value := .Filter.Config.FilterValue .Filter .Context}}
<advanced-filter-group type="filter-selectone" class="clearfix">
<label class="qor-field__label">
{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}
</label>
<select data-toggle="qor.chooser" multiple="multiple" {{if $value}}chooser-selected="true"{{end}} data-placeholder="{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}" name="{{.InputNamePrefix}}.Value" data-allow-clear="true" {{if .Filter.Config.RemoteDataResource}}data-remote-data="true" data-remote-url="{{url_for .Filter.Config.RemoteDataResource}}"{{end}} filter-required>
{{if .Filter.Config.RemoteDataResource}}
{{range $v:=$value}}
<option value="{{primary_key_of $v}}" selected>{{stringify $v}}</option>
{{else}}
<option></option>
{{end}}
{{else}}
<option></option>
{{range $values := (.Filter.Config.GetCollection nil .Context)}}
{{if (is_included $value (index $values 0))}}
<option value="{{index $values 0}}" selected>{{index $values 1}}</option>
{{else}}
<option value="{{index $values 0}}">{{index $values 1}}</option>
{{end}}
{{end}}
{{end}}
</select>
</advanced-filter-group>

View File

@@ -0,0 +1,36 @@
{{if .Filter.Config.Select2ResultTemplate}}
<script name="select2-result-template" type="x-tmpl-mustache">
{{.Filter.Config.Select2ResultTemplate}}
</script>
{{end}}
{{if .Filter.Config.Select2SelectionTemplate}}
<script name="select2-selection-template" type="x-tmpl-mustache">
{{.Filter.Config.Select2SelectionTemplate}}
</script>
{{end}}
{{$value := .Filter.Config.FilterValue .Filter .Context}}
<advanced-filter-group type="filter-selectone" class="clearfix">
<label class="qor-field__label">
{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}
</label>
<select data-toggle="qor.chooser" {{if $value}}chooser-selected="true"{{end}} data-placeholder="{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}" name="{{.InputNamePrefix}}.Value" data-allow-clear="true" {{if .Filter.Config.RemoteDataResource}}data-remote-data="true" data-remote-url="{{url_for .Filter.Config.RemoteDataResource}}"{{end}} filter-required>
{{if .Filter.Config.RemoteDataResource}}
{{if $value}}
<option value="{{primary_key_of $value}}" selected>{{stringify $value}}</option>
{{else}}
<option></option>
{{end}}
{{else}}
<option></option>
{{range $values := (.Filter.Config.GetCollection nil .Context)}}
{{if (is_equal $value (index $values 0))}}
<option value="{{index $values 0}}" selected>{{index $values 1}}</option>
{{else}}
<option value="{{index $values 0}}">{{index $values 1}}</option>
{{end}}
{{end}}
{{end}}
</select>
</advanced-filter-group>

View File

@@ -0,0 +1,24 @@
<advanced-filter-group class="qor-field clearfix" type="filter-string">
{{ $opt := .Context.Request.URL.Query.Get (print .InputNamePrefix ".Operation") }}
<label class="qor-field__label">
{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}
</label>
<div class="qor-field__flexbox">
<select name="{{.InputNamePrefix}}.Operation" data-toggle="qor.selector" placeholder="{{t (printf "%v.filter.%v" .Resource.ToParam .Filter.Label) .Filter.Label}}">
<option value="conts" {{if (or (eq $opt "conts") (eq $opt ""))}}selected{{end}}>{{t "qor_admin.filter.strings.conts" "Contains"}}</option>
<option value="eq" {{if (eq $opt "eq")}}selected{{end}}>{{t "qor_admin.filter.strings.eq" "Equals"}}</option>
<option value="start_with" {{if (eq $opt "start_with")}}selected{{end}}>{{t "qor_admin.filter.strings.start_with" "Start with"}}</option>
<option value="end_with" {{if (eq $opt "end_with")}}selected{{end}}>{{t "qor_admin.filter.strings.end_with" "End with"}}</option>
</select>
{{ $value := .Context.Request.URL.Query.Get (print .InputNamePrefix ".Value") }}
<div class="qor-field__edit">
<div class="mdl-textfield mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label"></label>
<input class="mdl-textfield__input" type="text" name="{{.InputNamePrefix}}.Value" value="{{$value}}" filter-required>
</div>
</div>
</div>
</advanced-filter-group>

View File

@@ -0,0 +1,10 @@
<div class="qor-field">
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" {{if .InputId}}for="{{.InputId}}"{{end}}>
<span class="qor-field__label mdl-checkbox__label">{{meta_label .Meta}}</span>
<span class="qor-field__edit">
<input type="checkbox" {{if .InputId}}id="{{.InputId}}"{{end}} name="{{.InputName}}" class="mdl-checkbox__input" value="true" type="checkbox" {{if .Value}}checked{{end}} {{if (not (has_change_permission .Meta)) }} disabled{{end}}>
{{if has_change_permission .Meta}}<input type="hidden" name="{{.InputName}}" value="false">{{end}}
</span>
</label>
</div>

View File

@@ -0,0 +1,41 @@
{{$metaConfig := .Meta.Config}}
{{$current_values := (raw_value_of .ResourceValue .Meta)}}
<div class="qor-field collection-edit qor-fieldset-container" {{if $metaConfig.Max}}data-max-item="{{$metaConfig.Max}}" data-max-item-hint="Up to {{$metaConfig.Max}} {{meta_label .Meta}}"{{end}}>
<label class="qor-field__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__block">
{{$meta := .Meta}}
{{if $current_values}}
{{range $index, $value := $current_values }}
<fieldset class="qor-fieldset">
{{if has_delete_permission $meta}}
<button data-confirm="{{t "qor_admin.form.are_you_sure" "Are you sure?"}}" class="mdl-button qor-button--muted mdl-button--icon mdl-js-button qor-fieldset__delete" type="button">
<i class="material-icons md-18">delete</i>
</button>
{{end}}
{{render_nested_form $value (edit_sections $meta.Resource) $index}}
</fieldset>
{{end}}
{{end}}
{{if has_create_permission .Meta}}
<fieldset class="qor-fieldset qor-fieldset--new">
<button data-confirm="{{t "qor_admin.form.are_you_sure" "Are you sure?"}}" class="mdl-button qor-button--muted mdl-button--icon mdl-js-button qor-fieldset__delete" type="button">
<i class="material-icons md-18">delete</i>
</button>
{{if $current_values}}
{{render_nested_form $meta.Resource.NewStruct (new_sections $meta.Resource) (len $current_values)}}
{{else}}
{{render_nested_form $meta.Resource.NewStruct (new_sections $meta.Resource) 0}}
{{end}}
</fieldset>
<button class="mdl-button mdl-button--primary qor-fieldset__add" type="button">
{{t (printf "%v.attributes.add_%v" .BaseResource.ToParam (singular (meta_label .Meta))) (printf "Add %v" (singular (meta_label .Meta)))}}
</button>
{{end}}
</div>
</div>

View File

@@ -0,0 +1,21 @@
<div class="qor-field">
<div class="mdl-textfield mdl-textfield--full-width mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show">
{{.Value}}
</div>
<div class="qor-field__edit qor-field__datepicker" data-picker-type="date">
<input class="mdl-textfield__input qor-datepicker__input" placeholder="{{meta_placeholder .Meta .Context "YYYY-MM-DD"}}" type="text" id="{{.InputId}}" name="{{.InputName}}" value="{{.Value}}" {{if (not (has_change_permission .Meta)) }} disabled{{end}}>
<div>
<button data-toggle="qor.datepicker" class="mdl-button mdl-js-button mdl-button--icon qor-action__datepicker" type="button">
<i class="material-icons">date_range</i>
</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,27 @@
<div class="qor-field">
<div class="mdl-textfield mdl-textfield--full-width mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show">
{{.Value}}
</div>
<div class="qor-field__edit {{if .Meta.Config.ShowTime}}qor-field__datetimepicker{{else}}qor-field__datepicker{{end}}" data-picker-type="{{if .Meta.Config.ShowTime}}datetime{{else}}date{{end}}">
<input class="mdl-textfield__input {{if .Meta.Config.ShowTime}}qor-datetimepicker__input{{else}}qor-datepicker__input{{end}}" placeholder="{{if .Meta.Config.ShowTime}}{{meta_placeholder .Meta .Context " YYYY-MM-DD HH:MM "}}{{else}}{{meta_placeholder .Meta .Context " YYYY-MM-DD "}}{{end}}" type="text" id="{{.InputId}}" name="{{.InputName}}" value="{{.Value}}" {{if (not (has_change_permission .Meta)) }} disabled{{end}}>
<div>
<button data-toggle="qor.datepicker" class="mdl-button mdl-js-button mdl-button--icon qor-action__datepicker" type="button">
<i class="material-icons">date_range</i>
</button>
{{if .Meta.Config.ShowTime}}
<button data-toggle="qor.timepicker" class="mdl-button mdl-js-button mdl-button--icon qor-action__timepicker" type="button">
<i class="material-icons">access_time</i>
</button>
{{end}}
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,15 @@
<div class="qor-field">
<div class="mdl-textfield mdl-textfield--full-width mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show">
{{.Value}}
</div>
<div class="qor-field__edit">
<input class="mdl-textfield__input" type="number" step="any" id="{{.InputId}}" name="{{.InputName}}" value="{{.Value}}" {{if not (has_change_permission .Meta) }}disabled{{end}}>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
<input id="{{.InputId}}" name="{{.InputName}}" value="{{.Value}}" type="hidden">

View File

@@ -0,0 +1 @@
<input id="{{.InputId}}" class="qor-hidden__primary_key" name="{{.InputName}}" value="{{.Value}}" type="hidden">

View File

@@ -0,0 +1,15 @@
<div class="qor-field">
<div class="mdl-textfield mdl-textfield--full-width mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show">
{{.Value}}
</div>
<div class="qor-field__edit">
<input class="mdl-textfield__input" type="number" id="{{.InputId}}" name="{{.InputName}}" value="{{.Value}}" {{if (not (has_change_permission .Meta)) }}disabled{{end}}>
</div>
</div>
</div>

View File

@@ -0,0 +1,16 @@
<div class="qor-field">
<div class="mdl-textfield mdl-textfield--full-width mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show">
******
</div>
<div class="qor-field__edit">
<input class="mdl-textfield__input" type="password" id="{{.InputId}}" placeholder="******" name="{{.InputName}}" value=""
{{if not (has_change_permission .Meta)}}disabled{{end}}>
</div>
</div>
</div>

View File

@@ -0,0 +1,15 @@
<div class="qor-field">
<div class="mdl-textfield mdl-textfield--full-width mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show">
{{.Value}}
</div>
<div class="qor-field__edit">
{{.Value}}
</div>
</div>
</div>

View File

@@ -0,0 +1,29 @@
<div class="qor-field">
<label class="qor-field__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show qor-redactor__show redactor-styles">{{raw .Value}}</div>
{{if .Meta.Config.Plugins}}
{{range $plugin := .Meta.Config.Plugins}}
<script src="{{$plugin.Source}}"></script>
{{end}}
{{end}}
{{$asset_manager := .Meta.Config.AssetManager}}
<div class="qor-field__edit qor-field__block qor-redactor-box">
<textarea class="qor-field__input" id="{{.InputId}}" name="{{.InputName}}" rows="10"
data-redactor-settings="{{marshal .Meta.Config.Settings}}"
data-toggle="qor.redactor"
{{if $asset_manager}}
{{$asset_router := printf "%v/%v" $asset_manager.GetAdmin.GetRouter.Prefix $asset_manager.ToParam}}
data-upload-url="{{$asset_router}}/upload"
data-crop-url="{{$asset_router}}/crop"
data-text="{&quot;title&quot;: &quot;{{t "qor_admin.form.crop_image" "Crop image"}}&quot;, &quot;ok&quot;: &quot;{{t "qor_admin.form.ok" "OK"}}&quot;, &quot;cancel&quot;: &quot;{{t "qor_admin.form.cancel" "Cancel"}}&quot;}"
{{end}}
{{if not (has_change_permission .Meta) }}disabled{{end}}>
{{.Value}}
</textarea>
</div>
</div>

View File

@@ -0,0 +1,95 @@
<div class="qor-field">
<label class="qor-field__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
{{$current_values := (raw_value_of .ResourceValue .Meta)}}
<div class="qor-field__show qor-field__selectmany-show">
{{range $value := .Value}}
<span>{{stringify $value}}</span>
{{end}}
</div>
{{if .Meta.Config.Select2ResultTemplate}}
<script name="select2-result-template" type="x-tmpl-mustache">
{{.Meta.Config.Select2ResultTemplate}}
</script>
{{end}}
{{if .Meta.Config.Select2SelectionTemplate}}
<script name="select2-selection-template" type="x-tmpl-mustache">
{{.Meta.Config.Select2SelectionTemplate}}
</script>
{{end}}
{{if (eq .Meta.Config.SelectMode "bottom_sheet")}}
<script name="select-many-selected-icon" type="x-tmpl-mustache">
<span class="qor-select__select-icon"><i class="material-icons">check_circle</i></span>
</script>
<script name="select-many-unselected-icon" type="x-tmpl-mustache">
<span class="qor-select__select-icon"><i class="material-icons">panorama_fish_eye</i></span>
</script>
<script name="select-many-hint" type="x-tmpl-mustache">
<div class="qor-selectmany__hint clearfix">
<span class="qor-selectmany__selectall">{{marshal (t "qor_admin.form.select_many_selectall" "select all")}}</span>
<span>[[ selectedNum ]] {{marshal (t "qor_admin.form.select_many_hint" "item(s) selected")}}</span>
<a href="#" data-dismiss="bottomsheets">{{t "qor_admin.form.select_many_hint_button" "DONE"}}</a>
</div>
</script>
<script name="select-many-template" type="x-tmpl-mustache">
<li data-primary-key="[[ primaryKey ]]">
<span>[[ &displayName ]]</span>
<a href="javascripr://" class="qor-selected-many__undo">
{{marshal (t "qor_admin.form.undo" "UNDO")}}
</a>
<a href="#" class="qor-selected-many__remove"><i class="material-icons">clear</i></a>
</li>
</script>
{{end}}
<div class="qor-field__edit qor-field__block qor-field__selectmany" {{if (eq .Meta.Config.SelectMode "bottom_sheet")}}data-toggle="qor.selectmany"{{end}} {{if (not (has_change_permission .Meta)) }}data-disabled="disabled"{{end}}>
{{if (eq .Meta.Config.SelectMode "bottom_sheet")}}
<ul class="qor-field__selected-many">
{{range $value := $current_values}}
<li data-primary-key="{{primary_key_of $value}}">
<span>{{stringify $value}}</span>
<a href="javascripr://" class="qor-selected-many__undo">UNDO</a>
<a href="javascripr://" class="qor-selected-many__remove"><i class="material-icons">clear</i></a>
</li>
{{end}}
</ul>
<a href="javascript://" class="mdl-button mdl-button--primary qor-field__selectmany-trigger" data-select-modal="many" {{if .InputId}}data-select-id="#{{.InputId}}"{{end}} data-select-listing-url="{{url_for .Meta.Config.RemoteDataResource}}" data-select-creating-url="{{new_resource_path .Meta.Config.RemoteDataResource}}" data-select-default-creating="{{.Meta.Config.DefaultCreating}}" {{if .Meta.Config.PrimaryField}}data-remote-data-primary-key="{{.Meta.Config.PrimaryField}}"{{end}}>
{{t "qor_admin.form.add_items" "ADD ITEMS"}}
</a>
<select class="qor-field__input qor-field__selectmany-input hidden" id="{{.InputId}}" data-init-data="{{range $value := $current_values}}{{primary_key_of $value}},{{end}}" name="{{.InputName}}" multiple {{if (not (has_change_permission .Meta)) }}disabled{{end}}>
{{range $value := $current_values}}
<option value="{{primary_key_of $value}}" selected>{{stringify $value}}</option>
{{end}}
</select>
{{else}}
<select class="qor-field__input hidden" id="{{.InputId}}" {{if not (eq .Meta.Config.SelectMode "bottom_sheet")}} data-toggle="qor.chooser" {{end}} data-placeholder="{{meta_placeholder .Meta .Context "Select some Options"}}" name="{{.InputName}}" multiple {{if (not (has_change_permission .Meta)) }}disabled{{end}} {{if .Meta.Config.RemoteDataResource}}data-remote-data="true" data-remote-url="{{url_for .Meta.Config.RemoteDataResource}}" {{if .Meta.Config.PrimaryField}}data-remote-data-primary-key="{{.Meta.Config.PrimaryField}}"{{end}}{{end}}>
{{if .Meta.Config.RemoteDataResource}}
{{range $value := $current_values}}
<option value="{{primary_key_of $value}}" selected>{{stringify $value}}</option>
{{end}}
{{else}}
{{range $values := (.Meta.Config.GetCollection .ResourceValue .Context)}}
{{if (is_included $current_values (index $values 0))}}
<option value="{{index $values 0}}" selected>{{index $values 1}}</option>
{{else}}
<option value="{{index $values 0}}">{{index $values 1}}</option>
{{end}}
{{end}}
{{end}}
</select>
{{end}}
{{if has_change_permission .Meta}}<input type="hidden" name="{{.InputName}}" value="">{{end}}
</div>
</div>

View File

@@ -0,0 +1,76 @@
{{$current_value := (raw_value_of .ResourceValue .Meta)}}
{{$is_existing_record := (not (is_new_record $current_value))}}
<div class="qor-field">
<label class="qor-field__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show">{{.Value}}</div>
{{if .Meta.Config.Select2ResultTemplate}}
<script name="select2-result-template" type="x-tmpl-mustache">
{{.Meta.Config.Select2ResultTemplate}}
</script>
{{end}}
{{if .Meta.Config.Select2SelectionTemplate}}
<script name="select2-selection-template" type="x-tmpl-mustache">
{{.Meta.Config.Select2SelectionTemplate}}
</script>
{{end}}
{{if (eq .Meta.Config.SelectMode "bottom_sheet")}}
<script name="select-one-selected-template" type="x-tmpl-mustache">
<p class="qor-field__selected" data-primary-key="[[ primaryKey ]]">
<span class="qor-selected__change">[[ &displayName ]]</span>
<a href="#" class="qor-selected__remove"><i class="material-icons">remove_circle_outline</i></a>
</p>
</script>
<script name="select-one-selected-icon" type="x-tmpl-mustache">
<span class="qor-select__select-icon"><i class="material-icons">check_circle</i></span>
</script>
{{end}}
<div class="qor-field__block qor-field__edit qor-field__selectone" {{if (eq .Meta.Config.SelectMode "bottom_sheet")}} data-toggle="qor.selectone"{{end}}>
{{if (eq .Meta.Config.SelectMode "bottom_sheet")}}
{{if $is_existing_record}}
<p class="qor-field__selected" data-primary-key="{{primary_key_of $current_value}}">
<span class="qor-selected__change">{{.Value}}</span>
<a href="javascripr://" class="qor-selected__remove"><i class="material-icons">remove_circle_outline</i></a>
</p>
{{end}}
<a href="javascript://" {{if $is_existing_record}}style="display:none"{{end}} class="mdl-button mdl-button--colored qor-field__selectone-trigger" data-select-modal="one" {{if .InputId}}data-select-id="#{{.InputId}}"{{end}} data-selectone-url="{{url_for .Meta.Config.RemoteDataResource}}" data-select-listing-url="{{url_for .Meta.Config.RemoteDataResource}}" data-select-creating-url="{{new_resource_path .Meta.Config.RemoteDataResource}}" data-select-default-creating="{{.Meta.Config.DefaultCreating}}" {{if .Meta.Config.PrimaryField}}data-remote-data-primary-key="{{.Meta.Config.PrimaryField}}"{{end}}>{{meta_placeholder .Meta .Context "Click to Select"}}</a>
<select id="{{.InputId}}" class="qor-field__input qor-field__selectone-input hidden" name="{{.InputName}}" {{if (not (has_change_permission .Meta)) }}disabled{{end}}>
{{if $is_existing_record}}
<option value="{{primary_key_of $current_value}}" selected>{{.Value}}</option>
{{end}}
</select>
{{else}}
<select id="{{.InputId}}" class="qor-field__input hidden" {{if .Meta.Config.RemoteDataResource}}{{if $is_existing_record}}chooser-selected="true"{{end}}{{end}} data-toggle="qor.chooser" data-placeholder="{{meta_placeholder .Meta .Context "Select an Option"}}" name="{{.InputName}}" {{if (not (has_change_permission .Meta)) }}disabled{{end}} {{if .Meta.Config.AllowBlank}}data-allow-clear="true"{{end}} {{if .Meta.Config.RemoteDataResource}}data-remote-url="{{url_for .Meta.Config.RemoteDataResource}}" data-remote-data="true" {{if .Meta.Config.RemoteDataHasImage}}data-remote-image="true"{{end}} {{if .Meta.Config.PrimaryField}}data-remote-data-primary-key="{{.Meta.Config.PrimaryField}}"{{end}}{{end}}>
{{if .Meta.Config.RemoteDataResource}}
{{if $is_existing_record}}
<option value="{{primary_key_of $current_value}}" selected>{{.Value}}</option>
{{end}}
{{else}}
{{if .Meta.Config.AllowBlank}}
<option></option>
{{end}}
{{range $values := (.Meta.Config.GetCollection .ResourceValue .Context)}}
{{if (is_equal $current_value (index $values 0))}}
<option value="{{index $values 0}}" selected>{{index $values 1}}</option>
{{else}}
<option value="{{index $values 0}}">{{index $values 1}}</option>
{{end}}
{{end}}
{{end}}
</select>
{{end}}
{{if has_change_permission .Meta}}<input type="hidden" name="{{.InputName}}" value="">{{end}}
</div>
</div>

View File

@@ -0,0 +1,14 @@
{{$value := (raw_value_of .ResourceValue .Meta)}}
{{if (or (not (is_new_record $value)) (has_create_permission .Meta))}}
<div class="signle-edit qor-field">
<label class="qor-field__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__block">
<fieldset id="{{.InputId}}" class="qor-fieldset">
{{render_nested_form $value (edit_sections .Meta.Resource) -1}}
</fieldset>
</div>
</div>
{{end}}

View File

@@ -0,0 +1,13 @@
<div class="qor-field">
<div class="mdl-textfield mdl-textfield--full-width mdl-js-textfield">
<label class="qor-field__label mdl-textfield__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show">{{.Value}}</div>
<div class="qor-field__edit">
<input class="mdl-textfield__input" type="text" id="{{.InputId}}" name="{{.InputName}}" value="{{.Value}}" {{if (not (has_change_permission .Meta)) }}disabled{{end}}>
</div>
</div>
</div>

View File

@@ -0,0 +1,13 @@
<div class="qor-field">
<div class="mdl-textfield mdl-textfield--full-width mdl-js-textfield">
<label class="qor-field__label" for="{{.InputId}}">
{{meta_label .Meta}}
</label>
<div class="qor-field__show">{{.Value}}</div>
<div class="qor-field__edit">
<textarea class="mdl-textfield__input qor-js-autoheight" id="{{.InputId}}" name="{{.InputName}}" rows="1" {{if (not (has_change_permission .Meta)) }}disabled{{end}}>{{.Value}}</textarea>
</div>
</div>
</div>

View File

@@ -0,0 +1,9 @@
{{$meta := .Meta}}
{{range $index, $value := .Value }}
{{$url := url_for $value}}
{{if (and $url (defined_resource_show_page $meta.Resource))}}
<a data-url="{{$url}}" href="{{$url}}">{{stringify $value}}</a>
{{else}}
{{stringify $value}}
{{end}}
{{end}}

View File

@@ -0,0 +1 @@
{{raw .Value}}

View File

@@ -0,0 +1,10 @@
{{$meta := .Meta}}
{{$values := (raw_value_of .ResourceValue .Meta)}}
{{range $index, $value := $values}}
{{$url := url_for $value}}
{{if (and $url (defined_resource_show_page $meta.Resource))}}
<a data-url="{{$url}}" href="{{$url}}">{{stringify $value}}</a>
{{else}}
{{stringify $value}}
{{end}}
{{end}}

View File

@@ -0,0 +1,7 @@
{{$value := (raw_value_of .ResourceValue .Meta)}}
{{$url := url_for $value}}
{{if (and $url (defined_resource_show_page .Meta.Resource))}}
{{if not (is_new_record $value)}}<a data-url="{{$url}}" href="{{$url}}">{{.Value}}</a>{{end}}
{{else}}
{{.Value}}
{{end}}

View File

@@ -0,0 +1,7 @@
{{$value := (raw_value_of .ResourceValue .Meta)}}
{{$url := url_for $value}}
{{if (and $url (defined_resource_show_page .Meta.Resource))}}
<a data-url="{{$url}}" href="{{$url}}">{{stringify $value}}</a>
{{else}}
{{stringify $value}}
{{end}}

View File

@@ -0,0 +1,15 @@
<div class="qor-form-section clearfix" data-section-title="{{.Title}}">
{{if .Title}}
<label class="qor-field__label qor-form-section-title">
{{t (printf "%v.form.sections.%v" .Section.Resource.ToParam .Title) .Title}}
</label>
{{end}}
<div {{if .Title}}class="qor-fieldset"{{end}}>
{{range .Rows}}
<div class="qor-form-section-rows qor-section-columns-{{.Length}} clearfix">
{{.ColumnsHTML}}
</div>
{{end}}
</div>
</div>