LP1831785 (follow-up): simplifying static string binding, removing empty else statement
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / sandbox / sandbox.component.html
1
2 <eg-staff-banner bannerText="Sandbox" i18n-bannerText>
3 </eg-staff-banner>
4
5 <eg-title 
6   i18n-prefix i18n-suffix
7   prefix=":) {{dynamicTitleText}}"
8   suffix="Sandbox">
9 </eg-title>
10 <eg-help-popover [placement]="'right'" helpText="This page is for random ng stuff!"></eg-help-popover>
11 <div class="row flex pt-2">
12   <div i18n> Modify Page Title: </div>
13   <div class="col-lg-2">
14     <input type="text" [(ngModel)]="dynamicTitleText" class="form-control"/>
15   </div>
16 </div>
17
18 <!-- FM Editor Experiments ----------------------------- -->
19 <div class="row mb-3">
20   <ng-template #descriptionTemplate 
21       let-field="field" let-record="record" let-hello="hello">
22   <!-- example custom template for editing the 'description' field -->
23     <textarea
24       placeholder="{{hello}}"
25       class="form-control"
26       name="{{field.name}}"
27       [readonly]="field.readOnly"
28       [required]="field.isRequired()"
29       [ngModel]="record[field.name]()"
30       (ngModelChange)="record[field.name]($event)">
31     </textarea>
32   </ng-template>
33   <!-- note: fieldOptions would be best defined in the .ts file, but
34       want to demostrate it can be set in the template as well -->
35   <eg-fm-record-editor #fmRecordEditor 
36       idlClass="cmrcfld" mode="create" 
37       [fieldOptions]="{marc_record_type:{customValues:[{id:'biblio'},{id:'serial'},{id:'authority'}]},description:{customTemplate:{template:descriptionTemplate,context:{'hello':'goodbye'}}}}"
38       recordId="1" orgDefaultAllowed="owner">
39   </eg-fm-record-editor>
40   <button class="btn btn-dark" (click)="openEditor()">
41       Fm Record Editor
42   </button>
43 </div>
44 <!-- / FM Editor Experiments ----------------------------- -->
45
46 <!-- Progress Dialog Experiments ----------------------------- -->
47 <div class="row mb-3">
48   <div class="col-lg-3">
49     <button class="btn btn-outline-danger" (click)="progress.increment()">Increment Inline</button>
50     <eg-help-popover [placement]="'bottom'" helpText="Exercise your clicking finger by clicking the button above.">
51     </eg-help-popover>
52   </div>
53   <div class="col-lg-3">
54     <eg-progress-inline [max]="100" [value]="1" #progress></eg-progress-inline>
55   </div>
56 </div>
57 <div class="row mb-3">
58   <div class="col-lg-4">
59     <eg-progress-dialog #progressDialog>
60     </eg-progress-dialog>
61     <button class="btn btn-light" (click)="showProgress()">Test Progress Dialog</button>
62   </div>
63   <div class="col-lg-3">
64     <eg-help-popover helpLink="https://www.youtube.com/watch?v=dQw4w9WgXcQ" helpText="This popover is supposed to help or something...!"></eg-help-popover>
65     <eg-combobox [allowFreeText]="true" 
66       placeholder="Combobox with static data"
67       [entries]="cbEntries"></eg-combobox>
68   </div>
69   <div class="col-lg-3">
70     <eg-help-popover helpText="You have to type to see any options in this dropdown."></eg-help-popover>
71     <eg-combobox
72       placeholder="Combobox with dynamic data that does not enable click if no search term is supplied"
73       [asyncDataSource]="cbAsyncSource"></eg-combobox>
74   </div>
75 </div>
76 <div class="row mb-3">
77   <div class="col-lg-4">
78    <eg-help-popover helpText="If you like Toast you must click below!" placement="'auto'"></eg-help-popover>
79    <button class="btn btn-info" (click)="testToast()">Test Toast Message</button>
80   </div>
81   <div class="col-lg-2">
82     Org select with limit perms
83   </div>
84   <div class="col-lg-2">
85     <eg-org-select [limitPerms]="['REGISTER_WORKSTATION']">
86     </eg-org-select>
87   </div>
88 </div>
89 <div class="row mb-3">
90   <div class="col-lg-4">
91   </div>
92   <div class="col-lg-3">
93     <eg-combobox placeholder="Combobox with @idlClass = 'aou' @idlField='shortname'" idlClass="aou" idlField="shortname" [asyncSupportsEmptyTermClick]="true">
94     </eg-combobox>
95   </div>
96   <div class="col-lg-3">
97     <eg-combobox placeholder="Combobox with @idlClass = 'csp'" idlClass="csp" [asyncSupportsEmptyTermClick]="true">
98     </eg-combobox>
99   </div>
100 </div>
101 <div class="row mb-3">
102   <div class="col-lg-4">
103   </div>
104   <div class="col-lg-3">
105     <eg-combobox placeholder="Combobox with @idlClass = 'aou'" idlClass="aou" [asyncSupportsEmptyTermClick]="true">
106     </eg-combobox>
107   </div>
108   <div class="col-lg-3">
109   </div>
110 </div>
111 <!-- /Progress Dialog Experiments ----------------------------- -->
112
113 <!-- eg strings -->
114 <!--
115 <div class="row mb-3">
116     <eg-string #helloString text="Hello, {{name}}" i18n-text></eg-string>
117     <button class="btn btn-success" (click)="testStrings()">Test Strings</button>
118 </div>
119 -->
120
121 <div class="row mb-3">
122     <ng-template #helloStrTmpl let-name="name" i18n>Hello, {{name}}</ng-template>
123     <!--
124     <eg-string #helloStr key="helloKey" [template]="helloStrTmpl"></eg-string>
125     -->
126     <eg-string key="staff.sandbox.test" [template]="helloStrTmpl"></eg-string>
127     <button class="btn btn-success" (click)="testStrings()">Test Strings</button>
128 </div>
129
130 <div class="row">
131   <div class="form-group">
132     <eg-date-select (onChangeAsDate)="changeDate($event)"
133         initialYmd="2017-03-04">
134     </eg-date-select>
135   </div>
136   <div>HERE: {{testDate}}</div>
137 </div>
138
139 <!-- printing -->
140
141 <button class="btn btn-secondary" (click)="doPrint()">Test Print</button>
142 <ng-template #printTemplate let-context>Hello, {{context.world}}!</ng-template>
143
144 <button class="btn btn-secondary" (click)="printWithDialog()">Print with dialog</button>
145
146 <br/><br/>
147 <div class="row">
148   <div class="col-lg-3">
149     <eg-translate #translate [idlObject]="oneBtype" fieldName="name"></eg-translate>
150     <button class="btn btn-info"
151       (click)="translate.open({size:'lg'})">Translate</button>
152   </div>
153 </div>
154 <br/><br/>
155
156 <div>
157   <h4>Cross-tab communications example</h4>
158   <p>To test, open this sandbox in a second browser tab. Enter something in the input box below, then switch to the other tab and click anywhere on the page. 
159      You should see the message that you sent to the other browser tab.</p>
160 </div>
161 <div class="row">
162   <div class="col-lg-3">
163     <input type="text" #sendSbMessage placeholder="message to send to another tab" size="40" (change)="sendMessage($event)">
164   </div>
165   <div class="col-lg-3">
166     message received: {{sbChannelText}}
167   </div>
168 </div>
169
170 <!-- grid stuff -->
171 <ng-template #cellTmpl let-row="row" let-col="col" let-userContext="userContext">
172   HELLO {{userContext.hello}}
173   <button>{{row.id()}}</button>
174 </ng-template>
175 <eg-grid #cbtGrid idlClass="cbt" 
176   [dataSource]="btSource" 
177   [rowClassCallback]="btGridRowClassCallback"
178   [rowFlairIsEnabled]="true"
179   [rowFlairCallback]="btGridRowFlairCallback"
180   [cellClassCallback]="btGridCellClassCallback"
181   [sortable]="true">
182   <eg-grid-toolbar-action label="Action that needs a single row" i18n-label
183     (onClick)="complimentEvergreen($event)" [disableOnRows]="notOneSelectedRow">
184   </eg-grid-toolbar-action>
185   <eg-grid-toolbar-action [isSeparator]="true">
186   </eg-grid-toolbar-action>
187   <eg-grid-toolbar-action label="Another Action" i18n-label
188     (onClick)="complimentEvergreen2($event)">
189   </eg-grid-toolbar-action>
190   <eg-grid-column name="test" [cellTemplate]="cellTmpl" 
191     [cellContext]="btGridTestContext" [sortable]="false">
192   </eg-grid-column>
193   <eg-grid-column [sortable]="false" path="owner.name"></eg-grid-column>
194   <eg-grid-column [sortable]="false" path="datetime_test" 
195     datatype="timestamp" [datePlusTime]="true"></eg-grid-column>
196 </eg-grid>
197
198 <br/><br/>
199
200 <h4>PCRUD auto flesh and FormatService detection</h4>
201 <div *ngIf="aMetarecord">Fingerprint: {{aMetarecord}}</div>
202
203 <div class="row">
204   <div class="card col-md-6">
205     <div class="card-body">
206       <h3 class="card-title">Do you like template-driven forms?</h3>
207       <div class="card-text">
208         <eg-org-family-select
209           [ancestorSelectorChecked]="true"
210           [hideDescendantSelector]="true"
211           selectedOrgId="7"
212           labelText="Choose the best libraries"
213           ngModel #bestOnes="ngModel">
214         </eg-org-family-select>
215         The best libraries are: {{bestOnes.value | json}}
216       </div>
217     </div>
218   </div>
219   <form class="card col-md-6" [formGroup]="badOrgForm">
220     <div class="card-body">
221       <h3 class="card-title">Or perhaps reactive forms interest you?</h3>
222       <div class="card-text">
223         <eg-org-family-select
224           formControlName="badOrgSelector"
225           labelText="Choose the fanciest libraries">
226         </eg-org-family-select>
227         <div *ngIf="!badOrgForm.valid" class="alert alert-danger">
228           <span class="material-icons">error</span>
229           <span i18n>Too many fancy libraries!</span>
230         </div>
231       </div>
232     </div>
233   </form>
234 </div>