summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorvsizov <vsv2711@gmail.com>2012-02-20 20:16:55 +0300
committervsizov <vsv2711@gmail.com>2012-02-20 20:16:55 +0300
commitbdc42488e9b0d297e0773040e077f414b6605c3d (patch)
tree2270f377f977a2e49987accab4d3199bbf1e6664 /app
parent2e1f119f2288a864ddc1ab49d2a4c47a573b47df (diff)
downloadgitlab-ce-bdc42488e9b0d297e0773040e077f414b6605c3d.tar.gz
wiki is done
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/main.scss2
-rw-r--r--app/assets/stylesheets/projects.css.scss4
-rw-r--r--app/assets/stylesheets/wiki.scss5
-rw-r--r--app/controllers/wikis_controller.rb5
-rw-r--r--app/helpers/wikis_helper.rb5
-rw-r--r--app/views/wikis/show.html.haml12
6 files changed, 27 insertions, 6 deletions
diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss
index df61cc81c5d..841b4307886 100644
--- a/app/assets/stylesheets/main.scss
+++ b/app/assets/stylesheets/main.scss
@@ -65,4 +65,6 @@ $hover: #FDF5D9;
@import "highlight.css.scss";
@import "highlight.black.css.scss";
+@import "wiki.scss";
+
diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss
index b54e12c8742..487925db7af 100644
--- a/app/assets/stylesheets/projects.css.scss
+++ b/app/assets/stylesheets/projects.css.scss
@@ -221,3 +221,7 @@ input.git_clone_url {
width:270px;
background:#fff !important;
}
+
+.span12 hr{
+ margin-top: 2px;
+}
diff --git a/app/assets/stylesheets/wiki.scss b/app/assets/stylesheets/wiki.scss
new file mode 100644
index 00000000000..acc37b969fd
--- /dev/null
+++ b/app/assets/stylesheets/wiki.scss
@@ -0,0 +1,5 @@
+p.time {
+ color: #999;
+ font-size: 90%;
+ margin: 30px 3px 3px 2px;
+}
diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb
index 9a1638f2e4a..544f9887258 100644
--- a/app/controllers/wikis_controller.rb
+++ b/app/controllers/wikis_controller.rb
@@ -42,11 +42,10 @@ class WikisController < ApplicationController
end
def destroy
- @wiki = @project.wikis.find(params[:id])
- @wiki.destroy
+ @wikis = @project.wikis.where(:slug => params[:id]).delete_all
respond_to do |format|
- format.html { redirect_to wikis_url }
+ format.html { redirect_to project_wiki_path(@project, :index), notice: "Page was successfully deleted" }
end
end
end
diff --git a/app/helpers/wikis_helper.rb b/app/helpers/wikis_helper.rb
new file mode 100644
index 00000000000..0c24f57add6
--- /dev/null
+++ b/app/helpers/wikis_helper.rb
@@ -0,0 +1,5 @@
+module WikisHelper
+ def markdown_to_html(text)
+ RDiscount.new(text).to_html.html_safe
+ end
+end
diff --git a/app/views/wikis/show.html.haml b/app/views/wikis/show.html.haml
index 5a4b904534e..63a166fe888 100644
--- a/app/views/wikis/show.html.haml
+++ b/app/views/wikis/show.html.haml
@@ -1,9 +1,15 @@
%h3
= @wiki.title
+ = link_to edit_project_wiki_path(@project, @wiki), :class => "right btn small" do
+ Edit
- if can? current_user, :write_wiki, @project
= link_to history_project_wiki_path(@project, @wiki), :class => "right btn small" do
History
- = link_to edit_project_wiki_path(@project, @wiki), :class => "right btn small" do
- Edit
+%hr
-= markdown @wiki.content
+= markdown_to_html @wiki.content
+
+%p.time Last edited by #{@wiki.user.name}, in #{time_ago_in_words @wiki.created_at}
+- if can? current_user, :write_wiki, @project
+ = link_to project_wiki_path(@project, @wiki), :confirm => "Are you sure you want to delete this page?", :method => :delete do
+ Delete this page