Skip to content

Commit 850fe0c

Browse files
committed
Wip
1 parent 1599f99 commit 850fe0c

17 files changed

Lines changed: 240 additions & 117 deletions

File tree

app/models/topic.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ class Topic < ApplicationRecord
4646

4747
class << self
4848
def by_year(year)
49-
where("extract(year from published_at) = ?", year)
49+
return all if year.blank?
50+
51+
where("extract(year from published_at) = ?", year.to_i)
5052
end
5153

5254
def by_month(month)
53-
where("extract(month from published_at) = ?", month)
55+
return all if month.blank?
56+
57+
where("extract(month from published_at) = ?", month.to_i)
5458
end
5559
end
5660

app/views/home/index.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<%= link_to "Dashboard", topics_path, class: "text-gray-700 hover:text-gray-900 font-medium" %>
2222
<%= button_to "Sign Out", session_path, method: :delete, class: "ml-4 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50" %>
2323
<% else %>
24-
<%= link_to "Sign In", new_session_path, class: "ml-4 px-4 py-2 bg-gradient-to-r from-indigo-500 to-purple-600 text-white rounded-lg hover:from-indigo-600 hover:to-purple-700 transition-all" %>
24+
<%= link_to "Sign In", new_session_path, class: "ml-4 px-4 py-2 bg-gradient-to-r from-indigo-500 to-purple-600 text-white rounded-lg hover:from-indigo-600 hover:to-purple-700 transition-all", id: "desktop-sign-in" %>
2525
<% end %>
2626
</div>
2727
</div>
@@ -36,7 +36,7 @@
3636
<%= link_to "Dashboard", topics_path, class: "block px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900 hover:bg-gray-50" %>
3737
<%= button_to "Sign Out", session_path, method: :delete, class: "w-full text-left px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900 hover:bg-gray-50" %>
3838
<% else %>
39-
<%= link_to "Sign In", new_session_path, class: "block px-3 py-2 rounded-md text-base font-medium bg-indigo-600 text-white hover:bg-indigo-700" %>
39+
<%= link_to "Sign In", new_session_path, class: "block px-3 py-2 rounded-md text-base font-medium bg-indigo-600 text-white hover:bg-indigo-700", id: "mobile-sign-in" %>
4040
<% end %>
4141
</div>
4242
</div>

app/views/languages/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<div style="display: flex; justify-content: space-between; align-items: center; padding-top: 2rem; border-top: 1px solid #f3f4f6;">
1818
<div style="display: flex; gap: 1rem;">
19-
<%= f.submit "Save Language",
19+
<%= f.submit (language.persisted? ? "Update Language" : "Create Language"),
2020
style: "background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: white; font-weight: 600; padding: 0.75rem 2rem; border-radius: 0.5rem; border: none; cursor: pointer; font-size: 0.875rem; box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3); transition: all 0.2s;" %>
2121
<%= link_to "Cancel", languages_path,
2222
style: "background: #f3f4f6; color: #6b7280; font-weight: 600; padding: 0.75rem 2rem; border-radius: 0.5rem; text-decoration: none; font-size: 0.875rem; transition: all 0.2s; display: inline-block;" %>

app/views/layouts/_sidebar.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<% if Current.user.is_admin? %>
2323
<li style="margin: 1.5rem 0 1rem 0;">
24-
<div style="padding: 0.5rem 1rem; font-size: 0.75rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid #f3f4f6; margin-bottom: 0.75rem;">Administration</div>
24+
<div style="padding: 0.5rem 1rem; font-size: 0.75rem; font-weight: 600; color: #6b7280; letter-spacing: 0.05em; border-bottom: 1px solid #f3f4f6; margin-bottom: 0.75rem;">Administration</div>
2525
</li>
2626
<li style="margin-bottom: 0.5rem;">
2727
<%= link_to regions_path, style: nav_link_class(regions_path) do %>

