@@ -565,7 +565,7 @@ def get_problems_table(all_problems,
565565 db = current .db
566566 uetable = db .user_editorials
567567 table = TABLE (_class = "bordered centered" )
568- thead = THEAD (TR (TH (T ("Problem Name" ), _class = page_prefix + "- name-column" ),
568+ thead = THEAD (TR (TH (T ("Problem Name" ), _class = generate_page_specific_class ( page_prefix , " name-column") ),
569569 TH (T ("Problem URL" )),
570570 TH (T ("Site" )),
571571 TH (T ("Accuracy" )),
@@ -595,10 +595,10 @@ def get_problems_table(all_problems,
595595 link_title ,
596596 problem ["id" ],
597597 page_prefix = page_prefix ),
598- _class = page_prefix + "- name-column" ))
598+ _class = generate_page_specific_class ( page_prefix , " name-column") ))
599599 tr .append (TD (A (I (_class = "fa fa-link" ),
600600 _href = problem ["link" ],
601- _class = page_prefix + "- tag-problem-link" ,
601+ _class = generate_page_specific_class ( page_prefix , "tag-problem-link" ) + " tag-problem-link" ,
602602 data = {"pid" : problem ["id" ]},
603603 _target = "_blank" )))
604604 tr .append (TD (IMG (_src = current .get_static_url ("images/" + \
@@ -619,7 +619,7 @@ def get_problems_table(all_problems,
619619 "editorials" ,
620620 args = problem ["id" ]),
621621 _target = "_blank" ,
622- _class = page_prefix + "- editorial-link" )))
622+ _class = generate_page_specific_class ( page_prefix , " editorial-link") )))
623623 else :
624624 tr .append (TD ())
625625
@@ -630,7 +630,7 @@ def get_problems_table(all_problems,
630630 _href = URL ("problems" ,
631631 "tag" ,
632632 vars = {"q" : tag .encode ("utf8" ), "page" : 1 }),
633- _class = page_prefix + "- tags-chip" ,
633+ _class = generate_page_specific_class ( page_prefix , "tags-chip" ) + " tags-chip" ,
634634 _style = "color: white;" ,
635635 _target = "_blank" ),
636636 _class = "chip" ))
@@ -680,14 +680,13 @@ def problem_widget(name,
680680
681681 problem_div = DIV (_style = "display: inline;" )
682682 if anchor :
683- class_name = page_prefix + "-problem-listing" if page_prefix is not None else "problem-listing"
684683 problem_div .append (A (name ,
685684 _href = URL ("problems" ,
686685 "index" ,
687686 vars = dict (problem_id = problem_id ,
688687 ** request_vars ),
689688 extension = False ),
690- _class = class_name + " " + link_class ,
689+ _class = generate_page_specific_class ( page_prefix , "problem-listing" ) + " " + link_class ,
691690 _title = link_title ,
692691 _target = "_blank" ,
693692 data = {"pid" : problem_id },
@@ -1480,4 +1479,8 @@ def render_user_editorials_table(user_editorials,
14801479
14811480 return table
14821481
1482+ # ----------------------------------------------------------------------------
1483+ def generate_page_specific_class (page_prefix , class_name ):
1484+ return (page_prefix + "-" + class_name ) if page_prefix is not None else class_name
1485+
14831486# =============================================================================
0 commit comments