Links, mainly...
This commit is contained in:
parent
fd42a3f173
commit
21ab02d647
69 changed files with 2258 additions and 155 deletions
|
|
@ -12,7 +12,6 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<%== pagy_info(@pagy) %>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -32,9 +31,12 @@
|
|||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="my-3">
|
||||
<%== pagy_info(@pagy) %>
|
||||
</div>
|
||||
|
||||
<%== pagy_bootstrap_nav(@pagy) %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_new", model: Check.model_name.human), new_check_path %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<div class="container">
|
||||
<a class="navbar-brand" href="<%= root_path %>">
|
||||
<%= tag.i(class: "bi bi-universal-access") %>
|
||||
a11ydive
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
|
|
@ -61,4 +62,4 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<!doctype html>
|
||||
<html <%== cookies[:"modeTheme"] && "data-bs-theme=\"#{cookies[:"modeTheme"]}\"" %> data-controller="set-theme">
|
||||
<head>
|
||||
<title>A11yDive</title>
|
||||
<title>a11ydive</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
||||
<%= csrf_meta_tags %>
|
||||
|
|
|
|||
5
app/views/link_categories/_form.html.erb
Normal file
5
app/views/link_categories/_form.html.erb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<%= bootstrap_form_with(model: link_category) do |form| %>
|
||||
<%= form.text_field :name %>
|
||||
<%= form.rich_text_area :description_html %>
|
||||
<%= form.submit %>
|
||||
<% end %>
|
||||
12
app/views/link_categories/_link_category.html.erb
Normal file
12
app/views/link_categories/_link_category.html.erb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<div id="<%= dom_id link_category %>">
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= link_category.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= link_category.description_html %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
2
app/views/link_categories/_link_category.json.jbuilder
Normal file
2
app/views/link_categories/_link_category.json.jbuilder
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
json.extract! link_category, :id, :name, :description, :rich_text, :created_at, :updated_at
|
||||
json.url link_category_url(link_category, format: :json)
|
||||
8
app/views/link_categories/edit.html.erb
Normal file
8
app/views/link_categories/edit.html.erb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<h1><%= t("scaffold.pagetitle_edit", model: LinkCategory.model_name.human) %></h1>
|
||||
|
||||
<%= render "form", link_category: @link_category %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_show", model: LinkCategory.model_name.human), @link_category %>
|
||||
<%= link_to t("scaffold.link_index", model: LinkCategory.model_name.human(count: 2)), link_categories_path %>
|
||||
</div>
|
||||
29
app/views/link_categories/index.html.erb
Normal file
29
app/views/link_categories/index.html.erb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<h1><%= t("scaffold.pagetitle_index", model: LinkCategory.model_name.human(count: 2)) %></h1>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= LinkCategory.human_attribute_name(:id) %></th>
|
||||
|
||||
<th><%= LinkCategory.human_attribute_name(:name) %></th>
|
||||
|
||||
<th><%= LinkCategory.human_attribute_name(:description) %></th>
|
||||
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @link_categories.each do |link_category| %>
|
||||
<tr>
|
||||
<td><%= link_to(link_category.id, url_for(link_category)) %></td>
|
||||
|
||||
<td><%= link_to(link_category.name, url_for(link_category)) %></td>
|
||||
|
||||
<td><%= link_to(link_category.description, url_for(link_category)) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_new", model: LinkCategory.model_name.human), new_link_category_path %>
|
||||
</div>
|
||||
1
app/views/link_categories/index.json.jbuilder
Normal file
1
app/views/link_categories/index.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
|||
json.array! @link_categories, partial: "link_categories/link_category", as: :link_category
|
||||
7
app/views/link_categories/new.html.erb
Normal file
7
app/views/link_categories/new.html.erb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<h1><%= t("scaffold.pagetitle_new", model: LinkCategory.model_name.human) %></h1>
|
||||
|
||||
<%= render "form", link_category: @link_category %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_index", model: LinkCategory.model_name.human(count: 2)), link_categories_path %>
|
||||
</div>
|
||||
9
app/views/link_categories/show.html.erb
Normal file
9
app/views/link_categories/show.html.erb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<h1><%= t("scaffold.pagetitle_show", model: @link_category.class.model_name.human) %></h1>
|
||||
|
||||
<%= render @link_category %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_edit", model: @link_category.model_name.human), edit_link_category_path(@link_category) %>
|
||||
<%= link_to t("scaffold.link_index", model: @link_category.model_name.human(count: 2)), link_categories_path %>
|
||||
<%= button_to t("scaffold.link_destroy", model: @link_category.model_name.human), @link_category, method: :delete, class: "btn btn-outline-danger" %>
|
||||
</div>
|
||||
1
app/views/link_categories/show.json.jbuilder
Normal file
1
app/views/link_categories/show.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
|||
json.partial! "link_categories/link_category", link_category: @link_category
|
||||
12
app/views/links/_form.html.erb
Normal file
12
app/views/links/_form.html.erb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<%= bootstrap_form_with(model: link) do |form| %>
|
||||
|
||||
<div data-controller="check-link">
|
||||
<%= form.text_field :url, placeholder: "https://wikipedia.org", data: { "check-link-target": "input" } %>
|
||||
<%= link_to(link.url, link.url, target: "_blank", class: "mb-2", data: { "check-link-target": "button" }) %>
|
||||
</div>
|
||||
|
||||
<%= form.collection_select :link_category_id, LinkCategory.all.order(:name), :id, :name, include_blank: !link.persisted? %>
|
||||
<%= form.text_field :text %>
|
||||
<%= form.rich_text_area :description %>
|
||||
<%= form.submit %>
|
||||
<% end %>
|
||||
32
app/views/links/_link.html.erb
Normal file
32
app/views/links/_link.html.erb
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<div id="<%= dom_id link %>">
|
||||
<p>
|
||||
<strong>Url:</strong>
|
||||
<%= link.url %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Text:</strong>
|
||||
<%= link.text %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= link.description_html %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Last check at:</strong>
|
||||
<%= link.last_check_at %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Fail count:</strong>
|
||||
<%= link.fail_count %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Link category:</strong>
|
||||
<%= link.link_category_id %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
3
app/views/links/_link.json.jbuilder
Normal file
3
app/views/links/_link.json.jbuilder
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
json.extract! link, :id, :url, :text, :description, :last_check_at, :fail_count, :link_category_id, :created_at, :updated_at
|
||||
json.url link_url(link, format: :json)
|
||||
json.description link.description.to_s
|
||||
8
app/views/links/edit.html.erb
Normal file
8
app/views/links/edit.html.erb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<h1><%= t("scaffold.pagetitle_edit", model: Link.model_name.human) %></h1>
|
||||
|
||||
<%= render "form", link: @link %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_show", model: Link.model_name.human), @link %>
|
||||
<%= link_to t("scaffold.link_index", model: Link.model_name.human(count: 2)), links_path %>
|
||||
</div>
|
||||
30
app/views/links/index.html.erb
Normal file
30
app/views/links/index.html.erb
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<h1><%= t("scaffold.pagetitle_index", model: Link.model_name.human(count: 2)) %></h1>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><%= LinkCategory.model_name.human %></th>
|
||||
<th><%= Link.human_attribute_name(:url) %></th>
|
||||
<th><%= Link.human_attribute_name(:text) %></th>
|
||||
<th><%= Link.human_attribute_name(:description) %></th>
|
||||
<th><%= Link.human_attribute_name(:last_check_at) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @links.each do |link| %>
|
||||
<tr>
|
||||
<td><%= link_to(tag.i(class: link.ok? ? "bi bi-check" : "bi bi-x-lg"), url_for(link)) %></td>
|
||||
<td><%= link_to(link.link_category.name, url_for(link)) %></td>
|
||||
<td><%= link_to(truncate(link.url), link.url, target: "_blank", rel: "nofollow") %></td>
|
||||
<td><%= link_to(link.text, url_for(link)) %></td>
|
||||
<td><%= link_to(truncate(link.description_html.to_plain_text), url_for(link)) %></td>
|
||||
<td><%= link.last_check_at && l(link.last_check_at, format: :short) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_new", model: Link.model_name.human), new_link_path %>
|
||||
</div>
|
||||
1
app/views/links/index.json.jbuilder
Normal file
1
app/views/links/index.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
|||
json.array! @links, partial: "links/link", as: :link
|
||||
7
app/views/links/new.html.erb
Normal file
7
app/views/links/new.html.erb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<h1><%= t("scaffold.pagetitle_new", model: Link.model_name.human) %></h1>
|
||||
|
||||
<%= render "form", link: @link %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_index", model: Link.model_name.human(count: 2)), links_path %>
|
||||
</div>
|
||||
8
app/views/links/show.html.erb
Normal file
8
app/views/links/show.html.erb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<h1><%= t("scaffold.pagetitle_show", model: @link.class.model_name.human) %></h1>
|
||||
<%= render @link %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_edit", model: @link.model_name.human), edit_link_path(@link) %>
|
||||
<%= link_to t("scaffold.link_index", model: @link.model_name.human(count: 2)), links_path %>
|
||||
<%= button_to t("scaffold.link_destroy", model: @link.model_name.human), @link, method: :delete, class: "btn btn-outline-danger" %>
|
||||
</div>
|
||||
1
app/views/links/show.json.jbuilder
Normal file
1
app/views/links/show.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
|||
json.partial! "links/link", link: @link
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<td><%= link_to(report.name, url_for(report)) %></td>
|
||||
|
||||
<td><%= link_to(truncate(strip_tags(report.comment)), url_for(report)) if report.comment %></td>
|
||||
<td><%= link_to(truncate(report.comment_html.to_plain_text), url_for(report)) if report.comment_html %></td>
|
||||
<td><%= l(report.created_at, format: :short) %></td>
|
||||
<td><%= l(report.updated_at, format: :short) %></td>
|
||||
</tr>
|
||||
|
|
@ -28,4 +28,4 @@
|
|||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_new", model: Report.model_name.human), new_report_path %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue