From 9a34cc0b954c9925da291973d8dfb86b3dfb7ed9 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Fri, 23 Aug 2019 00:01:10 +0200 Subject: [PATCH] Added Quantities model and controller commands: rails generate redmine_plugin_model body_tracking quantity rails generate redmine_plugin_controller body_tracking quantities index create destroy --- app/controllers/quantities_controller.rb | 11 +++++++++++ app/helpers/quantities_helper.rb | 2 ++ app/models/quantity.rb | 2 ++ app/views/quantities/create.html.erb | 1 + app/views/quantities/destroy.html.erb | 1 + app/views/quantities/index.html.erb | 1 + db/migrate/001_create_units.rb | 7 +++++++ test/functional/quantities_controller_test.rb | 8 ++++++++ test/unit/quantity_test.rb | 9 +++++++++ 9 files changed, 42 insertions(+) create mode 100644 app/controllers/quantities_controller.rb create mode 100644 app/helpers/quantities_helper.rb create mode 100644 app/models/quantity.rb create mode 100644 app/views/quantities/create.html.erb create mode 100644 app/views/quantities/destroy.html.erb create mode 100644 app/views/quantities/index.html.erb create mode 100644 test/functional/quantities_controller_test.rb create mode 100644 test/unit/quantity_test.rb diff --git a/app/controllers/quantities_controller.rb b/app/controllers/quantities_controller.rb new file mode 100644 index 0000000..79d2e55 --- /dev/null +++ b/app/controllers/quantities_controller.rb @@ -0,0 +1,11 @@ +class QuantitiesController < ApplicationController + + def index + end + + def create + end + + def destroy + end +end diff --git a/app/helpers/quantities_helper.rb b/app/helpers/quantities_helper.rb new file mode 100644 index 0000000..9e6aa8b --- /dev/null +++ b/app/helpers/quantities_helper.rb @@ -0,0 +1,2 @@ +module QuantitiesHelper +end diff --git a/app/models/quantity.rb b/app/models/quantity.rb new file mode 100644 index 0000000..b135928 --- /dev/null +++ b/app/models/quantity.rb @@ -0,0 +1,2 @@ +class Quantity < ActiveRecord::Base +end diff --git a/app/views/quantities/create.html.erb b/app/views/quantities/create.html.erb new file mode 100644 index 0000000..574941d --- /dev/null +++ b/app/views/quantities/create.html.erb @@ -0,0 +1 @@ +

QuantitiesController#create

diff --git a/app/views/quantities/destroy.html.erb b/app/views/quantities/destroy.html.erb new file mode 100644 index 0000000..9682839 --- /dev/null +++ b/app/views/quantities/destroy.html.erb @@ -0,0 +1 @@ +

QuantitiesController#destroy

diff --git a/app/views/quantities/index.html.erb b/app/views/quantities/index.html.erb new file mode 100644 index 0000000..64ddebe --- /dev/null +++ b/app/views/quantities/index.html.erb @@ -0,0 +1 @@ +

QuantitiesController#index

diff --git a/db/migrate/001_create_units.rb b/db/migrate/001_create_units.rb index 9ddc44b..dcd45c0 100644 --- a/db/migrate/001_create_units.rb +++ b/db/migrate/001_create_units.rb @@ -6,6 +6,13 @@ class CreateUnits < ActiveRecord::Migration t.string :shortname end + create_table :quantities do |t| + t.references :project + t.string :name + t.string :description + t.integer :domain + end + reversible do |dir| dir.up do Unit.create project: nil, shortname: "%", name: "percent" diff --git a/test/functional/quantities_controller_test.rb b/test/functional/quantities_controller_test.rb new file mode 100644 index 0000000..f739f8d --- /dev/null +++ b/test/functional/quantities_controller_test.rb @@ -0,0 +1,8 @@ +require File.expand_path('../../test_helper', __FILE__) + +class QuantitiesControllerTest < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/test/unit/quantity_test.rb b/test/unit/quantity_test.rb new file mode 100644 index 0000000..0eaffab --- /dev/null +++ b/test/unit/quantity_test.rb @@ -0,0 +1,9 @@ +require File.expand_path('../../test_helper', __FILE__) + +class QuantityTest < ActiveSupport::TestCase + + # Replace this with your real tests. + def test_truth + assert true + end +end