Attached path adds a link to rows on the project issue list containing '1 new' links, since I mostly read the email notifications, I always have to click those links to mark them as read. Included patch just adds a new link to fetch the page using ajax.

dreditor_markasread.png

Comments

helmo’s picture

Status: Needs review » Needs work

You seem to have forgotten the actual patch...

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new976 bytes

ooops

But not sure if it's working all the time :/

helmo’s picture

Status: Needs review » Needs work

In my first test it works as expected.

How about adding something like$mark.attr('title', 'Mark as read'); to this element to improve the UI.

To let the user know the click had a result we could, on a successful GET, remove the <span class="marker">updated</span> and maybe even the '**' link.

+++ b/dreditor.user.js
@@ -1942,6 +1942,25 @@ Drupal.behaviors.dreditorProjectsCollapse = function (context) {
+*/

Is missing a space char.

+++ b/dreditor.user.js
@@ -1942,6 +1942,25 @@ Drupal.behaviors.dreditorProjectsCollapse = function (context) {
+    var $table = $(this);

I don't think $table is still being used...

helmo’s picture

StatusFileSize
new1.86 KB

I added a Mark ALL as read option.
And fixed my own minor comments.

Removing the marker after a successful GET is still something I would like to see,

helmo’s picture

Status: Needs work » Needs review
StatusFileSize
new2.12 KB

I fixed the marker removal.

I also commented out the reload call in Mark ALL, as it was happening too fast. It can only happen after all background requests have finished.

attiks’s picture

Nice work, i think the reload after 'mark all' can be optional, if you really want to add it, use a timeout of a couple of seconds.

attiks’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.12 KB

Same patch but rerolled because of offset

attiks’s picture

StatusFileSize
new2.12 KB

another reroll

sun’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new49.61 KB

The selectors being used and events getting attached are looking more complex to me than they need to be:

dreditor-mark-as-read.png

The first line of the behavior including .once() seems to be fine (I hope you copied from another behavior that affects the project issue page/table?), but the selectors within can be drastically simplified:

Just search for .marker and attach a click event to them:

$(this).find('.marker').bind('click.dreditor-markasread', function () {
  var marker = this;
  var link = marker.previousSibling;
  $.get(link.href, function () {
    $(marker).remove();
  });
});

I didn't test this code, but that should cut it.

Also note that I do not really feel comfortable with adding the "mark all as read" behavior, since it issues a dozen of HTTP requests against d.o, so I'd rather want to leave that out.

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new979 bytes

this.previousSibling might fail on whitespace, so using jquery to find the link.

attiks’s picture

StatusFileSize
new964 bytes

better patch, works on dashboard and other pages

sun’s picture

Status: Needs review » Needs work

Thanks!

+++ b/dreditor.user.js
@@ -2114,6 +2114,23 @@ Drupal.behaviors.dreditorProjectsCollapse = function (context) {
+      // we need to use parent, this.previousSibling might fail on whitespace.
+      var $link = $marker.parent('.comment-info').find('a');

In that case, why not .prev('a') ?

+++ b/dreditor.user.js
@@ -2114,6 +2114,23 @@ Drupal.behaviors.dreditorProjectsCollapse = function (context) {
+        return false;

Which event does this try to prevent?

attiks’s picture

Status: Needs work » Needs review
StatusFileSize
new941 bytes

$marker.parent().find('a'); is safer, just in case the marker is positioned elsewhere, and the speed improvement is neglectable.

return false; removed, was from previous version.

BTW tested on:
http://drupal.org/user/105002/dashboard
http://drupal.org/project/issues/user/105002
http://drupal.org/project/issues/dreditor

sun’s picture

I'm not sure I see why it is safer -- actually, I'd say quite the contrary; by moving up to the parent node and selecting an arbitrary link within, it's not guaranteed that this link will be the link to the issue node.

Compared to that, in terms of currently common Drupal UI practices, the new/updated marker is always output after the link to the issue node. (I'm aware that the dashboard slightly diverges from that practice, but after all, it's still compatible, since the previous link before is the "X new" link to the issue node.)

attiks’s picture

StatusFileSize
new932 bytes

switched to prev()

attiks’s picture

StatusFileSize
new1.4 KB

patch with some visual indications, but no idea if it's really necessary

helmo’s picture

@attiks: thanks for working on this

@sun: I can understand your reluctance to include the "mark all as read" behavior, I'm open to suggestions for a better way.
But if it's a blocker for you the let's split that off from this patch.. .

attiks’s picture

@helmo, to be honest I used 'mark all as read' only once, so better to split it into a new issue, assuming that you're using it.

sun’s picture

Status: Needs review » Fixed
StatusFileSize
new1.42 KB

Thanks for reporting, reviewing, and testing!

Slightly adjusted and committed attached patch.

helmo’s picture

StatusFileSize
new1.34 KB

Nice.

I'm attaching a re-roll of the mark-ALL-as-read core just for future reference. We should indeed start a new issue if there is any interest in working on this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.