Standardize indentation.

This commit is contained in:
Sean Lip
2016-12-05 17:54:12 -08:00
parent 51f42ef5a3
commit 2a172c761c
4 changed files with 117 additions and 117 deletions

View File

@@ -27,39 +27,39 @@
blocklyApp.FieldSegmentComponent = ng.core.Component({ blocklyApp.FieldSegmentComponent = ng.core.Component({
selector: 'blockly-field-segment', selector: 'blockly-field-segment',
template: ` template: `
<template [ngIf]="!mainField"> <template [ngIf]="!mainField">
<label [id]="mainFieldId">{{getPrefixText()}}</label> <label [id]="mainFieldId">{{getPrefixText()}}</label>
</template>
<template [ngIf]="mainField">
<template [ngIf]="isTextInput()">
{{getPrefixText()}}
<input [id]="mainFieldId" type="text" [disabled]="disabled"
[ngModel]="mainField.getValue()" (ngModelChange)="mainField.setValue($event)"
[attr.aria-label]="getFieldDescription() + (disabled ? 'Disabled text field' : 'Press Enter to edit text')"
tabindex="-1">
</template> </template>
<template [ngIf]="isNumberInput()"> <template [ngIf]="mainField">
{{getPrefixText()}} <template [ngIf]="isTextInput()">
<input [id]="mainFieldId" type="number" [disabled]="disabled" {{getPrefixText()}}
[ngModel]="mainField.getValue()" (ngModelChange)="setNumberValue($event)" <input [id]="mainFieldId" type="text" [disabled]="disabled"
[attr.aria-label]="getFieldDescription() + (disabled ? 'Disabled number field' : 'Press Enter to edit number')" [ngModel]="mainField.getValue()" (ngModelChange)="mainField.setValue($event)"
tabindex="-1"> [attr.aria-label]="getFieldDescription() + (disabled ? 'Disabled text field' : 'Press Enter to edit text')"
</template> tabindex="-1">
</template>
<template [ngIf]="isDropdown()"> <template [ngIf]="isNumberInput()">
{{getPrefixText()}} {{getPrefixText()}}
<select [id]="mainFieldId" [name]="mainFieldId" tabindex="-1" <input [id]="mainFieldId" type="number" [disabled]="disabled"
[ngModel]="mainField.getValue()" [ngModel]="mainField.getValue()" (ngModelChange)="setNumberValue($event)"
(ngModelChange)="handleDropdownChange(mainField, $event)"> [attr.aria-label]="getFieldDescription() + (disabled ? 'Disabled number field' : 'Press Enter to edit number')"
<option *ngFor="#optionValue of getOptions()" value="{{optionValue}}" tabindex="-1">
[selected]="mainField.getValue() == optionValue"> </template>
{{optionText[optionValue]}}
</option> <template [ngIf]="isDropdown()">
</select> {{getPrefixText()}}
<select [id]="mainFieldId" [name]="mainFieldId" tabindex="-1"
[ngModel]="mainField.getValue()"
(ngModelChange)="handleDropdownChange(mainField, $event)">
<option *ngFor="#optionValue of getOptions()" value="{{optionValue}}"
[selected]="mainField.getValue() == optionValue">
{{optionText[optionValue]}}
</option>
</select>
</template>
</template> </template>
</template>
`, `,
inputs: ['prefixFields', 'mainField', 'mainFieldId', 'level'], inputs: ['prefixFields', 'mainField', 'mainFieldId', 'level'],
pipes: [blocklyApp.TranslatePipe] pipes: [blocklyApp.TranslatePipe]

View File

@@ -27,32 +27,32 @@
blocklyApp.SidebarComponent = ng.core.Component({ blocklyApp.SidebarComponent = ng.core.Component({
selector: 'blockly-sidebar', selector: 'blockly-sidebar',
template: ` template: `
<div class="blocklySidebarColumn"> <div class="blocklySidebarColumn">
<button *ngFor="#buttonConfig of customSidebarButtons" <button *ngFor="#buttonConfig of customSidebarButtons"
id="{{buttonConfig.id || undefined}}" id="{{buttonConfig.id || undefined}}"
(click)="buttonConfig.action()" (click)="buttonConfig.action()"
class="blocklySidebarButton"> class="blocklySidebarButton">
{{buttonConfig.text}} {{buttonConfig.text}}
</button> </button>
<button id="{{ID_FOR_ATTACH_TO_LINK_BUTTON}}" <button id="{{ID_FOR_ATTACH_TO_LINK_BUTTON}}"
(click)="showToolboxModalForAttachToMarkedConnection()" (click)="showToolboxModalForAttachToMarkedConnection()"
[attr.disabled]="!isAnyConnectionMarked() ? 'disabled' : undefined" [attr.disabled]="!isAnyConnectionMarked() ? 'disabled' : undefined"
[attr.aria-disabled]="!isAnyConnectionMarked()" [attr.aria-disabled]="!isAnyConnectionMarked()"
class="blocklySidebarButton"> class="blocklySidebarButton">
{{'ATTACH_NEW_BLOCK_TO_LINK'|translate}} {{'ATTACH_NEW_BLOCK_TO_LINK'|translate}}
</button> </button>
<button id="{{ID_FOR_CREATE_NEW_GROUP_BUTTON}}" <button id="{{ID_FOR_CREATE_NEW_GROUP_BUTTON}}"
(click)="showToolboxModalForCreateNewGroup()" (click)="showToolboxModalForCreateNewGroup()"
class="blocklySidebarButton"> class="blocklySidebarButton">
{{'CREATE_NEW_BLOCK_GROUP'|translate}} {{'CREATE_NEW_BLOCK_GROUP'|translate}}
</button> </button>
<button id="clear-workspace" (click)="clearWorkspace()" <button id="clear-workspace" (click)="clearWorkspace()"
[attr.disabled]="isWorkspaceEmpty() ? 'disabled' : undefined" [attr.disabled]="isWorkspaceEmpty() ? 'disabled' : undefined"
[attr.aria-disabled]="isWorkspaceEmpty()" [attr.aria-disabled]="isWorkspaceEmpty()"
class="blocklySidebarButton"> class="blocklySidebarButton">
{{'ERASE_WORKSPACE'|translate}} {{'ERASE_WORKSPACE'|translate}}
</button> </button>
</div> </div>
`, `,
pipes: [blocklyApp.TranslatePipe] pipes: [blocklyApp.TranslatePipe]
}) })

View File

@@ -27,48 +27,48 @@
blocklyApp.WorkspaceTreeComponent = ng.core.Component({ blocklyApp.WorkspaceTreeComponent = ng.core.Component({
selector: 'blockly-workspace-tree', selector: 'blockly-workspace-tree',
template: ` template: `
<li [id]="idMap['blockRoot']" role="treeitem" class="blocklyHasChildren" <li [id]="idMap['blockRoot']" role="treeitem" class="blocklyHasChildren"
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['blockSummary'], 'blockly-translate-workspace-block')" [attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['blockSummary'], 'blockly-translate-workspace-block')"
[attr.aria-level]="level"> [attr.aria-level]="level">
<label [id]="idMap['blockSummary']">{{getBlockDescription()}}</label> <label [id]="idMap['blockSummary']">{{getBlockDescription()}}</label>
<ol role="group"> <ol role="group">
<template ngFor #blockInput [ngForOf]="block.inputList" #i="index"> <template ngFor #blockInput [ngForOf]="block.inputList" #i="index">
<li role="treeitem" [id]="idMap['listItem' + i]" [attr.aria-level]="level + 1" *ngIf="blockInput.fieldRow.length" <li role="treeitem" [id]="idMap['listItem' + i]" [attr.aria-level]="level + 1" *ngIf="blockInput.fieldRow.length"
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['fieldLabel' + i])"> [attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['fieldLabel' + i])">
<blockly-field-segment *ngFor="#fieldSegment of inputListAsFieldSegments[i]" <blockly-field-segment *ngFor="#fieldSegment of inputListAsFieldSegments[i]"
[prefixFields]="fieldSegment.prefixFields" [prefixFields]="fieldSegment.prefixFields"
[mainField]="fieldSegment.mainField" [mainField]="fieldSegment.mainField"
[mainFieldId]="idMap['fieldLabel' + i]" [mainFieldId]="idMap['fieldLabel' + i]"
[level]="level + 2"> [level]="level + 2">
</blockly-field-segment> </blockly-field-segment>
</li> </li>
<blockly-workspace-tree *ngIf="blockInput.connection && blockInput.connection.targetBlock()" <blockly-workspace-tree *ngIf="blockInput.connection && blockInput.connection.targetBlock()"
[block]="blockInput.connection.targetBlock()" [level]="level + 1" [block]="blockInput.connection.targetBlock()" [level]="level + 1"
[tree]="tree"> [tree]="tree">
</blockly-workspace-tree> </blockly-workspace-tree>
<li #inputList [id]="idMap['inputList' + i]" role="treeitem" <li #inputList [id]="idMap['inputList' + i]" role="treeitem"
*ngIf="blockInput.connection && !blockInput.connection.targetBlock()" *ngIf="blockInput.connection && !blockInput.connection.targetBlock()"
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['inputMenuLabel' + i], 'blockly-submenu-indicator')" [attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['inputMenuLabel' + i], 'blockly-submenu-indicator')"
[attr.aria-level]="level + 1"> [attr.aria-level]="level + 1">
<label [id]="idMap['inputMenuLabel' + i]"> <label [id]="idMap['inputMenuLabel' + i]">
{{getBlockNeededLabel(blockInput)}} {{getBlockNeededLabel(blockInput)}}
</label> </label>
<button [id]="idMap[fieldButtonsInfo[0].baseIdKey + 'Button' + i]" <button [id]="idMap[fieldButtonsInfo[0].baseIdKey + 'Button' + i]"
(click)="fieldButtonsInfo[0].action(blockInput.connection)" (click)="fieldButtonsInfo[0].action(blockInput.connection)"
[disabled]="fieldButtonsInfo[0].isDisabled(blockInput.connection)" tabindex="-1"> [disabled]="fieldButtonsInfo[0].isDisabled(blockInput.connection)" tabindex="-1">
{{fieldButtonsInfo[0].translationIdForText|translate}} {{fieldButtonsInfo[0].translationIdForText|translate}}
</button> </button>
</li> </li>
</template> </template>
</ol> </ol>
</li> </li>
<blockly-workspace-tree *ngIf= "block.nextConnection && block.nextConnection.targetBlock()" <blockly-workspace-tree *ngIf= "block.nextConnection && block.nextConnection.targetBlock()"
[block]="block.nextConnection.targetBlock()" [block]="block.nextConnection.targetBlock()"
[level]="level" [tree]="tree"> [level]="level" [tree]="tree">
</blockly-workspace-tree> </blockly-workspace-tree>
`, `,
directives: [blocklyApp.FieldSegmentComponent, ng.core.forwardRef(function() { directives: [blocklyApp.FieldSegmentComponent, ng.core.forwardRef(function() {
return blocklyApp.WorkspaceTreeComponent; return blocklyApp.WorkspaceTreeComponent;

View File

@@ -27,32 +27,32 @@
blocklyApp.WorkspaceComponent = ng.core.Component({ blocklyApp.WorkspaceComponent = ng.core.Component({
selector: 'blockly-workspace', selector: 'blockly-workspace',
template: ` template: `
<div class="blocklyWorkspaceColumn"> <div class="blocklyWorkspaceColumn">
<h3 #workspaceTitle id="blockly-workspace-title">{{'WORKSPACE'|translate}}</h3> <h3 #workspaceTitle id="blockly-workspace-title">{{'WORKSPACE'|translate}}</h3>
<div *ngIf="workspace" class="blocklyWorkspace"> <div *ngIf="workspace" class="blocklyWorkspace">
<ol #tree *ngFor="#block of workspace.topBlocks_; #i = index" <ol #tree *ngFor="#block of workspace.topBlocks_; #i = index"
tabindex="0" role="tree" class="blocklyTree blocklyWorkspaceFocusTarget" tabindex="0" role="tree" class="blocklyTree blocklyWorkspaceFocusTarget"
[attr.aria-activedescendant]="getActiveDescId(tree.id)" [attr.aria-activedescendant]="getActiveDescId(tree.id)"
[attr.aria-labelledby]="workspaceTitle.id" [attr.aria-labelledby]="workspaceTitle.id"
(keydown)="onKeypress($event, tree)" (keydown)="onKeypress($event, tree)"
(focus)="speakLocation(i)"> (focus)="speakLocation(i)">
<blockly-workspace-tree [level]="0" [block]="block" [tree]="tree" [isTopLevel]="true"> <blockly-workspace-tree [level]="0" [block]="block" [tree]="tree" [isTopLevel]="true">
</blockly-workspace-tree> </blockly-workspace-tree>
</ol> </ol>
<span *ngIf="workspace.topBlocks_.length === 0"> <span *ngIf="workspace.topBlocks_.length === 0">
<p> <p>
There are no blocks in the workspace. There are no blocks in the workspace.
<button (click)="showToolboxModalForCreateNewGroup()" <button (click)="showToolboxModalForCreateNewGroup()"
class="blocklyWorkspaceFocusTarget" class="blocklyWorkspaceFocusTarget"
id="{{ID_FOR_EMPTY_WORKSPACE_BTN}}"> id="{{ID_FOR_EMPTY_WORKSPACE_BTN}}">
Create new block group... Create new block group...
</button> </button>
</p> </p>
</span> </span>
</div>
</div> </div>
</div>
`, `,
directives: [blocklyApp.WorkspaceTreeComponent], directives: [blocklyApp.WorkspaceTreeComponent],
pipes: [blocklyApp.TranslatePipe] pipes: [blocklyApp.TranslatePipe]