Edition tag sur modules

This commit is contained in:
Emmanuel Viennet 2022-05-02 10:54:52 +02:00
parent 72dc72d286
commit c11fccab02
4 changed files with 29 additions and 10 deletions

View File

@ -866,6 +866,7 @@ def module_edit(
{
"input_type": "checkbox",
"vertical": True,
"dom_id": "tf_module_parcours",
"labels": [parcour.libelle for parcour in ref_comp.parcours],
"allowed_values": [
str(parcour.id) for parcour in ref_comp.parcours
@ -904,9 +905,11 @@ def module_edit(
request.base_url,
scu.get_request_args(),
descr,
html_foot_markup="""<div style="width: 90%;"><span class="sco_tag_edit"><textarea data-module_id="{}" class="module_tag_editor">{}</textarea></span></div>""".format(
html_foot_markup="""<div class="sco_tag_module_edit"><span class="sco_tag_edit"><textarea data-module_id="{}" class="module_tag_editor">{}</textarea></span></div>""".format(
module_id, ",".join(sco_tag_module.module_tag_list(module_id))
),
)
if not create
else "",
initvalues=module_dict if module else {},
submitlabel="Modifier ce module" if module else "Créer ce module",
cancelbutton="Annuler",

View File

@ -235,7 +235,7 @@ def module_tag_list(module_id=""):
def module_tag_set(module_id="", taglist=None):
"""taglist may either be:
a string with tag names separated by commas ("un;deux")
a string with tag names separated by commas ("un,deux")
or a list of strings (["un", "deux"])
"""
if not taglist:
@ -243,7 +243,7 @@ def module_tag_set(module_id="", taglist=None):
elif isinstance(taglist, str):
taglist = taglist.split(",")
taglist = [t.strip() for t in taglist]
# log("module_tag_set: module_id=%s taglist=%s" % (module_id, taglist))
log("module_tag_set: module_id=%s taglist=%s" % (module_id, taglist))
# Sanity check:
Mod = sco_edit_module.module_list(args={"module_id": module_id})
if not Mod:

View File

@ -2267,6 +2267,10 @@ span.missing_value {
color: red;
}
tr#tf_module_parcours>td {
background-color: rgb(229, 229, 229);
}
/* tableau recap notes */
table.notes_recapcomplet {
border: 2px solid blue;
@ -3635,6 +3639,13 @@ span.sco_tag_edit .tag-editor {
margin-top: 2px;
}
div.sco_tag_module_edit span.sco_tag_edit .tag-editor {
background-color: rgb(210, 210, 210);
border: 0px;
margin-left: 0px;
margin-top: 2px;
}
span.sco_tag_edit .tag-editor-delete {
height: 20px;
}

View File

@ -543,12 +543,17 @@ sco_publish(
)
sco_publish("/module_list", sco_edit_module.module_table, Permission.ScoView)
sco_publish("/module_tag_search", sco_tag_module.module_tag_search, Permission.ScoView)
sco_publish(
"/module_tag_set",
sco_tag_module.module_tag_set,
Permission.ScoEditFormationTags,
methods=["GET", "POST"],
)
@bp.route("/module_tag_set", methods=["POST"])
@scodoc
@permission_required(Permission.ScoEditFormationTags)
def module_tag_set():
"""Set tags on module"""
module_id = int(request.form.get("module_id"))
taglist = request.form.get("taglist")
return sco_tag_module.module_tag_set(module_id, taglist)
#
@bp.route("/")