-# Not all inputs are ng inputs, they don't make the ng-form dirty on change.
-# ng-change is only valid for inputs, not for a form.
-# So we use onchange and have to get the scope to access the ng controller
= form_for [main_app, :admin, @enterprise], html: { name: "enterprise_form",
  "ng-controller" => 'enterpriseCtrl',
  'onchange' => 'angular.element(enterprise_form).scope().setFormDirty()',
  } do |f|

  %save-bar{ dirty: "enterprise_form.$dirty", persist: "true" }
    %input.red{ type: "button", value: t(:update), ng: { click: "submit()", disabled: "!enterprise_form.$dirty" } }
    %input{ type: "button", ng: { value: "enterprise_form.$dirty ? '#{t(:cancel)}' : '#{t(:close)}'", click: "cancel('#{main_app.admin_enterprises_path}')" } }

  .row
    .sixteen.columns.alpha
      .four.columns.alpha
        = render 'admin/shared/side_menu'
      .one.column &nbsp;
      .eleven.columns.omega.fullwidth_inputs
        = render 'form', f: f

-# Not all inputs are ng inputs, they don't make the ng-form dirty on change.
-# ng-change is only valid for inputs, not for a form.
-# So we use onchange and have to get the scope to access the ng controller
= form_for [main_app, :admin, @enterprise], html: { name: "enterprise_form",
  "ng-controller" => 'enterpriseCtrl',
  'onchange' => 'angular.element(enterprise_form).scope().setFormDirty()',
  "ng-cloak" => true } do |f|

  %save-bar{ dirty: "enterprise_form.$dirty", persist: "true" }
    %input.red{ type: "button", value: t(:update), ng: { click: "submit()", disabled: "!enterprise_form.$dirty" } }
    %input{ type: "button", ng: { value: "enterprise_form.$dirty ? '#{t(:cancel)}' : '#{t(:close)}'", click: "cancel('#{main_app.admin_enterprises_path}')" } }

  .row
    .sixteen.columns.alpha
      .four.columns.alpha
        = render 'admin/shared/side_menu'
      .one.column &nbsp;
      .eleven.columns.omega.fullwidth_inputs
        = render 'form', f: f

Use ng-cloak for admin/enterprises/edit form
Use ng-cloak for admin/enterprises/edit form
