Commits

Katsuya HIDAKA  committed 3b5f84c

add page_break macro

This macro behaves as follows:
* (Media Screen) Show the mark to page break
* (Media Print) Page break at the position of self

  • Participants
  • Parent commits d52332a
  • Branches page-break-macro

Comments (0)

Files changed (5)

File app/views/wiki_extensions/_html_header.html.erb

 
   <%= javascript_include_tag(baseurl + "/plugin_assets/redmine_wiki_extensions/javascripts/jquery.tablesorter.js") %>
   <%=  stylesheet_link_tag(baseurl + "/plugin_assets/redmine_wiki_extensions/stylesheets/wiki_extensions.css") %>
+  <%=  stylesheet_link_tag(baseurl + "/plugin_assets/redmine_wiki_extensions/stylesheets/wiki_extensions_print.css", :media => 'print') %>
   <%= javascript_include_tag(baseurl + "/plugin_assets/redmine_wiki_extensions/javascripts/wiki_extensions.js") %>
 <% end %>

File assets/stylesheets/wiki_extensions.css

 ul.list {display:block;list-style-type: none;list-style-image: none;}
 ul.IsRoot { margin-left:0px; list-style-type:none;}
 
+/**
+ * Styles for page_break macro
+ */
+.wiki .wikiext-page-break {
+  height: 1px;
+  width: 95%;
+  border-top: 1px dashed #ccc;
+  margin: 3em auto;
+}

File assets/stylesheets/wiki_extensions_print.css

+/**
+ * Styles for page_break macro
+ */
+.wiki .wikiext-page-break {
+  page-break-before: always;
+  margin: 0 !important;
+  border: 0 !important;
+  visibility: hidden;
+}

File lib/wiki_extensions_page_break_macro.rb

+# Wiki Extensions plugin for Redmine
+# Copyright (C) 2009-2013  Haruyuki Iida
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+require 'redmine'
+
+module WikiExtensionsPageBreakMacro
+  Redmine::WikiFormatting::Macros.register do
+    desc 'Page break here.'
+    macro :page_break do |obj, args|
+      content_tag(:div, nil, :class => 'wikiext-page-break')
+    end
+  end
+end

File test/functional/wiki_controller_test.rb

     end
   end
 
+  context "page_break" do
+    setup do
+      setContent("{{page_break}}\n")
+
+      @request.session[:user_id] = 1
+      get :show, :project_id => 1, :id => @page_name
+    end
+
+    should "success" do
+      assert_response :success
+    end
+
+    should "be rendered correctly" do
+      assert response.body.include?('<div class="wikiext-page-break">')
+    end
+  end
+
   private
 
   def setContent(text)