Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: duckduckgo/community-platform
...
head fork: duckduckgo/community-platform
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
View
22 lib/DDGC/Web/Controller/Admin/Help.pm
@@ -12,7 +12,27 @@ sub base :Chained('/admin/base') :PathPart('help') :CaptureArgs(0) {
sub index :Chained('base') :PathPart('') :Args(0) {
my ( $self, $c ) = @_;
- $c->stash->{helps} = [$c->model('DB::Language')->search({})->all];
+ $c->stash->{help} = [$c->model('DB::Help')->search({})->all];
+ my @keys = qw/ key name description /;
+ for my $l (@{$c->stash->{help}}) {
+ my $p = 'help_'.$l->id.'_';
+ if ($c->req->params->{$p.'delete'}) {
+ $l->delete;
+ } elsif ($c->req->params->{save_help}) {
+ for (@keys) {
+ $l->$_($c->req->params->{$p.$_}) if $c->req->params->{$p.$_};
+ }
+ $l->update;
+ }
+ }
+ my %new;
+ if ($c->req->params->{save_help}) {
+ for (@keys) {
+ $new{$_} = $c->req->params->{'help_0_'.$_} if $c->req->params->{'help_0_'.$_};
+ }
+ push @{$c->stash->{help}}, $c->model('DB::Help')->create(\%new) if (%new);
+ }
+
}
__PACKAGE__->meta->make_immutable;
View
15 templates/admin/help/index.tt
@@ -0,0 +1,15 @@
+<form action="<@ u('Admin::Help','index') @>" method="post" name="helpform" id="helpform">
+ <div class="mybox">
+ <@ FOREACH list_help IN help @>
+ <p>#<@ list_help.id @></p>
+ <@ INCLUDE admin/help/form.tt help=list_help @>
+ <p><input type="submit" value="Delete" name="help_<@ list_help.id @>_delete" /></p>
+ <@ END @>
+ </div>
+ <div class="mybox">
+ <@ INCLUDE admin/help/form.tt @>
+ <div>
+ <input type="submit" value="Save Help" name="save_help" />
+ </div>
+ </div>
+</form>

No commit comments for this range

Something went wrong with that request. Please try again.