Skip to content

Commit

Permalink
Merge branch 'feature/creator_controller' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbeig committed Nov 24, 2023
2 parents 6f1969d + 1981a19 commit 679c0d5
Show file tree
Hide file tree
Showing 16 changed files with 466 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
34 changes: 34 additions & 0 deletions Resources/templates/responsive/creator/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php $this->layout("layout", [
'bodyClass' => 'project creator',
]);

$permanentProject = $this->permanentProject;
$listOfProjects = $this->listOfProjects;
?>

<?php $this->section('head'); ?>
<?= $this->insert('creator/partials/styles') ?>
<?php $this->append(); ?>

<?php $this->section('content'); ?>

<main class="container-fluid main-info">
<div class="container-fluid">
<div class="row header text-center">
<h1 class="project-title"><?= $this->markdown($this->ee($permanentProject->name)) ?></h1>
<div class="project-by"><strong><?= $permanentProject->user->name ?></strong></div>
</div>

<div class="row">
<div class="col-md-12">
<?= $this->insert('project/partials/media', ['project' => $permanentProject ]) ?>
</div>
</div>

<?= $this->insert('creator/partials/subscriptions', ['project' => $permanentProject, 'subscriptions' => $permanentProject->getSubscribableRewards()]) ?>

<?= $this->insert('creator/partials/posts', ['project' => $permanentProject, 'subscriptions' => $permanentProject->getSubscribableRewards()]) ?>
</div>
</main>

<?php $this->append(); ?>
25 changes: 25 additions & 0 deletions Resources/templates/responsive/creator/partials/post_item.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
$post = $this->post;
$user = $this->user;
?>

<article class="post">
<?php if ($post->image): ?>
<div class="post-image">
<img class="post-image" src="<?= $post->image->getLink(80,80,false) ?>" alt="<?= $post->title ?>">
</div>
<?php endif; ?>

<div class="card-body">
<div class="card-info">
<h2><a href="<?= "/blog/$post->slug" ?>" target="_blank" ><?= $post->title ?></a></h2>
<p><?= $post->subtitle ?></p>
</div>
<div class="card-author-info">
<div class="author-image">
<img src="<?= $user->avatar->getLink(30,30,false) ?>" alt="<?= $user->name ?>"> <?= $user->name ?>
</div>
<span><?= date_formater($this->post->date) ?></span>
</div>
</div>
</article>
15 changes: 15 additions & 0 deletions Resources/templates/responsive/creator/partials/posts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
$posts = $this->posts;
if (empty($posts))
return;
?>

<section class="posts">
<h2><?= $this->t('regular-posts') ?></h2>

<div class="post-grid">
<?php foreach($posts as $post): ?>
<?= $this->insert('creator/partials/post_item', ['post' => $post]); ?>
<?php endforeach; ?>
</div>
</section>
15 changes: 15 additions & 0 deletions Resources/templates/responsive/creator/partials/projects.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
$projects = $this->projects;
if (empty($projects))
return;
?>

<section class="projects" >
<h2><?= $this->t('regular-projects') ?></h2>

<div class="project-grid">
<?php foreach ($this->listOfProjects as $project) : ?>
<?= $this->insert('project/widgets/normal', ['project' => $project]) ?>
<?php endforeach ?>
</div>
</section>
1 change: 1 addition & 0 deletions Resources/templates/responsive/creator/partials/styles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link href="<?= SRC_URL ?>/assets/css/creator.css" type="text/css" rel="stylesheet">
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
$project = $this->project;
$subscription = $this->subscription;
?>

<article class="subscription">
<div class="card-header">
<h2 title="<?= $subscription->reward ?>"><?= $subscription->reward ?></h2>
</div>
<div class="card-body">
<div class="amount-box text-center text-uppercase">
<span class="amount"><?= amount_format($subscription->amount) ?></span>
</div>

<p>
<?= $this->markdown($subscription->description) ?>
</p>
</div>
<div class="card-footer">
<div class="reward-donate text-center">
<a class="btn btn-lg btn-cyan text-uppercase" href="/invest/<?= $project->id ?>/<?= $subscription->id ?>">
<?= $this->text('project-regular-support') ?>
</a>
</div>
</div>
</article>
15 changes: 15 additions & 0 deletions Resources/templates/responsive/creator/partials/subscriptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
$subscriptions = $this->subscriptions;
if (empty($subscriptions))
return;
?>