app/views/providers/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
<div style="display: flex; justify-content: space-between; align-items: center; padding-top: 2rem; border-top: 1px solid #f3f4f6; margin-top: 2rem;">
5555
<div style="display: flex; gap: 1rem;">
56-
<%= form.submit "Save Provider",
56+
<%= form.submit (provider.persisted? ? "Update Provider" : "Create Provider"),
5757
style: "background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: white; font-weight: 600; padding: 0.75rem 2rem; border-radius: 0.5rem; border: none; cursor: pointer; font-size: 0.875rem; box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3); transition: all 0.2s;" %>
5858
<%= link_to "Cancel", providers_path,
5959
style: "background: #f3f4f6; color: #6b7280; font-weight: 600; padding: 0.75rem 2rem; border-radius: 0.5rem; text-decoration: none; font-size: 0.875rem; transition: all 0.2s; display: inline-block;" %>

app/views/sessions/new.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
class: "appearance-none relative block w-full px-4 py-3 border border-gray-300 rounded-lg placeholder-gray-400 text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all duration-200",
5757
autofocus: true,
5858
autocomplete: "username",
59-
placeholder: "you@example.com",
59+
placeholder: "Enter your email address",
6060
value: params[:email] %>
6161
</div>
6262

@@ -67,7 +67,7 @@
6767
required: true,
6868
class: "appearance-none relative block w-full px-4 py-3 border border-gray-300 rounded-lg placeholder-gray-400 text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all duration-200",
6969
autocomplete: "current-password",
70-
placeholder: "••••••••",
70+
placeholder: "Enter your password",
7171
maxlength: 72 %>
7272
</div>
7373
</div>

app/views/tags/_list.html.erb

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,22 @@
5353
</td>
5454
</tr>
5555
<% end %>
56-
<% else %>
57-
<tr>
58-
<td colspan="4" style="padding: 3rem 1.5rem; text-align: center;">
59-
<div style="color: #9ca3af;">
60-
<svg style="width: 3rem; height: 3rem; margin: 0 auto 1rem; color: #d1d5db;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
61-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"/>
62-
</svg>
63-
<p style="font-size: 1rem; font-weight: 500; color: #6b7280; margin: 0;">No tags found</p>
64-
<p style="font-size: 0.875rem; color: #9ca3af; margin: 0.5rem 0 0 0;">Try adjusting your search filters or create a new tag.</p>
65-
</div>
66-
</td>
67-
</tr>
6856
<% end %>
6957
</tbody>
7058

