summaryrefslogtreecommitdiffstats
path: root/app/views/wiki
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-22 17:47:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-22 17:47:11 +0000
commitbda78a4679bc947dfd42ab92adfc043afd1d2f60 (patch)
tree39ad1356f3024f2dd9ee3a8710e8d9bd46334efc /app/views/wiki
parentb56f77322ac2f6a900ba011e767446e17401cf6f (diff)
downloadredmine-bda78a4679bc947dfd42ab92adfc043afd1d2f60.tar.gz
redmine-bda78a4679bc947dfd42ab92adfc043afd1d2f60.zip
Adds "New wiki page" link to create a new wiki page (#5536).
git-svn-id: http://svn.redmine.org/redmine/trunk@15346 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/wiki')
-rw-r--r--app/views/wiki/_new_modal.html.erb21
-rw-r--r--app/views/wiki/date_index.html.erb3
-rw-r--r--app/views/wiki/index.html.erb3
-rw-r--r--app/views/wiki/new.html.erb17
-rw-r--r--app/views/wiki/new.js.erb2
-rw-r--r--app/views/wiki/show.html.erb3
6 files changed, 49 insertions, 0 deletions
diff --git a/app/views/wiki/_new_modal.html.erb b/app/views/wiki/_new_modal.html.erb
new file mode 100644
index 000000000..52a87b751
--- /dev/null
+++ b/app/views/wiki/_new_modal.html.erb
@@ -0,0 +1,21 @@
+<h3 class="title"><%=l(:label_wiki_page_new)%></h3>
+
+<%= labelled_form_for :page, @page,
+ :url => new_project_wiki_page_path(@project),
+ :method => 'post',
+ :remote => true do |f| %>
+
+ <%= render_error_messages @page.errors.full_messages_for(:title) %>
+
+ <div class="box tabular">
+ <p>
+ <%= f.text_field :title, :name => 'title', :size => 60, :required => true %>
+ <em class="info"><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em>
+ </p>
+ </div>
+
+ <p class="buttons">
+ <%= submit_tag l(:label_next), :name => nil %>
+ <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
+ </p>
+<% end %>
diff --git a/app/views/wiki/date_index.html.erb b/app/views/wiki/date_index.html.erb
index 74a5f45fb..c382ed6e7 100644
--- a/app/views/wiki/date_index.html.erb
+++ b/app/views/wiki/date_index.html.erb
@@ -1,4 +1,7 @@
<div class="contextual">
+<% if User.current.allowed_to?(:edit_wiki_pages, @project) %>
+<%= link_to l(:label_wiki_page_new), new_project_wiki_page_path(@project), :remote => true, :class => 'icon icon-add' %>
+<% end %>
<%= watcher_link(@wiki, User.current) %>
</div>
diff --git a/app/views/wiki/index.html.erb b/app/views/wiki/index.html.erb
index 333cc8531..0d6955da1 100644
--- a/app/views/wiki/index.html.erb
+++ b/app/views/wiki/index.html.erb
@@ -1,4 +1,7 @@
<div class="contextual">
+<% if User.current.allowed_to?(:edit_wiki_pages, @project) %>
+<%= link_to l(:label_wiki_page_new), new_project_wiki_page_path(@project), :remote => true, :class => 'icon icon-add' %>
+<% end %>
<%= watcher_link(@wiki, User.current) %>
</div>
diff --git a/app/views/wiki/new.html.erb b/app/views/wiki/new.html.erb
new file mode 100644
index 000000000..d0674202d
--- /dev/null
+++ b/app/views/wiki/new.html.erb
@@ -0,0 +1,17 @@
+<%= title l(:label_wiki_page_new) %>
+
+<%= labelled_form_for :page, @page,
+ :url => new_project_wiki_page_path(@project) do |f| %>
+
+ <%= render_error_messages @page.errors.full_messages_for(:title) %>
+
+ <div class="box tabular">
+ <p>
+ <%= f.text_field :title, :name => 'title', :size => 60, :required => true %>
+ <em class="info"><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em>
+ </p>
+ </div>
+
+ <%= submit_tag(l(:label_next)) %>
+
+<% end %>
diff --git a/app/views/wiki/new.js.erb b/app/views/wiki/new.js.erb
new file mode 100644
index 000000000..c12b35340
--- /dev/null
+++ b/app/views/wiki/new.js.erb
@@ -0,0 +1,2 @@
+$('#ajax-modal').html('<%= escape_javascript(render :partial => 'wiki/new_modal') %>');
+showModal('ajax-modal', '600px');
diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb
index a9db7a0c4..41dd12d10 100644
--- a/app/views/wiki/show.html.erb
+++ b/app/views/wiki/show.html.erb
@@ -1,4 +1,7 @@
<div class="contextual">
+<% if User.current.allowed_to?(:edit_wiki_pages, @project) %>
+<%= link_to l(:label_wiki_page_new), new_project_wiki_page_path(@project), :remote => true, :class => 'icon icon-add' %>
+<% end %>
<% if @editable %>
<% if @content.current_version? %>
<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>