Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d91bb3c
リンクの追加
Aug 26, 2025
9714f27
温泉をグルメに変更
rikuro00 Aug 26, 2025
afc36a2
リンク追加
Aug 26, 2025
f163572
Merge branch 'main' into ooguni1
Aug 26, 2025
38ec872
Merge pull request #1 from RubyCamp/ooguni1
Aug 26, 2025
8651d5e
feat: お店のURLの登録機能を追加
ny-si Aug 26, 2025
bf377ae
Merge pull request #2 from RubyCamp/feat/0000-shopsurl
ny-si Aug 27, 2025
004c1d8
住所のやつ終わりましたやり方については必ず相談してください
Aug 27, 2025
cf04ca2
fix: 2度URLカラムを追加していたのを修正
ny-si Aug 27, 2025
065ba41
fix: URLのカラムを2重に登録していたのを修正
ny-si Aug 27, 2025
ff51dd3
Merge pull request #3 from RubyCamp/fix/0001-twiceurlcolumn
ny-si Aug 27, 2025
a7d6e6d
温泉→グルメ
rikuro00 Aug 27, 2025
e68d32b
表示画像の変更
rikuro00 Aug 27, 2025
6c89494
fix: メインページでのボタンの重なりを修正
ny-si Aug 27, 2025
4462a1b
Revert "Merge pull request #2 from RubyCamp/feat/0000-shopsurl"
ny-si Aug 27, 2025
3f05c05
Revert "fix: 2度URLカラムを追加していたのを修正"
ny-si Aug 27, 2025
1be4f15
ヘッダー被り解消
Aug 27, 2025
dc44e18
Merge pull request #4 from RubyCamp/ooguni2
Aug 27, 2025
1cf0f60
fix: 場所の情報の詳細表示の変更
ny-si Aug 27, 2025
5278b35
営業時間の可視化
rikuro00 Aug 27, 2025
8a55397
Merge pull request #5 from RubyCamp/fix/ui-overlap-input-button
Aug 27, 2025
5f8553a
Merge pull request #6 from RubyCamp/fix/0002-onsen-descriptions
Aug 27, 2025
6c4e222
Merge branch 'main' into nagase
Aug 27, 2025
41e12d1
Merge pull request #7 from RubyCamp/nagase
Aug 27, 2025
b0e2cae
温泉→グルメ
rikuro00 Aug 27, 2025
ca7b1ec
営業時間の可視化
rikuro00 Aug 27, 2025
64f3edc
営業状況の可視化(調整版)
rikuro00 Aug 27, 2025
6d526fe
Merge pull request #9 from RubyCamp/nagase
Aug 27, 2025
7820d93
営業状態調整
rikuro00 Aug 28, 2025
7d3df3c
Merge pull request #10 from RubyCamp/nagase
Aug 28, 2025
d2af64b
fix: 営業時間が入っていないときの処理を追加
ny-si Aug 28, 2025
6e72f79
Merge pull request #11 from RubyCamp/fix/0004-blank-return
Aug 28, 2025
3d3be05
金額追加
motegi485 Aug 28, 2025
e6cf28f
Merge branch 'main' into ishikawa
Aug 28, 2025
bfd5f89
Merge pull request #12 from RubyCamp/ishikawa
Aug 28, 2025
fe83c13
feat: 詳細な開店・閉店時間を追加
ny-si Aug 28, 2025
399c835
params修正、位置情報検索削除
Aug 28, 2025
2c1f494
Merge pull request #14 from RubyCamp/ooguni4
Aug 28, 2025
712a253
Merge pull request #13 from RubyCamp/feat/miscellaneous-time
Aug 28, 2025
150f6e3
fix: 特定の時間による不具合の修正
ny-si Aug 28, 2025
63bc541
fix: グルメ管理から管理画面に変更
ny-si Aug 28, 2025
a933305
Merge pull request #15 from RubyCamp/fix/time-fix
Aug 28, 2025
1d85f3e
Merge pull request #16 from RubyCamp/fix/gurume-kanri
Aug 28, 2025
faac1d0
ログイン画面の追加
motegi485 Aug 28, 2025
2fcd420
feat: 開店状況に応じて変わるアイコンの追加
ny-si Aug 28, 2025
eafc918
Merge pull request #18 from RubyCamp/ishikawa2
Aug 28, 2025
996d120
Merge pull request #17 from RubyCamp/feat/O-C-shopicon
Aug 28, 2025
39fdfde
現在地の表示
rikuro00 Aug 28, 2025
e8faa9b
Merge branch 'main' into nagase
Aug 28, 2025
61c8fc6
Merge pull request #19 from RubyCamp/nagase
Aug 28, 2025
4e03fbe
マージ修正
Aug 28, 2025
d580784
fix: マップのアイコンがもとに戻っていたのを修正
ny-si Aug 28, 2025
18a61f3
Merge pull request #20 from RubyCamp/fix/ShopIconReborn
Aug 28, 2025
74575a0
一応戻しました。動きます
Aug 28, 2025
a931b03
ログイン画面完成
Aug 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "matsue_onsen_map"
name: "matsue_gourmet_map"

