tailwind_registration 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/tailwind_registration/tailwind_registration_generator.rb +15 -0
- data/lib/generators/tailwind_registration/templates/registrations/new.html.erb +14 -0
- data/lib/generators/tailwind_registration/templates/registrations_controller.rb +21 -0
- metadata +19 -3
- data/lib/tailwind_registration.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b12be8b75cd4570e1768cb9e5767c3a02b14869eee1e4d23480eb9dc3588015
|
4
|
+
data.tar.gz: a25f270fae8d49239e41d72a4a19f0e39f5ca997857f831a1730d38dfd6b1256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43bfdc991d3a5cde2254de90fec43908fd2e281b38b9785df3dcccc719568a4f2c0598ff1dc536b1920d80dbf7fe1858b907e2fd688f69d8b878620dfac848e8
|
7
|
+
data.tar.gz: 3115c14dd5426e90b172d87bf01a463141bb9261e0298d3dd455feb78667a47a81f496178b72edb750c9825c7d264593f28aca59372c303310efd6a80dd1802d
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
class TailwindRegistrationGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("templates", __dir__)
|
5
|
+
|
6
|
+
desc "Creates the default sign up views and controller for built in rails authentication"
|
7
|
+
def create_signup_controller_and_views
|
8
|
+
route "resource :registrations, only: [:new, :create]"
|
9
|
+
copy_file "registrations_controller.rb", "app/controllers/registrations_controller.rb"
|
10
|
+
directory "registrations", "app/views/registrations"
|
11
|
+
insert_into_file "app/views/sessions/new.html.erb", before: '<div class="mt-4 text-sm text-gray-500 sm:mt-0">' do
|
12
|
+
"<%= link_to 'Sign Up', new_registrations_path, class: 'px-3 py-2 rounded-lg border-2 border-gray-900 text-gray-900 hover:bg-gray-900 hover:text-gray-50 transition duration-250' %>"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="mx-auto md:w-2/3 w-full">
|
2
|
+
<h1 class="text-4xl text-gray-900 font-bold"> Create Account </h1>
|
3
|
+
<%= form_with url: registrations_path, model: @user do |f| %>
|
4
|
+
<%= f.email_field :email_address, class: "block w-full shadow-sm border border-gray-900 text-gray-900 px-3 py-2 rounded-lg my-5",
|
5
|
+
placeholder: "Enter your email" %>
|
6
|
+
<%= f.password_field :password, class: "block w-full shadow-sm border border-gray-900 text-gray-900 px-3 py-2 rounded-lg my-5",
|
7
|
+
placeholder: "Enter a password" %>
|
8
|
+
|
9
|
+
<div class="flex items-center gap-4">
|
10
|
+
<%= f.submit "Sign up", class: "px-3 py-2 rounded-lg bg-blue-500 text-blue-50 cursor-pointer hover:bg-blue-600 transition duration-250" %>
|
11
|
+
<%= link_to "Log in", new_session_path, class: "px-3 py-2 rounded-lg border-2 border-gray-900 text-gray-900 hover:bg-gray-900 hover:text-gray-50 transition duration-250" %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class RegistrationsController < ApplicationController
|
2
|
+
skip_before_action :require_authentication
|
3
|
+
def new
|
4
|
+
@user = User.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def create
|
8
|
+
if @user = User.create(user_params)
|
9
|
+
start_new_session_for @user
|
10
|
+
redirect_to root_path, notice: "User account was successfully created"
|
11
|
+
else
|
12
|
+
render :new
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def user_params
|
19
|
+
params.expect(user: [:email_address, :password])
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,21 +1,37 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tailwind_registration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Indigo Tech Tutorials
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
10
|
date: 2025-03-16 00:00:00.000000000 Z
|
11
|
-
dependencies:
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: rails
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '8.0'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '8.0'
|
12
26
|
description: Generate simple registration flow for app with TailwindCSS
|
13
27
|
email: indigotechtutorials@gmail.com
|
14
28
|
executables: []
|
15
29
|
extensions: []
|
16
30
|
extra_rdoc_files: []
|
17
31
|
files:
|
18
|
-
- lib/tailwind_registration.rb
|
32
|
+
- lib/generators/tailwind_registration/tailwind_registration_generator.rb
|
33
|
+
- lib/generators/tailwind_registration/templates/registrations/new.html.erb
|
34
|
+
- lib/generators/tailwind_registration/templates/registrations_controller.rb
|
19
35
|
homepage: https://rubygems.org/gems/tailwind_registration
|
20
36
|
licenses:
|
21
37
|
- MIT
|