[spalenque] - #7812 *WIP

This commit is contained in:
santipalenque 2014-12-03 13:39:24 -03:00 committed by Sebastian Marcet
parent 42f2681f9f
commit a541409705
10 changed files with 40 additions and 41 deletions

View File

@ -92,6 +92,7 @@ final class EventRegistrationRequestPage_Controller extends Page_Controller {
if(class_exists('SpamProtectorManager')) {
SpamProtectorManager::update_form($form);
}
return $form;
}
@ -106,6 +107,7 @@ final class EventRegistrationRequestPage_Controller extends Page_Controller {
try{
$this->event_registration_request_manager->registerEventRegistrationRequest($data);
Session::clear("FormInfo.Form_EventRegistrationRequestForm.data");
$form->clearMessage();
return $this->redirect($this->Link('?saved=1'));
}
catch(EntityValidationException $ex1){

View File

@ -1,4 +1,5 @@
<?
<?php
/**
* Copyright 2014 Openstack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -13,34 +13,27 @@
**/
class FeedbackForm extends Form {
function __construct($controller, $name) {
$FeedbackField = new TextAreaField('Content', 'My Feedback About This Page');
function __construct($controller, $name) {
$FeedbackField = new TextareaField('Content', 'My Feedback About This Page');
$fields = new FieldList(
$FeedbackField
);
$tellUsButton = new FormAction('submitFeedback', 'Tell Us');
$tellUsButton->addExtraClass('button');
$actions = new FieldList(
$tellUsButton
);
parent::__construct($controller, $name, $fields, $actions);
}
function forTemplate() {
return $this->renderWith(array(
$this->class,
'Form'
));
}
function submitFeedback($data, $form) {
function submitFeedback(array $data, Form $form) {
// TRUE if the submission contains a link. Crude spam mitigation.
$ContainsLink = strpos($data['Content'], "http://") !== false;
@ -52,6 +45,7 @@ class FeedbackForm extends Form {
// Tie the URL of the current page to the feedback submission
$page = Director::get_current_page();
$FeedbackSubmission->Page = $page->Link();
//$FeedbackSubmission->write();
//Send email alert about submission
$Subject = "New Website Feedback Submission";
@ -63,7 +57,7 @@ class FeedbackForm extends Form {
// Redirect back to the page with a success message
$form->controller->setMessage('Success', 'Thanks for providing feedback to improve the OpenStack website!');
$form->controller->redirectBack();
} else {
$form->controller->setMessage('Error', "Oops! It doesn't look like you provided any feedback. Please check the form and try again.");
@ -71,4 +65,11 @@ class FeedbackForm extends Form {
}
}
function forTemplate() {
return $this->renderWith(array(
$this->class,
'Form'
));
}
}

View File

@ -122,7 +122,7 @@ class HomePage_Controller extends Page_Controller {
$item->pubDate = date("D, M jS Y", strtotime($item->pubDate));
}
return $result->limit(0,$limit);
return $result->limit($limit,0);
}
function PastEvents($num=1) {

View File

@ -202,7 +202,7 @@ class Page_Controller extends ContentController {
*/
private static $allowed_actions = array (
'logout',
'FeedbackForm'
'FeedbackForm',
);
@ -326,7 +326,7 @@ class Page_Controller extends ContentController {
));
}
public function getMessage() {
public function getMessage() {
if($message = Session::get('Message')){
Session::clear('Message');
$array = new ArrayData($message);

View File

@ -5,7 +5,6 @@ label.error, .recaptcha .message.validation
color: #fff;
padding: 5px;
margin: 0;
width: 100%;
-webkit-border-radius: 05px;
-moz-border-radius: 05px;
border-radius: 05px;

View File

@ -120,8 +120,8 @@ jQuery(document).ready(function($) {
GenderField.on('change',function(){
var value = $(this).val();
if(value == 'Specify'){
$('#GenderSpecify').fadeIn();
GenderSpecify.fadeIn();
$('#GenderSpecify').removeClass('hide').fadeIn();
GenderSpecify.removeClass('hide').fadeIn();
} else {
$('#GenderSpecify').fadeOut();
GenderSpecify.fadeOut();

View File

@ -113,8 +113,8 @@ jQuery(document).ready(function($) {
GenderField.on('change',function(){
var value = $(this).val();
if(value == 'Specify'){
$('#GenderSpecify').fadeIn();
GenderSpecify.fadeIn();
$('#GenderSpecify').removeClass('hide').fadeIn();
GenderSpecify.removeClass('hide').fadeIn();
} else {
$('#GenderSpecify').fadeOut();
GenderSpecify.fadeOut();

View File

@ -1,9 +1,11 @@
<form class="form-inline" $FormAttributes>
<div class="form-group">
<div>
<input class="feedback-input" type="input" placeholder="Give Us Your Feedback On This Page" id="FeedbackForm_FeedbackForm_Content" name="Content">
$dataFieldByName(SecurityID)
<button type="submit" class="feedback-btn" id="FeedbackForm_FeedbackForm_action_submitFeedback" type="submit" name="action_submitFeedback">Submit</button>
<div class="form-group">
<div>
<fieldset style="border:none;margin:0;padding:0;">
<input class="feedback-input" type="input" placeholder="Give Us Your Feedback On This Page" id="FeedbackForm_FeedbackForm_Content" name="Content">
$Fields.dataFieldByName(SecurityID)
<button type="submit" class="feedback-btn" id="FeedbackForm_FeedbackForm_action_submitFeedback" name="action_submitFeedback">Submit</button>
</fieldset>
</div>
</div>
</div>
</form>
</form>

View File

@ -50,14 +50,8 @@
<% include Navigation %>
<!-- Page Content -->
<% if BootstrapConverted %>
$Message
$Layout
<% else %>
<div class="container">
$Layout
</div>
<% end_if %>
$Message
$Layout
<% include Footer %>