wiki is done

This commit is contained in:
vsizov 2012-02-20 20:16:55 +03:00
parent 2e1f119f22
commit bdc42488e9
8 changed files with 42 additions and 7 deletions

View file

@ -65,4 +65,6 @@ $hover: #FDF5D9;
@import "highlight.css.scss";
@import "highlight.black.css.scss";
@import "wiki.scss";

View file

@ -221,3 +221,7 @@ input.git_clone_url {
width:270px;
background:#fff !important;
}
.span12 hr{
margin-top: 2px;
}

View file

@ -0,0 +1,5 @@
p.time {
color: #999;
font-size: 90%;
margin: 30px 3px 3px 2px;
}

View file

@ -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

View file

@ -0,0 +1,5 @@
module WikisHelper
def markdown_to_html(text)
RDiscount.new(text).to_html.html_safe
end
end

View file

@ -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

View file

@ -58,7 +58,7 @@ Gitlab::Application.routes.draw do
resources :wikis, :only => [:show, :edit, :destroy, :create] do
member do
get "history"
get "history"
end
end

View file

@ -159,6 +159,20 @@ ActiveRecord::Schema.define(:version => 20120219193300) do
t.datetime "updated_at"
end
create_table "wiki_pages", :force => true do |t|
t.string "slug"
t.string "title"
t.text "content"
t.integer "author_id"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "wiki_pages", ["author_id"], :name => "index_wiki_pages_on_author_id"
add_index "wiki_pages", ["project_id"], :name => "index_wiki_pages_on_project_id"
add_index "wiki_pages", ["slug"], :name => "index_wiki_pages_on_slug", :unique => true
create_table "wikis", :force => true do |t|
t.string "title"
t.text "content"