Page MenuHomePhabricator

Allow PHUICurtainView more flexibility with Panels
AbandonedPublic

Authored by chad on May 17 2017, 5:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 10:27 AM
Unknown Object (File)
Thu, Apr 25, 3:54 AM
Unknown Object (File)
Sat, Apr 13, 3:57 PM
Unknown Object (File)
Mar 23 2024, 8:08 AM
Unknown Object (File)
Mar 21 2024, 7:25 PM
Unknown Object (File)
Mar 20 2024, 8:19 AM
Unknown Object (File)
Dec 25 2023, 4:35 PM
Unknown Object (File)
Oct 19 2023, 11:14 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';
   }