services:
rails-app:
Expand All @@ -7,9 +7,8 @@ services:
dockerfile: .devcontainer/Dockerfile

volumes:
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
- ../..:/workspaces:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Uncomment the next line to use a non-root user for all processes.
Expand All @@ -18,8 +17,8 @@ services:
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
depends_on:
- selenium
- postgres
- selenium
- postgres

selenium:
image: selenium/standalone-chromium
Expand All @@ -29,12 +28,12 @@ services:
image: postgres:16.1
restart: unless-stopped
networks:
- default
- default
volumes:
- postgres-data:/var/lib/postgresql/data
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres

volumes:
postgres-data:
16 changes: 6 additions & 10 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
// For format details, see https://containers.dev/implementors/json_reference/.
// For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "matsue_onsen_map",
"name": "matsue_gourmet_map",
"dockerComposeFile": "compose.yaml",
"service": "rails-app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/rails/devcontainer/features/activestorage": {},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/rails/devcontainer/features/postgres-client": {}
},

"containerEnv": {
"CAPYBARA_SERVER_PORT": "45678",
"SELENIUM_HOST": "selenium",
"KAMAL_REGISTRY_PASSWORD": "$KAMAL_REGISTRY_PASSWORD",
"DB_HOST": "postgres"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000, 5432],

"forwardPorts": [
3000,
5432
],
// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://containers.dev/implementors/json_reference/#remoteUser.
// "remoteUser": "root",


// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bin/setup --skip-server"
}
}
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
source "https://rubygems.org"

# 地図gem
gem "geocoder"

# dotenv
gem "dotenv-rails", groups: [ :development, :test ]

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 8.0.2"
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ GEM
concurrent-ruby (1.3.5)
connection_pool (2.5.3)
crass (1.0.6)
csv (3.3.5)
date (3.4.1)
debug (1.11.0)
irb (~> 1.10)
reline (>= 0.3.8)
dotenv (3.1.8)
dotenv-rails (3.1.8)
dotenv (= 3.1.8)
railties (>= 6.1)
drb (2.2.3)
ed25519 (1.4.0)
erb (5.0.2)
Expand All @@ -123,6 +127,9 @@ GEM
fugit (1.11.1)
et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4)
geocoder (1.8.5)
base64 (>= 0.1.0)
csv (>= 3.0.0)
globalid (1.2.1)
activesupport (>= 6.1)
htmlbeautifier (1.4.3)
Expand Down Expand Up @@ -386,6 +393,8 @@ DEPENDENCIES
brakeman
capybara
debug
dotenv-rails
geocoder
htmlbeautifier
image_processing (~> 1.2)
importmap-rails
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# 松江温泉マップ 🗺️♨️
# 松江グルメマップ 🗺️♨️

## プロジェクト概要

このアプリケーションは、島根県松江市の温泉を登録・閲覧できるWebアプリケーションです。
このアプリケーションは、島根県松江市のグルメを登録・閲覧できるWebアプリケーションです。

### 主な機能
- 🗺️ **温泉マップ表示**: 登録された温泉を地図上で確認できます
- ♨️ **温泉登録**: 新しい温泉スポットを登録できます
- ⭐ **レビュー機能**: 温泉にレビューを投稿できます
- 🗺️ **グルメマップ表示**: 登録されたグルメを地図上で確認できます
- ♨️ **グルメ登録**: 新しいグルメスポットを登録できます
- ⭐ **レビュー機能**: グルメにレビューを投稿できます
- 📱 **レスポンシブデザイン**: 複数の画面幅に対応しています

## 技術スタック
Expand Down Expand Up @@ -97,7 +97,7 @@ matsue-onsen-map/

## 開発の流れ

1. **機能の追加**: 新しい温泉登録機能を追加する場合
1. **機能の追加**: 新しいグルメ登録機能を追加する場合
2. **モデルの作成**: `rails generate model` でデータベーステーブルを作成
3. **コントローラーの作成**: `rails generate controller` で画面処理を作成
4. **ビューの作成**: HTMLテンプレートを作成
Expand Down
15 changes: 15 additions & 0 deletions app/controllers/admin/admin_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# app/controllers/admin/admin_controller.rb
class Admin::AdminController < ApplicationController
before_action :require_admin_password





private

def require_admin_password
return if session[:admin_authenticated]
redirect_to admin_login_path
end
end
2 changes: 2 additions & 0 deletions app/controllers/admin/base_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Admin::BaseController < ApplicationController
end
41 changes: 26 additions & 15 deletions app/controllers/admin/onsens_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
class Admin::OnsensController < ApplicationController
class Admin::OnsensController < Admin::AdminController
before_action :set_onsen, only: %i[ show edit update destroy ]

# GET /onsens or /onsens.json
# GET /onsens
def index
session[:admin] = nil

