← Back to team overview

harvest-dev team mailing list archive

[Merge] lp:~dholbach/harvest/504299 into lp:harvest

 

Daniel Holbach has proposed merging lp:~dholbach/harvest/504299 into lp:harvest.

Requested reviews:
  harvest-dev (harvest-dev)
Related bugs:
  #504299 add "inline help" for opportunity lists
  https://bugs.launchpad.net/bugs/504299

-- 
https://code.launchpad.net/~dholbach/harvest/504299/+merge/31737
Your team harvest-dev is requested to review the proposed merge of lp:~dholbach/harvest/504299 into lp:harvest.
=== modified file 'harvest/common/opportunity_lists.py'
--- harvest/common/opportunity_lists.py	2009-07-09 09:40:47 +0000
+++ harvest/common/opportunity_lists.py	2010-08-04 11:16:48 +0000
@@ -33,14 +33,26 @@
     sock.close()
     return ([map(unicode, [a for a in l]) for l in csv.reader(lines)], datetime_lm)
 
+def unify_list_entry(entry):
+    for e in entry:
+        e = unicode(e.strip())
+    # only contains url and short description
+    if len(entry) == 2:
+        entry.extend([None])
+    return entry
 
 def read_lists(list_dir):
     list_file = os.path.join(list_dir, "opportunities")
     if not os.path.exists(list_file):
         return []
     lines = open(list_file).readlines()
+    
+    # comment out empty entries, or entries that were commented out
     lines = filter(lambda b: b.strip() != "" and not b.startswith("#"), lines)
-    return [map(unicode, [a.strip() for a in l]) for l in csv.reader(lines)]
+    
+    csv_entries = [l for l in csv.reader(lines)]
+    entries = map(unify_list_entry, csv_entries)
+    return entries
 
 
 def pull_lists(data_dir):

=== modified file 'harvest/filters/filters.py'
--- harvest/filters/filters.py	2010-07-16 05:21:21 +0000
+++ harvest/filters/filters.py	2010-08-04 11:16:48 +0000
@@ -326,8 +326,17 @@
     def render_html_value_choice(self, item_id):
         toggle_params = self.serialize(self.get_value_with_selection(item_id))
         item_href = self.get_system().get_url_with_parameters(toggle_params)
+        title_attribute = ''
+        help_html = ''
+        if hasattr(self.choices_dict[item_id], 'description') and \
+           self.choices_dict[item_id].description:
+            title_attribute = 'title="%s"' % self.choices_dict[item_id].description
+        if hasattr(self.choices_dict[item_id], 'explanation') and \
+           self.choices_dict[item_id].explanation:
+            help_html = '<a class="help" href="%s">help</a>' % \
+                            self.choices_dict[item_id].explanation
         
-        return '<a class="item-toggle" href="%s">%s</a>' % (item_href, item_id)
+        return '<a class="item-toggle" href="%s" %s>%s</a> %s' % (item_href, title_attribute, item_id, help_html)
 
 
 class FilterGroup(FilterContainer, ChoiceFilter): #final

=== modified file 'harvest/locale/harvest.pot'
--- harvest/locale/harvest.pot	2010-07-12 09:33:48 +0000
+++ harvest/locale/harvest.pot	2010-08-04 11:16:48 +0000
@@ -8,10 +8,11 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-07-12 04:32-0500\n"
+"POT-Creation-Date: 2010-08-04 06:14-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"
+"Language: \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -21,15 +22,15 @@
 msgid "Name"
 msgstr ""
 
-#: opportunities/models.py:50 opportunities/models.py:77
+#: opportunities/models.py:50 opportunities/models.py:78
 msgid "URL"
 msgstr ""
 
-#: opportunities/models.py:51 opportunities/models.py:76
+#: opportunities/models.py:51 opportunities/models.py:77
 msgid "Description"
 msgstr ""
 
-#: opportunities/models.py:52 opportunities/models.py:78
+#: opportunities/models.py:52 opportunities/models.py:79
 msgid "Last Updated"
 msgstr ""
 
@@ -46,90 +47,69 @@
 msgstr ""
 
 #: opportunities/models.py:56
