Commit 275c2a31 authored by Douwe Maan's avatar Douwe Maan

Use new style for wiki

parent 09e712c0
...@@ -4,3 +4,8 @@ ...@@ -4,3 +4,8 @@
margin-right: auto; margin-right: auto;
padding-right: 7px; padding-right: 7px;
} }
.wiki-last-edit-by {
font-size: 80%;
font-weight: normal;
}
= form_for [@project.namespace.becomes(Namespace), @project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal wiki-form gfm-form' } do |f| = form_for [@project.namespace.becomes(Namespace), @project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal wiki-form gfm-form prepend-top-default' } do |f|
-if @page.errors.any? -if @page.errors.any?
#error_explanation #error_explanation
.alert.alert-danger .alert.alert-danger
...@@ -11,14 +11,7 @@ ...@@ -11,14 +11,7 @@
.col-sm-10 .col-sm-10
= f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: "form-control" = f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: "form-control"
.row .form-group
.col-sm-offset-2.col-sm-10
%p.cgray
To link to a (new) page you can just type
%code [Link Title](page-slug)
\.
.form-group.wiki-content
= f.label :content, class: 'control-label' = f.label :content, class: 'control-label'
.col-sm-10 .col-sm-10
= render layout: 'projects/md_preview', locals: { preview_class: "md-preview" } do = render layout: 'projects/md_preview', locals: { preview_class: "md-preview" } do
...@@ -27,6 +20,11 @@ ...@@ -27,6 +20,11 @@
.clearfix .clearfix
.error-alert .error-alert
.help-block
To link to a (new) page, simply type
%code [Link Title](page-slug)
\.
.form-group .form-group
= f.label :commit_message, class: 'control-label' = f.label :commit_message, class: 'control-label'
.col-sm-10= f.text_field :message, class: 'form-control', rows: 18 .col-sm-10= f.text_field :message, class: 'form-control', rows: 18
......
%span.pull-right %span.pull-right
- if can?(current_user, :create_wiki, @project)
= link_to '#modal-new-wiki', class: "add-new-wiki btn btn-new btn-grouped", "data-toggle" => "modal" do
%i.fa.fa-plus
New Page
- if (@page && @page.persisted?) - if (@page && @page.persisted?)
= link_to namespace_project_wiki_history_path(@project.namespace, @project, @page), class: "btn btn-grouped" do = link_to namespace_project_wiki_history_path(@project.namespace, @project, @page), class: "btn btn-grouped" do
Page History Page History
...@@ -11,5 +6,7 @@ ...@@ -11,5 +6,7 @@
= link_to namespace_project_wiki_edit_path(@project.namespace, @project, @page), class: "btn btn-grouped" do = link_to namespace_project_wiki_edit_path(@project.namespace, @project, @page), class: "btn btn-grouped" do
%i.fa.fa-pencil-square-o %i.fa.fa-pencil-square-o
Edit Edit
- if can?(current_user, :admin_wiki, @project)
= render 'projects/wikis/new' = link_to namespace_project_wiki_path(@project.namespace, @project, @page), data: { confirm: "Are you sure you want to delete this page?"}, method: :delete, class: "btn btn-remove" do
= icon('trash')
Delete
%ul.center-top-menu .project-issuable-filter
= nav_link(html_options: {class: params[:id] == 'home' ? 'active' : '' }) do .controls
= link_to 'Home', namespace_project_wiki_path(@project.namespace, @project, :home) - if can?(current_user, :create_wiki, @project)
= link_to '#modal-new-wiki', class: "add-new-wiki btn btn-new", "data-toggle" => "modal" do
%i.fa.fa-plus
New Page
= nav_link(path: 'wikis#pages') do = render 'projects/wikis/new'
= link_to 'Pages', namespace_project_wiki_pages_path(@project.namespace, @project)
= nav_link(path: 'wikis#git_access') do %ul.center-top-menu
= link_to namespace_project_wikis_git_access_path(@project.namespace, @project) do = nav_link(html_options: {class: params[:id] == 'home' ? 'active' : '' }) do
Git Access = link_to 'Home', namespace_project_wiki_path(@project.namespace, @project, :home)
= nav_link(path: 'wikis#pages') do
= link_to 'Pages', namespace_project_wiki_pages_path(@project.namespace, @project)
= nav_link(path: 'wikis#git_access') do
= link_to namespace_project_wikis_git_access_path(@project.namespace, @project) do
Git Access
...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
The page slug is invalid. Please don't use characters other then: a-z 0-9 _ - and / The page slug is invalid. Please don't use characters other then: a-z 0-9 _ - and /
%p.hint %p.hint
Please don't use spaces. Please don't use spaces.
.modal-footer .form-actions
= link_to 'Build', '#', class: 'build-new-wiki btn btn-create' = link_to 'Create Page', '#', class: 'build-new-wiki btn btn-create'
- page_title "Edit", @page.title, "Wiki" - page_title "Edit", @page.title.capitalize, "Wiki"
= render "header_title" = render "header_title"
= render 'nav' = render 'nav'
.pull-right .gray-content-block
= render 'main_links' .pull-right
%h3.page-title = render 'main_links'
Editing -
%span.light #{@page.title} %h3.page-title.oneline
%hr %span.light Edit Page
= render 'form' - if @page.persisted?
= link_to @page.title, namespace_project_wiki_path(@project.namespace, @project, @page)
- else
= @page.title
.pull-right = render 'form'
- if @page.persisted? && can?(current_user, :admin_wiki, @project)
= link_to namespace_project_wiki_path(@project.namespace, @project, @page), data: { confirm: "Are you sure you want to delete this page?"}, method: :delete, class: "btn btn-sm btn-remove" do
Delete this page
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
.gray-content-block .gray-content-block
.row .row
.col-sm-6 .col-sm-6
%h3.page-title %h3.page-title.oneline
Git access for Git access for
%strong= @project_wiki.path_with_namespace %strong= @project_wiki.path_with_namespace
......
- page_title "All Pages", "Wiki" - page_title "Pages", "Wiki"
= render "header_title" = render "header_title"
= render 'nav' = render 'nav'
.gray-content-block .gray-content-block
= render 'main_links' All pages in this wiki are listed below.
%h3.page-title
All Pages
%ul.content-list %ul.content-list
- @wiki_pages.each do |wiki_page| - @wiki_pages.each do |wiki_page|
%li %li
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
.gray-content-block .gray-content-block
= render 'main_links' = render 'main_links'
%h3.page-title %h3.page-title.oneline
= @page.title.capitalize = @page.title.capitalize
.wiki-last-edit-by %span.wiki-last-edit-by
Last edited by #{@page.commit.author.name} #{time_ago_with_tooltip(@page.commit.authored_date)} ·
last edited by #{@page.commit.author.name} #{time_ago_with_tooltip(@page.commit.authored_date)}
- if @page.historical? - if @page.historical?
.warning_message .warning_message
...@@ -21,8 +22,3 @@ ...@@ -21,8 +22,3 @@
.wiki .wiki
= preserve do = preserve do
= render_wiki_content(@page) = render_wiki_content(@page)
.gray-content-block.footer-block
.wiki-last-edit-by
Last edited by #{@page.commit.author.name} #{time_ago_with_tooltip(@page.commit.authored_date)}
...@@ -238,7 +238,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -238,7 +238,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
step 'I see new wiki page named test' do step 'I see new wiki page named test' do
expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "test") expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "test")
expect(page).to have_content "Editing" expect(page).to have_content "Edit Page test"
end end
When 'I go back to wiki page home' do When 'I go back to wiki page home' do
......
...@@ -5,7 +5,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -5,7 +5,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
include SharedPaths include SharedPaths
step 'I click on the Cancel button' do step 'I click on the Cancel button' do
page.within(:css, ".form-actions") do page.within(:css, ".wiki-form .form-actions") do
click_on "Cancel" click_on "Cancel"
end end
end end
...@@ -24,7 +24,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -24,7 +24,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
expect(page).to have_content "link test" expect(page).to have_content "link test"
click_link "link test" click_link "link test"
expect(page).to have_content "Editing" expect(page).to have_content "Edit Page"
end end
step 'I have an existing Wiki page' do step 'I have an existing Wiki page' do
...@@ -68,7 +68,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -68,7 +68,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end end
step 'I click on the "Delete this page" button' do step 'I click on the "Delete this page" button' do
click_on "Delete this page" click_on "Delete"
end end
step 'The page should be deleted' do step 'The page should be deleted' do
...@@ -120,13 +120,13 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -120,13 +120,13 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
step 'I should see the new wiki page form' do step 'I should see the new wiki page form' do
expect(current_path).to match('wikis/image.jpg') expect(current_path).to match('wikis/image.jpg')
expect(page).to have_content('New Wiki Page') expect(page).to have_content('New Wiki Page')
expect(page).to have_content('Editing - image.jpg') expect(page).to have_content('Edit Page image.jpg')
end end
step 'I create a New page with paths' do step 'I create a New page with paths' do
click_on 'New Page' click_on 'New Page'
fill_in 'Page slug', with: 'one/two/three' fill_in 'Page slug', with: 'one/two/three'
click_on 'Build' click_on 'Create Page'
fill_in "wiki_content", with: 'wiki content' fill_in "wiki_content", with: 'wiki content'
click_on "Create page" click_on "Create page"
expect(current_path).to include 'one/two/three' expect(current_path).to include 'one/two/three'
...@@ -135,7 +135,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -135,7 +135,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
step 'I create a New page with an invalid name' do step 'I create a New page with an invalid name' do
click_on 'New Page' click_on 'New Page'
fill_in 'Page slug', with: 'invalid name' fill_in 'Page slug', with: 'invalid name'
click_on 'Build' click_on 'Create Page'
end end
step 'I should see an error message' do step 'I should see an error message' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment