Skip to content

Commit 520a1fb

Browse files
authored
Make web working without assets (#93)
* Make web working without assets * Proper indentation * Update changelog
1 parent 5ec4c0d commit 520a1fb

File tree

10 files changed

+170
-163
lines changed

10 files changed

+170
-163
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## [0.7.8] - 2024-08-07
2+
- Make UI working without assets pipeline
3+
14
## [0.7.7] - 2024-07-22
25
- Unlock compatibility with Rails versions earlier than 6.0
36

app/assets/javascripts/application.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

app/assets/stylesheets/styles.css

Lines changed: 0 additions & 114 deletions
This file was deleted.

app/views/actual_db_schema/migrations/index.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<html>
33
<head>
44
<title>Migrations</title>
5-
<%= stylesheet_link_tag 'styles', media: 'all' %>
6-
<%= javascript_include_tag 'application' %>
5+
<%= render partial: 'actual_db_schema/shared/js' %>
6+
<%= render partial: 'actual_db_schema/shared/style' %>
77
</head>
88
<body>
99
<div>

app/views/actual_db_schema/migrations/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<html>
33
<head>
44
<title>Migration Details</title>
5-
<%= stylesheet_link_tag 'styles', media: 'all' %>
6-
<%= javascript_include_tag 'application' %>
5+
<%= render partial: 'actual_db_schema/shared/js' %>
6+
<%= render partial: 'actual_db_schema/shared/style' %>
77
</head>
88
<body>
99
<div>

app/views/actual_db_schema/phantom_migrations/index.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<html>
33
<head>
44
<title>Phantom Migrations</title>
5-
<%= stylesheet_link_tag 'styles', media: 'all' %>
6-
<%= javascript_include_tag 'application' %>
5+
<%= render partial: 'actual_db_schema/shared/js' %>
6+
<%= render partial: 'actual_db_schema/shared/style' %>
77
</head>
88
<body>
99
<div>

app/views/actual_db_schema/phantom_migrations/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<html>
33
<head>
44
<title>Phantom Migration Details</title>
5-
<%= stylesheet_link_tag 'styles', media: 'all' %>
6-
<%= javascript_include_tag 'application' %>
5+
<%= render partial: 'actual_db_schema/shared/js' %>
6+
<%= render partial: 'actual_db_schema/shared/style' %>
77
</head>
88
<body>
99
<div>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<script>
2+
document.addEventListener('DOMContentLoaded', function() {
3+
const migrationActions = document.querySelectorAll('.migration-action');
4+
5+
migrationActions.forEach(button => {
6+
button.addEventListener('click', function(event) {
7+
const originalText = button.value;
8+
button.value = 'Loading...';
9+
disableButtons();
10+
11+
fetch(event.target.form.action, {
12+
method: 'POST'
13+
})
14+
.then(response => {
15+
if (response.ok) {
16+
window.location.reload();
17+
} else {
18+
throw new Error('Network response was not ok.');
19+
}
20+
})
21+
.catch(error => {
22+
console.error('There has been a problem with your fetch operation:', error);
23+
enableButtons();
24+
button.value = originalText;
25+
});
26+
27+
event.preventDefault();
28+
});
29+
});
30+
31+
function disableButtons() {
32+
migrationActions.forEach(button => {
33+
button.disabled = true;
34+
});
35+
}
36+
37+
function enableButtons() {
38+
migrationActions.forEach(button => {
39+
button.disabled = false;
40+
});
41+
}
42+
});
43+
</script>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<style>
2+
body {
3+
margin: 8px;
4+
background-color: #fff;
5+
color: #333;
6+
}
7+
8+
body, p, td {
9+
font-family: helvetica, verdana, arial, sans-serif;
10+
font-size: 13px;
11+
line-height: 18px;
12+
}
13+
14+
h2 {
15+
padding-left: 10px;
16+
}
17+
18+
table {
19+
margin: 0;
20+
border-collapse: collapse;
21+
22+
thead tr {
23+
border-bottom: 2px solid #ddd;
24+
}
25+
26+
tbody {
27+
.migration-row.phantom {
28+
background-color: #fff3f3;
29+
}
30+
31+
.migration-row.normal {
32+
background-color: #ffffff;
33+
}
34+
35+
.migration-row:nth-child(odd).phantom {
36+
background-color: #ffe6e6;
37+
}
38+
39+
.migration-row:nth-child(odd).normal {
40+
background-color: #f9f9f9;
41+
}
42+
}
43+
44+
td {
45+
padding: 14px 30px;
46+
}
47+
}
48+
49+
.top-buttons {
50+
margin: 8px;
51+
display: flex;
52+
align-items: center;
53+
54+
.top-button {
55+
background-color: #ddd;
56+
}
57+
}
58+
59+
.button, .top-button {
60+
font-weight: bold;
61+
color: #000;
62+
border: none;
63+
padding: 5px 10px;
64+
text-align: center;
65+
text-decoration: none;
66+
display: inline-block;
67+
margin: 0 2px;
68+
cursor: pointer;
69+
border-radius: 4px;
70+
transition: background-color 0.3s;
71+
background: none;
72+
}
73+
74+
.button:hover, .top-button:hover {
75+
color: #fff;
76+
background-color: #000;
77+
}
78+
79+
.button:disabled, .button:hover:disabled {
80+
background-color: transparent;
81+
color: #666;
82+
cursor: not-allowed;
83+
}
84+
85+
.button-container {
86+
display: flex;
87+
}
88+
89+
pre {
90+
background-color: #f7f7f7;
91+
padding: 10px;
92+
border: 1px solid #ddd;
93+
}
94+
95+
.truncate-text {
96+
max-width: 200px;
97+
overflow: hidden;
98+
text-overflow: ellipsis;
99+
}
100+
101+
.flash {
102+
padding: 10px;
103+
margin-bottom: 10px;
104+
border-radius: 5px;
105+
}
106+
107+
.flash.notice {
108+
background-color: #d4edda;
109+
color: #155724;
110+
}
111+
112+
.flash.alert {
113+
background-color: #f8d7da;
114+
color: #721c24;
115+
}
116+
</style>

lib/actual_db_schema/engine.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ class Engine < ::Rails::Engine
1010
app.routes.append do
1111
mount ActualDbSchema::Engine => "/rails"
1212
end
13-
14-
app.config.assets.precompile += %w[styles.css application.js]
1513
end
1614
end
1715
end

0 commit comments

Comments
 (0)