Files
ODOO4projects.com/static/focus-rule.js
T
webmaster 768dc1151a fix(freelancer): the 15-point rule is now one shared constant, in both forms
The edit form's legend read "Skill areas" and carried no directive, while the
application form read "Skill profile — 15 points to distribute" and said what to
do. Same rule, worded in two places — and the edit form lost the sentence.

- New static/focus-rule.js exposes window.O4PFocus: LEGEND, DIRECTIVE, TOTAL, MAX
  and message(sum). Both forms render the legend, the directive and the
  wrong-total message from it, so the two cannot drift apart again.
- Edit form: legend from the constant, the application form's directive under it,
  and the blocked-save message now names the direction.
- Application form: legend set from the constant, live warn and sum gate use the
  same message(); the all-zero gate keeps the directive.
- Message wording: over -> "remove N", under -> "add N", zero -> "place all 15
  points"; the total, aria-live, data-bad, the blocked save and the
  fieldset/legend structure are unchanged.

The rule text now appears once: "You have 17 of 15 — remove 2."
2026-11-03 18:34:43 +00:00

23 lines
1.1 KiB
JavaScript

/* The ONE source of truth for the "skill profile" rule — the 15-point budget.
Two forms render this rule: the directory application form
(/odoo-community-developers/) and the private self-service edit form
(/freelancer-edit/). Both take the legend, the directive and the wrong-total
message from here, so the two cannot word the same rule differently again.
Loaded before each page's own script. */
(function () {
var TOTAL = 15;
window.O4PFocus = {
TOTAL: TOTAL,
MAX: 5,
LEGEND: "Skill profile — 15 points to distribute",
DIRECTIVE: "Distribute all 15 points across the five areas — they cannot all be 0.",
/* The wrong-total message, naming the direction to move. "" when the sum is right. */
message: function (sum) {
if (sum === TOTAL) return "";
if (sum === 0) return "You have 0 of " + TOTAL + " — place all " + TOTAL + " points.";
if (sum > TOTAL) return "You have " + sum + " of " + TOTAL + " — remove " + (sum - TOTAL) + ".";
return "You have " + sum + " of " + TOTAL + " — add " + (TOTAL - sum) + ".";
}
};
})();