Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[STAGING] Hide project signature fields #239

Merged
merged 6 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions Resources/templates/responsive/dashboard/project/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,26 @@
</div>

<?php $this->replace() ?>

<?php $this->section('footer') ?>
<script>

$(function(){
$('#autoform_sign_check').change(function() {
$('#form-sign_url').toggleClass('hidden');
$('#form-sign_url_action').toggleClass('hidden');

if (! $(this).is(':checked') ) {
$('#autoform_sign_url').val('');
$('#autoform_sign_url').prop('required', false);
$('#autoform_sign_url_action').val('');
$('#autoform_sign_url_action').prop('required', false);
} else {
$('#autoform_sign_url').prop('required', true);
$('#autoform_sign_url_action').prop('required', true);
}
})
});

</script>
<?php $this->append() ?>
3 changes: 2 additions & 1 deletion Resources/translations/ca/overview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ overview-field-sustainability-model: 'Model de sostenibilitat'
overview-field-sustainability-model-url: 'URL del teu business canvas'
tooltip-project-sustainability-model: 'Explica el model de sostenibilitat del teu projecte'
tooltip-project-sustainability-model-url: 'Afegeix una url amb teu <a href="https://canvanizer.com/new/business-model-canvas" target="_blank">business canvas</a>'
overview-field-sign-check: 'Tens una recollida de signatures oberta relacionada amb el projecte?'
overview-field-sign-url: "Url per signar"
overview-field-sign-url-action: "Text per fer una crida a signar"
overview-field-sign-url-help: "Aquest camp et permet afegir un salt cap a la teva pàgina de recollida de signatures"
overview-field-sign-url-help: "Si paral·lelament a la campanya a Goteo tens una campanya de recollida de signatures en una altra plataforma, pots afegir aquí un botó amb enllaç"
3 changes: 2 additions & 1 deletion Resources/translations/en/overview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ overview-field-sustainability-model: 'Sustainability plan'
overview-field-sustainability-model-url: 'URL of your business canvas'
tooltip-project-sustainability-model: 'Present a basic business plan to show how you will ensure project''s sustainability. The business plan should cover the key elements of the business canvas template and be no longer than two pages.'
tooltip-project-sustainability-model-url: 'Add the URL of your <a href="https://canvanizer.com/new/business-model-canvas" target="_blank">business canvas</a>'
overview-field-sign-check: 'Do you have an open signature collection related to the project?'
overview-field-sign-url: "Singature Url"
overview-field-sign-url-action: "Text to call for signature"
overview-field-sign-url-help: "This field allows you to add a redirection to your project signature page"
overview-field-sign-url-help: "If in parallel to the campaign on Goteo you have a signature campaign on another platform, you can add a button with a link here"
3 changes: 2 additions & 1 deletion Resources/translations/es/overview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ tooltip-project-sustainability-model: 'Explica el modelo de sostenibilidad de tu
tooltip-project-sustainability-model-url: 'Agrega una url con tu <a href="https://canvanizer.com/new/business-model-canvas" target="_blank">business canvas</a>'
tooltip-project-sdg: 'Elige los objetivos con los que cumple tu proyecto, intentando seleccionar un máximo de tres.'
tooltip-project-sdg-suggestion: 'A continuación te sugerimos algunos ODS que podrían encajar según el compromiso social seleccionado para tu proyecto, te recomendamos que consultes <a href="https://www.un.org/sustainabledevelopment/es/objetivos-de-desarrollo-sostenible/" target="_blank">aquí</a> su contenido especifico.<br><br>'
overview-field-sign-check: '¿Tienes una recogida de firmas abierta relacionada con el proyecto?'
overview-field-sign-url: "Url de firma"
overview-field-sign-url-action: "Texto para llamar a firmar"
overview-field-sign-url-help: "Este campo permite añadir un salto en la campaña para tu página de firmas del proyecto"
overview-field-sign-url-help: "Si paralelamente a la campaña en Goteo tienes una campaña de recogida de firmas en otra plataforma, puedes añadir aquí un botón con enlace"
17 changes: 15 additions & 2 deletions src/Goteo/Library/Forms/Model/ProjectOverviewForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

use Goteo\Util\Form\Type\TextType;
use Goteo\Util\Form\Type\UrlType;
use Goteo\Util\Form\Type\BooleanType;
use Symfony\Component\Form\Extension\Core\Type\FormType;


class ProjectOverviewForm extends AbstractFormProcessor implements FormProcessorInterface {
Expand Down Expand Up @@ -257,17 +259,28 @@ public function createForm() {
'attr' => ['help' => Text::get('tooltip-project-social-description'), 'rows' => 8]
])

->add('sign_check', BooleanType::class, [
'label' => 'overview-field-sign-check', // 'overview-field-sign-check',
'required' => false,
'data' => $model->sign_url && $model->sign_url_action ? true : false,
'mapped' => false
])

->add('sign_url', UrlType::Class, [
'label' => 'overview-field-sign-url',
'required' => false,
'data' => $model->sign_url,
'row_class' => $model->sign_url && $model->sign_url_action ? '' : 'hidden',
'attr' => [
'pre-help' => Text::get('overview-field-sign-url-help')
'help' => Text::get('overview-field-sign-url-help')
]
])

->add('sign_url_action', TextType::class, [
'label' => 'overview-field-sign-url-action',
'required' => false
'required' => false,
'data' => $model->sign_url_action,
'row_class' => $model->sign_url && $model->sign_url_action ? '' : 'hidden'
])
;

Expand Down
3 changes: 2 additions & 1 deletion tests/Goteo/Model/FaqTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ public function testValidate(Faq $ob) {

public function testCreate() {
self::$data['node'] = get_test_node()->id;
$errors = [];
$ob = new Faq(self::$data);
$this->assertTrue($ob->validate($errors));
$this->assertTrue($ob->validate($errors), implode(',',$errors));
$this->assertTrue($ob->save());
$ob = Faq::get($ob->id);
$this->assertInstanceOf('\Goteo\Model\Faq', $ob);
Expand Down