about summary refs log tree commit diff stats
path: root/app
diff options
context:
space:
mode:
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