Compare commits

..

No commits in common. "8629281c147669c516bd27aa35eca2def4cf61dc" and "86f5e7d0880aa201771f36a334df3e82be5a436a" have entirely different histories.

19 changed files with 46 additions and 176 deletions

View File

@ -1,4 +0,0 @@
.bundle
node_modules
log
vendor

2
.gitignore vendored
View File

@ -41,5 +41,3 @@
/node_modules
/.idea
/config/credentials/production.key

View File

@ -1,32 +0,0 @@
image: docker:latest
services:
- docker:dind
stages:
- release
variables:
# Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
CONTAINER_BRANCH_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
release:
stage: release
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $CONTAINER_BRANCH_IMAGE
- docker push $CONTAINER_BRANCH_IMAGE
except:
- master
release-master:
stage: release
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
only:
- master

View File

@ -1 +1 @@
3.2.2
ruby-3.0.5

View File

@ -1,25 +0,0 @@
# syntax=docker/dockerfile:1
FROM ruby:3.2.2
ENV RAILS_ENV=production
ENV RAILS_SERVE_STATIC_FILES=yes
ENV RAILS_LOG_TO_STDOUT=yes
EXPOSE 3000
RUN apt-get update && \
curl -fsSL https://deb.nodesource.com/setup_19.x | bash - && \
apt-get install -y sqlite3 neovim curl nodejs --no-install-recommends && \
apt-get clean && \
bundle config --global frozen 1 && \
npm install --global yarn
WORKDIR /count_anything
COPY Gemfile Gemfile.lock package.json yarn.lock ./
RUN bundle config set --local without 'development test' && \
bundle install && \
yarn install
COPY . .
CMD /count_anything/bin/rails assets:precompile && /count_anything/bin/rails db:migrate && /count_anything/bin/rails server

View File

@ -1,7 +1,7 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.2.2"
ruby "3.0.5"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.4"
@ -31,7 +31,7 @@ gem "cssbundling-rails"
gem "jbuilder"
# Use Redis adapter to run Action Cable in production
gem "redis", "~> 4.0"
# gem "redis", "~> 4.0"
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

View File

@ -124,7 +124,6 @@ GEM
matrix (0.4.2)
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.8.1)
minitest (5.16.3)
msgpack (1.6.0)
net-imap (0.3.2)
@ -137,8 +136,7 @@ GEM
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
nokogiri (1.13.10-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
public_suffix (5.0.1)
@ -175,7 +173,6 @@ GEM
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.0.6)
redis (4.8.1)
regexp_parser (2.6.1)
reline (0.3.2)
io-console (~> 0.5)
@ -195,8 +192,7 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.5.4)
mini_portile2 (~> 2.8.0)
sqlite3 (1.5.4-x86_64-linux)
stimulus-rails (1.2.1)
railties (>= 6.0.0)
thor (1.2.1)
@ -240,7 +236,6 @@ DEPENDENCIES
jsbundling-rails
puma (~> 5.0)
rails (~> 7.0.4)
redis (~> 4.0)
selenium-webdriver
sprockets-rails
sqlite3 (~> 1.4)
@ -251,7 +246,7 @@ DEPENDENCIES
webdrivers
RUBY VERSION
ruby 3.2.2p53
ruby 3.0.5p211
BUNDLED WITH
2.4.10
2.4.4

View File

@ -1,3 +1,24 @@
# Count anything
# README
This is a simple Ruby on Rails project using Websockets for real-time interfaces, to count literally anything.
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...

View File

@ -0,0 +1,6 @@
class Profile::HomeController < ApplicationController
before_action :authenticate_user!
def index
end
end

View File

@ -1,27 +0,0 @@
class ProfileController < ApplicationController
before_action :authenticate_user!
def edit
end
def update_email
if current_user.valid_password?(params["current_password"]) && current_user.update(email: params["email"])
flash[:notice] = I18n.translate("flashes.profile.update.success")
redirect_to profile_path
else
flash[:alert] = I18n.translate("flashes.profile.update.fail")
redirect_to profile_path
end
end
def update_password
if !params["password"].blank? && current_user.valid_password?(params["current_password"]) && params["password"] == params["password_confirmation"] && current_user.update(password: params["password"])
bypass_sign_in(current_user)
flash[:notice] = I18n.translate("flashes.profile.update.success")
redirect_to profile_path
else
flash[:alert] = I18n.translate("flashes.profile.update.fail")
redirect_to profile_path
end
end
end

View File

