summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-09 14:35:01 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-09 14:35:01 +0300
commitb27c42be870f55667eaa8a7152aa9e70e4e32a29 (patch)
treeb5cd924a13f74f2b5e52aa8630f81f6d3b3f4b6a
parent9a02e27b84589856b41e171493aa441add497ac1 (diff)
downloadgitlab-ce-b27c42be870f55667eaa8a7152aa9e70e4e32a29.tar.gz
Rename wiki variables
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/controllers/projects/wikis_controller.rb48
-rw-r--r--app/views/projects/wikis/_form.html.haml16
-rw-r--r--app/views/projects/wikis/_main_links.html.haml6
-rw-r--r--app/views/projects/wikis/edit.html.haml6
-rw-r--r--app/views/projects/wikis/git_access.html.haml8
-rw-r--r--app/views/projects/wikis/history.html.haml8
-rw-r--r--app/views/projects/wikis/show.html.haml10
7 files changed, 53 insertions, 49 deletions
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb
index 797f3d3dd41..9444d5a6b77 100644
--- a/app/controllers/projects/wikis_controller.rb
+++ b/app/controllers/projects/wikis_controller.rb
@@ -1,62 +1,67 @@
+require 'project_wiki'
+
class Projects::WikisController < Projects::ApplicationController
before_filter :authorize_read_wiki!
before_filter :authorize_write_wiki!, only: [:edit, :create, :history]
before_filter :authorize_admin_wiki!, only: :destroy
- before_filter :load_gollum_wiki
+ before_filter :load_project_wiki
def pages
- @wiki_pages = @gollum_wiki.pages
+ @wiki_pages = @project_wiki.pages
end
def show
- @wiki = @gollum_wiki.find_page(params[:id], params[:version_id])
+ @page = @project_wiki.find_page(params[:id], params[:version_id])
- if @wiki
+ if @page
render 'show'
else
return render('empty') unless can?(current_user, :write_wiki, @project)
- @wiki = WikiPage.new(@gollum_wiki)
- @wiki.title = params[:id]
+ @page = WikiPage.new(@project_wiki)
+ @page.title = params[:id]
render 'edit'
end
end
def edit
- @wiki = @gollum_wiki.find_page(params[:id])
+ @page = @project_wiki.find_page(params[:id])
end
def update
- @wiki = @gollum_wiki.find_page(params[:id])
+ @page = @project_wiki.find_page(params[:id])
return render('empty') unless can?(current_user, :write_wiki, @project)
- if @wiki.update(content, format, message)
- redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.'
+ if @page.update(content, format, message)
+ redirect_to [@project, @page], notice: 'Wiki was successfully updated.'
else
render 'edit'
end
end
def create
- @wiki = WikiPage.new(@gollum_wiki)
+ @page = WikiPage.new(@project_wiki)
- if @wiki.create(wiki_params)
- redirect_to project_wiki_path(@project, @wiki), notice: 'Wiki was successfully updated.'
+ if @page.create(wiki_params)
+ redirect_to project_wiki_path(@project, @page), notice: 'Wiki was successfully updated.'
else
render action: "edit"
end
end
def history
- @wiki = @gollum_wiki.find_page(params[:id])
+ @page = @project_wiki.find_page(params[:id])
- redirect_to(project_wiki_path(@project, :home), notice: "Page not found") unless @wiki
+ unless @page
+ redirect_to(project_wiki_path(@project, :home), notice: "Page not found")
+ end
end
def destroy
- @wiki = @gollum_wiki.find_page(params[:id])
- @wiki.delete if @wiki
+ @page = @project_wiki.find_page(params[:id])
+ @page.delete if @page
+
redirect_to project_wiki_path(@project, :home), notice: "Page was successfully deleted"
end
@@ -65,12 +70,12 @@ class Projects::WikisController < Projects::ApplicationController
private
- def load_gollum_wiki
- @gollum_wiki = GollumWiki.new(@project, current_user)
+ def load_project_wiki
+ @project_wiki = ProjectWiki.new(@project, current_user)
# Call #wiki to make sure the Wiki Repo is initialized
- @gollum_wiki.wiki
- rescue GollumWiki::CouldNotCreateWikiError => ex
+ @project_wiki.wiki
+ rescue ProjectWiki::CouldNotCreateWikiError => ex
flash[:notice] = "Could not create Wiki Repository at this time. Please try again later."
redirect_to @project
return false
@@ -91,5 +96,4 @@ class Projects::WikisController < Projects::ApplicationController
def message
params[:wiki][:message]
end
-
end
diff --git a/app/views/projects/wikis/_form.html.haml b/app/views/projects/wikis/_form.html.haml
index 06d8660630d..c77ed3433d1 100644
--- a/app/views/projects/wikis/_form.html.haml
+++ b/app/views/projects/wikis/_form.html.haml
@@ -1,16 +1,16 @@
-= form_for [@project, @wiki], method: @wiki.persisted? ? :put : :post, html: { class: 'form-horizontal' } do |f|
- -if @wiki.errors.any?
+= form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal' } do |f|
+ -if @page.errors.any?
#error_explanation
- %h2= "#{pluralize(@wiki.errors.count, "error")} prohibited this wiki from being saved:"
+ %h2= "#{pluralize(@page.errors.count, "error")} prohibited this wiki from being saved:"
%ul
- - @wiki.errors.full_messages.each do |msg|
+ - @page.errors.full_messages.each do |msg|
%li= msg
- = f.hidden_field :title, value: @wiki.title
+ = f.hidden_field :title, value: @page.title
.form-group
= f.label :format, class: 'control-label'
.col-sm-10
- = f.select :format, options_for_select(GollumWiki::MARKUPS, {selected: @wiki.format}), {}, class: "form-control"
+ = f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: "form-control"
.row
.col-sm-2
@@ -31,9 +31,9 @@
.col-sm-10= f.text_field :message, class: 'form-control', rows: 18
.form-actions
- - if @wiki && @wiki.persisted?
+ - if @page && @page.persisted?
= f.submit 'Save changes', class: "btn-save btn"
- = link_to "Cancel", project_wiki_path(@project, @wiki), class: "btn btn-cancel"
+ = link_to "Cancel", project_wiki_path(@project, @page), class: "btn btn-cancel"
- else
= f.submit 'Create page', class: "btn-create btn"
= link_to "Cancel", project_wiki_path(@project, :home), class: "btn btn-cancel"
diff --git a/app/views/projects/wikis/_main_links.html.haml b/app/views/projects/wikis/_main_links.html.haml
index 5dd769dcfe1..68d70873231 100644
--- a/app/views/projects/wikis/_main_links.html.haml
+++ b/app/views/projects/wikis/_main_links.html.haml
@@ -1,8 +1,8 @@
%span.pull-right
- - if (@wiki && @wiki.persisted?)
- = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-grouped" do
+ - if (@page && @page.persisted?)
+ = link_to history_project_wiki_path(@project, @page), class: "btn btn-grouped" do
Page History
- if can?(current_user, :write_wiki, @project)
- = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-grouped" do
+ = link_to edit_project_wiki_path(@project, @page), class: "btn btn-grouped" do
%i.icon-edit
Edit
diff --git a/app/views/projects/wikis/edit.html.haml b/app/views/projects/wikis/edit.html.haml
index 47b236083b3..49dd7b00ca4 100644
--- a/app/views/projects/wikis/edit.html.haml
+++ b/app/views/projects/wikis/edit.html.haml
@@ -3,11 +3,11 @@
= render 'main_links'
%h3.page-title
Editing -
- %span.light #{@wiki.title.titleize}
+ %span.light #{@page.title.titleize}
%hr
= render 'form'
.pull-right
- - if @wiki.persisted? && can?(current_user, :admin_wiki, @project)
- = link_to project_wiki_path(@project, @wiki), data: { confirm: "Are you sure you want to delete this page?"}, method: :delete, class: "btn btn-small btn-remove" do
+ - if @page.persisted? && can?(current_user, :admin_wiki, @project)
+ = link_to project_wiki_path(@project, @page), data: { confirm: "Are you sure you want to delete this page?"}, method: :delete, class: "btn btn-small btn-remove" do
Delete this page
diff --git a/app/views/projects/wikis/git_access.html.haml b/app/views/projects/wikis/git_access.html.haml
index b62c4975416..365edb524f4 100644
--- a/app/views/projects/wikis/git_access.html.haml
+++ b/app/views/projects/wikis/git_access.html.haml
@@ -3,10 +3,10 @@
.col-sm-6
%h3.page-title
Git access for
- %strong= @gollum_wiki.path_with_namespace
+ %strong= @project_wiki.path_with_namespace
.col-sm-6
- = render "shared/clone_panel", project: @gollum_wiki
+ = render "shared/clone_panel", project: @project_wiki
.git-empty
%fieldset
@@ -18,8 +18,8 @@
%legend Clone Your Wiki:
%pre.dark
:preserve
- git clone #{ content_tag(:span, default_url_to_repo(@gollum_wiki), class: 'clone')}
- cd #{@gollum_wiki.path}
+ git clone #{ content_tag(:span, default_url_to_repo(@project_wiki), class: 'clone')}
+ cd #{@project_wiki.path}
%legend Start Gollum And Edit Locally:
%pre.dark
diff --git a/app/views/projects/wikis/history.html.haml b/app/views/projects/wikis/history.html.haml
index 55efb624e23..7001bbd17c1 100644
--- a/app/views/projects/wikis/history.html.haml
+++ b/app/views/projects/wikis/history.html.haml
@@ -1,7 +1,7 @@
= render 'nav'
%h3.page-title
%span.light History for
- = link_to @wiki.title.titleize, project_wiki_path(@project, @wiki)
+ = link_to @page.title.titleize, project_wiki_path(@project, @page)
%table.table
%thead
@@ -12,11 +12,11 @@
%th Last updated
%th Format
%tbody
- - @wiki.versions.each do |version|
+ - @page.versions.each do |version|
- commit = version
%tr
%td
- = link_to project_wiki_path(@project, @wiki, version_id: commit.id) do
+ = link_to project_wiki_path(@project, @page, version_id: commit.id) do
= commit.short_id
%td
= commit_author_link(commit, avatar: true, size: 24)
@@ -26,4 +26,4 @@
#{time_ago_with_tooltip(version.date)}
%td
%strong
- = @wiki.page.wiki.page(@wiki.page.name, commit.id).try(:format)
+ = @page.page.wiki.page(@page.page.name, commit.id).try(:format)
diff --git a/app/views/projects/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml
index f7d4fe42b57..024ef068d08 100644
--- a/app/views/projects/wikis/show.html.haml
+++ b/app/views/projects/wikis/show.html.haml
@@ -1,20 +1,20 @@
= render 'nav'
%h3.page-title
- = @wiki.title.titleize
+ = @page.title.titleize
= render 'main_links'
-- if @wiki.historical?
+- if @page.historical?
.warning_message
This is an old version of this page.
- You can view the #{link_to "most recent version", project_wiki_path(@project, @wiki)} or browse the #{link_to "history", history_project_wiki_path(@project, @wiki)}.
+ You can view the #{link_to "most recent version", project_wiki_path(@project, @page)} or browse the #{link_to "history", history_project_wiki_path(@project, @page)}.
%hr
.wiki-holder
.wiki
= preserve do
- = render_wiki_content(@wiki)
+ = render_wiki_content(@page)
%hr
.wiki-last-edit-by
- Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_with_tooltip(@wiki.commit.created_at)}
+ Last edited by #{commit_author_link(@page.commit, avatar: true, size: 16)} #{time_ago_with_tooltip(@page.commit.created_at)}