remove unused files
16
Gemfile
|
|
@ -1,16 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
source "https://rubygems.org"
|
|
||||||
|
|
||||||
gem 'foreman'
|
|
||||||
gem 'sinatra'
|
|
||||||
gem 'puma'
|
|
||||||
gem "sinatra-activerecord"
|
|
||||||
gem "sqlite3"
|
|
||||||
gem "rake"
|
|
||||||
|
|
||||||
gem "rackup", "~> 2.1"
|
|
||||||
|
|
||||||
gem "sinatra-contrib", "~> 4.0"
|
|
||||||
|
|
||||||
gem "timecop", "~> 0.9.8"
|
|
||||||
110
Gemfile.lock
|
|
@ -1,110 +0,0 @@
|
||||||
GEM
|
|
||||||
remote: https://rubygems.org/
|
|
||||||
specs:
|
|
||||||
activemodel (8.0.1)
|
|
||||||
activesupport (= 8.0.1)
|
|
||||||
activerecord (8.0.1)
|
|
||||||
activemodel (= 8.0.1)
|
|
||||||
activesupport (= 8.0.1)
|
|
||||||
timeout (>= 0.4.0)
|
|
||||||
activesupport (8.0.1)
|
|
||||||
base64
|
|
||||||
benchmark (>= 0.3)
|
|
||||||
bigdecimal
|
|
||||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
||||||
connection_pool (>= 2.2.5)
|
|
||||||
drb
|
|
||||||
i18n (>= 1.6, < 2)
|
|
||||||
logger (>= 1.4.2)
|
|
||||||
minitest (>= 5.1)
|
|
||||||
securerandom (>= 0.3)
|
|
||||||
tzinfo (~> 2.0, >= 2.0.5)
|
|
||||||
uri (>= 0.13.1)
|
|
||||||
base64 (0.2.0)
|
|
||||||
benchmark (0.4.0)
|
|
||||||
bigdecimal (3.1.9)
|
|
||||||
concurrent-ruby (1.3.5)
|
|
||||||
connection_pool (2.5.0)
|
|
||||||
drb (2.2.1)
|
|
||||||
foreman (0.88.1)
|
|
||||||
i18n (1.14.7)
|
|
||||||
concurrent-ruby (~> 1.0)
|
|
||||||
logger (1.6.6)
|
|
||||||
minitest (5.25.4)
|
|
||||||
multi_json (1.15.0)
|
|
||||||
mustermann (3.0.3)
|
|
||||||
ruby2_keywords (~> 0.0.1)
|
|
||||||
nio4r (2.7.4)
|
|
||||||
puma (6.6.0)
|
|
||||||
nio4r (~> 2.0)
|
|
||||||
rack (3.1.11)
|
|
||||||
rack-protection (4.1.1)
|
|
||||||
base64 (>= 0.1.0)
|
|
||||||
logger (>= 1.6.0)
|
|
||||||
rack (>= 3.0.0, < 4)
|
|
||||||
rack-session (2.1.0)
|
|
||||||
base64 (>= 0.1.0)
|
|
||||||
rack (>= 3.0.0)
|
|
||||||
rackup (2.2.1)
|
|
||||||
rack (>= 3)
|
|
||||||
rake (13.2.1)
|
|
||||||
ruby2_keywords (0.0.5)
|
|
||||||
securerandom (0.4.1)
|
|
||||||
sinatra (4.1.1)
|
|
||||||
logger (>= 1.6.0)
|
|
||||||
mustermann (~> 3.0)
|
|
||||||
rack (>= 3.0.0, < 4)
|
|
||||||
rack-protection (= 4.1.1)
|
|
||||||
rack-session (>= 2.0.0, < 3)
|
|
||||||
tilt (~> 2.0)
|
|
||||||
sinatra-activerecord (2.0.28)
|
|
||||||
activerecord (>= 4.1)
|
|
||||||
sinatra (>= 1.0)
|
|
||||||
sinatra-contrib (4.1.1)
|
|
||||||
multi_json (>= 0.0.2)
|
|
||||||
mustermann (~> 3.0)
|
|
||||||
rack-protection (= 4.1.1)
|
|
||||||
sinatra (= 4.1.1)
|
|
||||||
tilt (~> 2.0)
|
|
||||||
sqlite3 (2.6.0-aarch64-linux-gnu)
|
|
||||||
sqlite3 (2.6.0-aarch64-linux-musl)
|
|
||||||
sqlite3 (2.6.0-arm-linux-gnu)
|
|
||||||
sqlite3 (2.6.0-arm-linux-musl)
|
|
||||||
sqlite3 (2.6.0-arm64-darwin)
|
|
||||||
sqlite3 (2.6.0-x86-linux-gnu)
|
|
||||||
sqlite3 (2.6.0-x86-linux-musl)
|
|
||||||
sqlite3 (2.6.0-x86_64-darwin)
|
|
||||||
sqlite3 (2.6.0-x86_64-linux-gnu)
|
|
||||||
sqlite3 (2.6.0-x86_64-linux-musl)
|
|
||||||
tilt (2.6.0)
|
|
||||||
timecop (0.9.10)
|
|
||||||
timeout (0.4.3)
|
|
||||||
tzinfo (2.0.6)
|
|
||||||
concurrent-ruby (~> 1.0)
|
|
||||||
uri (1.0.3)
|
|
||||||
|
|
||||||
PLATFORMS
|
|
||||||
aarch64-linux-gnu
|
|
||||||
aarch64-linux-musl
|
|
||||||
arm-linux-gnu
|
|
||||||
arm-linux-musl
|
|
||||||
arm64-darwin
|
|
||||||
x86-linux-gnu
|
|
||||||
x86-linux-musl
|
|
||||||
x86_64-darwin
|
|
||||||
x86_64-linux-gnu
|
|
||||||
x86_64-linux-musl
|
|
||||||
|
|
||||||
DEPENDENCIES
|
|
||||||
foreman
|
|
||||||
puma
|
|
||||||
rackup (~> 2.1)
|
|
||||||
rake
|
|
||||||
sinatra
|
|
||||||
sinatra-activerecord
|
|
||||||
sinatra-contrib (~> 4.0)
|
|
||||||
sqlite3
|
|
||||||
timecop (~> 0.9.8)
|
|
||||||
|
|
||||||
BUNDLED WITH
|
|
||||||
2.5.19
|
|
||||||
1
Procfile
|
|
@ -1 +0,0 @@
|
||||||
web: ruby mood_app.rb
|
|
||||||
8
Rakefile
|
|
@ -1,8 +0,0 @@
|
||||||
# Rakefile
|
|
||||||
require "sinatra/activerecord/rake"
|
|
||||||
|
|
||||||
namespace :db do
|
|
||||||
task :load_config do
|
|
||||||
require "./mood_app"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
class CreateMoods < ActiveRecord::Migration[7.1]
|
|
||||||
def change
|
|
||||||
create_table :moods do |t|
|
|
||||||
t.string :mode, null: false
|
|
||||||
t.datetime :recorded_at, precision: nil, null: false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
class CreateEvents < ActiveRecord::Migration[7.2]
|
|
||||||
def change
|
|
||||||
create_table :events do |t|
|
|
||||||
t.string :title
|
|
||||||
t.text :description
|
|
||||||
t.datetime :taken_place_on, precision: nil, null: false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
24
db/schema.rb
|
|
@ -1,24 +0,0 @@
|
||||||
# This file is auto-generated from the current state of the database. Instead
|
|
||||||
# of editing this file, please use the migrations feature of Active Record to
|
|
||||||
# incrementally modify your database, and then regenerate this schema definition.
|
|
||||||
#
|
|
||||||
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
||||||
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
||||||
# be faster and is potentially less error prone than running all of your
|
|
||||||
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
||||||
# migrations use external dependencies or application code.
|
|
||||||
#
|
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
|
||||||
|
|
||||||
ActiveRecord::Schema[7.2].define(version: 2024_11_01_211840) do
|
|
||||||
create_table "events", force: :cascade do |t|
|
|
||||||
t.string "title"
|
|
||||||
t.text "description"
|
|
||||||
t.datetime "taken_place_on", precision: nil, null: false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "moods", force: :cascade do |t|
|
|
||||||
t.string "mode", null: false
|
|
||||||
t.datetime "recorded_at", precision: nil, null: false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
15
draft
|
|
@ -1,15 +0,0 @@
|
||||||
x prendre billet de train
|
|
||||||
x répondre à Laurent
|
|
||||||
x noter agenda yaf et coopaname
|
|
||||||
|
|
||||||
- faire moodtracker mobile
|
|
||||||
|
|
||||||
- faire vaisselle
|
|
||||||
- vider poubelles
|
|
||||||
- demander à mathieu quel jour
|
|
||||||
- laver drap
|
|
||||||
- appeler athie
|
|
||||||
|
|
||||||
- répondre à delphine
|
|
||||||
- redige mail julie sauzin
|
|
||||||
|
|
||||||
7
event.rb
|
|
@ -1,7 +0,0 @@
|
||||||
class Event < ActiveRecord::Base
|
|
||||||
default_scope { order(:taken_place_on) }
|
|
||||||
validates_presence_of :title
|
|
||||||
validates_presence_of :taken_place_on
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
28
mood.rb
|
|
@ -1,28 +0,0 @@
|
||||||
class Mood < ActiveRecord::Base
|
|
||||||
default_scope { order(:recorded_at) }
|
|
||||||
validates_presence_of :mode
|
|
||||||
validates_presence_of :recorded_at
|
|
||||||
|
|
||||||
def self.log
|
|
||||||
return if Mood.count < 1
|
|
||||||
|
|
||||||
first_mood = Mood.first.recorded_at.to_date
|
|
||||||
first_monday = first_mood - (first_mood.wday - 1)
|
|
||||||
|
|
||||||
current_date = first_monday
|
|
||||||
current_mode = nil
|
|
||||||
log_mood = []
|
|
||||||
Mood.all.each do |mood|
|
|
||||||
while current_date < mood.recorded_at.to_date do
|
|
||||||
log_mood << [ current_date.to_s, current_mode ]
|
|
||||||
current_date += 1
|
|
||||||
end
|
|
||||||
current_mode = mood.mode
|
|
||||||
end
|
|
||||||
while current_date <= Date.today do
|
|
||||||
log_mood << [ current_date.to_s, current_mode ]
|
|
||||||
current_date += 1
|
|
||||||
end
|
|
||||||
log_mood.each_slice(7).to_a.last(52)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
33
mood_app.rb
|
|
@ -1,33 +0,0 @@
|
||||||
require 'sinatra/base'
|
|
||||||
require 'sinatra/namespace'
|
|
||||||
require 'sinatra/activerecord'
|
|
||||||
require './mood'
|
|
||||||
require './event'
|
|
||||||
|
|
||||||
class MoodApp < Sinatra::Base
|
|
||||||
register Sinatra::ActiveRecordExtension
|
|
||||||
register Sinatra::Namespace
|
|
||||||
set :database, { adapter: 'sqlite3', database: "mood-#{ENV['RACK_ENV']}.sqlite3" }
|
|
||||||
set :bind, '::1'
|
|
||||||
|
|
||||||
get '/' do
|
|
||||||
@mode = Mood.last&.mode || 'croisiere'
|
|
||||||
@mood_log = Mood.log || []
|
|
||||||
erb :index
|
|
||||||
end
|
|
||||||
|
|
||||||
namespace '/api/v1' do
|
|
||||||
before do
|
|
||||||
content_type 'application/json'
|
|
||||||
end
|
|
||||||
|
|
||||||
post '/moods' do
|
|
||||||
json = request.body.read
|
|
||||||
puts json
|
|
||||||
data = JSON.parse json
|
|
||||||
Mood.create(mode: data['mode'], recorded_at: Time.now)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
run! if app_file == $0
|
|
||||||
end
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
ENV['APP_ENV'] = 'test'
|
|
||||||
|
|
||||||
require './mood_app'
|
|
||||||
require 'rspec'
|
|
||||||
require 'rack/test'
|
|
||||||
|
|
||||||
describe 'MoodApp' do
|
|
||||||
include Rack::Test::Methods
|
|
||||||
|
|
||||||
it 'says hello' do
|
|
||||||
get '/'
|
|
||||||
expect(last_response).to be_ok
|
|
||||||
end
|
|
||||||
|
|
||||||
def app
|
|
||||||
MoodApp
|
|
||||||
end
|
|
||||||
end
|
|
||||||
42
mood_spec.rb
|
|
@ -1,42 +0,0 @@
|
||||||
ENV['APP_ENV'] = 'test'
|
|
||||||
|
|
||||||
require './mood_app'
|
|
||||||
require 'rspec'
|
|
||||||
require 'timecop'
|
|
||||||
|
|
||||||
describe 'Mood' do
|
|
||||||
before do
|
|
||||||
Mood.destroy_all
|
|
||||||
Timecop.freeze(Time.local(2024,2,10,9))
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
Timecop.return
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'returns log' do
|
|
||||||
Mood.create(recorded_at: '2024-02-03', mode: 'creatif')
|
|
||||||
Mood.create(recorded_at: '2024-02-09', mode: 'en-charge')
|
|
||||||
|
|
||||||
expect(Mood.log).to eq [
|
|
||||||
[
|
|
||||||
{'2024-01-29' => nil},
|
|
||||||
{'2024-01-30' => nil},
|
|
||||||
{'2024-01-31' => nil},
|
|
||||||
{'2024-02-01' => nil},
|
|
||||||
{'2024-02-02' => nil},
|
|
||||||
{'2024-02-03' => 'creatif'},
|
|
||||||
{'2024-02-04' => 'creatif'}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{'2024-02-05' => 'creatif'},
|
|
||||||
{'2024-02-06' => 'creatif'},
|
|
||||||
{'2024-02-07' => 'creatif'},
|
|
||||||
{'2024-02-08' => 'creatif'},
|
|
||||||
{'2024-02-09' => 'en-charge'},
|
|
||||||
{'2024-02-10' => 'en-charge'}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 904 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 337 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 836 KiB |
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 947 KiB |
187
public/main.css
|
|
@ -1,187 +0,0 @@
|
||||||
body {
|
|
||||||
margin: 0px;
|
|
||||||
font-family: "Sour Gummy", sans-serif;
|
|
||||||
font-weight: 350;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode {
|
|
||||||
grid-area: mode;
|
|
||||||
height: 50vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tracker {
|
|
||||||
grid-area: tracker;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
grid-area: title;
|
|
||||||
margin: 30px;
|
|
||||||
font-size: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.legend .bar-creatif {
|
|
||||||
background: red;
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
.legend .bar-frigo {
|
|
||||||
background: gray;
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
.legend .bar-croisiere {
|
|
||||||
background: green;
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
.legend .bar-en-charge {
|
|
||||||
background: orange;
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
.legend .bar-explain {
|
|
||||||
padding-left: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.legend-mood {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
|
||||||
display: block;
|
|
||||||
grid-template-rows: 1fr 1fr;
|
|
||||||
grid-template-areas:
|
|
||||||
"mode"
|
|
||||||
"tracker";
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.mode img {
|
|
||||||
height: 100%;
|
|
||||||
width:100%;
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
.tracker {
|
|
||||||
grid-area: tracker;
|
|
||||||
}
|
|
||||||
.title h1 {
|
|
||||||
font-weight: 350;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1000px) {
|
|
||||||
main {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
grid-template-rows: 1fr;
|
|
||||||
grid-template-areas: "mode tracker";
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode {
|
|
||||||
height: 100vh;
|
|
||||||
grid-area: mode;
|
|
||||||
}
|
|
||||||
.tracker {
|
|
||||||
grid-area: tracker;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
grid-template-rows: 2fr 1fr 6fr 1fr;
|
|
||||||
grid-template-areas:
|
|
||||||
"title title"
|
|
||||||
"info-day info-day"
|
|
||||||
"moods moods"
|
|
||||||
". legend";
|
|
||||||
background-color: lightgoldenrodyellow;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: 100vh;
|
|
||||||
width: 100%;
|
|
||||||
gap: 45px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
grid-area: title;
|
|
||||||
margin: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-day {
|
|
||||||
grid-area: info-day;
|
|
||||||
margin: 30px;
|
|
||||||
font-size: 1.8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
grid-area: info;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode img {
|
|
||||||
height: 100%;
|
|
||||||
width:100%;
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
.title h1 {
|
|
||||||
font-weight: 350;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.moods {
|
|
||||||
grid-area: moods;
|
|
||||||
margin: 30px;
|
|
||||||
max-height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.legend {
|
|
||||||
grid-area: legend;
|
|
||||||
margin: 4px;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: flex-end;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin: 30px;
|
|
||||||
}
|
|
||||||
.log {
|
|
||||||
align-self: flex-end;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: flex-start;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.moods .log .week {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-items: start;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
.moods .log .day {
|
|
||||||
border: 1px;
|
|
||||||
margin: 4px;
|
|
||||||
min-width: 15px;
|
|
||||||
min-height: 15px;
|
|
||||||
}
|
|
||||||
.creatif {
|
|
||||||
background-color: red;
|
|
||||||
}
|
|
||||||
.en-charge {
|
|
||||||
background-color: orange;
|
|
||||||
}
|
|
||||||
.frigo-vide {
|
|
||||||
background-color: grey;
|
|
||||||
}
|
|
||||||
.croisiere {
|
|
||||||
background-color: green;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
margin: 30px;
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 61 KiB |
|
|
@ -1,100 +0,0 @@
|
||||||
ENV["RACK_ENV"] = 'test'
|
|
||||||
|
|
||||||
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
||||||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
||||||
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
||||||
# this file to always be loaded, without a need to explicitly require it in any
|
|
||||||
# files.
|
|
||||||
#
|
|
||||||
# Given that it is always loaded, you are encouraged to keep this file as
|
|
||||||
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
||||||
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
||||||
# individual file that may not need all of that loaded. Instead, consider making
|
|
||||||
# a separate helper file that requires the additional dependencies and performs
|
|
||||||
# the additional setup, and require it from the spec files that actually need
|
|
||||||
# it.
|
|
||||||
#
|
|
||||||
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
||||||
RSpec.configure do |config|
|
|
||||||
# rspec-expectations config goes here. You can use an alternate
|
|
||||||
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
||||||
# assertions if you prefer.
|
|
||||||
config.expect_with :rspec do |expectations|
|
|
||||||
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
||||||
# and `failure_message` of custom matchers include text for helper methods
|
|
||||||
# defined using `chain`, e.g.:
|
|
||||||
# be_bigger_than(2).and_smaller_than(4).description
|
|
||||||
# # => "be bigger than 2 and smaller than 4"
|
|
||||||
# ...rather than:
|
|
||||||
# # => "be bigger than 2"
|
|
||||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
||||||
end
|
|
||||||
|
|
||||||
# rspec-mocks config goes here. You can use an alternate test double
|
|
||||||
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
||||||
config.mock_with :rspec do |mocks|
|
|
||||||
# Prevents you from mocking or stubbing a method that does not exist on
|
|
||||||
# a real object. This is generally recommended, and will default to
|
|
||||||
# `true` in RSpec 4.
|
|
||||||
mocks.verify_partial_doubles = true
|
|
||||||
end
|
|
||||||
|
|
||||||
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
|
||||||
# have no way to turn it off -- the option exists only for backwards
|
|
||||||
# compatibility in RSpec 3). It causes shared context metadata to be
|
|
||||||
# inherited by the metadata hash of host groups and examples, rather than
|
|
||||||
# triggering implicit auto-inclusion in groups with matching metadata.
|
|
||||||
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
||||||
|
|
||||||
# The settings below are suggested to provide a good initial experience
|
|
||||||
# with RSpec, but feel free to customize to your heart's content.
|
|
||||||
=begin
|
|
||||||
# This allows you to limit a spec run to individual examples or groups
|
|
||||||
# you care about by tagging them with `:focus` metadata. When nothing
|
|
||||||
# is tagged with `:focus`, all examples get run. RSpec also provides
|
|
||||||
# aliases for `it`, `describe`, and `context` that include `:focus`
|
|
||||||
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
|
||||||
config.filter_run_when_matching :focus
|
|
||||||
|
|
||||||
# Allows RSpec to persist some state between runs in order to support
|
|
||||||
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
||||||
# you configure your source control system to ignore this file.
|
|
||||||
config.example_status_persistence_file_path = "spec/examples.txt"
|
|
||||||
|
|
||||||
# Limits the available syntax to the non-monkey patched syntax that is
|
|
||||||
# recommended. For more details, see:
|
|
||||||
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
|
||||||
config.disable_monkey_patching!
|
|
||||||
|
|
||||||
# This setting enables warnings. It's recommended, but in some cases may
|
|
||||||
# be too noisy due to issues in dependencies.
|
|
||||||
config.warnings = true
|
|
||||||
|
|
||||||
# Many RSpec users commonly either run the entire suite or an individual
|
|
||||||
# file, and it's useful to allow more verbose output when running an
|
|
||||||
# individual spec file.
|
|
||||||
if config.files_to_run.one?
|
|
||||||
# Use the documentation formatter for detailed output,
|
|
||||||
# unless a formatter has already been configured
|
|
||||||
# (e.g. via a command-line flag).
|
|
||||||
config.default_formatter = "doc"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Print the 10 slowest examples and example groups at the
|
|
||||||
# end of the spec run, to help surface which specs are running
|
|
||||||
# particularly slow.
|
|
||||||
config.profile_examples = 10
|
|
||||||
|
|
||||||
# Run specs in random order to surface order dependencies. If you find an
|
|
||||||
# order dependency and want to debug it, you can fix the order by providing
|
|
||||||
# the seed, which is printed after each run.
|
|
||||||
# --seed 1234
|
|
||||||
config.order = :random
|
|
||||||
|
|
||||||
# Seed global randomization in this process using the `--seed` CLI option.
|
|
||||||
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
||||||
# test failures related to randomization by passing the same `--seed` value
|
|
||||||
# as the one that triggered the failure.
|
|
||||||
Kernel.srand config.seed
|
|
||||||
=end
|
|
||||||
end
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="stylesheet" href="main.css">
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Delius&family=Sour+Gummy:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
|
|
||||||
|
|
||||||
<script type="module">
|
|
||||||
import { Application, Controller } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js"
|
|
||||||
window.Stimulus = Application.start()
|
|
||||||
|
|
||||||
Stimulus.register("mood", class extends Controller {
|
|
||||||
static targets = [ "image", "info" ]
|
|
||||||
|
|
||||||
updateDayInfo(event) {
|
|
||||||
const image = this.imageTarget;
|
|
||||||
const infoDay = this.infoTarget;
|
|
||||||
image.src = event.target.dataset.mode + ".jpg"
|
|
||||||
infoDay.textContent = event.target.dataset.day;
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<main data-controller="mood">
|
|
||||||
<div class="mode">
|
|
||||||
<img data-mood-target="image" src="<%= @mode %>.jpg">
|
|
||||||
</div>
|
|
||||||
<div class="tracker">
|
|
||||||
<div class="title">
|
|
||||||
<h1>Comment il va le Robi ?</h1>
|
|
||||||
</div>
|
|
||||||
<div class="info-day" data-mood-target="info">Aujourd'hui</div>
|
|
||||||
<div class="moods">
|
|
||||||
<div class="log">
|
|
||||||
<% @mood_log.each do |week| %>
|
|
||||||
<div class="week">
|
|
||||||
<% week.each do |d| %>
|
|
||||||
<% if d[1] %>
|
|
||||||
<div data-mode="<%= d[1] %>" data-day="<%= d[0] %>" data-action="mouseover->mood#updateDayInfo mouseleave->mood#updateDayInfo" title="<%= d[0] %> : <%= d[1] %>" class="day <%= d[1] %>"></div>
|
|
||||||
<% else %>
|
|
||||||
<div class="day"></div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="legend">
|
|
||||||
<div class="legend-mood">
|
|
||||||
<div class="bar-frigo"></div>
|
|
||||||
<div class="bar-explain">Triste</div>
|
|
||||||
</div>
|
|
||||||
<div class="legend-mood">
|
|
||||||
<div class="bar-en-charge"></div>
|
|
||||||
<div class="bar-explain">En charge</div>
|
|
||||||
</div>
|
|
||||||
<div class="legend-mood">
|
|
||||||
<div class="bar-croisiere"></div>
|
|
||||||
<div class="bar-explain">Croisiere</div>
|
|
||||||
</div>
|
|
||||||
<div class="legend-mood">
|
|
||||||
<div class="bar-creatif"></div>
|
|
||||||
<div class="bar-explain">Créatif</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||