From 03db69d22b4fb80e4b79f4e32388eaef8d33e273 Mon Sep 17 00:00:00 2001 From: areeshatariq Date: Mon, 3 Aug 2020 23:51:13 +0500 Subject: [PATCH 1/3] Html template --- cgi/top_translators.pl | 42 ++++++------------------------- lib/ProductOpener/Display.pm | 3 ++- templates/top_translators.tt.html | 24 ++++++++++++++++++ 3 files changed, 34 insertions(+), 35 deletions(-) create mode 100755 templates/top_translators.tt.html diff --git a/cgi/top_translators.pl b/cgi/top_translators.pl index e332c9207d4f5..387a7dd42882b 100644 --- a/cgi/top_translators.pl +++ b/cgi/top_translators.pl @@ -36,6 +36,11 @@ ProductOpener::Display::init(); +# Passing values to the template +my $template_data_ref = { + lang => \&lang, +}; + $scripts .= < @@ -92,41 +97,10 @@ ; $initjs .= $js; -my $html = '

' . lang('translators_lead') . '

'; - -my $translators_column_name = lang('translators_column_name'); -my $translators_column_translated_words = lang('translators_column_translated_words'); -my $translators_column_target_words = lang('translators_column_target_words'); -my $translators_column_approved_words = lang('translators_column_approved_words'); -my $translators_column_votes_made = lang('translators_column_votes_made'); - -$html .= < - - - $translators_column_name - $translators_column_translated_words - $translators_column_target_words - $translators_column_approved_words - $translators_column_votes_made - - - - - $translators_column_name - $translators_column_translated_words - $translators_column_target_words - $translators_column_approved_words - $translators_column_votes_made - - - - - -HTML -; +my $html; -$html .= '

' . lang('translators_renewal_notice') . '

'; +$tt->process('top_translators.tt.html', $template_data_ref, \$html); +$html .= "

" . $tt->error() . "

"; display_new( { title=>lang('translators_title'), diff --git a/lib/ProductOpener/Display.pm b/lib/ProductOpener/Display.pm index 90fa64694e756..5bc532c26a44a 100644 --- a/lib/ProductOpener/Display.pm +++ b/lib/ProductOpener/Display.pm @@ -110,6 +110,7 @@ BEGIN @lcs $cc $country + $tt $nutriment_table @@ -239,7 +240,7 @@ if (defined $options{export_limit}) { } # Initialize the Template module -my $tt = Template->new({ +$tt = Template->new({ INCLUDE_PATH => $data_root . '/templates', INTERPOLATE => 1, EVAL_PERL => 1, diff --git a/templates/top_translators.tt.html b/templates/top_translators.tt.html new file mode 100755 index 0000000000000..acc030f1ce6aa --- /dev/null +++ b/templates/top_translators.tt.html @@ -0,0 +1,24 @@ +

[% lang('translators_lead') %]

+ + + + + + + + + + + + + + + + + + + + + +
[% lang('translators_column_name') %][% lang('translators_column_translated_words') %][% lang('translators_column_target_words') %][% lang('translators_column_approved_words') %][% lang('translators_column_votes_made') %]
[% lang('translators_column_name') %][% lang('translators_column_translated_words') %][% lang('translators_column_target_words') %][% lang('translators_column_approved_words') %][% lang('translators_column_votes_made') %]
+

[% lang('translators_renewal_notice') %]

From 3283bd5aa57fb1db565ce3bd0992a6ce42cb6a27 Mon Sep 17 00:00:00 2001 From: areeshatariq Date: Wed, 5 Aug 2020 02:43:57 +0500 Subject: [PATCH 2/3] Added caption to the table --- templates/top_translators.tt.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/top_translators.tt.html b/templates/top_translators.tt.html index acc030f1ce6aa..5cad6a0204ee0 100755 --- a/templates/top_translators.tt.html +++ b/templates/top_translators.tt.html @@ -1,5 +1,6 @@

[% lang('translators_lead') %]

+ From afdb6b2d41fc1354bbff3c5f123991561d5b5a38 Mon Sep 17 00:00:00 2001 From: areeshatariq Date: Wed, 5 Aug 2020 03:24:42 +0500 Subject: [PATCH 3/3] Replaced depreciated table attributes --- templates/top_translators.tt.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/top_translators.tt.html b/templates/top_translators.tt.html index 5cad6a0204ee0..b9ee0cbfeef71 100755 --- a/templates/top_translators.tt.html +++ b/templates/top_translators.tt.html @@ -1,5 +1,5 @@

[% lang('translators_lead') %]

-
[% lang('translators_title') %]
[% lang('translators_column_name') %]
+
[% lang('translators_title') %]