Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a read-only variant of the form, fixes #214
- Loading branch information
Showing
6 changed files
with
107 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
hawtio-web/src/main/webapp/app/forms/js/simpleReadOnlyFormDirective.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module Forms { | ||
|
||
export class SimpleReadOnlyForm extends SimpleForm { | ||
|
||
private attributeName = 'simpleReadOnlyForm'; | ||
|
||
constructor(private workspace, public $compile) { | ||
super(workspace, $compile); | ||
} | ||
|
||
private getCancelButton(config) { | ||
return ''; | ||
} | ||
|
||
private getResetButton(config) { | ||
return ''; | ||
} | ||
|
||
private getSubmitButton(config) { | ||
return ''; | ||
} | ||
|
||
private getInput(config, arg) { | ||
var a = this.sanitize(arg); | ||
|
||
switch (a.formType) { | ||
default: | ||
var rc = $('<span class="form-data"></span>'); | ||
var modelName = a.model; | ||
if (!angular.isDefined(a.model)) { | ||
// TODO always use 2 way binding? | ||
modelName = config.getEntity() + "." + a.name; | ||
} | ||
if (modelName) { | ||
rc.attr('ng-model', modelName); | ||
rc.append('{{' + modelName + '}}') | ||
} | ||
|
||
return rc; | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters