display selectors as list in profiles view

This commit is contained in:
Marc Michalsky 2023-08-16 11:26:10 +02:00
parent 518f8809c7
commit 63d713f9f0
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
2 changed files with 14 additions and 5 deletions

View file

@ -20,8 +20,11 @@ class CRM_Twingle_Page_Profiles extends CRM_Core_Page {
public function run() { public function run() {
CRM_Utils_System::setTitle(E::ts("Twingle API Profiles")); CRM_Utils_System::setTitle(E::ts("Twingle API Profiles"));
$profiles = []; $profiles = [];
foreach (CRM_Twingle_Profile::getProfiles() as $profile_name => $profile) { foreach (CRM_Twingle_Profile::getProfiles() as $profile_id => $profile) {
$profiles[$profile_name]['name'] = $profile_name; $profiles[$profile_id]['id'] = $profile_id;
$profiles[$profile_id]['name'] = $profile->getName();
$profiles[$profile_id]['is_default'] = $profile->is_default();
$profiles[$profile_id]['selectors'] = $profile->getProjectIds();
foreach (CRM_Twingle_Profile::allowedAttributes() as $attribute) { foreach (CRM_Twingle_Profile::allowedAttributes() as $attribute) {
$profiles[$profile_name][$attribute] = $profile->getAttribute($attribute); $profiles[$profile_name][$attribute] = $profile->getAttribute($attribute);
} }

View file

@ -25,7 +25,7 @@
<thead> <thead>
<tr> <tr>
<th>{ts domain="de.systopia.twingle"}Profile name{/ts}</th> <th>{ts domain="de.systopia.twingle"}Profile name{/ts}</th>
<th>{ts domain="de.systopia.twingle"}Properties{/ts}</th> <th>{ts domain="de.systopia.twingle"}Selectors{/ts}</th>
<th>{ts domain="de.systopia.twingle"}Used{/ts}</th> <th>{ts domain="de.systopia.twingle"}Used{/ts}</th>
<th>{ts domain="de.systopia.twingle"}Last Used{/ts}</th> <th>{ts domain="de.systopia.twingle"}Last Used{/ts}</th>
<th>{ts domain="de.systopia.twingle"}Operations{/ts}</th> <th>{ts domain="de.systopia.twingle"}Operations{/ts}</th>
@ -34,10 +34,16 @@
<tbody> <tbody>
{foreach from=$profiles item=profile} {foreach from=$profiles item=profile}
{assign var="profile_name" value=$profile.name} {assign var="profile_name" value=$profile.name}
<tr> <tr style="border-bottom: 1px solid #cfcec3;">
<td>{$profile.name}</td> <td>{$profile.name}</td>
<td> <td>
<div><strong>{ts domain="de.systopia.twingle"}Selector{/ts}:</strong> {$profile.selector}</div> {if not $profile.is_default}
<ul>
{foreach from=$profile.selectors item=selector}
<li><strong></strong> {$selector}</li>
{/foreach}
</ul>
{/if}
</td> </td>
<td>{ts domain="de.systopia.twingle"}{$profile_stats.$profile_name.access_counter_txt}{/ts}</td> <td>{ts domain="de.systopia.twingle"}{$profile_stats.$profile_name.access_counter_txt}{/ts}</td>
<td>{ts domain="de.systopia.twingle"}{$profile_stats.$profile_name.last_access_txt}{/ts}</td> <td>{ts domain="de.systopia.twingle"}{$profile_stats.$profile_name.last_access_txt}{/ts}</td>