module ScenarioHelper
  def current_scenario_scaled?
    Current.setting.scaling.present?
  end

  def scaling_sector_checkbox(name, default = true)
    scaled  = Current.setting.scaling.present?
    checked = scaled ? Current.setting.scaling[:"has_#{ name }"] : default

    check_box_tag("has_#{ name }", '1', checked, disabled: false)
  end
end

module ScenarioHelper
  def current_scenario_scaled?
    Current.setting.scaling.present?
  end

  def scaling_sector_checkbox(name, default = true)
    scaled  = Current.setting.scaling.present?
    checked = scaled ? Current.setting.scaling[:"has_#{ name }"] : default

    if scaled && checked
      check_box_tag("has_#{ name }", '1', checked, disabled: true) +
      hidden_field_tag("has_#{ name }", '1')
    else
      check_box_tag("has_#{ name }", '1', checked, disabled: scaled)
    end
  end
end

Disable sector checkboxes when rescaling scenario
Disable sector checkboxes when rescaling scenario

Checkboxes will now be disabled to prevent further changes by the
visitor, and the correct on/off value will be sent to ETEngine.

Closes #2149.
