Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove default buttons and replace with hawtio-submit directive
- Loading branch information
Showing
5 changed files
with
33 additions
and
84 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
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
28 changes: 28 additions & 0 deletions
28
hawtio-web/src/main/webapp/app/forms/js/submitDirective.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,28 @@ | ||
module Forms { | ||
|
||
export class SubmitForm { | ||
public restrict = 'A'; | ||
public scope = true; | ||
|
||
public link: (scope, element, attrs) => any; | ||
|
||
constructor() { | ||
// necessary to ensure 'this' is this object <sigh> | ||
this.link = (scope, element, attrs) => { | ||
return this.doLink(scope, element, attrs); | ||
} | ||
} | ||
|
||
private doLink(scope, element, attrs) { | ||
|
||
var el = $(element); | ||
|
||
var target = 'form[name=' + attrs['hawtioSubmit'] + ']'; | ||
|
||
el.click(function() { | ||
$(target).submit(); | ||
}); | ||
|
||
} | ||
} | ||
} |