59+
<% unless @tags.any? %>
60+
<!-- Empty state displayed outside the table -->
61+
<div style="padding: 3rem 1.5rem; text-align: center;">
62+
<div style="color: #9ca3af;">
63+
<svg style="width: 3rem; height: 3rem; margin: 0 auto 1rem; color: #d1d5db;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
64+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"/>
65+
</svg>
66+
<p style="font-size: 1rem; font-weight: 500; color: #6b7280; margin: 0;">No tags found</p>
67+
<p style="font-size: 0.875rem; color: #9ca3af; margin: 0.5rem 0 0 0;">Try adjusting your search filters or create a new tag.</p>
68+
</div>
69+
</div>
70+
<% end %>
71+
7172
<style>
7273
/* Action button hover effects */
7374
a[href*="tags/"]:hover {
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<%= turbo_stream.update "delete_tag_#{@tag.id}" do %>
2-
<div class="confirmation-dialog">
3-
<h5>Are you sure you want to delete this tag?</h5>
2+
<div class="confirmation-dialog" style="background: white; border: 1px solid #fca5a5; border-radius: 0.75rem; padding: 1.5rem; box-shadow: 0 10px 25px -10px rgba(220, 38, 38, 0.35);">
3+
<h5 style="font-size: 1.125rem; font-weight: 600; color: #991b1b; margin: 0 0 1rem 0;">Are you sure you want to delete this tag?</h5>
44

5-
<div class="mt-4 hstack gap-3">
6-
<div>
7-
<%= button_to "Confirm Delete", tag_path(@tag, confirmed: true), method: :delete, class: "btn btn-danger" %>
8-
</div>
9-
<div>
10-
<%= link_to "Cancel", tags_path, class: "btn btn-secondary" %>
11-
</div>
5+
<p style="color: #b91c1c; margin-bottom: 1.5rem; font-size: 0.95rem;">This action cannot be undone and will remove the tag from all associated topics.</p>
6+
7+
<div style="display: flex; gap: 0.75rem; flex-wrap: wrap;">
8+
<%= button_to "Delete", tag_path(@tag, confirmed: true), method: :delete, class: "delete-tag-button" %>
9+
<%= link_to "Cancel", tag_path(@tag), data: { turbo_frame: "_top" }, class: "cancel-delete-link" %>
1210
</div>
1311
</div>
1412
<% end %>

app/views/tags/index.html.erb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,7 @@
182182
Showing <%= @tags.count %> of <%= @pagy.count %> tags
183183
</div>
184184
<div>
185-
<% if @pagy.pages > 1 %>
186-
<%= render "shared/pagination", pagy: @pagy %>
187-
<% end %>
185+
<%= render "shared/pagination", pagy: @pagy %>
188186
</div>
189187
</div>
190188
</div>

app/views/tags/show.html.erb

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
</div>
138138

139139
<!-- Taggings Section -->
140-
<div id="<%= "delete_tag_#{@tag.id}" %>">
140+
<div>
141141
<%= render "taggings" %>
142142
</div>
143143

@@ -150,20 +150,22 @@
150150
<span>Back to Tags</span>
151151
<% end %>
152152

153-
<div style="display: flex; gap: 0.75rem;">
153+
<div style="display: flex; gap: 0.75rem; align-items: center;">
154154
<%= link_to edit_tag_path(@tag), style: "background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); color: white; padding: 0.875rem 1.75rem; border-radius: 0.75rem; text-decoration: none; font-weight: 600; font-size: 0.875rem; display: inline-flex; align-items: center; gap: 0.5rem; transition: all 0.2s;", data: { turbo: false } do %>
155155
<svg style="width: 1.125rem; height: 1.125rem;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
156156
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
157157
</svg>
158158
<span>Edit</span>
159159
<% end %>
160160

161-
<%= button_to @tag, method: :delete, data: { confirm: "Are you sure you want to delete this tag? This action cannot be undone." }, style: "background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); color: white; padding: 0.875rem 1.75rem; border-radius: 0.75rem; border: none; font-weight: 600; font-size: 0.875rem; display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; transition: all 0.2s;" do %>
162-
<svg style="width: 1.125rem; height: 1.125rem;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
163-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path>
164-
</svg>
165-
<span>Delete Tag</span>
166-
<% end %>
161+
<div id="<%= "delete_tag_#{@tag.id}" %>" style="display: inline-flex;">
162+
<%= button_to @tag, method: :delete, class: "delete-tag-button" do %>
163+
<svg style="width: 1.125rem; height: 1.125rem;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
164+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path>
165+
</svg>
166+
<span>Delete this tag</span>
167+
<% end %>
168+
</div>
167169
</div>
168170
</div>
169171
</div>
@@ -183,9 +185,43 @@
183185
box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.4), 0 10px 10px -5px rgba(59, 130, 246, 0.1) !important;
184186
}
185187

186-
button[style*="background: linear-gradient(135deg, #dc2626"]:hover {
188+
.delete-tag-button {
189+
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
190+
color: white;
191+
padding: 0.875rem 1.75rem;
192+
border-radius: 0.75rem;
193+
border: none;
194+
font-weight: 600;
195+
font-size: 0.875rem;
196+
display: inline-flex;
197+
align-items: center;
198+
gap: 0.5rem;
199+
cursor: pointer;
200+
transition: all 0.2s;
201+
}
202+
203+
.delete-tag-button:hover {
187204
box-shadow: 0 20px 25px -5px rgba(220, 38, 38, 0.4), 0 10px 10px -5px rgba(220, 38, 38, 0.1) !important;
188205
}
206+
207+
.cancel-delete-link {
208+
background: #f3f4f6;
209+
color: #374151;
210+
padding: 0.875rem 1.75rem;
211+
border-radius: 0.75rem;
212+
font-weight: 600;
213+
font-size: 0.875rem;
214+
display: inline-flex;
215+
align-items: center;
216+
gap: 0.5rem;
217+
text-decoration: none;
218+
transition: all 0.2s;
219+
}
220+
221+
.cancel-delete-link:hover {
222+
background: #e5e7eb;
223+
color: #111827;
224+
}
189225

190226
/* Cognate link hover effects */
191227
a[style*="background: linear-gradient(135deg, #10b981"]:hover {

0 commit comments

Comments
 (0)