blog_app 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.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +67 -0
  3. data/README.md +24 -0
  4. data/Rakefile +6 -0
  5. data/config/application.rb +22 -0
  6. data/config/boot.rb +4 -0
  7. data/config/cable.yml +10 -0
  8. data/config/credentials.yml.enc +1 -0
  9. data/config/database.yml +29 -0
  10. data/config/environment.rb +5 -0
  11. data/config/environments/development.rb +66 -0
  12. data/config/environments/production.rb +112 -0
  13. data/config/environments/test.rb +49 -0
  14. data/config/initializers/application_controller_renderer.rb +8 -0
  15. data/config/initializers/assets.rb +14 -0
  16. data/config/initializers/backtrace_silencers.rb +7 -0
  17. data/config/initializers/content_security_policy.rb +30 -0
  18. data/config/initializers/cookies_serializer.rb +5 -0
  19. data/config/initializers/devise.rb +311 -0
  20. data/config/initializers/filter_parameter_logging.rb +4 -0
  21. data/config/initializers/inflections.rb +16 -0
  22. data/config/initializers/mime_types.rb +4 -0
  23. data/config/initializers/wrap_parameters.rb +14 -0
  24. data/config/locales/devise.en.yml +65 -0
  25. data/config/locales/en.yml +33 -0
  26. data/config/puma.rb +38 -0
  27. data/config/routes.rb +12 -0
  28. data/config/spring.rb +6 -0
  29. data/config/storage.yml +34 -0
  30. data/config/webpack/development.js +5 -0
  31. data/config/webpack/environment.js +11 -0
  32. data/config/webpack/production.js +5 -0
  33. data/config/webpack/test.js +5 -0
  34. data/config/webpacker.yml +96 -0
  35. data/db/migrate/20220803091536_create_articles.rb +10 -0
  36. data/db/migrate/20220803160125_create_comments.rb +11 -0
  37. data/db/migrate/20220810064022_devise_create_users.rb +44 -0
  38. data/db/migrate/20220819063129_add_user_ref_to_comments.rb +5 -0
  39. data/db/migrate/20220819064210_changes_in_table.rb +6 -0
  40. data/db/migrate/20220907114823_create_active_storage_tables.active_storage.rb +27 -0
  41. data/db/migrate/20220908072238_add_omniauth_to_users.rb +5 -0
  42. data/db/schema.rb +80 -0
  43. data/db/seeds.rb +1018 -0
  44. data/lib/app/assets/config/manifest.js +2 -0
  45. data/lib/app/assets/stylesheets/application.css +15 -0
  46. data/lib/app/assets/stylesheets/articles.scss +3 -0
  47. data/lib/app/assets/stylesheets/comments.scss +3 -0
  48. data/lib/app/assets/stylesheets/custom.css +30 -0
  49. data/lib/app/channels/application_cable/channel.rb +4 -0
  50. data/lib/app/channels/application_cable/connection.rb +4 -0
  51. data/lib/app/controllers/application_controller.rb +11 -0
  52. data/lib/app/controllers/articles_controller.rb +50 -0
  53. data/lib/app/controllers/comments_controller.rb +25 -0
  54. data/lib/app/controllers/users/omniauth_callbacks_controller.rb +14 -0
  55. data/lib/app/helpers/application_helper.rb +2 -0
  56. data/lib/app/helpers/articles_helper.rb +2 -0
  57. data/lib/app/helpers/comments_helper.rb +2 -0
  58. data/lib/app/javascript/channels/consumer.js +6 -0
  59. data/lib/app/javascript/channels/index.js +5 -0
  60. data/lib/app/javascript/css/application.scss +2 -0
  61. data/lib/app/javascript/packs/application.js +18 -0
  62. data/lib/app/jobs/application_job.rb +7 -0
  63. data/lib/app/mailers/application_mailer.rb +4 -0
  64. data/lib/app/mailers/user_mailer.rb +11 -0
  65. data/lib/app/models/application_record.rb +3 -0
  66. data/lib/app/models/article.rb +5 -0
  67. data/lib/app/models/comment.rb +4 -0
  68. data/lib/app/models/user.rb +42 -0
  69. data/lib/app/views/articles/_form.html.erb +31 -0
  70. data/lib/app/views/articles/edit.html.erb +8 -0
  71. data/lib/app/views/articles/index.html.erb +26 -0
  72. data/lib/app/views/articles/new.html.erb +8 -0
  73. data/lib/app/views/articles/show.html.erb +26 -0
  74. data/lib/app/views/comments/_comment.html.erb +16 -0
  75. data/lib/app/views/comments/_form.html.erb +15 -0
  76. data/lib/app/views/header_and_footer/_header.html.erb +34 -0
  77. data/lib/app/views/layouts/application.html.erb +23 -0
  78. data/lib/app/views/layouts/authentication.html.erb +0 -0
  79. data/lib/app/views/layouts/mailer.html.erb +13 -0
  80. data/lib/app/views/layouts/mailer.text.erb +1 -0
  81. data/lib/app/views/user_mailer/welcome_email.html.erb +10 -0
  82. data/lib/app/views/user_mailer/welcome_email.text.erb +13 -0
  83. data/lib/app/views/users/confirmations/new.html.erb +16 -0
  84. data/lib/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
  85. data/lib/app/views/users/mailer/email_changed.html.erb +7 -0
  86. data/lib/app/views/users/mailer/password_change.html.erb +3 -0
  87. data/lib/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
  88. data/lib/app/views/users/mailer/unlock_instructions.html.erb +7 -0
  89. data/lib/app/views/users/passwords/edit.html.erb +27 -0
  90. data/lib/app/views/users/passwords/new.html.erb +18 -0
  91. data/lib/app/views/users/registrations/edit.html.erb +77 -0
  92. data/lib/app/views/users/registrations/new.html.erb +40 -0
  93. data/lib/app/views/users/sessions/new.html.erb +28 -0
  94. data/lib/app/views/users/shared/_error_messages.html.erb +15 -0
  95. data/lib/app/views/users/shared/_links.html.erb +26 -0
  96. data/lib/app/views/users/unlocks/new.html.erb +16 -0
  97. metadata +151 -0
