diff --git a/organisms/locale/bs/LC_MESSAGES/django.mo b/organisms/locale/bs/LC_MESSAGES/django.mo index 6a91ba491368f3dc6715735fbbc0cf8542ab442d..84f9710fb79d88fab474235a4033530452b0e70c 100644 Binary files a/organisms/locale/bs/LC_MESSAGES/django.mo and b/organisms/locale/bs/LC_MESSAGES/django.mo differ diff --git a/organisms/locale/bs/LC_MESSAGES/django.po b/organisms/locale/bs/LC_MESSAGES/django.po index 59c090ba0f20015f40e3291e5d0afa6054c31fde..800ee23531bc627115b4b42d42473bb44e7319ba 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 Binary files a/organisms/locale/nb/LC_MESSAGES/django.mo and b/organisms/locale/nb/LC_MESSAGES/django.mo differ diff --git a/organisms/locale/nb/LC_MESSAGES/django.po b/organisms/locale/nb/LC_MESSAGES/django.po index 42ed1dce290b2fa5651abd9f55a04c3ed61c7e28..b16bded9476761f8c8d078d39ba5d5340c39c7bd 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 Binary files a/organisms/locale/zh_CN/LC_MESSAGES/django.mo and b/organisms/locale/zh_CN/LC_MESSAGES/django.mo differ diff --git a/organisms/locale/zh_CN/LC_MESSAGES/django.po b/organisms/locale/zh_CN/LC_MESSAGES/django.po index f6998ee9f27903bfad54e7ac48a8ae085852131e..155b40bdbb416d8162dd8d913f95278cc7a2c758 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 Binary files a/vips_messages/locale/bg/LC_MESSAGES/django.mo and b/vips_messages/locale/bg/LC_MESSAGES/django.mo differ diff --git a/vips_messages/locale/bg/LC_MESSAGES/django.po b/vips_messages/locale/bg/LC_MESSAGES/django.po index 9604e3ebbf347c5d57d95b282062cd631f88729c..89366d94ce1a35c45d9b67644b53fa53d3b3fb04 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 Binary files a/vips_messages/locale/bs/LC_MESSAGES/django.mo and b/vips_messages/locale/bs/LC_MESSAGES/django.mo differ diff --git a/vips_messages/locale/bs/LC_MESSAGES/django.po b/vips_messages/locale/bs/LC_MESSAGES/django.po index 790422e91fd77d547c4232dc41d8b5f878e00fb3..93183b4ab2f93e04a635725c6f84213937f9c58a 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 Binary files a/vips_messages/locale/nb/LC_MESSAGES/django.mo and b/vips_messages/locale/nb/LC_MESSAGES/django.mo differ diff --git a/vips_messages/locale/nb/LC_MESSAGES/django.po b/vips_messages/locale/nb/LC_MESSAGES/django.po index cd45e58e680c049b70a648e5487ea34e9d27088d..5034db9fe821bce3789bc2d6292a21b14dc03ada 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 Binary files a/vips_messages/locale/vi/LC_MESSAGES/django.mo and b/vips_messages/locale/vi/LC_MESSAGES/django.mo differ diff --git a/vips_messages/locale/vi/LC_MESSAGES/django.po b/vips_messages/locale/vi/LC_MESSAGES/django.po index 1cb66ba836dfe77001198dbcf84e7c9871039496..bd37c6166017451bbe3f4d748ae3b45c2f82e7bb 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 Binary files a/vips_messages/locale/zh_CN/LC_MESSAGES/django.mo and b/vips_messages/locale/zh_CN/LC_MESSAGES/django.mo differ diff --git a/vips_messages/locale/zh_CN/LC_MESSAGES/django.po b/vips_messages/locale/zh_CN/LC_MESSAGES/django.po index 007ed0afb49385b802c302036748ee27920a05eb..74233b99ebb28bf2602373420ab9751062090370 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 7bc4a291d4717c787e87a2e63fbdd5bca07bf789..c2b63b4e993230e2b46206d8ace665ced197a5f5 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 2e1d7c90d5e5aef9facfe220c8b820bea3f36538..1d39ba2905f785b7588a9f77be030e05c5c00671 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 1460ea5a019c934e2bd381989a789385d3ba5d84..61d0e8b4686c17952c2a9d8173995fdf7bde7ad4 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 }