Skip to content

Commit 537f9da

Browse files
committed
Preview now via POST, closes #63
Improving style, refs #30
1 parent dfd1105 commit 537f9da

File tree

10 files changed

+84
-65
lines changed

10 files changed

+84
-65
lines changed

composer.lock

Lines changed: 33 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Net/Dontdrinkandroot/Gitki/BaseBundle/Controller/WikiController.php

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace Net\Dontdrinkandroot\Gitki\BaseBundle\Controller;
55

6-
76
use GitWrapper\GitException;
87
use Net\Dontdrinkandroot\Gitki\BaseBundle\Exception\PageLockedException;
98
use Net\Dontdrinkandroot\Utils\Path\DirectoryPath;
@@ -155,7 +154,7 @@ public function showPageAction(Request $request, FilePath $path)
155154
*/
156155
public function previewMarkdownAction(Request $request, FilePath $path)
157156
{
158-
$markdown = $request->query->get('markdown');
157+
$markdown = $request->request->get('markdown');
159158
$html = $this->getWikiService()->preview($path, $markdown);
160159

161160
return new Response($html);
@@ -239,7 +238,7 @@ public function editPageAction(Request $request, FilePath $path)
239238
'save' => array('type' => 'submit', 'options' => array('label' => 'Save')),
240239
'cancel' => array(
241240
'type' => 'submit',
242-
'options' => array('label' => 'Cancel', 'attr' => array('type' => 'default'))
241+
'options' => array('label' => 'Cancel', 'button_class' => 'default')
243242
),
244243
)
245244
)
@@ -278,7 +277,6 @@ public function editPageAction(Request $request, FilePath $path)
278277
} catch (GitException $e) {
279278
throw $e;
280279
}
281-
282280
} else {
283281

284282
$content = null;
@@ -355,7 +353,6 @@ public function renameFileAction(Request $request, FilePath $path)
355353
)
356354
);
357355
}
358-
359356
} else {
360357
$form->setData(array('newpath' => $path->toAbsoluteUrlString()));
361358
}
@@ -366,7 +363,6 @@ public function renameFileAction(Request $request, FilePath $path)
366363
);
367364
}
368365

369-
370366
/**
371367
* @param Request $request
372368
* @param FilePath $path
@@ -569,7 +565,6 @@ public function addPageAction(Request $request, DirectoryPath $path)
569565
)
570566
);
571567
}
572-
573568
}
574569

575570
return $this->render(
@@ -621,7 +616,6 @@ public function addFolderAction(Request $request, DirectoryPath $path)
621616
)
622617
);
623618
}
624-
625619
}
626620

627621
return $this->render(
@@ -637,16 +631,7 @@ public function addFolderAction(Request $request, DirectoryPath $path)
637631
*/
638632
public function historyAction()
639633
{
640-
$history = [];
641-
try {
642-
$history = $this->getWikiService()->getHistory(20);
643-
} catch (GitException $e) {
644-
if ($e->getMessage() === "fatal: bad default revision 'HEAD'\n") {
645-
/* swallow, history not there yet */
646-
} else {
647-
throw $e;
648-
}
649-
}
634+
$history = $this->getWikiService()->getHistory(20);
650635

651636
return $this->render('DdrGitkiBaseBundle:Wiki:history.html.twig', array('history' => $history));
652637
}
@@ -682,6 +667,4 @@ protected function checkPreconditions(Request $request, $path)
682667
throw new AccessDeniedHttpException();
683668
}
684669
}
685-
686-
687670
}

src/Net/Dontdrinkandroot/Gitki/BaseBundle/Resources/public/css/custom.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ div.dropdown {
4646
}
4747

4848
.breadcrumb {
49+
4950
a {
5051
color: @gray-dark;
5152
}
@@ -57,4 +58,10 @@ div.dropdown {
5758

5859
.margin-bottom-none {
5960
margin-bottom: 0px;
61+
}
62+
63+
/* Highlight JS customizations */
64+
65+
.hljs {
66+
background: @gray-lightestest;
6067
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
.navbar{display:none}
22
a{color:#000}
3+
.toc{display:none}
4+
table{width:100%}
5+
table,th,td{border:1px solid #000}
36
.wiki .breadcrumb{display:none}
47
.wiki .global-actions,.wiki .item-actions{display:none}

src/Net/Dontdrinkandroot/Gitki/BaseBundle/Resources/public/css/print.less

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ a {
66
color: black;
77
}
88

9+
.toc {
10+
display: none;
11+
}
12+
13+
table {
14+
width: 100%;
15+
}
16+
17+
table, th, td {
18+
border: 1px solid black;
19+
}
20+
921
.wiki {
1022

1123
.breadcrumb {

src/Net/Dontdrinkandroot/Gitki/BaseBundle/Resources/public/css/style.css

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Net/Dontdrinkandroot/Gitki/BaseBundle/Resources/public/css/variables.less

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,9 @@
4040
@navbar-default-link-hover-color: @gray-darker;
4141

4242
@breadcrumb-active-color: @gray;
43-
@breadcrumb-bg: transparent;
43+
@breadcrumb-bg: transparent;
44+
45+
@code-bg: @gray-lightestest;
46+
@pre-bg: @gray-lightestest;
47+
48+
@blockquote-font-size: @font-size-base;

src/Net/Dontdrinkandroot/Gitki/BaseBundle/Resources/views/Wiki/page.edit.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
4141
this.update = function () {
4242
$('.loading-indicator .spinner').show();
43-
$.get(previewUrl, {'markdown': input.val()})
43+
$.post(previewUrl, {'markdown': input.val()})
4444
.done(function (data) {
4545
preview.html(data);
4646
$('.loading-indicator .spinner').hide();

src/Net/Dontdrinkandroot/Gitki/BaseBundle/Resources/views/Wiki/page.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@
8888
<script>hljs.initHighlightingOnLoad();</script>
8989
{% endblock %}
9090
{% block stylesheet %}
91-
{{ parent() }}
9291
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/styles/default.min.css">
92+
{{ parent() }}
9393
{% endblock %}

0 commit comments

Comments
 (0)