Commit bdc42488e9b0d297e0773040e077f414b6605c3d
1 parent
2e1f119f
Exists in
master
and in
4 other branches
wiki is done
Showing
8 changed files
with
42 additions
and
7 deletions
Show diff stats
app/assets/stylesheets/main.scss
app/assets/stylesheets/projects.css.scss
app/controllers/wikis_controller.rb
| ... | ... | @@ -42,11 +42,10 @@ class WikisController < ApplicationController |
| 42 | 42 | end |
| 43 | 43 | |
| 44 | 44 | def destroy |
| 45 | - @wiki = @project.wikis.find(params[:id]) | |
| 46 | - @wiki.destroy | |
| 45 | + @wikis = @project.wikis.where(:slug => params[:id]).delete_all | |
| 47 | 46 | |
| 48 | 47 | respond_to do |format| |
| 49 | - format.html { redirect_to wikis_url } | |
| 48 | + format.html { redirect_to project_wiki_path(@project, :index), notice: "Page was successfully deleted" } | |
| 50 | 49 | end |
| 51 | 50 | end |
| 52 | 51 | end | ... | ... |
app/views/wikis/show.html.haml
| 1 | 1 | %h3 |
| 2 | 2 | = @wiki.title |
| 3 | + = link_to edit_project_wiki_path(@project, @wiki), :class => "right btn small" do | |
| 4 | + Edit | |
| 3 | 5 | - if can? current_user, :write_wiki, @project |
| 4 | 6 | = link_to history_project_wiki_path(@project, @wiki), :class => "right btn small" do |
| 5 | 7 | History |
| 6 | - = link_to edit_project_wiki_path(@project, @wiki), :class => "right btn small" do | |
| 7 | - Edit | |
| 8 | +%hr | |
| 8 | 9 | |
| 9 | -= markdown @wiki.content | |
| 10 | += markdown_to_html @wiki.content | |
| 11 | + | |
| 12 | +%p.time Last edited by #{@wiki.user.name}, in #{time_ago_in_words @wiki.created_at} | |
| 13 | +- if can? current_user, :write_wiki, @project | |
| 14 | + = link_to project_wiki_path(@project, @wiki), :confirm => "Are you sure you want to delete this page?", :method => :delete do | |
| 15 | + Delete this page | ... | ... |
config/routes.rb
db/schema.rb
| ... | ... | @@ -159,6 +159,20 @@ ActiveRecord::Schema.define(:version => 20120219193300) do |
| 159 | 159 | t.datetime "updated_at" |
| 160 | 160 | end |
| 161 | 161 | |
| 162 | + create_table "wiki_pages", :force => true do |t| | |
| 163 | + t.string "slug" | |
| 164 | + t.string "title" | |
| 165 | + t.text "content" | |
| 166 | + t.integer "author_id" | |
| 167 | + t.integer "project_id" | |
| 168 | + t.datetime "created_at" | |
| 169 | + t.datetime "updated_at" | |
| 170 | + end | |
| 171 | + | |
| 172 | + add_index "wiki_pages", ["author_id"], :name => "index_wiki_pages_on_author_id" | |
| 173 | + add_index "wiki_pages", ["project_id"], :name => "index_wiki_pages_on_project_id" | |
| 174 | + add_index "wiki_pages", ["slug"], :name => "index_wiki_pages_on_slug", :unique => true | |
| 175 | + | |
| 162 | 176 | create_table "wikis", :force => true do |t| |
| 163 | 177 | t.string "title" |
| 164 | 178 | t.text "content" | ... | ... |