Task Overview:

We know the UI for node/add/project-issue in D6 is horrible. #1044950: Re-architect the project-dropdown UI selector on node/add/project-issue to prevent server crashes
However, right now in the D7 port, this page is a fatal error and a lot of functionality relies on it, so it needs to work.

Task Details:

- hook_menu_alter() to capture the /node/add/project-issue page.
- add our own custom landing page which replicates the old one as closely as possible.
- query for all nodes that have a field_project_type field at all, and that have the field_project_has_issue_queue set to TRUE.
- create a select list of all of them (fun!).
- have the submit button on this form called "next" and have it redirect you to node/add/project-issue/%project (thanks, #1548222: node/add/project-issue/%project).

Scope Creep?

Do not address any of the problems with the existing workflow or UI in terms of accessibility or usability. Just get it working at this point by replicating existing systems as closely as possible.

Level Of Effort

It is estimated to take 3-4 days of effort to complete this task.

FINISH LINE:

When a working, testbot-approved patch is uploaded which allows users to add a new issue from within an existing issue queue by submitting a form, and they can instantly see the results of their submission on the following page, this task will be RTBC.

Comments

rgristroph’s picture

I'm going to make an attempt at this today.
--Rob

senpai’s picture

Issue summary: View changes

Setting a finish line and a level of effort.

rgristroph’s picture

Assigned: Unassigned » rgristroph

I'm taking this one.

--Rob

senpai’s picture

Issue tags: +sprint 1
rgristroph’s picture

This is my first cut at this - it seems to work for me.

Note that for this to work, I had to port the select options function in the project module, so that you have to apply the patch at https://drupal.org/node/1551346#comment-5999284 to actually get the select box pull down.

dww’s picture

Status: Active » Needs work

Sweet, thanks! From visual inspection of the patch:

A) The PHPDoc standard in Drupal code is for a 1-line summary at the top of the doc block, then the full description below, instead of this:

+/**
+ * Form builder for a simple form to select a project when creating a new
+ * issue (as the first "page", but this is not really a multi-page form).
+ */

While nit-picking comment formatting, there needs to be a newline between the @file docblock and this first function docblock.


B) This is assuming a single 'project_issue' node type:

+  drupal_set_title(t('Submit @name', array('@name' => node_type_get_name('project_issue'))));

In fact, many parts of this patch do so. We probably need an equivalent to project_project_entity_bundles() but for project_issue, using the setting I'm talking about at #1569524: Add a 'Project settings' tab on node type edit forms. In fact, see #1580178: Add helper functions to handle multiple node types behaving as issues for that...


C) project_issue_pick_project_form_validate() could be a lot simpler if it just used project_node_is_project().


D) project_issue_pick_project_form_validate() should also be checking field_project_has_issue_queue so we don't keep perpetuating the bugs at #956744: Unchecking a project's "Enable issue tracker" option doesn't do anything....

Although, it'd really be nice if we could cleanly handle that at project_projects_select_options(), too. This kind of needs a bit more thought on how to Do It Right(tm). We don't really want project.module to have to know about issues if we can help it. So, maybe we need a project_issue_projects_select_options() function or something? I'm open to suggestions for this.

E) Inside project_issue_pick_project_form_submit(), instead of redirecting to node/add/project-issue/[nid] it'd be nicer to redirect to node/add/[appropriate-node-type]/[machine-name]. The validate function is already doing the node_load(), so we could just stash the loaded node (or at least its machine_name) into $form_state to access it during the submit handler.

F) project_issue_menu_alter() also needs to iterate over all the issue-enabled node types (see point A).

G) Since we're rewriting this, I wouldn't mind a more self-documenting form element key than 'pid'. ;) Perhaps 'project_id'?

Thanks!
-Derek

dww’s picture

Re: D) bah -- the D6 version of project_projects_select_options() already has an $issues parameter to handle this. Kinda ugly, but I guess that's okay at this point. I'm trying not to let perfect be the enemy of good...

senpai’s picture

Assigned: rgristroph » merlinofchaos
Status: Needs work » Active
Issue tags: +sprint 2

Tagging for sprint 2.

senpai’s picture

Assigned: merlinofchaos » rgristroph

Woops. Assigning back to rgristroph.

dww’s picture

Status: Active » Needs work

Why change the status? There's a proposed solution which needs work...

dww’s picture

FYI: #1580178: Add helper functions to handle multiple node types behaving as issues is done, committed, and pushed, so you can use those new API functions for this...

rgristroph’s picture

StatusFileSize
new3.2 KB

Patch attached, it depends on https://drupal.org/files/project-select_options-1580246-5.patch in #1580246 .

I don't think this is a final version, however I wanted to put up my current state of work for any comment.

From @dww's points in #5, all the points regarding iterating over project-issue types and handling that correctly still apply. I'm still working on those, however, hopefully I'll have another patch this afternoon.

--Rob

senpai’s picture

Status: Needs work » Needs review

Setting this one to 'needs review'.

dww’s picture

Status: Needs review » Needs work

Most of my review from #5 is still valid here. This needs more work before it's actually ready for review.

dww’s picture

FYI: #1580246: Port project_projects_select_options() to D7 and make it handle multiple project node types is committed and pushed to 7.x-2.x. I recommend spending the bare minimum time on this issue, since D7 makes it impossible to have anything resembling a performant solution for project_projects_select_options(). This UI already crashes browsers on the live d.o. It's going to start crashing our servers, too, as we try to entity_load() 10K projects into RAM. Fun!!!

So, it's still worth getting *something* working here for smaller sites. Maybe I should push my project_release feature branch so you can copy what I'm doing there. For now, I'm just attaching a file with the relevant code from my clone of project_release so you can mostly copy/paste this and s/release/issue/ to replicate the insanity. ;)

But, I bumped #1044950: Re-architect the project-dropdown UI selector on node/add/project-issue to prevent server crashes to critical and tagged it for Drupal.org D7, since this UI here is going to melt our web servers if we deploy it as-is. :/

senpai’s picture

Issue tags: +sprint 3

Tagging for sprint 3.

rgristroph’s picture

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

I believe this patch should address all issues, and I did find @dww's example from project_release in #14 very helpful in this, so thanks for that.

One minor difference between the way project_issue does this and project_release does it is that this module has "includes/issue_node_form.inc" where as following the exact same pattern as project_release it should be "includes/issue_node_add.inc". It is not a big change to name it consistently, should I do that ?

Thanks,

--Rob

dww’s picture

Status: Needs review » Fixed
StatusFileSize
new5.93 KB

Great, thanks. There are just a few minor issues with #16:

  1. 4 whitespace bugs in the patch
  2. I removed the comment about how to include sandboxes and the commented-out line of code
  3. I renamed the file to issue_node_add.inc

See attached patch, which is what I committed and pushed to 7.x-2.x.

Thanks!
-Derek

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

Anonymous’s picture

Issue summary: View changes

Fixing a typo.