@ -19,7 +19,7 @@
<li><%= link_to t("fields.home"), root_path, class: "nav-link px-2 #{current_page?(root_path) ? "text-secondary" : "text-white"}" %></li>
<% if current_user %>
<li><%= link_to t("fields.count"), count_index_path, class: "nav-link px-2 #{current_page?(count_index_path) ? "text-secondary" : "text-white"}" %></li>
<li><%= link_to t("fields.profile"), profile_path, class: "nav-link px-2 #{current_page?(profile_path) ? "text-secondary" : "text-white"}" %></li>
<li><%= link_to t("fields.profile"), profile_root_path, class: "nav-link px-2 #{current_page?(profile_root_path) ? "text-secondary" : "text-white"}" %></li>
<% end %>
</ul>

View File

@ -1,41 +0,0 @@
<div class="mt-2 mb-4">
<div class="mt-2 mb-4">
<h3><%= t("fields.update_email") %></h3>
<%= form_tag profile_update_email_path, method: :post do %>
<div class="col-2 mt-2">
<%= label_tag :email, t("fields.email") %>
<%= email_field_tag :email, current_user.email, class: "form-control" %>
</div>
<div class="col-2 mt-2">
<%= label_tag :current_password, t("fields.current_password") %>
<%= password_field_tag :current_password, nil, class: "form-control" %>
</div>
<%= submit_tag t("fields.save"), class: "btn btn-primary mt-2" %>
<% end %>
</div>
<div class="mt-2 mb-4">
<h3><%= t("fields.update_password") %></h3>
<%= form_tag profile_update_password_path, method: :post do %>
<div class="col-2 mt-2">
<%= label_tag :password, t("fields.new_password") %>
<%= password_field_tag :password, nil, class: "form-control" %>
</div>
<div class="col-2 mt-2">
<%= label_tag :password_confirmation, t("fields.new_password_confirmation") %>
<%= password_field_tag :password_confirmation, nil, class: "form-control" %>
</div>
<div class="col-2 mt-2">
<%= label_tag :current_password, t("fields.current_password") %>
<%= password_field_tag :current_password, nil, class: "form-control" %>
</div>
<%= submit_tag t("fields.save"), class: "btn btn-primary mt-2" %>
<% end %>
</div>
</div>

View File

@ -0,0 +1,2 @@
<h1>Profile::Home#index</h1>
<p>Find me in app/views/profile/home/index.html.erb</p>

View File

@ -1 +0,0 @@
VkHkFcjwHIZ058dE72qEUhZXiE993ohEARNdsjFmbp6UY4UYS+kGizPKM+h3C4VywYa5j0L/tSvuHgwbHIex8buwIsp3AsyoJZcemnCiwXx1q7rvF3amNCT/AcsggB49YdicUZiESinY+ajLsMH/oeVUyNhXBaliGU3LLnft/ACpxBYAnSLXNysTsxfWL43xlUTjsHF3tMyoA+NGr5Nf6OwrLy4ptaoC3MW5/IBwjsXuOdIceEY3tatCRkOgRDJbk+YhDJme3teXdfgUlEgLRw==--OEyLLU8aYtwqGhtI--0Q8owoP/yIviwiyotCGo5Q==

View File

@ -8,11 +8,4 @@ en:
edit: "Edit"
new: "New"
name: "Name"
save: "Save"
email: "E-mail"
password: "Password"
current_password: "Current password"
update_email: "Update e-mail"
new_password: "New password"
new_password_confirmation: "Confirm the new password"
update_password: "Update password"
save: "Save"

View File

@ -9,8 +9,4 @@ en:
fail: "Count creation failed."
destroy:
fail: "Count deletion has failed."
success: "Count has been deleted successfully."
profile:
update:
success: "Profile updated successfully."
fail: "Updating the profile failed."
success: "Count has been deleted successfully."

View File

@ -9,10 +9,3 @@ fr:
new: "Nouveau"
name: "Nom"
save: "Sauvegarder"
email: "Courriel"
password: "Mot de passe"
current_password: "Mot de passe actuel"
update_email: "Mettre à jour le courriel"
new_password: "Nouveau mot de passe"
new_password_confirmation: "Confirmez le nouveau mot de passe"
update_password: "Mettre à jour de mot de passe"

View File

@ -9,8 +9,4 @@ fr:
fail: "La création du compte a échoué."
destroy:
fail: "La suppression du compte a échoué."
success: "Le compte a été supprimé avec succès."
profile:
update:
success: "Le profil a bien été mis à jour."
fail: "La mise à jour du profil a échoué."
success: "Le compte a été supprimé avec succès."

View File

@ -1,10 +1,10 @@
Rails.application.routes.draw do
resources :count, except: [:show]
namespace :profile do
root "home#index"
end
get "profile", to: "profile#edit"
post "profile/update_email", to: "profile#update_email"
post "profile/update_password", to: "profile#update_password"
resources :count, except: [:show]
root "home#index"