From 511afc464cb9d2825e25a4850f3d0d741b5c874b Mon Sep 17 00:00:00 2001 From: veselcraft Date: Wed, 22 Dec 2021 16:26:49 +0300 Subject: [PATCH] ListView: Add a actions block to the element of the list --- Web/Presenters/templates/@listView.xml | 3 + Web/Presenters/templates/Group/Followers.xml | 84 ++++++++++---------- Web/Presenters/templates/User/Friends.xml | 34 ++++++++ Web/Presenters/templates/User/Groups.xml | 23 ++++-- Web/static/css/style.css | 4 + 5 files changed, 96 insertions(+), 52 deletions(-) diff --git a/Web/Presenters/templates/@listView.xml b/Web/Presenters/templates/@listView.xml index 58d51dff..35c9a2f0 100644 --- a/Web/Presenters/templates/@listView.xml +++ b/Web/Presenters/templates/@listView.xml @@ -29,6 +29,9 @@ {include description, x => $dat} + + {include actions, x => $dat} + diff --git a/Web/Presenters/templates/Group/Followers.xml b/Web/Presenters/templates/Group/Followers.xml index e6409ac4..61daeae6 100644 --- a/Web/Presenters/templates/Group/Followers.xml +++ b/Web/Presenters/templates/Group/Followers.xml @@ -14,10 +14,6 @@ {_only_administrators} {/block} -{block actions} - -{/block} - {* BEGIN ELEMENTS DESCRIPTION *} {block tabs} @@ -81,50 +77,13 @@ {/if} - - {_actions}: - - - {if $manager} - {_devote} - {else} - {_promote_to_admin} - {/if} - - {if $club->getOwner()->getId() != $user->getId() && $manager && $thisUser->getId() == $club->getOwner()->getId()} - | - - {_promote_to_owner} - - {/if} - {if $manager} - | - - {_set_comment} - - {/if} - - {_set_comment} - - {if $manager} - | - - {if $manager->isHidden()}{_hidden_yes}{else}{_hidden_no}{/if} - - {/if} - {if $club->getOwner()->getId() == $user->getId()} - | - - {if $club->isOwnerHidden()}{_hidden_yes}{else}{_hidden_no}{/if} - - {/if} - - + {/block} + +{block actions} + {var user = $x instanceof $Manager ? $x->getUser() : $x} + {var manager = $x instanceof $Manager ? $x : $club->getManager($user, !$club->canBeModifiedBy($thisUser))} + {if $club->canBeModifiedBy($thisUser ?? NULL)} + + {if $manager} + {_devote} + {else} + {_promote_to_admin} + {/if} + + {if $club->getOwner()->getId() != $user->getId() && $manager && $thisUser->getId() == $club->getOwner()->getId()} + + {_promote_to_owner} + + {/if} + {if $manager} + + {_set_comment} + + {/if} + + {_set_comment} + + {if $manager} + + {if $manager->isHidden()}{_hidden_yes}{else}{_hidden_no}{/if} + + {/if} + {if $club->getOwner()->getId() == $user->getId()} + + {if $club->isOwnerHidden()}{_hidden_yes}{else}{_hidden_no}{/if} + + {/if} + {/if} +{/block} \ No newline at end of file diff --git a/Web/Presenters/templates/User/Friends.xml b/Web/Presenters/templates/User/Friends.xml index 117ce1a0..e6c9f50c 100644 --- a/Web/Presenters/templates/User/Friends.xml +++ b/Web/Presenters/templates/User/Friends.xml @@ -79,3 +79,37 @@ {/block} + +{block actions} + {var subStatus = $x->getSubscriptionStatus($thisUser)} + {if $subStatus === 0} + + {elseif $subStatus === 1} + + {elseif $subStatus === 2} + + {elseif $subStatus === 3} + {_"send_message"} + + {/if} +{/block} diff --git a/Web/Presenters/templates/User/Groups.xml b/Web/Presenters/templates/User/Groups.xml index e740694d..b2268b6a 100644 --- a/Web/Presenters/templates/User/Groups.xml +++ b/Web/Presenters/templates/User/Groups.xml @@ -50,22 +50,29 @@ {block description} {$x->getDescription()} {if $x->canBeModifiedBy($thisUser ?? NULL)} - {var clubPinned = $thisUser->isClubPinned($x)} +
{_actions}: - - {if $clubPinned} - {_remove_from_left_menu} - {else} - {_add_to_left_menu} - {/if} - +
{/if} {/block} + +{var clubPinned = $thisUser->isClubPinned($x)} +{if $clubPinned || $thisUser->getPinnedClubCount() <= 10} + {block actions} + + {if $clubPinned} + {_remove_from_left_menu} + {else} + {_add_to_left_menu} + {/if} + + {/block} +{/if} \ No newline at end of file diff --git a/Web/static/css/style.css b/Web/static/css/style.css index 489f7b8d..f5abe0c6 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -330,6 +330,10 @@ a { background: #ECECEC; } +.action_links > .profile_link, .action_links > .profile_link_form > .profile_link { + width: 150px; +} + .page_footer { margin-left: 95px; padding-top: 5px;