From 0b549b909a327246cb44308fa450bb39883f9cd3 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Mon, 23 Sep 2019 14:45:13 +0200 Subject: [PATCH] Added Sources model + controller commands: rails generate redmine_plugin_model body_tracking source project:references name:string description:text rails generate redmine_plugin_controller body_tracking sources index create destroy --- app/controllers/sources_controller.rb | 11 +++++++++++ app/helpers/sources_helper.rb | 2 ++ app/models/source.rb | 2 ++ app/views/sources/create.html.erb | 1 + app/views/sources/destroy.html.erb | 1 + app/views/sources/index.html.erb | 1 + db/migrate/002_create_sources.rb | 10 ++++++++++ test/functional/sources_controller_test.rb | 8 ++++++++ test/unit/source_test.rb | 9 +++++++++ 9 files changed, 45 insertions(+) create mode 100644 app/controllers/sources_controller.rb create mode 100644 app/helpers/sources_helper.rb create mode 100644 app/models/source.rb create mode 100644 app/views/sources/create.html.erb create mode 100644 app/views/sources/destroy.html.erb create mode 100644 app/views/sources/index.html.erb create mode 100644 db/migrate/002_create_sources.rb create mode 100644 test/functional/sources_controller_test.rb create mode 100644 test/unit/source_test.rb diff --git a/app/controllers/sources_controller.rb b/app/controllers/sources_controller.rb new file mode 100644 index 0000000..f3bfb46 --- /dev/null +++ b/app/controllers/sources_controller.rb @@ -0,0 +1,11 @@ +class SourcesController < ApplicationController + + def index + end + + def create + end + + def destroy + end +end diff --git a/app/helpers/sources_helper.rb b/app/helpers/sources_helper.rb new file mode 100644 index 0000000..c2433ba --- /dev/null +++ b/app/helpers/sources_helper.rb @@ -0,0 +1,2 @@ +module SourcesHelper +end diff --git a/app/models/source.rb b/app/models/source.rb new file mode 100644 index 0000000..12221de --- /dev/null +++ b/app/models/source.rb @@ -0,0 +1,2 @@ +class Source < ActiveRecord::Base +end diff --git a/app/views/sources/create.html.erb b/app/views/sources/create.html.erb new file mode 100644 index 0000000..ff4ae49 --- /dev/null +++ b/app/views/sources/create.html.erb @@ -0,0 +1 @@ +

SourcesController#create

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

SourcesController#destroy

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

SourcesController#index

diff --git a/db/migrate/002_create_sources.rb b/db/migrate/002_create_sources.rb new file mode 100644 index 0000000..df5ba93 --- /dev/null +++ b/db/migrate/002_create_sources.rb @@ -0,0 +1,10 @@ +class CreateSources < ActiveRecord::Migration + def change + create_table :sources do |t| + t.references :project, index: true, foreign_key: true + t.string :name + t.text :description + end + add_index :sources, :project_id + end +end diff --git a/test/functional/sources_controller_test.rb b/test/functional/sources_controller_test.rb new file mode 100644 index 0000000..7280891 --- /dev/null +++ b/test/functional/sources_controller_test.rb @@ -0,0 +1,8 @@ +require File.expand_path('../../test_helper', __FILE__) + +class SourcesControllerTest < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/test/unit/source_test.rb b/test/unit/source_test.rb new file mode 100644 index 0000000..78c3d7f --- /dev/null +++ b/test/unit/source_test.rb @@ -0,0 +1,9 @@ +require File.expand_path('../../test_helper', __FILE__) + +class SourceTest < ActiveSupport::TestCase + + # Replace this with your real tests. + def test_truth + assert true + end +end