-
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.
* add announcement entity * add announcement partial and show in home page * add template for donation * improve buttons in announcement partials * add close button * add permissions and copies for announcement admin * add necessary FormsProcessors and EntityNormalizer to use Entity instead of Model! * add Announcement admin * fix announcement api controller * add slider for announcements * add lang table and some fixes * add Announcement Model * change repository to use model instead of entity * change admin controller and views to use new model * change use of entity to model in public views of announcements * add missing translations * add announcements without donation to projects landing * change to now show announcement and make it appear instead of remove it * add announcements to channel layouts * add announcements to blog * change name of localStorage variable * remove entity announcement * update datetime of migration * fix error on announcement admin form
- Loading branch information
Showing
55 changed files
with
1,342 additions
and
77 deletions.
There are no files selected for viewing
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
25 changes: 25 additions & 0 deletions
25
Resources/templates/responsive/admin/announcements/edit.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,25 @@ | ||
<?php | ||
|
||
$this->layout('admin/announcements/layout'); | ||
|
||
$this->section('admin-search-box-addons'); | ||
?> | ||
<a class="btn btn-cyan" href="/admin/announcement"><i class="fa fa-arrow-circle-left"></i> <?= $this->text('admin-back-list') ?></a> | ||
|
||
<?php $this->replace() ?> | ||
|
||
<?php $this->section('admin-container-body') ?> | ||
|
||
<?php | ||
$id = $this->announcement->id; | ||
?> | ||
|
||
<h4 class="title"><?= $id ? $this->text('admin-announcement-edit', "#{$id}") : $this->text('admin-announcement-add') ?></h4> | ||
|
||
|
||
<?= $this->form_form($this->raw('form')) ?> | ||
|
||
</div> | ||
</div> | ||
|
||
<?php $this->replace() ?> |
14 changes: 14 additions & 0 deletions
14
Resources/templates/responsive/admin/announcements/layout.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,14 @@ | ||
<?php | ||
|
||
$this->layout('admin/container'); | ||
|
||
$this->section('admin-container-head'); | ||
|
||
?> | ||
<h2><?= $this->text('admin-announcements') ?></h2> | ||
|
||
<?= $this->insert('admin/partials/search_box') ?> | ||
|
||
<?= $this->supply('admin-announcements-head') ?> | ||
|
||
<?php $this->replace() ?> |
20 changes: 20 additions & 0 deletions
20
Resources/templates/responsive/admin/announcements/list.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,20 @@ | ||
<?php | ||
|
||
$this->layout('admin/announcements/layout'); | ||
|
||
$this->section('admin-search-box-addons'); | ||
?> | ||
<a class="btn btn-cyan" href="/admin/announcement/add"><i class="fa fa-plus"></i> <?= $this->text('admin-announcement-add') ?></a> | ||
|
||
<?php $this->replace() ?> | ||
|
||
<?php $this->section('admin-container-body') ?> | ||
|
||
<h5><?= $this->text('admin-list-total', $this->total) ?></h5> | ||
|
||
<?= $this->insert('admin/partials/material_table', ['list' => $this->model_list_entries($this->list, ['id', 'title', 'type', 'active', 'actions'])]) ?> | ||
|
||
</div> | ||
</div> | ||
|
||
<?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
28 changes: 28 additions & 0 deletions
28
Resources/templates/responsive/partials/components/announcements.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,28 @@ | ||
<?php | ||
$announcements = $this->announcements; | ||
if ($announcements) : | ||
|
||
|
||
$id = md5(serialize($announcements)); | ||
?> | ||
<div class="announcement" id="<?= $id ?>"> | ||
<button id="announcement-close" class="close" aria-label="Close" onclick="this.parentNode.style.display='none'"><i class="fa fa-close"></i></button> | ||
|
||
<div class="container"> | ||
<div class="slider-announcements"> | ||
<?php foreach ($announcements as $announcement) : ?> | ||
<div class="row"> | ||
<div class="col-lg-8 col-md-7 col-md-offset-1 col-sm-offset-2 col-sm-6 col-xs-offset-3 col-xs-9"> | ||
<h2 class="announcement-title"><?= $announcement->title ?></h2> | ||
<p class="announcement-description"><?= $announcement->description ?></p> | ||
</div> | ||
<div class="cta col-lg-4 col-md-4 col-sm-4 col-xs-12"> | ||
<?php $type = $announcement->type ?> | ||
<?= $this->insert("partials/components/announcements/partials/$type", ['announcement' => $announcement]) ?> | ||
</div> | ||
</div> | ||
<?php endforeach; ?> | ||
</div> | ||
</div> | ||
</div> | ||
<?php endif; ?> |
8 changes: 8 additions & 0 deletions
8
Resources/templates/responsive/partials/components/announcements/partials/donation.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,8 @@ | ||
<?php $announcement = $this->announcement; ?> | ||
|
||
<div class="grid-donation"> | ||
<a href="/donate/payment?amount=5" class="btn btn-lg btn-white"><?= $this->get_currency() ?> 5</a> | ||
<a href="/donate/payment?amount=10" class="btn btn-lg btn-white"><?= $this->get_currency() ?> 10</a> | ||
<a href="/donate/payment?amount=20" class="btn btn-lg btn-white"><?= $this->get_currency() ?> 20</a> | ||
<a href="/donate/payment?amount=50" class="btn btn-lg btn-white"><?= $this->get_currency() ?> 50</a> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
Resources/templates/responsive/partials/components/announcements/partials/general.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,3 @@ | ||
<?php $announcement = $this->announcement; ?> | ||
|
||
<a href="<?= $announcement->cta_url ?>" class="btn btn-white btn-lg btn-block"><?= $announcement->cta_text ?></a> |
3 changes: 3 additions & 0 deletions
3
Resources/templates/responsive/partials/components/announcements/partials/project.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,3 @@ | ||
<?php $announcement = $this->announcement; ?> | ||
|
||
<a href="<?= $announcement->cta_url ?>" class="btn btn-white btn-lg btn-block"><?= $announcement->cta_text ?></a> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
/** | ||
* Migration Task class. | ||
*/ | ||
class GoteoAnnouncement | ||
{ | ||
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 " | ||
CREATE TABLE `announcement` ( | ||
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | ||
`title` TEXT NOT NULL, | ||
`description` TEXT NOT NULL, | ||
`type` VARCHAR(50) NOT NULL, | ||
`lang` VARCHAR(6) NOT NULL, | ||
`project_id` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL, | ||
`cta_url` VARCHAR(255), | ||
`cta_text` VARCHAR(255), | ||
`active` INT(1) NOT NULL DEFAULT 0, | ||
`start_date` date NULL, | ||
`end_date` date NULL, | ||
`created_at` timestamp NOT NULL DEFAULT current_timestamp, | ||
`modified_at` timestamp NOT NULL DEFAULT current_timestamp on update CURRENT_TIMESTAMP, | ||
PRIMARY KEY (`id`), | ||
FOREIGN KEY (`project_id`) REFERENCES `project` (`id`) ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
CREATE TABLE `announcement_lang` ( | ||
`id` BIGINT(20) UNSIGNED NOT NULL, | ||
`title` TEXT NOT NULL, | ||
`description` TEXT NOT NULL, | ||
`lang` VARCHAR(6) NOT NULL, | ||
`cta_url` VARCHAR(255), | ||
`cta_text` VARCHAR(255), | ||
FOREIGN KEY (`id`) REFERENCES `announcement` (`id`) ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
"; | ||
} | ||
|
||
/** | ||
* 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 `announcement_lang`; | ||
DROP TABLE `announcement`; | ||
"; | ||
} | ||
} |
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,60 @@ | ||
/* | ||
@licstart The following is the entire license notice for the | ||
JavaScript code in this page. | ||
Copyright (C) 2010 Goteo Foundation | ||
The JavaScript code in this page is free software: you can | ||
redistribute it and/or modify it under the terms of the GNU | ||
General Public License (GNU GPL) as published by the Free Software | ||
Foundation, either version 3 of the License, or (at your option) | ||
any later version. The code is distributed WITHOUT ANY WARRANTY; | ||
without even the implied warranty of MERCHANTABILITY or FITNESS | ||
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. | ||
As additional permission under GNU GPL version 3 section 7, you | ||
may distribute non-source (e.g., minimized or compacted) forms of | ||
that code without the copy of the GNU GPL normally required by | ||
section 4, provided you include this license notice and a URL | ||
through which recipients can access the Corresponding Source. | ||
@licend The above is the entire license notice | ||
for the JavaScript code in this page. | ||
*/ | ||
|
||
$(function() { | ||
const $closeAnnouncement = document.getElementById('announcement-close'); | ||
const $announcements = $closeAnnouncement.parentNode; | ||
const announcementsId = $announcements.id; | ||
const date = new Date(); | ||
const today = `${date.getFullYear()}-${date.getMonth()}-${date.getDay()}`; | ||
const itemId = `goteo_announcements_${today}_${announcementsId}`; | ||
|
||
$closeAnnouncement.addEventListener("click", (event) => { | ||
$announcements.style.display = 'none'; | ||
localStorage.setItem(itemId, true); | ||
}); | ||
|
||
if (!localStorage.getItem(itemId)) | ||
$announcements.style.display = 'block'; | ||
|
||
$(".slider-announcements").slick({ | ||
dots: false, | ||
infinite: true, | ||
autoplay: false, | ||
autoplaySpeed: 7000, | ||
speed: 500, | ||
fade: true, | ||
cssEase: "linear", | ||
responsive: [ | ||
{ | ||
breakpoint: 500, | ||
settings: { | ||
dots: true, | ||
arrows: false | ||
} | ||
} | ||
] | ||
}); | ||
}); |
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.