-msgid "Explanatory help text"
+msgid "Explanatory instructions"
 msgstr ""
 
 #: opportunities/models.py:57
+msgid "Link to more instructions about this type of opportunities."
+msgstr ""
+
+#: opportunities/models.py:58
 msgid "Commentable"
 msgstr ""
 
-#: opportunities/models.py:58
+#: opportunities/models.py:59
 msgid "Can opportunities on this list have comments?"
 msgstr ""
 
-#: opportunities/models.py:59 opportunities/models.py:86
+#: opportunities/models.py:60 opportunities/models.py:87
 msgid "Required Experience"
 msgstr ""
 
-#: opportunities/models.py:60
+#: opportunities/models.py:61
 msgid "Level of experience required for this type of opportunities."
 msgstr ""
 
-#: opportunities/models.py:79
+#: opportunities/models.py:80
 msgid "Since"
 msgstr ""
 
-#: opportunities/models.py:79
+#: opportunities/models.py:80
 msgid "On the list since"
 msgstr ""
 
-#: opportunities/models.py:80
+#: opportunities/models.py:81
 msgid "Irrelevant"
 msgstr ""
 
-#: opportunities/models.py:81
+#: opportunities/models.py:82
 msgid "Applied"
 msgstr ""
 
-#: opportunities/models.py:84
+#: opportunities/models.py:85
 msgid "Comment"
 msgstr ""
 
-#: opportunities/models.py:85
+#: opportunities/models.py:86
 msgid "Valid"
 msgstr ""
 
-#: opportunities/models.py:87
+#: opportunities/models.py:88
 msgid "Level of experience required for this specific opportunity."
 msgstr ""
 
-#: opportunities/models.py:101
+#: opportunities/models.py:102
 msgid "Timestamp"
 msgstr ""
 
-#: opportunities/models.py:103
+#: opportunities/models.py:104
 msgid "Action"
 msgstr ""
 
-#: opportunities/views.py:81
+#: opportunities/views.py:53
 msgid "Opportunity details could not be saved."
 msgstr ""
 
-#: opportunities/templates/opportunities/opportunities_by_package.html:9
-msgid "Opportunities By Package"
-msgstr ""
-
-#: opportunities/templates/opportunities/opportunities_by_package.html:18
-#: opportunities/templates/opportunities/opportunities_by_type.html:18
-#: templates/opportunities/opportunitylist_list.html:11
-#: templates/opportunities/sourcepackage_list.html:11
-#, python-format
-msgid "(1 opportunity)"
-msgid_plural "(%(counter)s opportunities)"
-msgstr[0] ""
-msgstr[1] ""
-
-#: opportunities/templates/opportunities/opportunities_by_package.html:49
-#: opportunities/templates/opportunities/opportunities_by_type.html:24
-#: templates/opportunities/opportunities_filter.html:45
-#: templates/opportunities/opportunity_index.html:41
-msgid "There are currently no opportunities in Harvest. :("
-msgstr ""
-
-#: opportunities/templates/opportunities/opportunities_by_type.html:9
-msgid "Opportunities By Type"
-msgstr ""
-
 #: templates/404.html:5 templates/404.html.py:8
 msgid "Page Not Found"
 msgstr ""
@@ -146,12 +126,25 @@
 msgid "A server error has occurred."
 msgstr ""
 
-#: templates/base.html:7 templates/base.html.py:82 templates/index.html:9
+#: templates/base.html:7 templates/base.html.py:31 templates/base.html:62
+#: templates/base.html.py:73 templates/index.html:9
 #: templates/admin/base_site.html:7
 msgid "Harvest"
 msgstr ""
 
-#: templates/base.html:73 templates/index.html:22
+#: templates/base.html:62
+msgid "Help"
+msgstr ""
+
+#: templates/base.html:62
+msgid "Bugs"
+msgstr ""
+
+#: templates/base.html:62
+msgid "Code"
+msgstr ""
+
+#: templates/base.html:75 templates/index.html:16
 msgid "Translated by:"
 msgstr ""
 
@@ -159,15 +152,19 @@
 msgid "Harvest Admin"
 msgstr ""
 
