Added projects
This commit is contained in:
parent
0964187f22
commit
8b4ffb83ec
37 changed files with 470 additions and 1935 deletions
|
|
@ -22,9 +22,13 @@ class ApplicationController < ActionController::Base
|
||||||
path: :root
|
path: :root
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: Report.model_name.human(count: 2),
|
label: Project.model_name.human(count: 2),
|
||||||
icon: :'journal-text',
|
icon: :'folder',
|
||||||
path: :reports },
|
path: :projects },
|
||||||
|
# {
|
||||||
|
# label: Report.model_name.human(count: 2),
|
||||||
|
# icon: :'journal-text',
|
||||||
|
# path: :reports },
|
||||||
{
|
{
|
||||||
label: I18n.t("backoffice"),
|
label: I18n.t("backoffice"),
|
||||||
icon: :gear,
|
icon: :gear,
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,6 @@ class HomeController < ApplicationController
|
||||||
path: profile_path,
|
path: profile_path,
|
||||||
active: action_name == "profile"
|
active: action_name == "profile"
|
||||||
},
|
},
|
||||||
# {
|
|
||||||
# label: "Passwort ändern",
|
|
||||||
# path: new_password_path,
|
|
||||||
# icon: :lock
|
|
||||||
# },
|
|
||||||
{
|
{
|
||||||
label: "Logout",
|
label: "Logout",
|
||||||
icon: :"box-arrow-right",
|
icon: :"box-arrow-right",
|
||||||
|
|
|
||||||
62
app/controllers/projects_controller.rb
Normal file
62
app/controllers/projects_controller.rb
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
class ProjectsController < ApplicationController
|
||||||
|
before_action :set_project, only: %i[ show edit update destroy ]
|
||||||
|
|
||||||
|
# GET /projects
|
||||||
|
def index
|
||||||
|
@projects = Project.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /projects/1
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /projects/new
|
||||||
|
def new
|
||||||
|
@project = Project.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /projects/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /projects
|
||||||
|
def create
|
||||||
|
@project = if params[:copy_from_id]
|
||||||
|
Project.find(params[:copy_from_id]).dup
|
||||||
|
else
|
||||||
|
Project.new(project_params)
|
||||||
|
end
|
||||||
|
|
||||||
|
if @project.save
|
||||||
|
redirect_to @project, notice: "Project was successfully created."
|
||||||
|
else
|
||||||
|
render :new, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /projects/1
|
||||||
|
def update
|
||||||
|
if @project.update(project_params)
|
||||||
|
redirect_to @project, notice: "Project was successfully updated.", status: :see_other
|
||||||
|
else
|
||||||
|
render :edit, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /projects/1
|
||||||
|
def destroy
|
||||||
|
@project.destroy!
|
||||||
|
redirect_to projects_url, notice: "Project was successfully destroyed.", status: :see_other
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_project
|
||||||
|
@project = Project.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only allow a list of trusted parameters through.
|
||||||
|
def project_params
|
||||||
|
params.require(:project).permit(:name, :details)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ReportsController < ApplicationController
|
class ReportsController < ApplicationController
|
||||||
|
before_action :set_project, only: %i[index new create]
|
||||||
before_action :set_report, only: %i[show edit update destroy work]
|
before_action :set_report, only: %i[show edit update destroy work]
|
||||||
|
|
||||||
# GET /reports
|
# GET /reports
|
||||||
def index
|
def index
|
||||||
@reports = Report.all
|
@reports = @project.reports
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /reports/1
|
# GET /reports/1
|
||||||
|
|
@ -85,7 +86,7 @@ class ReportsController < ApplicationController
|
||||||
|
|
||||||
# GET /reports/new
|
# GET /reports/new
|
||||||
def new
|
def new
|
||||||
@report = Report.new
|
@report = Report.new(project_id: @project.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /reports/1/edit
|
# GET /reports/1/edit
|
||||||
|
|
@ -93,10 +94,45 @@ class ReportsController < ApplicationController
|
||||||
|
|
||||||
# POST /reports
|
# POST /reports
|
||||||
def create
|
def create
|
||||||
@report = Report.new(report_params)
|
success = if params[:copy_from_id]
|
||||||
|
original = Report.find(params[:copy_from_id])
|
||||||
|
@report = original.dup
|
||||||
|
@report.pages = original.pages.map do |page|
|
||||||
|
page.dup.tap do |p|
|
||||||
|
p.elements = page.elements.map do |element|
|
||||||
|
element.dup.tap do |e|
|
||||||
|
e.success_criteria = element.success_criteria.map do |sc|
|
||||||
|
csc = sc.dup
|
||||||
|
SuccessCriterion.rich_text_association_names
|
||||||
|
.map { _1.to_s.sub(/^rich_text_/, "") }
|
||||||
|
.each do |a|
|
||||||
|
csc.send("#{a}=", sc.send(a).dup)
|
||||||
|
end
|
||||||
|
csc
|
||||||
|
end
|
||||||
|
e.screenshot = element.screenshot&.dup
|
||||||
|
Element.rich_text_association_names
|
||||||
|
.map { _1.to_s.sub(/^rich_text_/, "") }
|
||||||
|
.each do |a|
|
||||||
|
e.send("#{a}=", element.send(a).dup)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Page.rich_text_association_names
|
||||||
|
.map { _1.to_s.sub(/^rich_text_/, "") }
|
||||||
|
.each do |a|
|
||||||
|
p.send("#{a}=", page.send(a).dup)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@report.save
|
||||||
|
else
|
||||||
|
@report = Report.new(report_params.merge(project_id: @project.id))
|
||||||
|
@report.save
|
||||||
|
end
|
||||||
|
|
||||||
if @report.save
|
if success
|
||||||
redirect_to @report, notice: "Report was successfully created."
|
redirect_to @report.reload, notice: "Report was successfully created."
|
||||||
else
|
else
|
||||||
render :new, status: :unprocessable_entity
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
@ -114,7 +150,7 @@ class ReportsController < ApplicationController
|
||||||
# DELETE /reports/1
|
# DELETE /reports/1
|
||||||
def destroy
|
def destroy
|
||||||
@report.destroy!
|
@report.destroy!
|
||||||
redirect_to reports_url, notice: "Report was successfully destroyed.", status: :see_other
|
redirect_to project_url(@report.project), notice: "Report was successfully destroyed.", status: :see_other
|
||||||
end
|
end
|
||||||
|
|
||||||
def work
|
def work
|
||||||
|
|
@ -130,7 +166,7 @@ class ReportsController < ApplicationController
|
||||||
|
|
||||||
# Only allow a list of trusted parameters through.
|
# Only allow a list of trusted parameters through.
|
||||||
def report_params
|
def report_params
|
||||||
params.require(:report).permit(:name, :comment, :url)
|
params.require(:report).permit(:name, :comment, :url, :project_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def filename(report, extension: "html")
|
def filename(report, extension: "html")
|
||||||
|
|
@ -140,4 +176,8 @@ class ReportsController < ApplicationController
|
||||||
def page_param
|
def page_param
|
||||||
params[:page_id]
|
params[:page_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_project
|
||||||
|
@project = Project.find(params[:project_id])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
2
app/helpers/projects_helper.rb
Normal file
2
app/helpers/projects_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ProjectsHelper
|
||||||
|
end
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
// Entry point for the build script in your package.json
|
// Entry point for the build script in your package.json
|
||||||
import "@hotwired/turbo-rails"
|
import "@hotwired/turbo-rails"
|
||||||
import "./controllers"
|
import "./controllers"
|
||||||
import * as bootstrap from "bootstrap"
|
|
||||||
|
|
||||||
import "trix"
|
import "trix"
|
||||||
import "@rails/actiontext"
|
import "@rails/actiontext"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ module PdfDocuments
|
||||||
end
|
end
|
||||||
|
|
||||||
@prawn_document.font_size(8) do
|
@prawn_document.font_size(8) do
|
||||||
@prawn_document.draw_text("Dokument erstellt am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')}", at: [0, 0])
|
@prawn_document.draw_text("Dokument erstellt am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')}", at: [ 0, 0 ])
|
||||||
end
|
end
|
||||||
@prawn_document.start_new_page
|
@prawn_document.start_new_page
|
||||||
@pages = {}
|
@pages = {}
|
||||||
|
|
@ -45,7 +45,7 @@ module PdfDocuments
|
||||||
|
|
||||||
@prawn_document.start_new_page
|
@prawn_document.start_new_page
|
||||||
heading1("Anhang: Richtlinien")
|
heading1("Anhang: Richtlinien")
|
||||||
params.report.export[:success_criteria].group_by(&:check).sort_by{ |c, _scs| c.external_number }.each do |check, criteria|
|
params.report.export[:success_criteria].group_by(&:check).sort_by { |c, _scs| c.external_number }.each do |check, criteria|
|
||||||
heading2(check.display_label)
|
heading2(check.display_label)
|
||||||
@pages[check] = @prawn_document.page_number
|
@pages[check] = @prawn_document.page_number
|
||||||
{
|
{
|
||||||
|
|
@ -79,7 +79,7 @@ module PdfDocuments
|
||||||
rich_text(%Q(
|
rich_text(%Q(
|
||||||
<span>#{cat.name}</span>
|
<span>#{cat.name}</span>
|
||||||
<ul>
|
<ul>
|
||||||
#{links.map{ "<li><a href='#{_1.url}'>#{_1.text}</a></li>" }.join() }
|
#{links.map { "<li><a href='#{_1.url}'>#{_1.text}</a></li>" }.join() }
|
||||||
</ul>
|
</ul>
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
|
|
@ -101,10 +101,10 @@ module PdfDocuments
|
||||||
|
|
||||||
@prawn_document.repeat(2..) do
|
@prawn_document.repeat(2..) do
|
||||||
@prawn_document.text_box "<b>#{params.report.name}</b>", at: [ 50, 777 ], inline_format: true, width: 300
|
@prawn_document.text_box "<b>#{params.report.name}</b>", at: [ 50, 777 ], inline_format: true, width: 300
|
||||||
@prawn_document.bounding_box([0, 766], width: 532) do
|
@prawn_document.bounding_box([ 0, 766 ], width: 532) do
|
||||||
hr
|
hr
|
||||||
end
|
end
|
||||||
@prawn_document.bounding_box([0, 796], width: 200, height: 200) do
|
@prawn_document.bounding_box([ 0, 796 ], width: 200, height: 200) do
|
||||||
logo
|
logo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -120,7 +120,7 @@ module PdfDocuments
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
section("Anhang: Richtlinien") do
|
section("Anhang: Richtlinien") do
|
||||||
x.report.export[:success_criteria].group_by(&:check).sort_by{ |c, _scs| c.external_number }.each do |check, _criteria|
|
x.report.export[:success_criteria].group_by(&:check).sort_by { |c, _scs| c.external_number }.each do |check, _criteria|
|
||||||
page(title: check.display_label, destination: p[check])
|
page(title: check.display_label, destination: p[check])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
7
app/models/project.rb
Normal file
7
app/models/project.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
class Project < ApplicationRecord
|
||||||
|
has_many :reports, dependent: :restrict_with_error
|
||||||
|
|
||||||
|
has_rich_text :details
|
||||||
|
|
||||||
|
scope :current, -> { where("updated_at > ?", 1.month.ago) }
|
||||||
|
end
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Report < ApplicationRecord
|
class Report < ApplicationRecord
|
||||||
|
belongs_to :project, touch: true
|
||||||
|
|
||||||
has_many :pages, -> { order(:position) }, dependent: :destroy
|
has_many :pages, -> { order(:position) }, dependent: :destroy
|
||||||
has_many :elements, through: :pages, dependent: :destroy
|
has_many :elements, through: :pages, dependent: :destroy
|
||||||
has_many :success_criteria, through: :elements, dependent: :destroy
|
has_many :success_criteria, through: :elements, dependent: :destroy
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,27 @@
|
||||||
h1 a11ydive
|
h1 Dashboard
|
||||||
h2 Dashboard
|
|
||||||
|
|
||||||
- if Report.any?
|
.row
|
||||||
h3 Zuletzt bearbeitete Prüfberichte
|
.col-md-6
|
||||||
|
- if Project.current.any?
|
||||||
|
h2
|
||||||
|
i.bi.bi-folder>
|
||||||
|
'Aktuelle Projekte
|
||||||
|
ul
|
||||||
|
- Project.current.order(updated_at: :desc).each do |p|
|
||||||
|
li = link_to(p.name, p)
|
||||||
|
|
||||||
|
- if Report.any?
|
||||||
|
h2
|
||||||
|
i.bi.bi-journal-text>
|
||||||
|
'Zuletzt bearbeitete Prüfberichte
|
||||||
ul
|
ul
|
||||||
- Report.all.order(updated_at: :desc).limit(3).each do |r|
|
- Report.all.order(updated_at: :desc).limit(3).each do |r|
|
||||||
li = link_to(r.name, r)
|
li = link_to(r.name, r)
|
||||||
|
|
||||||
p
|
.col-md-6
|
||||||
i.bi.bi-journal-text
|
h2 Hotkeys
|
||||||
=< Report.count
|
p Auf der Bericht-Ausfüllen Seite können folgende Shortcuts verwendet werden:
|
||||||
=< link_to Report.model_name.human(count: Report.count), :reports
|
dl
|
||||||
|
|
||||||
h3 Hotkeys
|
|
||||||
p Auf der Bericht-Ausfüllen Seite können folgende Shortcuts verwendet werden:
|
|
||||||
dl
|
|
||||||
dt t
|
dt t
|
||||||
dd Springe zum Anfang des Contents (Skip-Link, kann auf allen Seiten verwendet werden)
|
dd Springe zum Anfang des Contents (Skip-Link, kann auf allen Seiten verwendet werden)
|
||||||
dt a
|
dt a
|
||||||
|
|
|
||||||
5
app/views/projects/_form.html.erb
Normal file
5
app/views/projects/_form.html.erb
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= bootstrap_form_with(model: project) do |form| %>
|
||||||
|
<%= form.text_field :name %>
|
||||||
|
<%= form.rich_text_area :details %>
|
||||||
|
<%= form.submit %>
|
||||||
|
<% end %>
|
||||||
20
app/views/projects/_project.html.slim
Normal file
20
app/views/projects/_project.html.slim
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
.project id=dom_id(project)
|
||||||
|
p
|
||||||
|
strong Name:
|
||||||
|
= project.name
|
||||||
|
p
|
||||||
|
strong Details:
|
||||||
|
= project.details
|
||||||
|
p
|
||||||
|
strong Berichte:
|
||||||
|
ul.ps-0
|
||||||
|
- project.reports.each do
|
||||||
|
li.d-flex.ps-0
|
||||||
|
=< "ID #{_1.id}: #{l(_1.created_at,format: :short)} #{_1.name}"
|
||||||
|
= link_to(_1, class: "btn btn-sm btn-link-secondary") do
|
||||||
|
i.bi.bi-folder-symlink
|
||||||
|
= button_to(project_reports_path(project), class: "btn btn-sm btn-link-secondary", params: { copy_from_id: _1.id }) do
|
||||||
|
i.bi.bi-copy
|
||||||
|
p
|
||||||
|
= link_to(new_project_report_path(project), class: "btn btn-secondary") do
|
||||||
|
i.bi.bi-plus-lg
|
||||||
2
app/views/projects/_project.json.jbuilder
Normal file
2
app/views/projects/_project.json.jbuilder
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
json.extract! project, :id, :name, :created_at, :updated_at
|
||||||
|
json.url project_url(project, format: :json)
|
||||||
8
app/views/projects/edit.html.erb
Normal file
8
app/views/projects/edit.html.erb
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<h1><%= t("scaffold.pagetitle_edit", model: Project.model_name.human) %></h1>
|
||||||
|
|
||||||
|
<%= render "form", project: @project %>
|
||||||
|
|
||||||
|
<div class="action-row">
|
||||||
|
<%= link_to t("scaffold.link_show", model: Project.model_name.human), @project %>
|
||||||
|
<%= link_to t("scaffold.link_index", model: Project.model_name.human(count: 2)), projects_path %>
|
||||||
|
</div>
|
||||||
25
app/views/projects/index.html.erb
Normal file
25
app/views/projects/index.html.erb
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<h1><%= t("scaffold.pagetitle_index", model: Project.model_name.human(count: 2)) %></h1>
|
||||||
|
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><%= Project.human_attribute_name(:id) %></th>
|
||||||
|
|
||||||
|
<th><%= Project.human_attribute_name(:name) %></th>
|
||||||
|
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @projects.each do |project| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to(project.id, url_for(project)) %></td>
|
||||||
|
|
||||||
|
<td><%= link_to(project.name, url_for(project)) %></td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="action-row">
|
||||||
|
<%= link_to t("scaffold.link_new", model: Project.model_name.human), new_project_path %>
|
||||||
|
</div>
|
||||||
1
app/views/projects/index.json.jbuilder
Normal file
1
app/views/projects/index.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
json.array! @projects, partial: "projects/project", as: :project
|
||||||
7
app/views/projects/new.html.erb
Normal file
7
app/views/projects/new.html.erb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<h1><%= t("scaffold.pagetitle_new", model: Project.model_name.human) %></h1>
|
||||||
|
|
||||||
|
<%= render "form", project: @project %>
|
||||||
|
|
||||||
|
<div class="action-row">
|
||||||
|
<%= link_to t("scaffold.link_index", model: Project.model_name.human(count: 2)), projects_path %>
|
||||||
|
</div>
|
||||||
9
app/views/projects/show.html.erb
Normal file
9
app/views/projects/show.html.erb
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<h1><%= t("scaffold.pagetitle_show", model: @project.class.model_name.human) %></h1>
|
||||||
|
|
||||||
|
<%= render @project %>
|
||||||
|
|
||||||
|
<div class="action-row">
|
||||||
|
<%= link_to t("scaffold.link_edit", model: @project.model_name.human), edit_project_path(@project) %>
|
||||||
|
<%= link_to t("scaffold.link_index", model: @project.model_name.human(count: 2)), projects_path %>
|
||||||
|
<%= button_to t("scaffold.link_destroy", model: @project.model_name.human), @project, method: :delete, class: "btn btn-outline-danger" if @project.reports.none? %>
|
||||||
|
</div>
|
||||||
1
app/views/projects/show.json.jbuilder
Normal file
1
app/views/projects/show.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
json.partial! "projects/project", project: @project
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<%= bootstrap_form_with(model: report) do |form| %>
|
<%= bootstrap_form_with(model: report.persisted? ? report : [@project, report]) do |form| %>
|
||||||
|
<%= form.collection_select :project_id, Project.all, :id, :name, include_blank: true %>
|
||||||
<%= form.text_field :name %>
|
<%= form.text_field :name %>
|
||||||
<%= form.text_field :url %>
|
<%= form.text_field :url %>
|
||||||
<%= form.rich_text_area :comment %>
|
<%= form.rich_text_area :comment %>
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
<div class="action-row">
|
<div class="action-row">
|
||||||
<%= link_to t("scaffold.link_show", model: Report.model_name.human), @report %>
|
<%= link_to t("scaffold.link_show", model: Report.model_name.human), @report %>
|
||||||
<%= link_to t("scaffold.link_index", model: Report.model_name.human(count: 2)), reports_path %>
|
<%= link_to t("scaffold.link_index", model: Report.model_name.human(count: 2)), project_reports_path(@report.project) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,5 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="action-row">
|
<div class="action-row">
|
||||||
<%= link_to t("scaffold.link_new", model: Report.model_name.human), new_report_path %>
|
<%= link_to t("scaffold.link_new", model: Report.model_name.human), new_project_report_path(@project) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@
|
||||||
<%= render "form", report: @report %>
|
<%= render "form", report: @report %>
|
||||||
|
|
||||||
<div class="action-row">
|
<div class="action-row">
|
||||||
<%= link_to t("scaffold.link_index", model: Report.model_name.human(count: 2)), reports_path %>
|
<%= link_to t("scaffold.link_index", model: Report.model_name.human(count: 2)), project_reports_path(@project) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,12 @@
|
||||||
i.bi.bi-journal-text.me-2
|
i.bi.bi-journal-text.me-2
|
||||||
= @report.name
|
= @report.name
|
||||||
div
|
div
|
||||||
small
|
small = "Erstellt am #{l(@report.created_at, format: :short)}, zuletzt bearbeitet am #{l(@report.updated_at, format: :short)}"
|
||||||
'Erstellt am
|
|
||||||
= l(@report.created_at, format: :short)
|
p
|
||||||
', zuletzt bearbeitet am
|
i.bi.bi-folder
|
||||||
= l(@report.updated_at, format: :short)
|
strong< = link_to(@report.project.name, @report.project)
|
||||||
|
|
||||||
.smb-4.lead.mb-5
|
.smb-4.lead.mb-5
|
||||||
= @report.comment || tag.i("leer")
|
= @report.comment || tag.i("leer")
|
||||||
- if @current_page
|
- if @current_page
|
||||||
|
|
@ -26,7 +27,6 @@ div
|
||||||
.btn-group.me-3.visually-hidden
|
.btn-group.me-3.visually-hidden
|
||||||
= link_to("Alle zu [s]", "#", data: { action: "click->details-list#closeAll", controller: :hotkey, hotkey: "s" }, class: "btn btn-outline-secondary")
|
= link_to("Alle zu [s]", "#", data: { action: "click->details-list#closeAll", controller: :hotkey, hotkey: "s" }, class: "btn btn-outline-secondary")
|
||||||
= link_to("Alle auf [a]", "#", data: { action: "click->details-list#openAll", controller: :hotkey, hotkey: "a" }, class: "btn btn-outline-secondary")
|
= link_to("Alle auf [a]", "#", data: { action: "click->details-list#openAll", controller: :hotkey, hotkey: "a" }, class: "btn btn-outline-secondary")
|
||||||
/= button_to(tag.i(class: "bi bi-trash"), page_path(@current_page), method: :delete, class: "btn btn-outline-danger", form: {data: { turbo_confirm: "Bist du sicher?" }})
|
|
||||||
.row
|
.row
|
||||||
.col-lg-3.col-md-4.col-sm-12
|
.col-lg-3.col-md-4.col-sm-12
|
||||||
.page_nav.sticky-top
|
.page_nav.sticky-top
|
||||||
|
|
@ -63,5 +63,5 @@ div
|
||||||
| ODT
|
| ODT
|
||||||
.action-row
|
.action-row
|
||||||
= link_to t("scaffold.link_edit", model: @report.model_name.human), edit_report_path(@report)
|
= link_to t("scaffold.link_edit", model: @report.model_name.human), edit_report_path(@report)
|
||||||
= link_to t("scaffold.link_index", model: @report.model_name.human(count: 2)), reports_path
|
= link_to t("scaffold.link_index", model: @report.model_name.human(count: 2)), project_reports_path(@report.project)
|
||||||
= button_to t("scaffold.link_destroy", model: @report.model_name.human), @report, method: :delete, class: "btn btn-outline-danger", data: { turbo_confirm: "Bist du sicher?"}
|
= button_to t("scaffold.link_destroy", model: @report.model_name.human), @report, method: :delete, class: "btn btn-outline-danger", data: { turbo_confirm: "Bist du sicher?"}
|
||||||
|
|
|
||||||
9
db/migrate/20241124183246_create_projects.rb
Normal file
9
db/migrate/20241124183246_create_projects.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
class CreateProjects < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :projects do |t|
|
||||||
|
t.string :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
5
db/migrate/20241124183406_add_project_to_reports.rb
Normal file
5
db/migrate/20241124183406_add_project_to_reports.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddProjectToReports < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
add_reference :reports, :project, null: true, foreign_key: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,4 +1,16 @@
|
||||||
ActiveRecord::Schema[7.1].define(version: 1) do
|
# This file is auto-generated from the current state of the database. Instead
|
||||||
|
# of editing this file, please use the migrations feature of Active Record to
|
||||||
|
# incrementally modify your database, and then regenerate this schema definition.
|
||||||
|
#
|
||||||
|
# This file is the source Rails uses to define your schema when running `bin/rails
|
||||||
|
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
||||||
|
# be faster and is potentially less error prone than running all of your
|
||||||
|
# migrations from scratch. Old migrations may fail to apply correctly if those
|
||||||
|
# migrations use external dependencies or application code.
|
||||||
|
#
|
||||||
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
|
ActiveRecord::Schema[8.0].define(version: 1) do
|
||||||
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
t.bigint "job_id", null: false
|
t.bigint "job_id", null: false
|
||||||
t.string "queue_name", null: false
|
t.string "queue_name", null: false
|
||||||
|
|
@ -6,24 +18,24 @@ ActiveRecord::Schema[7.1].define(version: 1) do
|
||||||
t.string "concurrency_key", null: false
|
t.string "concurrency_key", null: false
|
||||||
t.datetime "expires_at", null: false
|
t.datetime "expires_at", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.index [ "concurrency_key", "priority", "job_id" ], name: "index_solid_queue_blocked_executions_for_release"
|
t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release"
|
||||||
t.index [ "expires_at", "concurrency_key" ], name: "index_solid_queue_blocked_executions_for_maintenance"
|
t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||||
t.index [ "job_id" ], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
||||||
t.bigint "job_id", null: false
|
t.bigint "job_id", null: false
|
||||||
t.bigint "process_id"
|
t.bigint "process_id"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.index [ "job_id" ], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
||||||
t.index [ "process_id", "job_id" ], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
||||||
t.bigint "job_id", null: false
|
t.bigint "job_id", null: false
|
||||||
t.text "error"
|
t.text "error"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.index [ "job_id" ], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_jobs", force: :cascade do |t|
|
create_table "solid_queue_jobs", force: :cascade do |t|
|
||||||
|
|
@ -37,17 +49,17 @@ ActiveRecord::Schema[7.1].define(version: 1) do
|
||||||
t.string "concurrency_key"
|
t.string "concurrency_key"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index [ "active_job_id" ], name: "index_solid_queue_jobs_on_active_job_id"
|
t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id"
|
||||||
t.index [ "class_name" ], name: "index_solid_queue_jobs_on_class_name"
|
t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name"
|
||||||
t.index [ "finished_at" ], name: "index_solid_queue_jobs_on_finished_at"
|
t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at"
|
||||||
t.index [ "queue_name", "finished_at" ], name: "index_solid_queue_jobs_for_filtering"
|
t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering"
|
||||||
t.index [ "scheduled_at", "finished_at" ], name: "index_solid_queue_jobs_for_alerting"
|
t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_pauses", force: :cascade do |t|
|
create_table "solid_queue_pauses", force: :cascade do |t|
|
||||||
t.string "queue_name", null: false
|
t.string "queue_name", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.index [ "queue_name" ], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_processes", force: :cascade do |t|
|
create_table "solid_queue_processes", force: :cascade do |t|
|
||||||
|
|
@ -59,9 +71,9 @@ ActiveRecord::Schema[7.1].define(version: 1) do
|
||||||
t.text "metadata"
|
t.text "metadata"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.index [ "last_heartbeat_at" ], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
||||||
t.index [ "name", "supervisor_id" ], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
||||||
t.index [ "supervisor_id" ], name: "index_solid_queue_processes_on_supervisor_id"
|
t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
||||||
|
|
@ -69,9 +81,9 @@ ActiveRecord::Schema[7.1].define(version: 1) do
|
||||||
t.string "queue_name", null: false
|
t.string "queue_name", null: false
|
||||||
t.integer "priority", default: 0, null: false
|
t.integer "priority", default: 0, null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.index [ "job_id" ], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
||||||
t.index [ "priority", "job_id" ], name: "index_solid_queue_poll_all"
|
t.index ["priority", "job_id"], name: "index_solid_queue_poll_all"
|
||||||
t.index [ "queue_name", "priority", "job_id" ], name: "index_solid_queue_poll_by_queue"
|
t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
||||||
|
|
@ -79,8 +91,8 @@ ActiveRecord::Schema[7.1].define(version: 1) do
|
||||||
t.string "task_key", null: false
|
t.string "task_key", null: false
|
||||||
t.datetime "run_at", null: false
|
t.datetime "run_at", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.index [ "job_id" ], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
||||||
t.index [ "task_key", "run_at" ], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
||||||
|
|
@ -95,8 +107,8 @@ ActiveRecord::Schema[7.1].define(version: 1) do
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index [ "key" ], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
||||||
t.index [ "static" ], name: "index_solid_queue_recurring_tasks_on_static"
|
t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
||||||
|
|
@ -105,8 +117,8 @@ ActiveRecord::Schema[7.1].define(version: 1) do
|
||||||
t.integer "priority", default: 0, null: false
|
t.integer "priority", default: 0, null: false
|
||||||
t.datetime "scheduled_at", null: false
|
t.datetime "scheduled_at", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.index [ "job_id" ], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
||||||
t.index [ "scheduled_at", "priority", "job_id" ], name: "index_solid_queue_dispatch_all"
|
t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "solid_queue_semaphores", force: :cascade do |t|
|
create_table "solid_queue_semaphores", force: :cascade do |t|
|
||||||
|
|
@ -115,9 +127,9 @@ ActiveRecord::Schema[7.1].define(version: 1) do
|
||||||
t.datetime "expires_at", null: false
|
t.datetime "expires_at", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index [ "expires_at" ], name: "index_solid_queue_semaphores_on_expires_at"
|
t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at"
|
||||||
t.index [ "key", "value" ], name: "index_solid_queue_semaphores_on_key_and_value"
|
t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||||
t.index [ "key" ], name: "index_solid_queue_semaphores_on_key", unique: true
|
t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
|
|
||||||
27
db/schema.rb
generated
27
db/schema.rb
generated
|
|
@ -10,7 +10,19 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2024_11_11_034826) do
|
ActiveRecord::Schema[8.0].define(version: 2024_11_24_183406) do
|
||||||
|
create_table "account_remember_keys", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.datetime "deadline", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "accounts", force: :cascade do |t|
|
||||||
|
t.integer "status", default: 1, null: false
|
||||||
|
t.string "email", null: false
|
||||||
|
t.string "password_hash"
|
||||||
|
t.index ["email"], name: "index_accounts_on_email", unique: true, where: "status IN (1, 2)"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "action_text_rich_texts", force: :cascade do |t|
|
create_table "action_text_rich_texts", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.text "body"
|
t.text "body"
|
||||||
|
|
@ -115,6 +127,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_034826) do
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.integer "page_id", null: false
|
t.integer "page_id", null: false
|
||||||
t.integer "position", null: false
|
t.integer "position", null: false
|
||||||
|
t.index ["page_id", "position"], name: "index_elements_on_page_id_and_position", unique: true
|
||||||
t.index ["page_id"], name: "index_elements_on_page_id"
|
t.index ["page_id"], name: "index_elements_on_page_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -144,6 +157,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_034826) do
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.text "notes"
|
t.text "notes"
|
||||||
|
t.index ["report_id", "position"], name: "index_pages_on_report_id_and_position", unique: true
|
||||||
t.index ["report_id"], name: "index_pages_on_report_id"
|
t.index ["report_id"], name: "index_pages_on_report_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -154,11 +168,19 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_034826) do
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "projects", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "reports", force: :cascade do |t|
|
create_table "reports", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.string "url"
|
t.string "url"
|
||||||
|
t.integer "project_id"
|
||||||
|
t.index ["project_id"], name: "index_reports_on_project_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "sessions", force: :cascade do |t|
|
create_table "sessions", force: :cascade do |t|
|
||||||
|
|
@ -191,6 +213,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_034826) do
|
||||||
t.integer "priority"
|
t.integer "priority"
|
||||||
t.integer "position", null: false
|
t.integer "position", null: false
|
||||||
t.index ["check_id"], name: "index_success_criteria_on_check_id"
|
t.index ["check_id"], name: "index_success_criteria_on_check_id"
|
||||||
|
t.index ["element_id", "position"], name: "index_success_criteria_on_element_id_and_position", unique: true
|
||||||
t.index ["element_id"], name: "index_success_criteria_on_element_id"
|
t.index ["element_id"], name: "index_success_criteria_on_element_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -202,6 +225,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_034826) do
|
||||||
t.index ["email_address"], name: "index_users_on_email_address", unique: true
|
t.index ["email_address"], name: "index_users_on_email_address", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_foreign_key "account_remember_keys", "accounts", column: "id"
|
||||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||||
add_foreign_key "checklist_entries", "checklists"
|
add_foreign_key "checklist_entries", "checklists"
|
||||||
|
|
@ -210,6 +234,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_034826) do
|
||||||
add_foreign_key "elements", "pages"
|
add_foreign_key "elements", "pages"
|
||||||
add_foreign_key "links", "link_categories"
|
add_foreign_key "links", "link_categories"
|
||||||
add_foreign_key "pages", "reports"
|
add_foreign_key "pages", "reports"
|
||||||
|
add_foreign_key "reports", "projects"
|
||||||
add_foreign_key "sessions", "users"
|
add_foreign_key "sessions", "users"
|
||||||
add_foreign_key "success_criteria", "checks"
|
add_foreign_key "success_criteria", "checks"
|
||||||
add_foreign_key "success_criteria", "elements"
|
add_foreign_key "success_criteria", "elements"
|
||||||
|
|
|
||||||
1831
package-lock.json
generated
1831
package-lock.json
generated
File diff suppressed because it is too large
Load diff
55
test/controllers/projects_controller_test.rb
Normal file
55
test/controllers/projects_controller_test.rb
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class ProjectsControllerTest < ::ControllerTest
|
||||||
|
teardown do
|
||||||
|
logout
|
||||||
|
end
|
||||||
|
|
||||||
|
setup do
|
||||||
|
@project = projects(:one)
|
||||||
|
User.create!(email_address: "test@example.com", password: "password")
|
||||||
|
login("test@example.com", "password")
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get index" do
|
||||||
|
get projects_url
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get new" do
|
||||||
|
get new_project_url
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should create project" do
|
||||||
|
assert_difference("Project.count") do
|
||||||
|
post projects_url, params: { project: { name: @project.name } }
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_redirected_to project_url(Project.last)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should show project" do
|
||||||
|
get project_url(@project)
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get edit" do
|
||||||
|
get edit_project_url(@project)
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should update project" do
|
||||||
|
patch project_url(@project), params: { project: { name: @project.name } }
|
||||||
|
assert_redirected_to project_url(@project)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should destroy project" do
|
||||||
|
p = Project.create!(name: "empty")
|
||||||
|
assert_difference("Project.count", -1) do
|
||||||
|
delete project_url(p)
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_redirected_to projects_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -14,18 +14,18 @@ class ReportsControllerTest < ::ControllerTest
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should get index" do
|
test "should get index" do
|
||||||
get reports_url
|
get project_reports_url(@report.project)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should get new" do
|
test "should get new" do
|
||||||
get new_report_url
|
get new_project_report_url(@report.project)
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should create report" do
|
test "should create report" do
|
||||||
assert_difference("Report.count") do
|
assert_difference("Report.count") do
|
||||||
post reports_url, params: { report: { comment: @report.comment, name: @report.name } }
|
post project_reports_url(@report.project), params: { report: { comment: @report.comment, name: @report.name } }
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_redirected_to report_url(Report.last)
|
assert_redirected_to report_url(Report.last)
|
||||||
|
|
@ -51,6 +51,6 @@ class ReportsControllerTest < ::ControllerTest
|
||||||
delete report_url(@report)
|
delete report_url(@report)
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_redirected_to reports_url
|
assert_redirected_to project_url(@report.project)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
7
test/fixtures/projects.yml
vendored
Normal file
7
test/fixtures/projects.yml
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
name: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
name: MyString
|
||||||
2
test/fixtures/reports.yml
vendored
2
test/fixtures/reports.yml
vendored
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
one:
|
one:
|
||||||
name: MyString
|
name: MyString
|
||||||
|
project: one
|
||||||
|
|
||||||
two:
|
two:
|
||||||
name: MyString
|
name: MyString
|
||||||
|
project: one
|
||||||
|
|
|
||||||
7
test/models/project_test.rb
Normal file
7
test/models/project_test.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class ProjectTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
47
test/system/projects_test.rb
Normal file
47
test/system/projects_test.rb
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
require "application_system_test_case"
|
||||||
|
|
||||||
|
class ProjectsTest < ApplicationSystemTestCase
|
||||||
|
setup do
|
||||||
|
@project = projects(:one)
|
||||||
|
login_test
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
logout
|
||||||
|
end
|
||||||
|
|
||||||
|
test "visiting the index" do
|
||||||
|
visit projects_url
|
||||||
|
assert_selector "h1", text: "Projekte"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should create project" do
|
||||||
|
visit projects_url
|
||||||
|
click_on "Projekt hinzufügen"
|
||||||
|
|
||||||
|
fill_in "Name", with: @project.name
|
||||||
|
click_on "Projekt erstellen"
|
||||||
|
|
||||||
|
assert_text "Project was successfully created"
|
||||||
|
click_on "Projekte Liste"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should update Project" do
|
||||||
|
visit project_url(@project)
|
||||||
|
click_on "Projekt bearbeiten", match: :first
|
||||||
|
|
||||||
|
fill_in "Name", with: @project.name
|
||||||
|
click_on "Projekt aktualisieren"
|
||||||
|
|
||||||
|
assert_text "Project was successfully updated"
|
||||||
|
click_on "Projekte Liste"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should destroy Project" do
|
||||||
|
empty = Project.create!(name: "empty")
|
||||||
|
visit project_url(empty)
|
||||||
|
click_on "Projekt löschen", match: :first
|
||||||
|
|
||||||
|
assert_text "Project was successfully destroyed"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -13,12 +13,12 @@ class ReportsTest < ApplicationSystemTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test "visiting the index" do
|
test "visiting the index" do
|
||||||
visit reports_url
|
visit project_reports_url(@report.project)
|
||||||
assert_selector "h1", text: "Prüfberichte"
|
assert_selector "h1", text: "Prüfberichte"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should create report" do
|
test "should create report" do
|
||||||
visit reports_url
|
visit project_reports_url(@report.project)
|
||||||
click_on "Prüfbericht hinzufügen"
|
click_on "Prüfbericht hinzufügen"
|
||||||
|
|
||||||
fill_in_rich_text_area "Projektbeschreibung", with: @report.comment
|
fill_in_rich_text_area "Projektbeschreibung", with: @report.comment
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue