-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create subscriptions menu for project dashboard (#555) authored-by: David Igón <davidbenabarre@platoniq.net> * Add subscriptions * Add subscriptions to project dashboard * Update database code * Update dashboard subscription form * Start updating subscriptions dashboard to add new subscription * Basic subscription form on dashboard * CRUD for subscriptions on project dashboard * Add support for subscriptions via stripe payments * Fix Stripe integration details * Make stripe subscriptions be enabled via rewards * Remove legacy integration * Remove javascript related to previous subscription model * Fix stripe integration PR comments * Use abstract payment in stripe payment method * add migrations for privacy seetings in project posts with rewards * allow limiting access to project posts * add PostRewardAccess model * add form to handle project post privacy settings with invests to rewards * add missing copies for project's post privacy * add library to handle access to project posts based on rewards * fix check if user has invest to reward based on if it's subscribable or not * limit visible content of project post if it has a restricted access * add missing copy * add missing use of translation copy * improve use of if else in postprivacyaccess library * rework of sql to check if user has donation to rewards that grant access to post * add InvestRepository --------- Co-authored-by: David Igón <david.igon@riseup.net> Co-authored-by: David Igón <davidbenabarre@platoniq.net>
- Loading branch information
1 parent
8671ed6
commit c9715e6
Showing
24 changed files
with
776 additions
and
65 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
Resources/templates/responsive/dashboard/project/privacy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php $this->layout('dashboard/project/layout') ?> | ||
|
||
<?php $this->section('dashboard-content') ?> | ||
|
||
<div class="dashboard-content"> | ||
<div class="inner-container"> | ||
<h2><?= $this->ee($this->post->title) ?></h2> | ||
<p><?= $this->text('dashboard-menu-projects-updates-privacy') ?></p> | ||
<a href="/dashboard/project/<?= $this->project->id ?>/updates/<?= $this->post->id ?>/privacy/new" class="btn btn-cyan spacer-bottom-20"><i class="fa fa-plus"></i> <?= $this->text('form-add-button') ?></a> | ||
|
||
<?php if($this->rewards): ?> | ||
<table class="-footable table"> | ||
<thead> | ||
<tr> | ||
<th data-type="number" data-breakpoints="xs">#</th> | ||
<th><?= $this->text('regular-title') ?></th> | ||
<th style="min-width: 140px"><?= $this->text('regular-actions') ?></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php | ||
foreach($this->rewards as $reward): | ||
?> | ||
<tr> | ||
<td><?= $reward->getReward()->id ?></td> | ||
<td><?= $reward->getReward()->reward ?></td> | ||
<td> | ||
<div class="btn-group"> | ||
<a class="btn btn-default" title="<?= $this->text('regular-delete') ?>" href="/project/<?= $this->project->id ?>/updates/<?= $this->post->id ?>/delete/<?= $reward->getReward()->id ?>"><i class="fa fa-trash"></i></a> | ||
</div> | ||
</td> | ||
</tr> | ||
<?php endforeach ?> | ||
</tbody> | ||
</table> | ||
|
||
<?= $this->insert('partials/utils/paginator', ['total' => $this->total, 'limit' => $this->limit]) ?> | ||
|
||
<?php else: ?> | ||
<blockquote> | ||
<?= $this->text('dashboard-project-blog-privacy-empty') ?> | ||
</blockquote> | ||
<?php endif ?> | ||
</div> | ||
</div> | ||
|
||
<?php $this->replace() ?> |
12 changes: 12 additions & 0 deletions
12
Resources/templates/responsive/dashboard/project/privacy/new.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php $this->layout('dashboard/project/layout') ?> | ||
|
||
<?php $this->section('dashboard-content') ?> | ||
|
||
|
||
<section class="container"> | ||
<h2><?= $this->text('dashboard-project-privacy-add-new-restriction', $this->post->title) ?></h2> | ||
|
||
<?= $this->form_form($this->raw('form')) ?> | ||
</section> | ||
|
||
<?php $this->replace() ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
db/migrations/20231030152314_goteo_create_post_reward_access.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* Migration Task class. | ||
*/ | ||
class GoteoCreatePostRewardAccess | ||
{ | ||
public function preUp() | ||
{ | ||
// add the pre-migration code here | ||
} | ||
|
||
public function postUp() | ||
{ | ||
// add the post-migration code here | ||
} | ||
|
||
public function preDown() | ||
{ | ||
// add the pre-migration code here | ||
} | ||
|
||
public function postDown() | ||
{ | ||
// add the post-migration code here | ||
} | ||
|
||
/** | ||
* Return the SQL statements for the Up migration | ||
* | ||
* @return string The SQL string to execute for the Up migration. | ||
*/ | ||
public function getUpSQL() | ||
{ | ||
// return sql query to create table that links post with reward to grant access to the post content | ||
return " | ||
ALTER TABLE `post` ADD COLUMN `access_limited` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `allow`; | ||
CREATE TABLE `post_reward_access` ( | ||
`post_id` bigint(20) unsigned NOT NULL, | ||
`reward_id` bigint(20) unsigned NOT NULL, | ||
PRIMARY KEY (`post_id`, `reward_id`), | ||
FOREIGN KEY (`post_id`) REFERENCES `post` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, | ||
FOREIGN KEY (`reward_id`) REFERENCES `reward` (`id`) ON DELETE CASCADE ON UPDATE CASCADE | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
"; | ||
} | ||
|
||
/** | ||
* Return the SQL statements for the Down migration | ||
* | ||
* @return string The SQL string to execute for the Down migration. | ||
*/ | ||
public function getDownSQL() | ||
{ | ||
return " | ||
DROP TABLE `post_reward_access`; | ||
ALTER TABLE `post` DROP COLUMN `access_limited`; | ||
"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.