Removed Identifier field from taskboard card config model as it was redundant. Added a readme. Added german locales. Fixed up the view specs so they actually do something.

pull/6827/head
Richard 11 years ago
parent 7ee0929d0c
commit 3f47201817
  1. 159
      README.md
  2. 2
      app/controllers/taskboard_card_configurations_controller.rb
  3. 1
      app/models/taskboard_card_configuration.rb
  4. 1
      app/views/taskboard_card_configurations/_form.html.erb
  5. 8
      config/locales/de.yml
  6. 5
      db/migrate/20140128093055_remove_identifier_from_taksboard_card_configurations.rb
  7. 3
      db/seeds/taskboard_card_configurations.rb
  8. 3
      features/step_definitions/given.rb
  9. 1
      features/taskboard_card_configurations_admin.feature
  10. 2
      spec/controllers/taskboard_card_configurations_controller_spec.rb
  11. 3
      spec/factories/taskboard_card_configuration_factory.rb
  12. 1
      spec/taskboard_card/document_generator_spec.rb
  13. 13
      spec/views/edit.html.erb_spec.rb
  14. 13
      spec/views/new.html.erb_spec.rb

@ -1,7 +1,158 @@
# OpenProject Pdf Export Plugin
OpenProject PDF Export Plugin
===========================
FIXME Add description and check issue tracker link below
This Plugin adds features which enable the configuration and generation of printable taskboard card PDFs.
## Issue Tracker
https://www.openproject.org/projects/pdf-export/issues
Requirements
------------
The OpenProject PDF Export plug-in requires the [OpenProject Core](https://github.com/opf/openproject/) in
version greater or equal to *3.0.0pre37*.
Tests for this plugin require `pdf-inspector`, so just add the following line to
OpenProject's `Gemfile.plugin`:
`gem "pdf-inspector", "~>1.0.0", :group => :test`
Installation
------------
OpenProject PDF Export depends on OpenProject Plugins. Thus, if you haven't done
it already, add the following line to the `Gemfile.plugins` to your OpenProject installation:
`gem "openproject-plugins", git: "https://github.com/opf/openproject-plugins.git", :branch => "dev"`
For OpenProject PDF Export itself you need to add the following line to the
`Gemfile.plugins` of the project which is using the plugin:
`gem "openproject-pdf_export", git: "https://github.com/finnlabs/openproject-pdf_export.git", :branch => "dev"`
Afterwards, run:
`bundle install`
This plugin contains migrations. To migrate the database, run:
`rake db:migrate`
There is a seed file to load a default TaskboardCardConfiguration model, although this is not strictly required.
Deinstallation
--------------
Remove the line
`gem "openproject-pdf_export", git: "https://github.com/finnlabs/openproject-backlogs.git"`
from the file `Gemfile.plugins` and run:
`bundle install`
Please not that this leaves plugin data in the database. Currently, we do not
support full uninstall of the plugin.
Usage
------------
The plugin provides an admin interface for TaskboardCardConfiguration CRUD. Existing TaskboardCardConfigurations can then be used to export data in PDF form, the configuration defining the layout of the card and the specific data which appears in it. The DocumentGenerator init takes a TaskboardCardConfiguration and an array of any object. It is left to the developer to make sure the fields in the config match the given data. A TaskboardCardConfiguration currently allows for the following fields to be defined:
Name - A unique identifier for the configuration.
Per Page - The number of taskboard cards which will appear on each page of the exported PDF.
Page Size - Currently we only support A4 paper size.
Orientation - Portrait of Landscape.
Rows - A YAML text block which defines in detail what should appear in each row and column of the taskboard cards.
The following sample YAML shows the required form and all of the available configuration options:
rows:
row1:
has_border: false
columns:
id:
has_label: false
font_size: 20
font_style: bold
priority: 1
minimum_lines: 2
render_if_empty: false
width: 30%
due_date:
has_label: false
font_size: 15
font_style: italic
priority: 1
minimum_lines: 2
render_if_empty: false
width: 70%
row2:
has_border: false
columns:
status:
has_label: true
font_size: 15
font_style: normal
priority: 2
minimum_lines: 1
render_if_empty: true
Any number of rows can be defined. The font_size and minimum_lines properties define how much height on the card is given to the row. The plugin will attempt to assign enough space to each of the rows, however space will be assigned based on the priorities of the the rows, with rows with lower priority (higher numbers) being reduced and removed first if there is not enough for all the data.
The name of the column informs the plugin which data should be read from the model (status, due_date, id, etc.). There can be any number of columns per row. Columns are given an equal share of the row width unless a specific width % is given. If there is more text in the column than can fit into its assinged space on the card then the text will be truncated.
Bug Reporting
-------------
If you find any bugs, you can create a bug ticket at
https://www.openproject.org/projects/plugin-backlogs
Development
-----------
To contribute, you can create pull request on the official repository at
`https://github.com/finnlabs/openproject-pdf_export`
Credits
-------
We thank the original maintainers and developers of [Redmine
Backlogs](http://www.redminebacklogs.net/) as well as
[Chiliproject Backlogs](https://github.com/finnlabs/chiliproject_backlogs) for
their immense work on this plugin. OpenProject Backlogs would not have been
possible without their original contribution. Those contributors are:
* Marnen Laibow-Koser
* Sandro Munda
* friflaj
* Maxime Guilbot
* Andrew Vit
* Joakim Kolsjö
* ibussieres
* Daniel Passos
* Jason Vasquez
* jpic
* Emiliano Heyns
* Mark Maglana
* Joe Heck
* Nate Lowrie
Additionally, we would like to thank
* Deutsche Telekom AG (opensource@telekom.de) for project sponsorhip
Licence
-------
Copyright (C)2013 the OpenProject Foundation (OPF)<br />
Copyright (C)2011 Marnen Laibow-Koser, Sandro Munda<br />
Copyright (C)2010-2011 friflaj<br />
Copyright (C)2010 Maxime Guilbot, Andrew Vit, Joakim Kolsjö, ibussieres, Daniel Passos, Jason Vasquez, jpic, Emiliano Heyns<br />
Copyright (C)2009-2010 Mark Maglana<br />
Copyright (C)2009 Joe Heck, Nate Lowrie
This plugin is licensed under the GNU GPL v3. See doc/COPYRIGHT.md and doc/GPL.txt for details.

@ -57,7 +57,7 @@ class TaskboardCardConfigurationsController < ApplicationController
end
def taskboard_card_configurations_params
params.require(:taskboard_card_configuration).permit(:identifier, :name, :rows, :per_page, :page_size, :orientation)
params.require(:taskboard_card_configuration).permit(:name, :rows, :per_page, :page_size, :orientation)
end
def load_config

@ -12,7 +12,6 @@ class TaskboardCardConfiguration < ActiveRecord::Base
include OpenProject::PdfExport::Exceptions
validates :identifier, presence: true
validates :name, presence: true
validates :rows, rows_yaml: true
validates :per_page, numericality: { only_integer: true }

@ -3,7 +3,6 @@
<p><%= f.error_messages %></p>
<!--[form:taskboard_card_configuration]-->
<p><%= f.text_field :name, :required => true %></p>
<p><%= f.text_field :identifier, :required => true %></p>
<p><%= f.text_field :per_page, :required => true %></p>
<p><%= f.text_field :page_size, :required => true, :value => "A4", :readonly => true %></p>
<P><%= f.select :orientation, [:landscape, :portrait], :required => true %></p>

@ -0,0 +1,8 @@
de:
error_can_not_delete_taskboard_card_configuration: "Diese Konfiguration kann nicht gelöscht werden."
error_can_not_change_name_of_default_configuration: "Der Name der Standardkonfiguration kann nicht geändert werden."
label_backlogs_taskboard_card_config_select: "Bitte wählen Sie eine Taskboard-Kartenkonfiguration"
label_backlogs_taskboard_card_export: "Exportieren"
label_taskboard_card_configuration_new: "Neue Taskboard-Kartenkonfiguration"
label_taskboard_card_configuration_plural: "Taskboard-Kartenkonfigurationen"

@ -0,0 +1,5 @@
class RemoveIdentifierFromTaksboardCardConfigurations < ActiveRecord::Migration
def change
remove_column :taskboard_card_configurations, :identifier
end
end

@ -1,7 +1,6 @@
if TaskboardCardConfiguration.find_by_identifier("default").nil?
TaskboardCardConfiguration.create({identifier: "default",
name: "Default",
TaskboardCardConfiguration.create({name: "Default",
per_page: 2,
page_size: "A4",
orientation: "landscape",

@ -1,7 +1,6 @@
Given /^there are multiple taskboard card configurations$/ do
config1 = TaskboardCardConfiguration.create!({
name: "Default",
identifier: "DEFAULT",
per_page: 1,
page_size: "A4",
orientation: "landscape",
@ -9,7 +8,6 @@ Given /^there are multiple taskboard card configurations$/ do
})
config2 = TaskboardCardConfiguration.create!({
name: "Custom",
identifier: "CUSTOM",
per_page: 1,
page_size: "A4",
orientation: "landscape",
@ -17,7 +15,6 @@ Given /^there are multiple taskboard card configurations$/ do
})
config3 = TaskboardCardConfiguration.create!({
name: "Custom 2",
identifier: "CUSTOM2",
per_page: 1,
page_size: "A4",
orientation: "landscape",

@ -20,7 +20,6 @@ Feature: Taskboard Card Configurations Admin
And I am on the taskboard card configurations index page
When I follow "New Taskboard Card Config"
And I fill in "Config 1" for "taskboard_card_configuration_name"
And I fill in "config1" for "taskboard_card_configuration_identifier"
And I fill in "5" for "taskboard_card_configuration_per_page"
And I select "landscape" from "taskboard_card_configuration_orientation"
And I fill in "rows:\n row1:\n test" for "taskboard_card_configuration_rows"

@ -16,7 +16,6 @@ describe TaskboardCardConfigurationsController do
it 'should let you create a configuration with all the values set' do
@params[:taskboard_card_configuration] = {
name: "Config 1",
identifier: "config1",
rows: @valid_rows_yaml,
per_page: 5,
page_size: "A4",
@ -31,7 +30,6 @@ describe TaskboardCardConfigurationsController do
it 'should not let you create an invalid configuration' do
@params[:taskboard_card_configuration] = {
name: "Config 1",
identifier: "config1"
}
post 'create', @params

@ -2,7 +2,6 @@
FactoryGirl.define do
factory :taskboard_card_configuration do
name "Config 1"
identifier "config1"
rows "rows:\n row1:\n has_border: false\n columns:\n id:\n has_label: false\n font_size: \"15\""
per_page 5
page_size "A4"
@ -11,7 +10,6 @@ FactoryGirl.define do
factory :default_taskboard_card_configuration, :class => TaskboardCardConfiguration do
name "Default"
identifier "default"
rows "rows:\n row1:\n has_border: false\n columns:\n id:\n has_label: false\n font_size: \"15\""
per_page 5
page_size "A4"
@ -20,7 +18,6 @@ FactoryGirl.define do
factory :invalid_taskboard_card_configuration, :class => TaskboardCardConfiguration do
name "Invalid"
identifier "invalid"
rows "row1"
per_page "string"
page_size "asdf"

@ -3,7 +3,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe OpenProject::PdfExport::TaskboardCard::DocumentGenerator do
let(:config) { TaskboardCardConfiguration.new({
name: "Default",
identifier: "default",
per_page: 1,
page_size: "A4",
orientation: "landscape",

@ -12,14 +12,11 @@ describe 'taskboard_card_configurations/edit' do
it 'shows edit taskboard card configuration inputs' do
render
rendered.should have_selector("form") do |f|
f.should have_selector("input", value: config.identifier)
f.should have_selector("input", value: config.name)
f.should have_selector("input", value: config.rows)
f.should have_selector("input", value: config.per_page)
f.should have_selector("input", value: config.page_size)
f.should have_selector("input", value: config.orientation)
end
rendered.should have_field("Name", with: config.name)
rendered.should have_field("Per page", with: config.per_page.to_s)
rendered.should have_field("Page size", with: config.page_size)
rendered.should have_field("Orientation", with: config.orientation)
rendered.should have_field("Rows", with: config.rows)
end
end

@ -11,14 +11,11 @@ describe 'taskboard_card_configurations/new' do
it 'shows new taskboard card configuration empty inputs' do
render
rendered.should have_selector("form") do |f|
f.should have_selector("input", value: "")
f.should have_selector("input", value: "")
f.should have_selector("input", value: "")
f.should have_selector("input", value: "")
f.should have_selector("input", value: "")
f.should have_selector("input", value: "")
end
rendered.should have_css("input#taskboard_card_configuration_name")
rendered.should have_css("input#taskboard_card_configuration_per_page")
rendered.should have_css("input#taskboard_card_configuration_page_size")
rendered.should have_css("select#taskboard_card_configuration_orientation")
rendered.should have_css("textarea#taskboard_card_configuration_rows")
end
end
Loading…
Cancel
Save