<section class="subscriptions">
<h2><?= $this->t('regular-subscriptions') ?></h2>

<div class="subscription-grid">
<?php foreach($subscriptions as $subscription): ?>
<?= $this->insert('creator/partials/subscription_item', ['subscription' => $subscription]); ?>
<?php endforeach; ?>
</div>
</section>
230 changes: 230 additions & 0 deletions public/assets/sass/creator.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
@import 'variables';

body.creator {

section {
h2 {
font-weight: bold;
text-align: center;
text-transform: uppercase;
}
}

section.subscriptions {

.subscription-grid {
display: grid;
grid-template-columns: 1fr;
justify-items: center;
padding: 1rem;
margin-top: 2.5rem;
grid-row-gap: 3em;

&:has(> :last-child:nth-child(2)) {
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 3em;

article.subscription:first-child {
justify-self:right;
}
article.subscription:last-child {
justify-self:left;
}
}

article.subscription {
display: grid;
grid-template-rows: auto auto auto;
background-color: white;
border: 1px solid $color-light-grey;
border-radius: 1rem;
width: 300px;
padding: 2rem;
font-size: 1.5rem;
transition: all 0.5s ease-in-out;

&:only-child {
grid-column-start: 2;
}

.card-header {
h2 {
overflow: hidden;
text-overflow: ellipsis;
}
}

.card-body {
height: 20rem;
overflow: hidden;
text-overflow: ellipsis;
padding-bottom: 1rem;

.amount-box {
color: $color-dark-green;
font-size: 40px;
font-weight: bold;
}

img {
width: 100%;
}

&:hover {
height: fit-content;
min-height: 20rem;
}
}

&:hover {
border: $background-light-green 2px solid;
}
}
}
}

section.posts {
.post-grid {
display: grid;
grid-template-columns: 1fr 4fr 1fr;

gap: 1rem;
padding: 1rem;
margin-top: 2.5rem;

article.post {
display: grid;
grid-template-columns: 1fr;
grid-column-start: 2;
margin: 20px;
border: 1px solid #ddd;
border-radius: 8px;

h2 {
overflow: hidden;
text-overflow: ellipsis;
}

&:has(.post-image) {
grid-template-columns: 1fr 2fr;
}

.post-image {
width: 100%;

img {
object-fit: cover;
height: 100%;
display: block;
}
}

.card-body {
display: grid;
grid-template-rows: 2fr 1fr;

.card-info {
margin: 1em;
text-align: center;

h2 {
text-wrap: balance;

a {
color: inherit;
}
}

p {
display: -webkit-box;
text-overflow: ellipsis;
line-clamp: 2;
}
}
.card-author-info {
padding: 1em;
display: flex;
align-items: center;
background-color: $background-light-green;
justify-content: space-between;
color: $color-white;

.author-image {
margin-right: 10px;

img {
width: 30px;
height: 30px;
border-radius: 50%;
object-fit: cover;
}
}
}
}
}
}
}

section.projects {
.project-grid {
display: grid;
grid-template-columns: 1fr;
justify-items: center;
grid-column-gap: 3em;
grid-row-gap: 3em;

&:has(> :last-child:nth-child(2)) {
grid-template-columns: repeat(2, 1fr);

.project-widget:first-child {
justify-self:right;
}
.project-widget:last-child {
justify-self:left;
}
}

padding: 1rem;
margin-top: 2.5rem;
}
}

@media (max-width: $breakpoint-lg) {
section.projects .project-grid, section.subscriptions .subscription-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}


@media (max-width: $breakpoint-md) {
section.projects .project-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}

section.subscriptions .subscription-grid {
&:has(> :last-child:nth-child(2)) {
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 3em;

article.subscription:first-child {
justify-self:right;
}
article.subscription:last-child {
justify-self:left;
}
}
}
}

@media (max-width: $breakpoint-sm) {
section.projects div.project-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}

@media (max-width: $breakpoint-xs) {
section.projects div.project-grid {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
}
}
Loading

0 comments on commit 679c0d5

Please sign in to comment.