@onsens = Onsen.all
end

# GET /onsens/1 or /onsens/1.json
# GET /onsens/1
def show
end

Expand All @@ -19,7 +21,7 @@ def new
def edit
end

# POST /onsens or /onsens.json
# POST /onsens
def create
@onsen = Onsen.new(onsen_params)

Expand All @@ -34,10 +36,17 @@ def create
end
end

# PATCH/PUT /onsens/1 or /onsens/1.json
# PATCH/PUT /onsens/1
def update
respond_to do |format|
if @onsen.update(onsen_params)
if @onsen.update(onsen_params.except(:remove_image_ids))
if onsen_params[:remove_image_ids].present?
onsen_params[:remove_image_ids].each do |image_id|
image = @onsen.images.find_by(id: image_id)
image.purge if image
end
end

format.html { redirect_to admin_onsen_path(@onsen), notice: "Onsen was successfully updated." }
format.json { render :show, status: :ok, location: @onsen }
else
Expand All @@ -47,7 +56,8 @@ def update
end
end

# DELETE /onsens/1 or /onsens/1.json

# DELETE /onsens/1
def destroy
@onsen.destroy!

Expand All @@ -58,13 +68,14 @@ def destroy
end

private
# Use callbacks to share common setup or constraints between actions.
def set_onsen
@onsen = Onsen.find(params.expect(:id))
end

# Only allow a list of trusted parameters through.
def onsen_params
params.expect(onsen: [ :name, :geo_lat, :geo_lng, :description, :tags, images: [] ])
end
# Use callbacks to share common setup or constraints between actions.
def set_onsen
@onsen = Onsen.find(params[:id])
end

# Only allow a list of trusted parameters through.
def onsen_params
params.require(:onsen).permit(:name, :geo_lat, :geo_lng, :description, :tags, :url, :sales_s, :sales_f, :holiday, :address, :price, images: [], remove_image_ids: [])
end
end
27 changes: 27 additions & 0 deletions app/controllers/admin/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# app/controllers/admin/sessions_controller.rb
class Admin::SessionsController < ApplicationController
def new
# パスワード入力フォーム
end

def create
if params[:password] == ENV["ADMIN_PASSWORD"]
session[:admin_authenticated] = true
redirect_to admin_root_path, notice: "ログイン成功"
else
flash[:alert] = "パスワードが違います"
render :new
end
end

def destroy
session.delete(:admin_authenticated)
redirect_to root_path, notice: "ログアウトしました"
end


# セッションリセット
def reset_admin_session
session[:admin_authenticated] = nil
end
end
6 changes: 6 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@ class ApplicationController < ActionController::Base
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
# Disable browser restrictions in development environment
allow_browser versions: :modern unless Rails.env.development?

private

def reset_admin_session
session.delete(:admin_authenticated)
end
end
21 changes: 19 additions & 2 deletions app/controllers/onsens_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,26 @@ class OnsensController < ApplicationController
before_action :set_onsen, only: %i[ show ]
# GET /onsens or /onsens.json
def index
# Strong Parametersで安全なパラメータのみ許可
@search_params = params.permit(:q, :tags)
# Strong Parametersで安全なパラメータのみ許可(boundsを追加)
@search_params = params.permit(:q, :tags, :bounds)

# モデルの検索メソッドを呼び出し、新しい順でソート
@onsens = Onsen.search(@search_params).order(created_at: :desc)

# 地図の表示範囲で絞り込み
if @search_params[:bounds].present?
bounds = @search_params[:bounds].split(",")
@onsens = @onsens.within_bounds(bounds)
end

# セッションリセット
reset_admin_session
end





# GET /onsens/1 or /onsens/1.json
def show
@reviews = @onsen.reviews.order(created_at: :desc)
Expand All @@ -18,4 +31,8 @@ def show
def set_onsen
@onsen = Onsen.find(params[:id])
end

def onsen_params
params.require(:onsen).permit(:name, :sales_s, :sales_f, :holiday, :other_columns)
end
end
2 changes: 2 additions & 0 deletions app/helpers/admin/admin_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Admin::AdminHelper
end
2 changes: 2 additions & 0 deletions app/helpers/admin/base_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Admin::BaseHelper
end
2 changes: 2 additions & 0 deletions app/helpers/admin/sessions_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Admin::SessionsHelper
end
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def public_navigation_links(current_path)
# @return [Array<Hash>] 管理サイト用ナビゲーションリンク
def admin_navigation_links(current_path)
create_navigation_link_set([
{ path: "/admin/onsens", label: t("views.navigation.onsen_management"), aria_label: "温泉管理", current_check: -> { current_path.start_with?("/admin/onsens") } },
{ path: "/admin/onsens", label: t("views.navigation.onsen_management"), aria_label: "管理画面", current_check: -> { current_path.start_with?("/admin/onsens") } },
{ path: "/", label: t("views.navigation.public_site"), aria_label: "公開サイト", current_check: -> { false } }
])
end
Expand Down
Loading