Page MenuHomePhabricator

Allow PHUICurtainView more flexibility with Panels
AbandonedPublic

Authored by chad on May 17 2017, 5:03 AM.
Tags
None
Referenced Files
F14012532: D17924.diff
Fri, Nov 1, 2:37 PM
F13998698: D17924.id.diff
Thu, Oct 24, 10:44 AM
Unknown Object (File)
Oct 8 2024, 8:22 AM
Unknown Object (File)
Oct 6 2024, 5:20 PM
Unknown Object (File)
Sep 4 2024, 10:27 PM
Unknown Object (File)
Aug 17 2024, 4:56 PM
Unknown Object (File)
Aug 13 2024, 7:37 PM
Unknown Object (File)
Aug 9 2024, 8:11 PM
Subscribers

Details

Reviewers
epriestley
Summary

This lets you build a plain CurtainView with only information panels and skip adding the action list (and it's side effects).

Test Plan

Test building a curtain with just a single panel, multiple panels, and actions with panels.

Diff Detail

Repository
rP Phabricator
Branch
plain-curtain (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 17041
Build 22788: Run Core Tests
Build 22787: arc lint + arc unit

Event Timeline

I think this may break existing code which calls getActionList() or setActionList(). Consider this code:

$curtain->addAction("A");
$curtain->setActionList("B");

Before, this would render "B" (the "set" overrides the action list) -- or maybe it would fatal? Now, it will render "B", "A".

Consider this code:

$curtain->addAction("A");
$view = array($curtain, $curtain);

Before, each curtain would render with "A". Now, the first curtain will render with "A". The second curtain will render with "A", "A", because we add "A" each time getTagContent() is called.

Consider this code:

$curtain->setActionList("B");

Before, this would render "B". Now, it won't render anything, because $this->actions will be empty.

It's not clear to me exactly what problem this is solving: why did you need to add actions/an action list before? From the code here, it doesn't immediately look like anything here requires it. I think we can probably find a better fix here without creating these weird situations where mixtures of add/set do surprising things.

Just pushing this back into your queue -- I'm happy to help figure out how to fix this more robustly, so you can't get any "tricky" effects from mixing add/set, I'm just not sure what the current issue is.

This revision now requires changes to proceed.May 17 2017, 11:56 AM

The main issue is I don't want to append an action list if it's empty. I just get a single <ul>, which leads to CSS wonkiness.

Does this work as a "fix"? Still a little wonky but doesn't make things worse, I think.

diff --git a/src/view/layout/PhabricatorActionListView.php b/src/view/layout/PhabricatorActionListView.php
index faf30555eb..134c336735 100644
--- a/src/view/layout/PhabricatorActionListView.php
+++ b/src/view/layout/PhabricatorActionListView.php
@@ -16,6 +16,10 @@ final class PhabricatorActionListView extends AphrontTagView {
   }
 
   protected function getTagName() {
+    if (!$this->actions) {
+      return null;
+    }
+
     return 'ul';
   }