about summary refs log tree commit diff stats
path: root/app
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-30 00:18:04 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-30 00:18:04 -0400
commit489583486bd9d31de5bec8751d7e63997c325fd3 (patch)
treef6ebe78ad4acbfb39e76bc80aeea0ca9f17b5a1b /app
parent392cc8a0f938b0f363e1a9227d5ff9a3ecbdbe10 (diff)
downloadwittle-489583486bd9d31de5bec8751d7e63997c325fd3.tar.gz
wittle-489583486bd9d31de5bec8751d7e63997c325fd3.tar.bz2
wittle-489583486bd9d31de5bec8751d7e63997c325fd3.zip
added archive page and some expert puzzles
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/wittle/general.css.scss26
-rw-r--r--app/controllers/wittle/puzzles_controller.rb3
-rw-r--r--app/views/wittle/puzzles/about.html.haml1
-rw-r--r--app/views/wittle/puzzles/index.html.haml25
4 files changed, 54 insertions, 1 deletions
diff --git a/app/assets/stylesheets/wittle/general.css.scss b/app/assets/stylesheets/wittle/general.css.scss index c258734..a0eb980 100644 --- a/app/assets/stylesheets/wittle/general.css.scss +++ b/app/assets/stylesheets/wittle/general.css.scss
@@ -143,3 +143,29 @@ input[type="range"]::-ms-thumb {
143 padding-left: 1em; 143 padding-left: 1em;
144 text-align: right; 144 text-align: right;
145} 145}
146
147#archive {
148 width: 50%;
149 margin: 0 auto;
150 border-spacing: 0;
151 text-align: center;
152
153 tr {
154 &.odd {
155 background-color: #fff;
156 }
157
158 &.even {
159 background-color: #edf;
160 }
161 }
162
163 th, td {
164 padding: 0.5em;
165 }
166
167 ul {
168 list-style-type: none;
169 padding: 0;
170 }
171}
diff --git a/app/controllers/wittle/puzzles_controller.rb b/app/controllers/wittle/puzzles_controller.rb index 2949f94..3c3c8a6 100644 --- a/app/controllers/wittle/puzzles_controller.rb +++ b/app/controllers/wittle/puzzles_controller.rb
@@ -3,10 +3,11 @@ module Wittle
3 def about 3 def about
4 @normal_puzzle = Puzzle.normal.order(created_at: :desc).first 4 @normal_puzzle = Puzzle.normal.order(created_at: :desc).first
5 @hard_puzzle = Puzzle.hard.order(created_at: :desc).first 5 @hard_puzzle = Puzzle.hard.order(created_at: :desc).first
6 @expert_puzzle = Puzzle.expert.order(created_at: :desc).first
6 end 7 end
7 8
8 def index 9 def index
9 #@puzzle = WittleGenerator.new.generate_medium 10 @puzzles = Puzzle.select(:id, :created_at, :category).order(created_at: :asc).all.chunk { |puzzle| puzzle.created_at.localtime.to_date }.to_h.transform_values { |by_date| by_date.sort_by(&:category).chunk { |puzzle| puzzle.category }.to_h }
10 end 11 end
11 12
12 def show 13 def show
diff --git a/app/views/wittle/puzzles/about.html.haml b/app/views/wittle/puzzles/about.html.haml index 628ba0b..6a47972 100644 --- a/app/views/wittle/puzzles/about.html.haml +++ b/app/views/wittle/puzzles/about.html.haml
@@ -1,3 +1,4 @@
1%p by Hatkirby, with help from Sigma144 and jbzdarkid 1%p by Hatkirby, with help from Sigma144 and jbzdarkid
2%p= link_to "Normal", @normal_puzzle 2%p= link_to "Normal", @normal_puzzle
3%p= link_to "Hard", @hard_puzzle 3%p= link_to "Hard", @hard_puzzle
4%p= link_to "Expert", @expert_puzzle
diff --git a/app/views/wittle/puzzles/index.html.haml b/app/views/wittle/puzzles/index.html.haml index e69de29..097eb87 100644 --- a/app/views/wittle/puzzles/index.html.haml +++ b/app/views/wittle/puzzles/index.html.haml
@@ -0,0 +1,25 @@
1%h1 Archive
2%table#archive
3 %tr
4 %th
5 %th Normal
6 %th Hard
7 %th Expert
8 - @puzzles.each do |date, dps|
9 %tr{ class: cycle("even", "odd") }
10 %td= date.strftime("%B %-d, %Y")
11 %td
12 - if dps.has_key? "normal"
13 %ul
14 - dps["normal"].each do |puzzle|
15 %li= link_to "\##{puzzle.id}", puzzle
16 %td
17 - if dps.has_key? "hard"
18 %ul
19 - dps["hard"].each do |puzzle|
20 %li= link_to "\##{puzzle.id}", puzzle
21 %td
22 - if dps.has_key? "expert"
23 %ul
24 - dps["expert"].each do |puzzle|
25 %li= link_to "\##{puzzle.id}", puzzle