Showing 8 changed files with 47 additions and 11 deletions
+3 -1
CHANGES
... ...
@@ -4,7 +4,9 @@
4 4
     All your pull requests is removed. Please create Pull request again by the following command.
5 5
     
6 6
       old/fix_v2_pull_request data/gitprep.db
7
-
7
+  
8
+  - support markdown table
9
+  
8 10
 2.2.1 (2016-06-14)
9 11
   - fix _search page error bug.
10 12
 2.2 (2016-06-04)
+3
lib/Gitprep.pm
... ...
@@ -429,6 +429,9 @@ sub startup {
429 429
             
430 430
             # Issue
431 431
             $r->get('/issues' => sub { shift->render_maybe('/issues') })->to(tab => 'issues');
432
+
433
+            # New issue
434
+            $r->get('/issues/new' => sub { shift->render_maybe('/issues/new') })->to(tab => 'issues');
432 435
             
433 436
             # Pull requests
434 437
             $r->get('/pulls' => sub { shift->render_maybe('/pulls') })->to(tab => 'pulls');
+9
lib/Gitprep/API.pm
... ...
@@ -2,9 +2,18 @@ package Gitprep::API;
2 2
 use Mojo::Base -base;
3 3
 
4 4
 use Digest::MD5 'md5_hex';
5
+use Text::Markdown::Hoedown qw(HOEDOWN_EXT_FENCED_CODE HOEDOWN_EXT_TABLES);
5 6
 
6 7
 has 'cntl';
7 8
 
9
+sub markdown {
10
+  my ($self, $text) = @_;
11
+
12
+  my $text_e = Text::Markdown::Hoedown::markdown($text, extensions => HOEDOWN_EXT_FENCED_CODE|HOEDOWN_EXT_TABLES);
13
+  
14
+  return $text_e;
15
+}
16
+
8 17
 sub age_string {
9 18
   my ($self, $epoch_time) = @_;
10 19
   
+1 -3
templates/blob.html.ep
... ...
@@ -1,6 +1,4 @@
1 1
 <%
2
-  use Text::Markdown::Hoedown;
3
-  
4 2
   # API
5 3
   my $api = gitprep_api;
6 4
 
... ...
@@ -119,7 +117,7 @@
119 117
           my $readme = join "\n", @$lines;
120 118
           $readme =~ s#^(\[.*\]:)(?!\s*https?://)\s*(\S*)#{"$1 " . url_for("/$user/$project/raw/$rev/$2")}#mge;
121 119
           $readme =~ s#^(!\[.*\]\()(?!https?://)(\S*)#{$1 . url_for("/$user/$project/raw/$rev/$2")}#mge;
122
-          my $readme_e = Text::Markdown::Hoedown::markdown($readme, extensions => HOEDOWN_EXT_FENCED_CODE);
120
+          my $readme_e = $api->markdown($readme);
123 121
         %>
124 122
         <div class="readme-frame">
125 123
           <div class="markdown-body">
+3 -2
templates/include/readme.html.ep
... ...
@@ -1,6 +1,7 @@
1 1
 <%
2 2
   use Mojo::ByteStream ();
3
-  use Text::Markdown::Hoedown;
3
+  
4
+  my $api = gitprep_api;
4 5
   
5 6
   my $dir = stash('dir');
6 7
   
... ...
@@ -24,7 +25,7 @@
24 25
       my $readme = join "\n", @$lines;
25 26
       $readme =~ s#^(\[.*\]:)(?!\s*https?://)\s*(\S*)#{"$1 " . url_for("/$user/$project/raw/$rev/$2")}#mge;
26 27
       $readme =~ s#^(!\[.*\]\()(?!https?://)(\S*)#{$1 . url_for("/$user/$project/raw/$rev/$2")}#mge;
27
-      $readme_e = Text::Markdown::Hoedown::markdown($readme, extensions => HOEDOWN_EXT_FENCED_CODE);
28
+      $readme_e = $api->markdown($readme);
28 29
     }
29 30
   }
30 31
 %>
+3 -3
templates/issues.html.ep
... ...
@@ -42,15 +42,15 @@
42 42
       {'issue.open' => 0, pull_request => 0, 'project.id' => $project_id}
43 43
     ]
44 44
   )->value;
45
-%>
46 45
 
47
-% layout 'common', title => "Pull Requests Tags \x{30fb} $user_id/$project_id";
46
+  layout 'common', title => "Issues - $user_id/$project_id";
47
+%>
48 48
   
49 49
   %= include '/include/header';
50 50
   
51 51
   <div class="container">
52 52
     <div class="pulls-button-container">
53
-      <a href="<%= url_for("/$user_id/$project_id/compare") %>" class="btn btn-success">New issue</a>
53
+      <a href="<%= url_for("/$user_id/$project_id/issues/new") %>" class="btn btn-success">New issue</a>
54 54
     </div>
55 55
     <div class="pulls">
56 56
       <div class="pulls-header">
+25
templates/issues/new.html.ep
... ...
@@ -0,0 +1,25 @@
1
+<%
2
+  # API
3
+  my $api = gitprep_api;
4
+
5
+  # Parameters
6
+  my $user_id = param('user');
7
+  my $project_id = param('project');
8
+  my $issue_number = param('number');
9
+
10
+  layout 'common', title => "New issue - $user_id/$project_id";
11
+%>
12
+    <div class="compare-open-pull-request">
13
+      <form action="<%= url_for %>" method="post">
14
+        <%= hidden_field op => 'create-pull-request' %>
15
+        <div class="compare-open-pull-request-title">
16
+          <%= text_field 'title' %>
17
+        </div>
18
+        <div class="compare-open-pull-request-message">
19
+          <%= text_area 'message' %>
20
+        </div>
21
+        <div class="compare-open-pull-request-button">
22
+          <%= submit_button 'Create pull request', class => 'btn btn-success' %>
23
+        </div>
24
+      </form>
25
+    </div>
-2
templates/tree.html.ep
... ...
@@ -1,6 +1,4 @@
1 1
 <%
2
-  use Text::Markdown::Hoedown;
3
-
4 2
   my $state;
5 3
 
6 4
   # API