Skip to content

Commit 141fd1c

Browse files
committed
Add dummy app for specs
1 parent e188a45 commit 141fd1c

72 files changed

Lines changed: 1564 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

spec/dummy/.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby-2.7.1

spec/dummy/.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby 2.6.6

spec/dummy/Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative 'config/application'
5+
6+
Rails.application.load_tasks

spec/dummy/app/admin/authors.rb

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# frozen_string_literal: true
2+
3+
ActiveAdmin.register Author do
4+
permit_params :name,
5+
:email,
6+
:age,
7+
:avatar,
8+
profile_attributes: %i[id description _destroy],
9+
posts_attributes: %i[id title description]
10+
11+
index do
12+
selectable_column
13+
id_column
14+
column :name
15+
column :email
16+
column :created_at
17+
actions
18+
end
19+
20+
filter :name
21+
filter :created_at
22+
23+
show do
24+
attributes_table do
25+
row :name
26+
row :email
27+
row :age
28+
row :avatar do |record|
29+
image_tag url_for(record.avatar), style: 'max-width:800px;max-height:500px' if record.avatar.attached?
30+
end
31+
row :created_at
32+
row :updated_at
33+
row :profile
34+
row :posts
35+
end
36+
active_admin_comments
37+
end
38+
39+
form do |f|
40+
f.inputs do
41+
f.input :name
42+
f.input :email
43+
f.input :age
44+
f.input :avatar,
45+
as: :file,
46+
hint: (object.avatar.attached? ? "Current: #{object.avatar.filename}" : nil)
47+
end
48+
f.has_many :profile, allow_destroy: true do |ff|
49+
ff.input :description
50+
end
51+
f.has_many :posts do |fp|
52+
fp.input :title
53+
fp.input :description
54+
end
55+
f.actions
56+
end
57+
end

spec/dummy/app/admin/dashboard.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
ActiveAdmin.register_page "Dashboard" do
2+
menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
3+
4+
content title: proc { I18n.t("active_admin.dashboard") } do
5+
div class: "blank_slate_container", id: "dashboard_default_message" do
6+
span class: "blank_slate" do
7+
span I18n.t("active_admin.dashboard_welcome.welcome")
8+
small I18n.t("active_admin.dashboard_welcome.call_to_action")
9+
end
10+
end
11+
12+
# Here is an example of a simple dashboard with columns and panels.
13+
#
14+
# columns do
15+
# column do
16+
# panel "Recent Posts" do
17+
# ul do
18+
# Post.recent(5).map do |post|
19+
# li link_to(post.title, admin_post_path(post))
20+
# end
21+
# end
22+
# end
23+
# end
24+
25+
# column do
26+
# panel "Info" do
27+
# para "Welcome to ActiveAdmin."
28+
# end
29+
# end
30+
# end
31+
end # content
32+
end

spec/dummy/app/admin/posts.rb

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# frozen_string_literal: true
2+
3+
ActiveAdmin.register Post do
4+
permit_params :author_id, :title, :description, :category, :dt, :position, :published, tag_ids: []
5+
6+
index do
7+
selectable_column
8+
id_column
9+
column :title
10+
column :author
11+
column :published
12+
column :created_at
13+
actions
14+
end
15+
16+
show do
17+
attributes_table do
18+
row :author
19+
row :title
20+
row :description
21+
row :category
22+
row :dt
23+
row :position
24+
row :published
25+
row :tags
26+
row :created_at
27+
row :updated_at
28+
end
29+
active_admin_comments
30+
end
31+
32+
form do |f|
33+
buttons = %w[bold italic underline link]
34+
f.inputs 'Post' do
35+
f.input :author
36+
f.input :title
37+
f.input :description
38+
f.input :category
39+
f.input :dt
40+
f.input :position
41+
f.input :published
42+
end
43+
44+
f.inputs 'Tags' do
45+
f.input :tags
46+
end
47+
48+
f.actions
49+
end
50+
end

spec/dummy/app/admin/tags.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# frozen_string_literal: true
2+
3+
ActiveAdmin.register Tag do
4+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//= link_tree ../images
2+
//= link_directory ../stylesheets .css
3+
// OFF link active_storage_db_manifest.js

spec/dummy/app/assets/images/.keep

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//= require active_admin/base

0 commit comments

Comments
 (0)