feature/layout-improvements #38
@ -71,8 +71,6 @@ class CommunityController implements IAuthenticationRequired
 | 
			
		||||
 | 
			
		||||
        return new HtmlContent('communities/community', [
 | 
			
		||||
            'community' => $community,
 | 
			
		||||
            'members' => $this->getMembers($community),
 | 
			
		||||
            'currencies' => $this->getCurrencies($community),
 | 
			
		||||
            'upcomingEvents' => [],
 | 
			
		||||
            'debtItems' => $debtItems,
 | 
			
		||||
            'debtBalance' => $debtBalance,
 | 
			
		||||
@ -83,6 +81,20 @@ class CommunityController implements IAuthenticationRequired
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getCommunitySettings(): ?IContent
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->checkPermission(\Container::$request->query('communityId'), false, $community, $ownCommunityMember)) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return new HtmlContent('communities/community_settings', [
 | 
			
		||||
            'community' => $community,
 | 
			
		||||
            'members' => $this->getMembers($community),
 | 
			
		||||
            'currencies' => $this->getCurrencies($community),
 | 
			
		||||
            'editPermission' => $ownCommunityMember->getOwner()
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getCommunityNew(): IContent
 | 
			
		||||
    {
 | 
			
		||||
        return new HtmlContent('communities/community_edit');
 | 
			
		||||
 | 
			
		||||
@ -86,6 +86,7 @@ class TransactionController implements IAuthenticationRequired, ISecured
 | 
			
		||||
            'exchangeRateCalculator' => $exchangeRateCalculator,
 | 
			
		||||
            'pages' => $pages,
 | 
			
		||||
            'currentPage' => $currentPage,
 | 
			
		||||
            'numberOfTransactions' => $numberOfTransactions,
 | 
			
		||||
            'transactions' => $transactions
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1,35 +1,16 @@
 | 
			
		||||
@extends(templates/layout_normal)
 | 
			
		||||
 | 
			
		||||
@section(main)
 | 
			
		||||
    <h2><?= $community->getName() ?> <span class="small">[<a href="<?= Container::$routeCollection->getRoute('community-edit')->generateLink(['communityId' => $community->getId()]) ?>">edit</a>]</span></h2>
 | 
			
		||||
    <h2>
 | 
			
		||||
        <?= $community->getName() ?>
 | 
			
		||||
        <?php if ($editPermission): ?>
 | 
			
		||||
            <span class="small">[<a href="<?= Container::$routeCollection->getRoute('community-edit')->generateLink(['communityId' => $community->getId()]) ?>">edit</a>]</span>
 | 
			
		||||
        <?php endif; ?>
 | 
			
		||||
    </h2>
 | 
			
		||||
 | 
			
		||||
    <p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.settings')->generateLink(['communityId' => $community->getId()]) ?>">Settings</a></p>
 | 
			
		||||
 | 
			
		||||
    <div class="gridContainer marginTop">
 | 
			
		||||
        <div>
 | 
			
		||||
            <h3 class="marginBottom">Members</h3>
 | 
			
		||||
            <?php foreach ($members as $member): ?>
 | 
			
		||||
                <p><?= $member->getUser()->getDisplayName() ?></p>
 | 
			
		||||
            <?php endforeach; ?>
 | 
			
		||||
            <?php if ($editPermission): ?>
 | 
			
		||||
                <hr>
 | 
			
		||||
                <p><a href="<?= Container::$routeCollection->getRoute('community-members')->generateLink(['communityId' => $community->getId()]) ?>">Edit members</a></p>
 | 
			
		||||
            <?php endif; ?>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div>
 | 
			
		||||
            <h3 class="marginBottom">Currencies</h3>
 | 
			
		||||
            <?php foreach ($currencies as $currency): ?>
 | 
			
		||||
                <p>
 | 
			
		||||
                    <?php if ($currency->getId() === $community->getMainCurrencyId()): ?>
 | 
			
		||||
                        <b><?= $currency->getCode() ?></b>
 | 
			
		||||
                    <?php else: ?>
 | 
			
		||||
                        <a href="<?= Container::$routeCollection->getRoute('community-currency-exchange-rates')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode()]) ?>"><?= $currency->getCode() ?></a>
 | 
			
		||||
                    <?php endif; ?>
 | 
			
		||||
                </p>
 | 
			
		||||
            <?php endforeach; ?>
 | 
			
		||||
            <?php if ($editPermission): ?>
 | 
			
		||||
                <hr>
 | 
			
		||||
                <p><a href="<?= Container::$routeCollection->getRoute('community-currencies')->generateLink(['communityId' => $community->getId()]) ?>">Edit currencies</a></p>
 | 
			
		||||
            <?php endif; ?>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div>
 | 
			
		||||
            <h3 class="marginBottom">Upcoming events</h3>
 | 
			
		||||
            <?php if (count($upcomingEvents) > 0): ?>
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@
 | 
			
		||||
@section(main)
 | 
			
		||||
    <h2>
 | 
			
		||||
        <a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> »
 | 
			
		||||
        <a href="<?= Container::$routeCollection->getRoute('community.settings')->generateLink(['communityId' => $community->getId()]) ?>">Settings</a> »
 | 
			
		||||
        Edit currencies
 | 
			
		||||
    </h2>
 | 
			
		||||
    <div class="box compactBox">
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,7 @@
 | 
			
		||||
@section(main)
 | 
			
		||||
    <h2>
 | 
			
		||||
        <a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> »
 | 
			
		||||
        <a href="<?= Container::$routeCollection->getRoute('community.settings')->generateLink(['communityId' => $community->getId()]) ?>">Settings</a> »
 | 
			
		||||
        Edit members
 | 
			
		||||
    </h2>
 | 
			
		||||
    <div class="box compactBox">
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										39
									
								
								views/communities/community_settings.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								views/communities/community_settings.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,39 @@
 | 
			
		||||
@extends(templates/layout_normal)
 | 
			
		||||
 | 
			
		||||
@section(main)
 | 
			
		||||
    <h2>
 | 
			
		||||
        <a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> »
 | 
			
		||||
        Settings
 | 
			
		||||
    </h2>
 | 
			
		||||
 | 
			
		||||
    <div class="gridContainer marginTop">
 | 
			
		||||
        <div>
 | 
			
		||||
            <h3 class="marginBottom">
 | 
			
		||||
                Members
 | 
			
		||||
                <?php if ($editPermission): ?>
 | 
			
		||||
                    <span class="small">[<a href="<?= Container::$routeCollection->getRoute('community-members')->generateLink(['communityId' => $community->getId()]) ?>">edit</a>]</span>
 | 
			
		||||
                <?php endif; ?>
 | 
			
		||||
            </h3>
 | 
			
		||||
            <?php foreach ($members as $member): ?>
 | 
			
		||||
                <p><?= $member->getUser()->getDisplayName() ?></p>
 | 
			
		||||
            <?php endforeach; ?>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div>
 | 
			
		||||
            <h3 class="marginBottom">
 | 
			
		||||
                Currencies
 | 
			
		||||
                <?php if ($editPermission): ?>
 | 
			
		||||
                    <span class="small">[<a href="<?= Container::$routeCollection->getRoute('community-currencies')->generateLink(['communityId' => $community->getId()]) ?>">edit</a>]</span>
 | 
			
		||||
                <?php endif; ?>
 | 
			
		||||
            </h3>
 | 
			
		||||
            <?php foreach ($currencies as $currency): ?>
 | 
			
		||||
                <p>
 | 
			
		||||
                    <?php if ($currency->getId() === $community->getMainCurrencyId()): ?>
 | 
			
		||||
                        <b><?= $currency->getCode() ?></b>
 | 
			
		||||
                    <?php else: ?>
 | 
			
		||||
                        <a href="<?= Container::$routeCollection->getRoute('community-currency-exchange-rates')->generateLink(['communityId' => $community->getId(), 'code' => $currency->getCode()]) ?>"><?= $currency->getCode() ?></a>
 | 
			
		||||
                    <?php endif; ?>
 | 
			
		||||
                </p>
 | 
			
		||||
            <?php endforeach; ?>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
@ -3,6 +3,7 @@
 | 
			
		||||
@section(main)
 | 
			
		||||
    <h2>
 | 
			
		||||
        <a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a> »
 | 
			
		||||
        <a href="<?= Container::$routeCollection->getRoute('community.settings')->generateLink(['communityId' => $community->getId()]) ?>">Settings</a> »
 | 
			
		||||
        Exchange rates for <?= $currency->getCode() ?>
 | 
			
		||||
    </h2>
 | 
			
		||||
    <div class="box compactBox">
 | 
			
		||||
 | 
			
		||||
@ -8,6 +8,7 @@
 | 
			
		||||
 | 
			
		||||
    <p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communityId' => $community->getId()]) ?>">New transaction</a></p>
 | 
			
		||||
 | 
			
		||||
    <?php if ($numberOfTransactions > 0): ?>
 | 
			
		||||
        <?php if ($pages > 1): ?>
 | 
			
		||||
            <p class="paginateContainer marginTop">
 | 
			
		||||
                <a href="<?= Container::$routeCollection->getRoute('community.transactions')->generateLink(['communityId' => $community->getId(), 'page' => 0]) ?>">«</a>
 | 
			
		||||
@ -59,4 +60,9 @@
 | 
			
		||||
        <?php endif; ?>
 | 
			
		||||
 | 
			
		||||
        <p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.transactions.new')->generateLink(['communityId' => $community->getId()]) ?>">New transaction</a></p>
 | 
			
		||||
    <?php else: ?>
 | 
			
		||||
        <div class="box">
 | 
			
		||||
            <p>There are no transactions yet.</p>
 | 
			
		||||
        </div>
 | 
			
		||||
    <?php endif; ?>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,10 @@
 | 
			
		||||
@section(main)
 | 
			
		||||
    <div class="gridContainer">
 | 
			
		||||
        <div>
 | 
			
		||||
            <h3 class="marginBottom">Communities</h3>
 | 
			
		||||
            <h3 class="marginBottom">
 | 
			
		||||
                Communities
 | 
			
		||||
                <span class="small">[<a href="<?= Container::$routeCollection->getRoute('community-new')->generateLink() ?>">new</a>]</span>
 | 
			
		||||
            </h3>
 | 
			
		||||
            <?php if (count($communities) > 0): ?>
 | 
			
		||||
                <?php foreach ($communities as $community): ?>
 | 
			
		||||
                    <p><a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communityId' => $community->getId()]) ?>"><?= $community->getName() ?></a></p>
 | 
			
		||||
@ -11,8 +14,6 @@
 | 
			
		||||
            <?php else: ?>
 | 
			
		||||
                <p>You have no community.</p>
 | 
			
		||||
            <?php endif; ?>
 | 
			
		||||
            <hr>
 | 
			
		||||
            <p><a href="<?= Container::$routeCollection->getRoute('community-new')->generateLink() ?>">New community</a></p>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div>
 | 
			
		||||
            <h3 class="marginBottom">Upcoming events</h3>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								web.php
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								web.php
									
									
									
									
									
								
							@ -61,6 +61,7 @@ Container::$routeCollection->group('communities', function (RouteCollection $rou
 | 
			
		||||
    $routeCollection->post('community-new-action', 'new', [CommunityController::class, 'saveCommunity']);
 | 
			
		||||
    $routeCollection->group('{communityId}', function (RouteCollection $routeCollection) {
 | 
			
		||||
        $routeCollection->get('community', '', [CommunityController::class, 'getCommunityHome']);
 | 
			
		||||
        $routeCollection->get('community.settings', 'settings', [CommunityController::class, 'getCommunitySettings']);
 | 
			
		||||
        $routeCollection->get('community-edit', 'edit', [CommunityController::class, 'getCommunityEdit']);
 | 
			
		||||
        $routeCollection->post('community-edit-action', 'edit', [CommunityController::class, 'saveCommunity']);
 | 
			
		||||
        $routeCollection->get('community-members', 'members', [CommunityController::class, 'getMembersEdit']);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user