Feedback HTML views added and fixes made
This commit is contained in:
parent
baea01e8b5
commit
09f9cf9d48
6 changed files with 110 additions and 5 deletions
|
@ -177,6 +177,9 @@ sub startup {
|
||||||
$admin_routes->get('/organisations/pending/:id')->to('admin-organisations#pending_read');
|
$admin_routes->get('/organisations/pending/:id')->to('admin-organisations#pending_read');
|
||||||
$admin_routes->get('/organisations/pending/:id/approve')->to('admin-organisations#pending_approve');
|
$admin_routes->get('/organisations/pending/:id/approve')->to('admin-organisations#pending_approve');
|
||||||
|
|
||||||
|
$admin_routes->get('/feedback')->to('admin-feedback#index');
|
||||||
|
$admin_routes->get('/feedback/:id')->to('admin-feedback#read');
|
||||||
|
|
||||||
# my $user_routes = $r->under('/')->to('root#under');
|
# my $user_routes = $r->under('/')->to('root#under');
|
||||||
|
|
||||||
# $user_routes->get('/home')->to('root#home');
|
# $user_routes->get('/home')->to('root#home');
|
||||||
|
|
29
lib/Pear/LocalLoop/Controller/Admin/Feedback.pm
Normal file
29
lib/Pear/LocalLoop/Controller/Admin/Feedback.pm
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
package Pear::LocalLoop::Controller::Admin::Feedback;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
has result_set => sub {
|
||||||
|
my $c = shift;
|
||||||
|
return $c->schema->resultset('Feedback');
|
||||||
|
};
|
||||||
|
|
||||||
|
sub index {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $feedback_rs = $c->result_set;
|
||||||
|
$c->stash( feedbacks => [ $feedback_rs->all ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub read {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $id = $c->param('id');
|
||||||
|
|
||||||
|
if ( my $feedback = $c->result_set->find($id) ) {
|
||||||
|
$c->stash( feedback => $feedback );
|
||||||
|
} else {
|
||||||
|
$c->flash( error => 'No Feedback found' );
|
||||||
|
$c->redirect_to( '/admin/feedback' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
|
@ -45,7 +45,6 @@ sub post_feedback {
|
||||||
my $user = $user_rs->find({'email' => $validation->param('email')});
|
my $user = $user_rs->find({'email' => $validation->param('email')});
|
||||||
|
|
||||||
$c->schema->resultset('Feedback')->create({
|
$c->schema->resultset('Feedback')->create({
|
||||||
email => $validation->param('email'),
|
|
||||||
user => $user,
|
user => $user,
|
||||||
feedbacktext => $validation->param('feedbacktext'),
|
feedbacktext => $validation->param('feedbacktext'),
|
||||||
app_name => $validation->param('app_name'),
|
app_name => $validation->param('app_name'),
|
||||||
|
|
|
@ -7,18 +7,24 @@ use base 'DBIx::Class::Core';
|
||||||
|
|
||||||
__PACKAGE__->table("feedback");
|
__PACKAGE__->table("feedback");
|
||||||
|
|
||||||
|
__PACKAGE__->load_components(qw/
|
||||||
|
InflateColumn::DateTime
|
||||||
|
TimeStamp
|
||||||
|
/);
|
||||||
|
|
||||||
__PACKAGE__->add_columns(
|
__PACKAGE__->add_columns(
|
||||||
"id",
|
"id",
|
||||||
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
|
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
|
||||||
"email" => {
|
|
||||||
data_type => "text",
|
|
||||||
is_nullable => 0,
|
|
||||||
},
|
|
||||||
"user_id" => {
|
"user_id" => {
|
||||||
data_type => "integer",
|
data_type => "integer",
|
||||||
is_foreign_key => 1,
|
is_foreign_key => 1,
|
||||||
is_nullable => 0,
|
is_nullable => 0,
|
||||||
},
|
},
|
||||||
|
"submitted_at" => {
|
||||||
|
data_type => "datetime",
|
||||||
|
is_nullable => 0,
|
||||||
|
set_on_create => 1,
|
||||||
|
},
|
||||||
"feedbacktext" => {
|
"feedbacktext" => {
|
||||||
data_type => "text",
|
data_type => "text",
|
||||||
is_nullable => 0,
|
is_nullable => 0,
|
||||||
|
|
25
templates/admin/feedback/index.html.ep
Normal file
25
templates/admin/feedback/index.html.ep
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
% layout 'admin';
|
||||||
|
% title 'Feedback';
|
||||||
|
% content_for javascript => begin
|
||||||
|
% end
|
||||||
|
% if ( my $error = flash 'error' ) {
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
<strong>Error!</strong> <%= $error %>
|
||||||
|
</div>
|
||||||
|
% } elsif ( my $success = flash 'success' ) {
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
<strong>Success!</strong> <%= $success %>
|
||||||
|
</div>
|
||||||
|
% }
|
||||||
|
<div class="list-group">
|
||||||
|
% for my $feedback (@$feedbacks) {
|
||||||
|
<a href="<%= url_for . '/' . $feedback->id %>" class="list-group-item list-group-item-action">
|
||||||
|
<div>
|
||||||
|
%= $feedback->user->email
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
%= $feedback->submitted_at
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
% }
|
||||||
|
</div>
|
43
templates/admin/feedback/read.html.ep
Normal file
43
templates/admin/feedback/read.html.ep
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
% layout 'admin';
|
||||||
|
% title 'Feedback';
|
||||||
|
% content_for javascript => begin
|
||||||
|
% end
|
||||||
|
% if ( my $error = flash 'error' ) {
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
<strong>Error!</strong> <%= $error %>
|
||||||
|
</div>
|
||||||
|
% } elsif ( my $success = flash 'success' ) {
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
<strong>Success!</strong> <%= $success %>
|
||||||
|
</div>
|
||||||
|
% }
|
||||||
|
<form action="<%= url_for %>" method="post">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="email">Email Address</label>
|
||||||
|
<input id="email" type="text" class="form-control" placeholder="Email" name="email" value="<%= $feedback->user->email %>" disabled>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="joindate">Submitted At</label>
|
||||||
|
<input id="submitted_at" type="datetime" class="form-control" placeholder="Date" name="submitted_at" value="<%= $feedback->submitted_at %>" disabled>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="feedback">Feedback</label>
|
||||||
|
<input id="feedback" type="text" class="form-control" placeholder="Feedback" name="feedback" value="<%= $feedback->feedbacktext %>" disabled>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="app_name">App Name</label>
|
||||||
|
<input id="app_name" type="text" class="form-control" placeholder="App Name" name="app_name" value="<%= $feedback->app_name %>" disabled>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="package_name">Package Name</label>
|
||||||
|
<input id="package_name" type="text" class="form-control" placeholder="Package Name" name="package_name" value="<%= $feedback->package_name %>" disabled>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="version_code">Version Code</label>
|
||||||
|
<input id="version_code" type="text" class="form-control" placeholder="Version Code" name="version_code" value="<%= $feedback->version_code %>" disabled>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="version_number">Version Number</label>
|
||||||
|
<input id="version_number" type="text" class="form-control" placeholder="Version Number" name="feedback" value="<%= $feedback->version_number %>" disabled>
|
||||||
|
</div>
|
||||||
|
</form>
|
Reference in a new issue