From 2cc61cbd337e36f27b719781631b24e016efcca4 Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@bioforsk.no> Date: Wed, 6 Jul 2016 15:25:49 +0200 Subject: [PATCH] Better filtering of message list --- organisms/locale/bs/LC_MESSAGES/django.mo | Bin 606 -> 606 bytes organisms/locale/bs/LC_MESSAGES/django.po | 9 ++-- organisms/locale/nb/LC_MESSAGES/django.mo | Bin 497 -> 525 bytes organisms/locale/nb/LC_MESSAGES/django.po | 3 +- organisms/locale/zh_CN/LC_MESSAGES/django.mo | Bin 447 -> 447 bytes organisms/locale/zh_CN/LC_MESSAGES/django.po | 6 +-- vips_messages/locale/bg/LC_MESSAGES/django.mo | Bin 630 -> 630 bytes vips_messages/locale/bg/LC_MESSAGES/django.po | 26 ++++++++-- vips_messages/locale/bs/LC_MESSAGES/django.mo | Bin 657 -> 657 bytes vips_messages/locale/bs/LC_MESSAGES/django.po | 26 ++++++++-- vips_messages/locale/nb/LC_MESSAGES/django.mo | Bin 777 -> 992 bytes vips_messages/locale/nb/LC_MESSAGES/django.po | 29 ++++++++--- vips_messages/locale/vi/LC_MESSAGES/django.mo | Bin 414 -> 414 bytes vips_messages/locale/vi/LC_MESSAGES/django.po | 24 ++++++++-- .../locale/zh_CN/LC_MESSAGES/django.mo | Bin 829 -> 790 bytes .../locale/zh_CN/LC_MESSAGES/django.po | 23 +++++---- vips_messages/models.py | 6 +-- vips_messages/templates/messages/index.html | 45 ++++++++++++++---- vips_messages/views.py | 3 +- 19 files changed, 146 insertions(+), 54 deletions(-) diff --git a/organisms/locale/bs/LC_MESSAGES/django.mo b/organisms/locale/bs/LC_MESSAGES/django.mo index 6a91ba491368f3dc6715735fbbc0cf8542ab442d..84f9710fb79d88fab474235a4033530452b0e70c 100644 GIT binary patch delta 27 icmcb|a*t)g838k019M#iGX+CaD<eZ~1EY<1niv6kQV31} delta 27 icmcb|a*t)g839vW10!8SV+BKFD`PWl1H+AXniv6j<OoRs diff --git a/organisms/locale/bs/LC_MESSAGES/django.po b/organisms/locale/bs/LC_MESSAGES/django.po index 59c090ba..800ee235 100644 --- a/organisms/locale/bs/LC_MESSAGES/django.po +++ b/organisms/locale/bs/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VIPS\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-13 13:36+0100\n" +"POT-Creation-Date: 2016-07-06 15:21+0200\n" "PO-Revision-Date: 2015-02-13 11:14+0100\n" "Last-Translator: Vjekoslav vujica <wvjeko@gmail.com>\n" "Language-Team: \n" @@ -15,11 +15,11 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Poedit 1.7.4\n" -#: templates/organisms/index.html:3 -#: templates/organisms/index.html.py:5 +#: templates/organisms/index.html:3 templates/organisms/index.html.py:5 msgid "Organisms" msgstr "Organizama" @@ -30,4 +30,3 @@ msgstr "Usjevi " #: templates/organisms/index.html:6 msgid "Crop" msgstr "Usjevi " - diff --git a/organisms/locale/nb/LC_MESSAGES/django.mo b/organisms/locale/nb/LC_MESSAGES/django.mo index 58ee17c429521f9f175d4e711bb617e1b100dd83..ed472a5b60603484ffea867ac56e2afb0f3c61b8 100644 GIT binary patch delta 178 zcmey!+{;pbPl#nI0|NsC3j+g#3<Cp$4FdxMD+2>V3`mfHfuR5@R|pj^V_;z5WME*Z zVPIg$W@KP!V_;xlV_;zT#K^$F!N9=qlaYaei-CcGiHU)Mk%57M8LA&-921CeF3K-p z01?Fu{zd5%vmyk{bPddP4a^h_O|6U!wGE6mUJ_&!W$-S|DJd;VEdr@Z%*!m!O)X*o E03)FrhX4Qo delta 140 zcmeBW`N*7bPl#nI0|NsCGXn#I3<Cp$2?GNID+2?A4@i)Kfgu6PPh?<V;ACK6NM~SR z$Yx|<C}dz@;9y{2xXZ}Ez{SA8@Qjgxff1?)WEP0Y#K6EXu{24*RM)^r*U(tO(Adh@ bOxwV4<8whqzSJTH|DyE7yv*X<)FK7|BSjM_ diff --git a/organisms/locale/nb/LC_MESSAGES/django.po b/organisms/locale/nb/LC_MESSAGES/django.po index 42ed1dce..b16bded9 100644 --- a/organisms/locale/nb/LC_MESSAGES/django.po +++ b/organisms/locale/nb/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-13 13:36+0100\n" +"POT-Creation-Date: 2016-07-06 15:21+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -28,7 +28,6 @@ msgid "Crops" msgstr "Kulturer" #: templates/organisms/index.html:6 -#, fuzzy msgid "Crop" msgstr "Kultur" diff --git a/organisms/locale/zh_CN/LC_MESSAGES/django.mo b/organisms/locale/zh_CN/LC_MESSAGES/django.mo index 53a2b2243900e08ce2ddd2a74d87c6d093c01db0..477fe31e58e116e8089476af39aa5d81d1514d4b 100644 GIT binary patch delta 32 ocmdnbyq|f(X)beJ12Y9fQ!69GiB}CK=QAoyW@gNq+|OtL0IL59<NyEw delta 32 ocmdnbyq|f(X)aS;BXb2qV=EJbiB}CKt21UyW@c2H+|OtL0I3BDoB#j- diff --git a/organisms/locale/zh_CN/LC_MESSAGES/django.po b/organisms/locale/zh_CN/LC_MESSAGES/django.po index f6998ee9..155b40bd 100644 --- a/organisms/locale/zh_CN/LC_MESSAGES/django.po +++ b/organisms/locale/zh_CN/LC_MESSAGES/django.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-05-27 13:40+0200\n" +"POT-Creation-Date: 2016-07-06 15:21+0200\n" "PO-Revision-Date: 2016-06-01 11:48+0200\n" +"Last-Translator: \n" +"Language-Team: \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Last-Translator: \n" -"Language-Team: \n" "X-Generator: Poedit 1.8.7\n" #: templates/organisms/index.html:3 templates/organisms/index.html.py:5 diff --git a/vips_messages/locale/bg/LC_MESSAGES/django.mo b/vips_messages/locale/bg/LC_MESSAGES/django.mo index aa66cd7ed882abce934a2db20a6d7591d3464804..ae07c8c818d136488367ab1decdb18eaf4a92865 100644 GIT binary patch delta 24 fcmeyy@{MJ}M_w~s19M#iGX+CaD<h+g|0);(Z72vV delta 24 fcmeyy@{MJ}M_yB1LjzqSLj^-qD-)BA|0);(Y`X|1 diff --git a/vips_messages/locale/bg/LC_MESSAGES/django.po b/vips_messages/locale/bg/LC_MESSAGES/django.po index 9604e3eb..89366d94 100644 --- a/vips_messages/locale/bg/LC_MESSAGES/django.po +++ b/vips_messages/locale/bg/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-10-21 15:44+0200\n" +"POT-Creation-Date: 2016-07-06 15:22+0200\n" "PO-Revision-Date: 2014-05-14 09:25+0200\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -18,6 +18,22 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 1.6.5\n" +#: models.py:196 templates/messages/index.html:49 +msgid "Headline" +msgstr "Заглавие" + +#: models.py:198 +msgid "Date published" +msgstr "" + +#: models.py:199 +msgid "Date expired" +msgstr "" + +#: models.py:200 +msgid "Illustration" +msgstr "" + #: templates/messages/index.html:3 templates/messages/index.html.py:9 msgid "Messages" msgstr "Съобщения" @@ -27,7 +43,7 @@ msgid "Text search" msgstr "" #: templates/messages/index.html:20 -msgid "All crops" +msgid "All crop categories" msgstr "" #: templates/messages/index.html:31 @@ -47,10 +63,10 @@ msgid "Publish date" msgstr "Дата на издаване" #: templates/messages/index.html:48 -msgid "Headline" -msgstr "Заглавие" +msgid "Crop group(s)" +msgstr "" -#: templates/messages/index.html:49 +#: templates/messages/index.html:50 msgid "Author" msgstr "Автор" diff --git a/vips_messages/locale/bs/LC_MESSAGES/django.mo b/vips_messages/locale/bs/LC_MESSAGES/django.mo index a7a88eb2d626e3125ac62eb8091c8ada1c868ccb..70aedba7426aa61cec631fd85e35a37fd2802818 100644 GIT binary patch delta 25 gcmbQpI+1n4S6(w+19M#iGX+CaD<h-LOpN`E0A92Ph5!Hn delta 25 gcmbQpI+1n4S6)+HLjzqSLj^-qD-)B=OpN`E0A4``fB*mh diff --git a/vips_messages/locale/bs/LC_MESSAGES/django.po b/vips_messages/locale/bs/LC_MESSAGES/django.po index 790422e9..93183b4a 100644 --- a/vips_messages/locale/bs/LC_MESSAGES/django.po +++ b/vips_messages/locale/bs/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VIPS\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-10-21 15:44+0200\n" +"POT-Creation-Date: 2016-07-06 15:22+0200\n" "PO-Revision-Date: 2015-02-13 11:13+0100\n" "Last-Translator: Vjekoslav vujica <wvjeko@gmail.com>\n" "Language-Team: \n" @@ -19,6 +19,22 @@ msgstr "" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Poedit 1.7.4\n" +#: models.py:196 templates/messages/index.html:49 +msgid "Headline" +msgstr "Naslov " + +#: models.py:198 +msgid "Date published" +msgstr "" + +#: models.py:199 +msgid "Date expired" +msgstr "" + +#: models.py:200 +msgid "Illustration" +msgstr "" + #: templates/messages/index.html:3 templates/messages/index.html.py:9 msgid "Messages" msgstr "Poruke " @@ -28,7 +44,7 @@ msgid "Text search" msgstr "" #: templates/messages/index.html:20 -msgid "All crops" +msgid "All crop categories" msgstr "" #: templates/messages/index.html:31 @@ -48,10 +64,10 @@ msgid "Publish date" msgstr "Datum objave " #: templates/messages/index.html:48 -msgid "Headline" -msgstr "Naslov " +msgid "Crop group(s)" +msgstr "" -#: templates/messages/index.html:49 +#: templates/messages/index.html:50 msgid "Author" msgstr "Autor " diff --git a/vips_messages/locale/nb/LC_MESSAGES/django.mo b/vips_messages/locale/nb/LC_MESSAGES/django.mo index 00b5fb0e2d9ae0f07754efd668cbaea7f97b42cb..a326d5113324e1841d63bdfb351635a41d923cb2 100644 GIT binary patch delta 548 zcmeBVd%#|QPl#nI0|NsC9|Hq}3<Cp04+8^(Fara_ACMpe1A_-6gzw47z`(}9z!1yG zz`)DEz>vboz`(=6z)-{p(Ob{Rz`)JGz|hCYz`(-5z%YxEfq{d8fnh#W-3lmwE0n(v zqQ0KtG$R8869WUobw&n;Y(@r#TZ{}0LJSNHZp;h}oD2*Mk<1JX{0s~X$;=Q7i<u!7 zHZVgh=x1hNU}j)on8D1zz{SA8FbAq`IaL1^W(EcU1_p+GQ1SCn^>>&V7#JDqA%=n+ z015$+i$Sgjc^+gahz4Ph&q2Ne`5eS&XJBApWq?=+;)5K@;Fy!6kX)2sppcwclA4}h zl$l!0;8<Fckzd5%3=&Q+$}cU@DAr_fNi0cKNUbQyEJ_tff$$1SlX5bPGg4C~Gcro^ zc;@7k7MBzymSpDVO_pXX=QYzcFxNFOQ!q5OGBVmcpHY%ADZQw)pdht~!7aZiEwQ8| zwTQvHG^eDr2qLag1hyt$p|m9D@Q#8KkS+NN5L;4<Al%}^JF*$viV_+8%TkMqvx_p* RN*G`^7iZ<?O}@jV3jkdeV@d!3 delta 312 zcmaFB-pN*fPl#nI0|NsC7Xt%>3<Cp04g&)NF9QR^9*`gd1H%Uf1_n+B28NFe3=C`x z3=F>+7#O%27#Nrs85md?7#R2%85lSi7#M`1v<xEy0}lfOgDN9Loe?7g0}}%SgB>FS zLpCD=gCirv{IyJAbL$y)GeHbE%EZ9H%)r2KjtSzJOArMNcbOO%1Q-|?o-;uV{sC3T z%FMvP2z4YYlm_VsITGX`kfT8svok;(3Q_{{B!gp4jzV%#enByVV`&L<Mt;%cUPkH3 wTN%rEO?3?obd3xZ3{9;}Og39ENiy=J7BRTx7o{bZl%y6-?qimmyoFf@0C4mq(*OVf diff --git a/vips_messages/locale/nb/LC_MESSAGES/django.po b/vips_messages/locale/nb/LC_MESSAGES/django.po index cd45e58e..5034db9f 100644 --- a/vips_messages/locale/nb/LC_MESSAGES/django.po +++ b/vips_messages/locale/nb/LC_MESSAGES/django.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-10-21 15:44+0200\n" +"POT-Creation-Date: 2016-07-06 15:22+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -30,6 +30,23 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#: models.py:196 +#: templates/messages/index.html:49 +msgid "Headline" +msgstr "Overskrift" + +#: models.py:198 +msgid "Date published" +msgstr "Dato publisert" + +#: models.py:199 +msgid "Date expired" +msgstr "Dato utløpt" + +#: models.py:200 +msgid "Illustration" +msgstr "Illustrasjon" + #: templates/messages/index.html:3 #: templates/messages/index.html.py:9 msgid "Messages" @@ -40,8 +57,8 @@ msgid "Text search" msgstr "Fritekstsøk" #: templates/messages/index.html:20 -msgid "All crops" -msgstr "Alle kulturer" +msgid "All crop categories" +msgstr "Alle kulturgrupper" #: templates/messages/index.html:31 msgid "From" @@ -60,10 +77,10 @@ msgid "Publish date" msgstr "Publiseringsdato" #: templates/messages/index.html:48 -msgid "Headline" -msgstr "Overskrift" +msgid "Crop group(s)" +msgstr "Kulturgruppe(r)" -#: templates/messages/index.html:49 +#: templates/messages/index.html:50 msgid "Author" msgstr "Forfatter" diff --git a/vips_messages/locale/vi/LC_MESSAGES/django.mo b/vips_messages/locale/vi/LC_MESSAGES/django.mo index ec74e8e0fc1c08702a7f2551ea0416c67a8bd0e3..cb7af51942ac354e9c7fa9d6681cff4980c96815 100644 GIT binary patch delta 24 fcmbQoJdb%oFR!_-ftiA#sg;qDwt>;cSuBhIQ-=mP delta 24 fcmbQoJdb%oFR!7lfu(|hrIo3<wt?ZsSuBhIQ>g|& diff --git a/vips_messages/locale/vi/LC_MESSAGES/django.po b/vips_messages/locale/vi/LC_MESSAGES/django.po index 1cb66ba8..bd37c616 100644 --- a/vips_messages/locale/vi/LC_MESSAGES/django.po +++ b/vips_messages/locale/vi/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-01-09 09:57+0100\n" +"POT-Creation-Date: 2016-07-06 15:22+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -18,6 +18,22 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +#: models.py:196 templates/messages/index.html:49 +msgid "Headline" +msgstr "" + +#: models.py:198 +msgid "Date published" +msgstr "" + +#: models.py:199 +msgid "Date expired" +msgstr "" + +#: models.py:200 +msgid "Illustration" +msgstr "" + #: templates/messages/index.html:3 templates/messages/index.html.py:9 msgid "Messages" msgstr "" @@ -27,7 +43,7 @@ msgid "Text search" msgstr "" #: templates/messages/index.html:20 -msgid "All crops" +msgid "All crop categories" msgstr "" #: templates/messages/index.html:31 @@ -47,9 +63,9 @@ msgid "Publish date" msgstr "" #: templates/messages/index.html:48 -msgid "Headline" +msgid "Crop group(s)" msgstr "" -#: templates/messages/index.html:49 +#: templates/messages/index.html:50 msgid "Author" msgstr "" diff --git a/vips_messages/locale/zh_CN/LC_MESSAGES/django.mo b/vips_messages/locale/zh_CN/LC_MESSAGES/django.mo index 9fe6a619804543a3283bea2e218febf9adca8439..b4643750d4d68ebb5ee24814ebdb3550a77da109 100644 GIT binary patch delta 364 zcmdnXHjS<Ro)F7a1_lNO9tH*m83qQ18U_XiK?VkfJ0L*@1_lL21_m|;1_nh&h#Cz> z1_nL`1_o0`1_o{h1_l>K1_l-e28IAe1_llW28K|mx;Q958_F+%s&8auU|?ckVCZFJ zU{GdcsAre}wO|Vq#Dd*W`UI4|%EZ9H%)r3#hza75XHfoIDE}i=-47_u$_!C2#LU3J z2=xTWq3jG0{hSOC2ZN+o8I&Nd0r?)}dXOLpgDm6%F&G#aCR;IX<ucbbFjFuzwK6iA z{FBjO@?<83$?8m5QW3iDsd=eIi6!|(Rtf?6sVSKy3Wj<Xdgfe{Z!y`iJ)5@S<@DW? H<(TCGgw`p| delta 380 zcmbQnwwJB`o)F7a1_lNOUIqpR83qQ176t|eK?VkfHy}X<1_lF01_n+B1_nb$1_m|; z1_o<J1_mAm1_mca1_nL`1_pmd1_o{h28K9B1_l-e28Jv~1_llW28Mj7x(X=270T~} zs-Mlsz`(@7P|vWOk%2*(k%3_qRKYnWh())VAQnA>((j@4A0`F{W(EcZPG*QYUS<ei z1j?6ShUk-r(mGIiOJ)WJMyRJi9$;l)U|?skVPN250J{V%1@a-ta8PJ~d;#(~NCM<D zkS{@O2FIKnh2*0Ag5t>vj9a-(b&bpw42`W!3?|=aG?;A2lrfo?Non#-CTX5$oej_C cbUxWT=XvMK$(xz%*q-cP_^fgL<nK)K0N)QS>i_@% diff --git a/vips_messages/locale/zh_CN/LC_MESSAGES/django.po b/vips_messages/locale/zh_CN/LC_MESSAGES/django.po index 007ed0af..74233b99 100644 --- a/vips_messages/locale/zh_CN/LC_MESSAGES/django.po +++ b/vips_messages/locale/zh_CN/LC_MESSAGES/django.po @@ -7,18 +7,17 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-05-27 13:40+0200\n" +"POT-Creation-Date: 2016-07-06 15:22+0200\n" "PO-Revision-Date: 2016-06-01 11:50+0200\n" +"Last-Translator: \n" +"Language-Team: \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Last-Translator: \n" -"Language-Team: \n" "X-Generator: Poedit 1.8.7\n" -#: models.py:196 -#: templates/messages/index.html:48 +#: models.py:196 templates/messages/index.html:49 msgid "Headline" msgstr "标题" @@ -34,8 +33,7 @@ msgstr "过期日期" msgid "Illustration" msgstr "图" -#: templates/messages/index.html:3 -#: templates/messages/index.html.py:9 +#: templates/messages/index.html:3 templates/messages/index.html.py:9 msgid "Messages" msgstr "新闻" @@ -44,7 +42,9 @@ msgid "Text search" msgstr "搜索文本" #: templates/messages/index.html:20 -msgid "All crops" +#, fuzzy +#| msgid "All crops" +msgid "All crop categories" msgstr "所有作物" #: templates/messages/index.html:31 @@ -63,7 +63,10 @@ msgstr "搜索日期" msgid "Publish date" msgstr "发布日期" -#: templates/messages/index.html:49 +#: templates/messages/index.html:48 +msgid "Crop group(s)" +msgstr "" + +#: templates/messages/index.html:50 msgid "Author" msgstr "作者" - diff --git a/vips_messages/models.py b/vips_messages/models.py index 7bc4a291..c2b63b4e 100644 --- a/vips_messages/models.py +++ b/vips_messages/models.py @@ -75,7 +75,7 @@ class Message: illustration_file_name, illustration_caption, created_by, - message_crop_organism_ids + crop_category_ids ): self.message_id = message_id self.organization_id = organization_id @@ -87,7 +87,7 @@ class Message: self.illustration_file_name = illustration_file_name self.illustration_caption = illustration_caption self.created_by = created_by - self.message_crop_organism_ids = message_crop_organism_ids + self.crop_category_ids = crop_category_ids def get_illustration_url(self): return "http://%s/static/images/messages/%s/%s" % (settings.VIPSLOGIC_SERVER_NAME,self.organization_id,self.illustration_file_name) @@ -159,7 +159,7 @@ class Message: message_illustration.get("file_name", None), message_illustration.get("caption", None), created_by, - the_dict.get("messageCropOrganismIds",[]) + the_dict.get("cropCategoryIds",[]) ) @staticmethod diff --git a/vips_messages/templates/messages/index.html b/vips_messages/templates/messages/index.html index 2e1d7c90..1d39ba29 100644 --- a/vips_messages/templates/messages/index.html +++ b/vips_messages/templates/messages/index.html @@ -16,10 +16,10 @@ </div> <div class="col-xs-3"> <div class="form-group"> - <select name="cropOrganismIds" class="form-control chosen-select" onchange="cropFilter(this);"> - <option value="-1">{% trans "All crops" %}</option> - {% for crop in crops %} - <option value="{{crop.organism_id}}">{{crop.local_name}} ({{crop.latin_name}})</option> + <select name="cropCategoryIds" class="form-control chosen-select" onchange="cropCategoryFilter(this);"> + <option value="-1">{% trans "All crop categories" %}</option> + {% for crop_category in crop_categories %} + <option value="{{crop_category.crop_category_id}}">{{crop_category.name}}</option> {% endfor %} </select> </div> @@ -45,6 +45,7 @@ <thead> <tr> <th>{% trans "Publish date" %}</th> + <th>{% trans "Crop group(s)" %}</th> <th>{% trans "Headline" %}</th> <th>{% trans "Author" %}</th> </tr> @@ -72,11 +73,22 @@ body: "{{ message.body | escapejs }}", createdBy:"{{ message.created_by }}", url:"{% url 'vips_messages:detail' message.message_id %}", - messageCropOrganismIds:{{message.message_crop_organism_ids}} + cropCategoryIds:{{message.crop_category_ids}} } {% if not forloop.last %},{% endif %} {% endfor %} ]; + var cropCategories = [ + {% for crop_category in crop_categories %} + { + cropCategoryId: {{ crop_category.crop_category_id }}, + name: "{{ crop_category.name }}", + cropIds: {{ crop_category.crop_ids }} + } + {% if not forloop.last %},{% endif %} + {% endfor %} + ]; + var messageListSubset; /** @@ -92,9 +104,22 @@ for(var i in messageListSubset) { var listItem = messageListSubset[i]; + // Get the crop groups + var cropGroupNames = []; + for(var j in listItem.cropCategoryIds) + { + for(var k in cropCategories) + { + if(cropCategories[k].cropCategoryId == listItem.cropCategoryIds[j]) + { + cropGroupNames.push(cropCategories[k].name); + } + } + } HTML += [ '<tr>', '<td>',listItem.datePub,'</td>', + '<td>', cropGroupNames.join(", "),'</td>', '<td><a href="',listItem.url,'">',listItem.heading,'</a></td>', '<td>',listItem.createdBy,'</td>', '</tr>'] @@ -132,12 +157,12 @@ /** * Filters messages based on selected crops. Resets the text search */ - function cropFilter(cropSelectList) + function cropCategoryFilter(cropCategorySelectList) { // Reset text search field document.getElementById("textSearchField").value=""; - var selectedCropOrganismId = parseInt(cropSelectList.options[cropSelectList.selectedIndex].value); - if(selectedCropOrganismId == -1) + var selectedCropCategoryId = parseInt(cropCategorySelectList.options[cropCategorySelectList.selectedIndex].value); + if(selectedCropCategoryId == -1) { messageListSubset = messageList; } @@ -147,9 +172,9 @@ for(var i in messageList) { var message = messageList[i]; - for(var j in message.messageCropOrganismIds) + for(var j in message.cropCategoryIds) { - if(message.messageCropOrganismIds[j] == selectedCropOrganismId) + if(message.cropCategoryIds[j] == selectedCropCategoryId) { messageListSubset.push(message); break; diff --git a/vips_messages/views.py b/vips_messages/views.py index 1460ea5a..61d0e8b4 100644 --- a/vips_messages/views.py +++ b/vips_messages/views.py @@ -24,7 +24,7 @@ from django.http import HttpResponse from vips_messages.models import Message from vips_messages.forms import MessagePublishedDateFilterForm -from organisms.models import Organism +from organisms.models import Organism, CropCategory def index(request): messages = None @@ -47,6 +47,7 @@ def index(request): context = { 'messages' : messages, + 'crop_categories': CropCategory.get_crop_categories(translation.get_language()), 'form' : form, 'crops' : crops } -- GitLab