@@ -0,0 +1,18 @@
1
+ <div class="col">
2
+ <h2 class="align-class">Forgot your password?</h2>
3
+ <br>
4
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
5
+ <%= render "users/shared/error_messages", resource: resource %>
6
+
7
+ <div class="field col-6 mx-auto">
8
+ <%= f.label :email, class: "form-label" %><br />
9
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
10
+ </div>
11
+ <br>
12
+ <div class="actions d-grid gap-2 col-6 mx-auto shadow">
13
+ <%= f.submit "Send me reset password instructions", class: "btn btn-success btn-lg" %>
14
+ </div>
15
+ <% end %>
16
+ <br>
17
+ <%= render "users/shared/links" %>
18
+ </div>
@@ -0,0 +1,77 @@
1
+ <div class="col">
2
+ <h2 class="align-class">Edit <%= resource_name.to_s.humanize %></h2>
3
+
4
+ <% if current_user.avatar.attached? %>
5
+ <br>
6
+ <br>
7
+ <div class="field col-6 mx-auto align-class"><%= image_tag current_user.avatar, width: "200px", style: "border-radius: 30px;border: 3px solid black" %></div>
8
+ <br>
9
+ <% elsif user_signed_in? %>
10
+ <br>
11
+ <div class="field col-6 mx-auto align-class"><%= image_tag current_user.image, width: "200px", style: "border-radius: 30px;border: 3px solid black" if current_user.image? %></div>
12
+ <% end %>
13
+ <br>
14
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
15
+ <%= render "users/shared/error_messages", resource: resource %>
16
+
17
+ <div class="field col-6 mx-auto">
18
+ <%= f.label :email, class: "form-label" %><br />
19
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
20
+ </div>
21
+
22
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
23
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
24
+ <% end %>
25
+
26
+ <br>
27
+ <div class="field col-6 mx-auto">
28
+ <%= f.label :first_name, class: "form-label" %><br />
29
+ <%= f.text_field :first_name, autofocus: true, autocomplete: "first_name", class: "form-control" %>
30
+ </div>
31
+ <br>
32
+ <div class="field col-6 mx-auto">
33
+ <%= f.label :last_name, class: "form-label" %><br />
34
+ <%= f.text_field :last_name, autofocus: true, autocomplete: "last_name", class: "form-control" %>
35
+ </div>
36
+ <br>
37
+
38
+ <div class="field col-6 mx-auto">
39
+ <%= f.label :avatar, class: "form-label" %><br />
40
+ <%= f.file_field :avatar, class: "form-control"%>
41
+ </div>
42
+ <br>
43
+
44
+ <div class="field col-6 mx-auto">
45
+ <%= f.label :password, class: "form-label" %> <i>(leave blank if you don't want to change it)</i><br />
46
+ <%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
47
+ <% if @minimum_password_length %>
48
+ <em><%= @minimum_password_length %> characters minimum</em>
49
+ <% end %>
50
+ </div>
51
+ <br>
52
+ <div class="field col-6 mx-auto">
53
+ <%= f.label :password_confirmation, class: "form-label" %><br />
54
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %>
55
+ </div>
56
+ <br>
57
+ <div class="field col-6 mx-auto">
58
+ <%= f.label :current_password, class: "form-label" %> <i>(we need your current password to confirm your changes)</i><br />
59
+ <%= f.password_field :current_password, autocomplete: "current-password", class: "form-control" %>
60
+ </div>
61
+ <br>
62
+ <div class="actions d-grid gap-2 col-6 mx-auto shadow">
63
+ <%= f.submit "Update", class: "btn btn-success btn-lg" %>
64
+ </div>
65
+ <% end %>
66
+ <br>
67
+ <hr>
68
+ <br>
69
+ <h3 class="align-class">Cancel my account</h3>
70
+ <br>
71
+ <br>
72
+ <p class="align-class">Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "d-grid gap-2 col-6 mx-auto shadow btn btn-danger btn-lg" %></p>
73
+ <div class="align-class">
74
+ <%= link_to "Back", :back, class: "btn btn-secondary shadow" %>
75
+ </div>
76
+ <br>
77
+ </div>
@@ -0,0 +1,40 @@
1
+ <div class="col">
2
+ <h2 class="align-class">Sign up</h2>
3
+ <br>
4
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
5
+ <%= render "users/shared/error_messages", resource: resource %>
6
+ <div class="field col-6 mx-auto">
7
+ <%= f.label :email, class: "form-label" %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
9
+ </div>
10
+ <br>
11
+ <div class="field col-6 mx-auto">
12
+ <%= f.label :first_name, class: "form-label" %><br />
13
+ <%= f.text_field :first_name, autofocus: true, autocomplete: "first_name", class: "form-control" %>
14
+ </div>
15
+ <br>
16
+ <div class="field col-6 mx-auto">
17
+ <%= f.label :last_name, class: "form-label" %><br />
18
+ <%= f.text_field :last_name, autofocus: true, autocomplete: "last_name", class: "form-control" %>
19
+ </div>
20
+ <br>
21
+ <div class="field col-6 mx-auto">
22
+ <%= f.label :password, class: "form-label" %>
23
+ <% if @minimum_password_length %>
24
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
25
+ <% end %><br />
26
+ <%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
27
+ </div>
28
+ <br>
29
+ <div class="field col-6 mx-auto">
30
+ <%= f.label :password_confirmation, class: "form-label" %><br />
31
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %>
32
+ </div>
33
+ <br>
34
+ <div class="actions d-grid gap-2 col-6 mx-auto shadow">
35
+ <%= f.submit "Sign up", class: "btn btn-success btn-lg" %>
36
+ </div>
37
+ <% end %>
38
+ <br>
39
+ <%= render "users/shared/links" %>
40
+ </div>
@@ -0,0 +1,28 @@
1
+ <div class="col">
2
+ <h2 class="align-class">Log in</h2>
3
+ <br>
4
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
5
+ <div class="field col-6 mx-auto">
6
+ <%= f.label :email, class: "form-label" %><br />
7
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
8
+ </div>
9
+ <br>
10
+ <div class="field col-6 mx-auto">
11
+ <%= f.label :password, class: "form-label" %><br />
12
+ <%= f.password_field :password, autocomplete: "current-password", class: "form-control" %>
13
+ </div>
14
+ <br>
15
+ <% if devise_mapping.rememberable? %>
16
+ <div class="field col-6 mx-auto">
17
+ <%= f.check_box :remember_me, class: "form-check-input" %>
18
+ <%= f.label :remember_me, class: "form-check-label" %>
19
+ </div>
20
+ <% end %>
21
+ <br>
22
+ <div class="actions d-grid gap-2 col-6 mx-auto shadow">
23
+ <%= f.submit "Log in", class: "btn btn-success btn-lg" %>
24
+ </div>
25
+ <% end %>
26
+ <br>
27
+ <%= render "users/shared/links" %>
28
+ </div>
@@ -0,0 +1,15 @@
1
+ <% if resource.errors.any? %>
2
+ <div id="error_explanation">
3
+ <h2>
4
+ <%= I18n.t("errors.messages.not_saved",
5
+ count: resource.errors.count,
6
+ resource: resource.class.model_name.human.downcase)
7
+ %>
8
+ </h2>
9
+ <ul>
10
+ <% resource.errors.full_messages.each do |message| %>
11
+ <li><%= message %></li>
12
+ <% end %>
13
+ </ul>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to "Log in", new_session_path(resource_name), class: "d-grid gap-2 col-6 mx-auto link-class" %><br>
3
+
4
+ <% end %>
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to "Sign up", new_registration_path(resource_name), class: "d-grid gap-2 col-6 mx-auto link-class" %><br>
7
+ <% end %>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10
+ <%= link_to "Forgot your password?", new_password_path(resource_name), class: "d-grid gap-2 col-6 mx-auto link-class" %><br>
11
+ <% end %>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br>
15
+ <% end %>
16
+
17
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br>
19
+ <% end %>
20
+
21
+ <%- if devise_mapping.omniauthable? %><div class="align-class">-------------- OR SIGN IN WITH --------------</div><br>
22
+ <%- resource_class.omniauth_providers.each do |provider| %>
23
+ <%= link_to "Sign in with Google", omniauth_authorize_path(resource_name, provider), method: :post, class: "d-grid gap-2 col-6 mx-auto link-class btn btn-primary btn-lg shadow" %><br>
24
+ <% end %>
25
+ <% end %>
26
+
@@ -0,0 +1,16 @@
1
+ <h2>Resend unlock instructions</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= render "users/shared/error_messages", resource: resource %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Resend unlock instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "users/shared/links" %>
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blog_app
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Charchit Khandelwal
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-06-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: A full Rails blog application as a reusable gem.
28
+ email:
29
+ - charchitkhandelwal575@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - Gemfile
35
+ - README.md
36
+ - Rakefile
37
+ - config/application.rb
38
+ - config/boot.rb
39
+ - config/cable.yml
40
+ - config/credentials.yml.enc
41
+ - config/database.yml
42
+ - config/environment.rb
43
+ - config/environments/development.rb
44
+ - config/environments/production.rb
45
+ - config/environments/test.rb
46
+ - config/initializers/application_controller_renderer.rb
47
+ - config/initializers/assets.rb
48
+ - config/initializers/backtrace_silencers.rb
49
+ - config/initializers/content_security_policy.rb
50
+ - config/initializers/cookies_serializer.rb
51
+ - config/initializers/devise.rb
52
+ - config/initializers/filter_parameter_logging.rb
53
+ - config/initializers/inflections.rb
54
+ - config/initializers/mime_types.rb
55
+ - config/initializers/wrap_parameters.rb
56
+ - config/locales/devise.en.yml
57
+ - config/locales/en.yml
58
+ - config/puma.rb
59
+ - config/routes.rb
60
+ - config/spring.rb
61
+ - config/storage.yml
62
+ - config/webpack/development.js
63
+ - config/webpack/environment.js
64
+ - config/webpack/production.js
65
+ - config/webpack/test.js
66
+ - config/webpacker.yml
67
+ - db/migrate/20220803091536_create_articles.rb
68
+ - db/migrate/20220803160125_create_comments.rb
69
+ - db/migrate/20220810064022_devise_create_users.rb
70
+ - db/migrate/20220819063129_add_user_ref_to_comments.rb
71
+ - db/migrate/20220819064210_changes_in_table.rb
72
+ - db/migrate/20220907114823_create_active_storage_tables.active_storage.rb
73
+ - db/migrate/20220908072238_add_omniauth_to_users.rb
74
+ - db/schema.rb
75
+ - db/seeds.rb
76
+ - lib/app/assets/config/manifest.js
77
+ - lib/app/assets/stylesheets/application.css
78
+ - lib/app/assets/stylesheets/articles.scss
79
+ - lib/app/assets/stylesheets/comments.scss
80
+ - lib/app/assets/stylesheets/custom.css
81
+ - lib/app/channels/application_cable/channel.rb
82
+ - lib/app/channels/application_cable/connection.rb
83
+ - lib/app/controllers/application_controller.rb
84
+ - lib/app/controllers/articles_controller.rb
85
+ - lib/app/controllers/comments_controller.rb
86
+ - lib/app/controllers/users/omniauth_callbacks_controller.rb
87
+ - lib/app/helpers/application_helper.rb
88
+ - lib/app/helpers/articles_helper.rb
89
+ - lib/app/helpers/comments_helper.rb
90
+ - lib/app/javascript/channels/consumer.js
91
+ - lib/app/javascript/channels/index.js
92
+ - lib/app/javascript/css/application.scss
93
+ - lib/app/javascript/packs/application.js
94
+ - lib/app/jobs/application_job.rb
95
+ - lib/app/mailers/application_mailer.rb
96
+ - lib/app/mailers/user_mailer.rb
97
+ - lib/app/models/application_record.rb
98
+ - lib/app/models/article.rb
99
+ - lib/app/models/comment.rb
100
+ - lib/app/models/user.rb
101
+ - lib/app/views/articles/_form.html.erb
102
+ - lib/app/views/articles/edit.html.erb
103
+ - lib/app/views/articles/index.html.erb
104
+ - lib/app/views/articles/new.html.erb
105
+ - lib/app/views/articles/show.html.erb
106
+ - lib/app/views/comments/_comment.html.erb
107
+ - lib/app/views/comments/_form.html.erb
108
+ - lib/app/views/header_and_footer/_header.html.erb
109
+ - lib/app/views/layouts/application.html.erb
110
+ - lib/app/views/layouts/authentication.html.erb
111
+ - lib/app/views/layouts/mailer.html.erb
112
+ - lib/app/views/layouts/mailer.text.erb
113
+ - lib/app/views/user_mailer/welcome_email.html.erb
114
+ - lib/app/views/user_mailer/welcome_email.text.erb
115
+ - lib/app/views/users/confirmations/new.html.erb
116
+ - lib/app/views/users/mailer/confirmation_instructions.html.erb
117
+ - lib/app/views/users/mailer/email_changed.html.erb
118
+ - lib/app/views/users/mailer/password_change.html.erb
119
+ - lib/app/views/users/mailer/reset_password_instructions.html.erb
120
+ - lib/app/views/users/mailer/unlock_instructions.html.erb
121
+ - lib/app/views/users/passwords/edit.html.erb
122
+ - lib/app/views/users/passwords/new.html.erb
123
+ - lib/app/views/users/registrations/edit.html.erb
124
+ - lib/app/views/users/registrations/new.html.erb
125
+ - lib/app/views/users/sessions/new.html.erb
126
+ - lib/app/views/users/shared/_error_messages.html.erb
127
+ - lib/app/views/users/shared/_links.html.erb
128
+ - lib/app/views/users/unlocks/new.html.erb
129
+ homepage:
130
+ licenses: []
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubygems_version: 3.1.2
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: A Rails blog application packaged as a gem.
151
+ test_files: []