Introduce ViewComponent
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
https://viewcomponent.org
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<header class="py-10">
|
||||
<div class="max-w-xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<h1 class="text-3xl font-bold text-white text-center">
|
||||
<%= page_title %>
|
||||
<%= @title %>
|
||||
</h1>
|
||||
</div>
|
||||
</header>
|
||||
7
app/components/header_compact_component.rb
Normal file
7
app/components/header_compact_component.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class HeaderCompactComponent < ViewComponent::Base
|
||||
def initialize(title:)
|
||||
@title = title
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
<header class="py-10">
|
||||
<div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<h1 class="text-3xl font-bold text-white">
|
||||
<%= page_title %>
|
||||
<%= @title %>
|
||||
</h1>
|
||||
</div>
|
||||
</header>
|
||||
7
app/components/header_component.rb
Normal file
7
app/components/header_component.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class HeaderComponent < ViewComponent::Base
|
||||
def initialize(title:)
|
||||
@title = title
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
<main class="w-full max-w-xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">
|
||||
<div class="bg-white rounded-lg shadow px-6 py-12 sm:px-12">
|
||||
<%= yield %>
|
||||
<%= content %>
|
||||
</div>
|
||||
</main>
|
||||
5
app/components/main_compact_component.rb
Normal file
5
app/components/main_compact_component.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MainCompactComponent < ViewComponent::Base
|
||||
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
<main class="w-full max-w-6xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">
|
||||
<div class="bg-white rounded-lg shadow px-6 py-12 sm:px-12">
|
||||
<%= yield %>
|
||||
<%= content %>
|
||||
</div>
|
||||
</main>
|
||||
5
app/components/main_simple_component.rb
Normal file
5
app/components/main_simple_component.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MainSimpleComponent < ViewComponent::Base
|
||||
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Admin Panel" } %>
|
||||
<%= render HeaderComponent.new(title: "Admin Panel") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<p class="text-center">
|
||||
With great power comes great responsibility.
|
||||
</p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Donations" } %>
|
||||
<%= render HeaderComponent.new(title: "Donations") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<h2>Editing Donation</h2>
|
||||
|
||||
<%= render 'form', donation: @donation, url: admin_donation_path(@donation) %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Donations" } %>
|
||||
<%= render HeaderComponent.new(title: "Donations") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<% if @donations.any? %>
|
||||
<table class="w-full">
|
||||
<thead>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Donations" } %>
|
||||
<%= render HeaderComponent.new(title: "Donations") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<h2>New Donation</h2>
|
||||
|
||||
<%= render 'form', donation: @donation, url: admin_donations_path %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Donations" } %>
|
||||
<%= render HeaderComponent.new(title: "Donations") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Invitations" } %>
|
||||
<%= render HeaderComponent.new(title: "Invitations") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section>
|
||||
<p>
|
||||
There are currently <strong><%= @invitations_unused_count %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "LDAP Users: #{@ou}" } %>
|
||||
<%= render HeaderComponent.new(title: "LDAP Users: #{@ou}") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<h3 class="hidden">Domains</h3>
|
||||
<ul class="mb-10">
|
||||
<li class="inline-block">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Services" } %>
|
||||
<%= render HeaderComponent.new(title: "Services") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section>
|
||||
<p>
|
||||
Your Kosmos account and password currently give you access to these
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header_compact", locals: { page_title: "Log in" } %>
|
||||
<%= render HeaderCompactComponent.new(title: "Log in") %>
|
||||
|
||||
<%= render layout: "components/main_compact" do %>
|
||||
<%= render MainCompactComponent.new do %>
|
||||
<h2>Resend confirmation instructions</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header_compact", locals: { page_title: "Log in" } %>
|
||||
<%= render HeaderCompactComponent.new(title: "Log in") %>
|
||||
|
||||
<%= render layout: "components/main_compact" do %>
|
||||
<%= render MainCompactComponent.new do %>
|
||||
<h2>Change your password</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header_compact", locals: { page_title: "Log in" } %>
|
||||
<%= render HeaderCompactComponent.new(title: "Log in") %>
|
||||
|
||||
<%= render layout: "components/main_compact" do %>
|
||||
<%= render MainCompactComponent.new do %>
|
||||
<h2>Forgot your password?</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header_compact", locals: { page_title: "Log in" } %>
|
||||
<%= render HeaderCompactComponent.new(title: "Log in") %>
|
||||
|
||||
<%= render layout: "components/main_compact" do %>
|
||||
<%= render MainCompactComponent.new do %>
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
<p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Donations" } %>
|
||||
<%= render HeaderComponent.new(title: "Donations") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section>
|
||||
<p>
|
||||
Your financial contributions to the development and upkeep of Kosmos
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Invitations" } %>
|
||||
<%= render HeaderComponent.new(title: "Invitations") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section>
|
||||
<% if @invitations_unused.any? %>
|
||||
<p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Account" } %>
|
||||
<%= render HeaderComponent.new(title: "Account") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section>
|
||||
<h2>Security</h2>
|
||||
</section>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<%= link_to "Invitations", admin_invitations_path,
|
||||
class: main_nav_class(@current_section, :invitations) %>
|
||||
<%= link_to "Donations", admin_donations_path,
|
||||
class: main_nav_class(@current_section, :contributions) %>
|
||||
class: main_nav_class(@current_section, :donations) %>
|
||||
<%= link_to "LDAP Users", admin_ldap_users_path,
|
||||
class: main_nav_class(@current_section, :ldap_users) %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= render partial: "components/header", locals: { page_title: "Wallet" } %>
|
||||
<%= render HeaderComponent.new(title: "Wallet") %>
|
||||
|
||||
<%= render layout: "components/main_simple" do %>
|
||||
<%= render MainSimpleComponent.new do %>
|
||||
<section class="w-full grid grid-cols-1 md:grid-cols-12 md:mb-0">
|
||||
<div class="md:col-span-8">
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user