Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-kimoto committed May 13, 2017
1 parent 4a2121f commit 4b74d53
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/Gitprep.pm
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ sub startup {
$r->any('/');

# Create page
$r->any('/_new')->to(create => 1);
$r->any('/_new')->to(new => 1);

# Show pages
$r->any('/_pages')->to('list-pages' => 1);
Expand Down
26 changes: 14 additions & 12 deletions templates/wiki.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
my $user_id = param('user');
my $project_id = param('project');
my $title = param('title');
my $create = param('create');
my $new = param('new');
my $edit = param('edit');
my $list_pages = param('list-pages');

Expand Down Expand Up @@ -39,7 +39,7 @@
if ($self->req->method eq 'POST') {
my $op = param('op') // '';

if ($op eq 'create') {
if ($op eq 'new') {

my $title = param('title');
my $content = param('content');
Expand Down Expand Up @@ -80,8 +80,8 @@
my $content_sidebar_md;
my $content_footer_md;
if ($wiki) {
if ($create) {
$display = 'create';
if ($new) {
$display = 'new';
}
else {
if ($edit) {
Expand All @@ -90,7 +90,7 @@
$display = 'edit';
}
else {
$display = 'create';
$display = 'new';
}
}
elsif ($list_pages) {
Expand Down Expand Up @@ -151,7 +151,7 @@
}
}
else {
$display = 'create';
$display = 'new';
}
}
}
Expand Down Expand Up @@ -246,7 +246,7 @@
</a>
</li>
% }
% if ($display ne 'create') {
% if ($display ne 'new' && $display ne 'init') {
<li>
<a href="<%= url_for("/$user_id/$project_id/wiki/_new") %>">
<button class="btn btn-green btn-new">Create page</button>
Expand All @@ -260,14 +260,16 @@
<div class="wiki-container">
% if ($display eq 'init') {
<h1 class="topic1">Wiki</h1>
<form action="<%= url_for("/$user_id/$project_id/wiki/_new") %>">
<%= submit_button 'Create Wiki', class => 'btn btn-green btn-new' %>
</form>
% } elsif ($display eq 'create' || $display eq 'edit') {
<div>
<a href="<%= url_for("/$user_id/$project_id/wiki/_new") %>">
<button class="btn btn-green btn-new">Create page</button>
</a>
</div>
% } elsif ($display eq 'new' || $display eq 'edit') {
<%
my $h1_text;
my $submit_button_title;
if ($display eq 'create') {
if ($display eq 'new') {
$h1_text = 'Create page';
$submit_button_title = 'Create page';
}
Expand Down

0 comments on commit 4b74d53

Please sign in to comment.