Wiki: design fixed
This commit is contained in:
parent
4c1b8558df
commit
57271da612
5 changed files with 18 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
||||||
class WikisController < ApplicationController
|
class WikisController < ApplicationController
|
||||||
before_filter :project
|
before_filter :project
|
||||||
|
before_filter :add_project_abilities
|
||||||
layout "project"
|
layout "project"
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -5,6 +5,7 @@ class Ability
|
||||||
when "Issue" then issue_abilities(object, subject)
|
when "Issue" then issue_abilities(object, subject)
|
||||||
when "Note" then note_abilities(object, subject)
|
when "Note" then note_abilities(object, subject)
|
||||||
when "Snippet" then snippet_abilities(object, subject)
|
when "Snippet" then snippet_abilities(object, subject)
|
||||||
|
when "Wiki" then wiki_abilities(object, subject)
|
||||||
else []
|
else []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -26,12 +27,14 @@ class Ability
|
||||||
:write_issue,
|
:write_issue,
|
||||||
:write_snippet,
|
:write_snippet,
|
||||||
:write_merge_request,
|
:write_merge_request,
|
||||||
:write_note
|
:write_note,
|
||||||
|
:write_wiki
|
||||||
] if project.allow_write_for?(user)
|
] if project.allow_write_for?(user)
|
||||||
|
|
||||||
rules << [
|
rules << [
|
||||||
:modify_issue,
|
:modify_issue,
|
||||||
:modify_snippet,
|
:modify_snippet,
|
||||||
|
:modify_wiki,
|
||||||
:admin_project,
|
:admin_project,
|
||||||
:admin_issue,
|
:admin_issue,
|
||||||
:admin_snippet,
|
:admin_snippet,
|
||||||
|
@ -48,7 +51,7 @@ class Ability
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
[:issue, :note, :snippet, :merge_request].each do |name|
|
[:issue, :note, :snippet, :merge_request, :wiki].each do |name|
|
||||||
define_method "#{name}_abilities" do |user, subject|
|
define_method "#{name}_abilities" do |user, subject|
|
||||||
if subject.author == user
|
if subject.author == user
|
||||||
[
|
[
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
- @wiki.errors.full_messages.each do |msg|
|
- @wiki.errors.full_messages.each do |msg|
|
||||||
%li= msg
|
%li= msg
|
||||||
|
|
||||||
.field
|
.clearfix
|
||||||
= f.label :title
|
= f.label :title
|
||||||
= f.text_field :title
|
.input= f.text_field :title, :class => :xxlarge
|
||||||
= f.hidden_field :slug
|
= f.hidden_field :slug
|
||||||
.field
|
.clearfix
|
||||||
= f.label :content
|
= f.label :content
|
||||||
= f.text_area :content
|
.input= f.text_area :content, :class => :xxlarge
|
||||||
.actions
|
.actions
|
||||||
= f.submit 'Save'
|
= f.submit 'Save', :class => "primary btn"
|
||||||
|
= link_to "Cancel", project_wiki_path(@project, :index), :class => "btn"
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
%h1 Editing page
|
%h1 Editing page
|
||||||
|
|
||||||
= render 'form'
|
= render 'form'
|
||||||
|
|
||||||
= link_to 'Show', [@project, @wiki]
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
%h3
|
||||||
|
= @wiki.title
|
||||||
|
- if can? current_user, :write_wiki, @project
|
||||||
|
= link_to edit_project_wiki_path(@project, @wiki), :class => "right btn small" do
|
||||||
|
Edit
|
||||||
|
|
||||||
%p#notice= notice
|
%p#notice= notice
|
||||||
|
|
||||||
%h3= @wiki.title
|
|
||||||
= @wiki.content
|
= @wiki.content
|
||||||
|
|
||||||
%br
|
%br
|
||||||
= link_to 'Edit', edit_project_wiki_path(@project, @wiki)
|
|
||||||
|
|
Loading…
Reference in a new issue