Skip to content

Commit

Permalink
controllerAs changes - fix for edit/update key values and lists
Browse files Browse the repository at this point in the history
controllerAs changes - fix for edit/update key values
  • Loading branch information
lgalis committed Feb 10, 2017
1 parent 306b1f4 commit 6be21e2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
ManageIQ.angular.scope = $scope;

if (catalogItemFormId == 'new') {
vm.newRecord = true;
$scope.newRecord = true;
vm.catalogItemModel.name = '';
vm.catalogItemModel.description = '';
vm.catalogItemModel.catalog_id = '';
Expand All @@ -58,7 +58,7 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
} else {
vm.newRecord = false;
catalogItemDataFactory.getCatalogItemData(catalogItemFormId).then(function (catalogItemData) {
vm.newRecord = false;
$scope.newRecord = false;
vm.catalogItemModel.name = catalogItemData.name;
vm.catalogItemModel.description = catalogItemData.description;
vm.catalogItemModel.display = catalogItemData.display;
Expand Down
2 changes: 1 addition & 1 deletion app/views/catalog/_st_angular_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
%select{"ng-model" => "vm._catalog",
"name" => "catalog_id",
"ng-required" => "vm.catalogItemModel.display",
'ng-options' => 'catalog as catalog.name for catalog in catalogs',
'ng-options' => 'catalog as catalog.name for catalog in vm.catalogs',
'pf-select' => true}
%option{"value" => ""}
= "<#{_('Choose')}>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
%div{:class => "btn-container"}
%button{:class => "btn btn-link",
:type => "button",
"ng-click" => "addKeyValue('#{prefix}')",
"ng-click" => "vm.addKeyValue('#{prefix}')",
"ng-disabled" => "(#{ng_model}.#{prefix}_key == '' || #{ng_model}.#{prefix}_value == '')"}
%span{:class => "fa fa-plus tag-add"}

Expand All @@ -136,15 +136,15 @@
-# %div{:class => "btn-container"}
%td
%div{"ng-if" => "#{ng_model}.#{prefix}_editMode && $index === #{ng_model}.s_index"}
%button{:class => "btn btn-primary", :type => "button", "ng-disabled" => "(#{ng_model}.key === '' || #{ng_model}.key_value === '')", "ng-click" => "saveKeyValue('#{prefix}', $index)"}
%button{:class => "btn btn-primary", :type => "button", "ng-disabled" => "(#{ng_model}.key === '' || #{ng_model}.key_value === '')", "ng-click" => "vm.saveKeyValue('#{prefix}', $index)"}
=_("Save")
%button{:class => "btn btn-default", :type => "button", "ng-click" => "cancelKeyValue('#{prefix}', this.key, this.key_value, $index)"}
%button{:class => "btn btn-default", :type => "button", "ng-click" => "vm.cancelKeyValue('#{prefix}', this.key, this.key_value, $index)"}
=_("Cancel")

%div{"ng-if" => "!#{ng_model}.#{prefix}_editMode || (#{ng_model}.#{prefix}_editMode && $index !== #{ng_model}.s_index)", :class => "btn-container"}
%button{:class => "btn btn-link", :type => "button", "ng-click" => "editKeyValue('#{prefix}', this.key, this.key_value, $index)", "ng-disabled" => "#{ng_model}.#{prefix}_editMode"}
%button{:class => "btn btn-link", :type => "button", "ng-click" => "vm.editKeyValue('#{prefix}', this.key, this.key_value, $index)", "ng-disabled" => "#{ng_model}.#{prefix}_editMode"}
%span{:class => "pficon pficon-edit"}
%button{:class => "btn btn-link", :type => "button", "ng-click" => "removeKeyValue('#{prefix}', this.key, this.key_value, $index)", "ng-disabled" => "#{ng_model}.#{prefix}_editMode"}
%button{:class => "btn btn-link", :type => "button", "ng-click" => "vm.removeKeyValue('#{prefix}', this.key, this.key_value, $index)", "ng-disabled" => "#{ng_model}.#{prefix}_editMode"}
%span{:class => "pficon pficon-delete"}

.form-group
Expand All @@ -162,7 +162,7 @@
.form-group{"ng-class" => "{'has-error': angularForm.#{prefix}_dialog_id.$invalid}", "ng-if" => "#{ng_model}.#{prefix}_dialog_existing == 'existing'"}
%select{"ng-model" => "vm._#{prefix}_dialog",
"name" => "#{prefix}_dialog_id",
'ng-options' => 'dialog as dialog.label for dialog in dialogs',
'ng-options' => 'dialog as dialog.label for dialog in vm.dialogs',
"ng-required" => "fieldsRequired('#{prefix}') && #{ng_model}.#{prefix}_dialog_existing == 'existing'",
:checkchange => true,
'pf-select' => true}
Expand Down

0 comments on commit 6be21e2

Please sign in to comment.