-#: templates/opportunities/opportunities_filter.html:4
-#: templates/opportunities/opportunity_index.html:4
+#: templates/opportunities/filter.html:4
 msgid "Opportunity Index"
 msgstr ""
 
-#: templates/opportunities/opportunities_filter.html:9
-#: templates/opportunities/opportunity_index.html:9
-#: templates/opportunities/opportunity_list.html:5
-msgid "Opportunities"
+#: templates/opportunities/filter_results.html:25
+#, python-format
+msgid "%(counter)s package has no matching opportunities"
+msgid_plural "%(counter)s packages have no matching opportunities"
+msgstr[0] ""
+msgstr[1] ""
+
+#: templates/opportunities/filter_results.html:31
+msgid "There are currently no opportunities in Harvest. :("
 msgstr ""
 
 #: templates/opportunities/opportunity_edit.html:10
@@ -178,14 +175,9 @@
 msgid "Update Information Now!"
 msgstr ""
 
-#: templates/opportunities/opportunitylist_list.html:5
-msgid "Opportunity Lists"
-msgstr ""
-
-#: templates/opportunities/packageset_list.html:5
-msgid "Packagesets"
-msgstr ""
-
-#: templates/opportunities/sourcepackage_list.html:5
-msgid "Source Packages"
-msgstr ""
+#: templates/opportunities/package_details.html:10
+#, python-format
+msgid "%(counter)s opportunity hidden"
+msgid_plural "%(counter)s opportunities hidden"
+msgstr[0] ""
+msgstr[1] ""

=== modified file 'harvest/media/css/style.css'
--- harvest/media/css/style.css	2010-07-30 21:45:23 +0000
+++ harvest/media/css/style.css	2010-08-04 11:16:48 +0000
@@ -198,6 +198,16 @@
 	padding-bottom:5px;
 }
 
+#filters > .filtergroup > .filter-value > ul > li a.help {
+	background-image: url(../img/help.png);
+	background-repeat: no-repeat;
+	background-position: left top;
+	width: 14px;
+	height: 14px;
+	float: right;
+	text-indent: -9999px;
+}
+
 #filters .editfilter input {
 	width:8em;
 	border:none;

=== added file 'harvest/media/img/help.png'
Binary files harvest/media/img/help.png	1970-01-01 00:00:00 +0000 and harvest/media/img/help.png	2010-08-04 11:16:48 +0000 differ
=== modified file 'harvest/opportunities/management/commands/updatelists.py'
--- harvest/opportunities/management/commands/updatelists.py	2010-03-21 15:32:06 +0000
+++ harvest/opportunities/management/commands/updatelists.py	2010-08-04 11:16:48 +0000
@@ -19,9 +19,13 @@
             os.makedirs(data_dir)
         list_dir = opportunity_lists.pull_lists(data_dir)
 
-        for (list_url, list_description) in opportunity_lists.read_lists(list_dir):
+        for (list_url, 
+             list_description, 
+             list_explanation) in opportunity_lists.read_lists(list_dir):
             op_list, created = OpportunityList.objects.get_or_create(url=list_url)
             op_list.description = list_description
+            if list_explanation:
+                op_list.explanation = list_explanation
             op_list.active = True
             op_list.name = self.chop_name(list_url)
             op_list.save()

=== modified file 'harvest/opportunities/models.py'
--- harvest/opportunities/models.py	2010-07-29 02:57:09 +0000
+++ harvest/opportunities/models.py	2010-08-04 11:16:48 +0000
@@ -53,7 +53,8 @@
     active = models.BooleanField(_("Active"), default=True)
     featured = models.BooleanField(_("Featured"), default=False, 
                                    help_text=_("Specially feature this list of opportunities?"))
-    explanation = models.TextField(_("Explanatory help text"), max_length=500, null=True)
+    explanation = models.TextField(_("Explanatory instructions"), max_length=500, null=True, 
+                                   help_text=_("Link to more instructions about this type of opportunities."))
     commentable = models.BooleanField(_("Commentable"), default=True, 
                                       help_text=_("Can opportunities on this list have comments?"))
     experience = models.IntegerField(_("Required Experience"), default=0, choices=EXPERIENCE_CHOICES,


Follow ups