Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fields directives for default fields (checkbox and radio for now)
- Loading branch information
1 parent
6fadc84
commit 62eca78
Showing
3 changed files
with
31 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
div | ||
label | ||
input(type="checkbox", ng-model="data.value", ng-change="changeSettings(data.name, data.value)", ng-value="data.value") | ||
| {{ data.name }} |
23 changes: 23 additions & 0 deletions
23
www/base/src/app/common/directives/fields/fields.directive.coffee
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,23 @@ | ||
class bbcheckbox extends Directive('common') | ||
constructor: (RecursionHelper) -> | ||
return { | ||
restrict: 'E' | ||
transclude: true | ||
scope: {data:'='} | ||
templateUrl: 'views/checkbox.html' | ||
controller: '_fieldController' | ||
} | ||
|
||
class bbradio extends Directive('common') | ||
constructor: (RecursionHelper) -> | ||
return { | ||
restrict: 'E' | ||
transclude: true | ||
scope: {data:'='} | ||
templateUrl: 'views/radio.html' | ||
controller: '_fieldController' | ||
} | ||
|
||
class _field extends Controller('common') | ||
constructor: ($scope) -> | ||
$scope.changeSettings = (settings, value) -> localStorage.setItem(settings, value) |
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,4 @@ | ||
div | ||
label(ng-repeat="(key,answer) in data.answers") | ||
input(type="radio", ng-model="data.value", ng-change="changeSettings(data.name, answer)", ng-value="answer") | ||
| {{ key }} |