summary refs log tree commit diff stats
path: root/rails/app
diff options
context:
space:
mode:
Diffstat (limited to 'rails/app')
-rw-r--r--rails/app/assets/config/lingo_manifest.js2
-rw-r--r--rails/app/assets/images/lingo/.keep0
-rw-r--r--rails/app/assets/images/lingo/header.pngbin0 -> 1213722 bytes
-rw-r--r--rails/app/assets/stylesheets/lingo/application.css15
-rw-r--r--rails/app/assets/stylesheets/lingo/main.css.scss24
-rw-r--r--rails/app/controllers/concerns/.keep0
-rw-r--r--rails/app/controllers/lingo/application_controller.rb4
-rw-r--r--rails/app/controllers/lingo/scores_controller.rb21
-rw-r--r--rails/app/helpers/lingo/application_helper.rb4
-rw-r--r--rails/app/helpers/lingo/scores_helper.rb4
-rw-r--r--rails/app/jobs/lingo/application_job.rb4
-rw-r--r--rails/app/mailers/lingo/application_mailer.rb6
-rw-r--r--rails/app/models/concerns/.keep0
-rw-r--r--rails/app/models/lingo/application_record.rb5
-rw-r--r--rails/app/models/lingo/score.rb4
-rw-r--r--rails/app/views/layouts/lingo/application.html.haml9
-rw-r--r--rails/app/views/lingo/scores/index.html.haml9
17 files changed, 111 insertions, 0 deletions
diff --git a/rails/app/assets/config/lingo_manifest.js b/rails/app/assets/config/lingo_manifest.js new file mode 100644 index 0000000..32c12fb --- /dev/null +++ b/rails/app/assets/config/lingo_manifest.js
@@ -0,0 +1,2 @@
1//= link_directory ../stylesheets/lingo .css
2//= link lingo/header.png
diff --git a/rails/app/assets/images/lingo/.keep b/rails/app/assets/images/lingo/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/rails/app/assets/images/lingo/.keep
diff --git a/rails/app/assets/images/lingo/header.png b/rails/app/assets/images/lingo/header.png new file mode 100644 index 0000000..9384865 --- /dev/null +++ b/rails/app/assets/images/lingo/header.png
Binary files differ
diff --git a/rails/app/assets/stylesheets/lingo/application.css b/rails/app/assets/stylesheets/lingo/application.css new file mode 100644 index 0000000..0ebd7fe --- /dev/null +++ b/rails/app/assets/stylesheets/lingo/application.css
@@ -0,0 +1,15 @@
1/*
2 * This is a manifest file that'll be compiled into application.css, which will include all the files
3 * listed below.
4 *
5 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7 *
8 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10 * files in this directory. Styles in this file should be added after the last require_* statement.
11 * It is generally better to create a new file per style scope.
12 *
13 *= require_tree .
14 *= require_self
15 */
diff --git a/rails/app/assets/stylesheets/lingo/main.css.scss b/rails/app/assets/stylesheets/lingo/main.css.scss new file mode 100644 index 0000000..c5bdad0 --- /dev/null +++ b/rails/app/assets/stylesheets/lingo/main.css.scss
@@ -0,0 +1,24 @@
1body {
2 background-color: black;
3 color: white;
4}
5
6#header {
7 width: 100%;
8
9 img {
10 max-width: 80%;
11 margin: 0 auto;
12 display: block;
13 }
14}
15
16h2 {
17 text-align: center;
18 font-family: sans-serif;
19}
20
21#scores {
22 width: 50%;
23 margin: 0 auto;
24} \ No newline at end of file
diff --git a/rails/app/controllers/concerns/.keep b/rails/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/rails/app/controllers/concerns/.keep
diff --git a/rails/app/controllers/lingo/application_controller.rb b/rails/app/controllers/lingo/application_controller.rb new file mode 100644 index 0000000..33f4567 --- /dev/null +++ b/rails/app/controllers/lingo/application_controller.rb
@@ -0,0 +1,4 @@
1module Lingo
2 class ApplicationController < ActionController::Base
3 end
4end
diff --git a/rails/app/controllers/lingo/scores_controller.rb b/rails/app/controllers/lingo/scores_controller.rb new file mode 100644 index 0000000..63fd0f9 --- /dev/null +++ b/rails/app/controllers/lingo/scores_controller.rb
@@ -0,0 +1,21 @@
1module Lingo
2 class ScoresController < ApplicationController
3 def index
4 @scores = Score.order(score: :desc)
5 end
6
7 def update
8 if params[:secret_code] != Lingo.secret_code then
9 head :unauthorized
10 else
11 score = Score.find_or_create_by(user_id: params[:user_id])
12 score.username = params[:username]
13 score.avatar_url = params[:avatar_url]
14 score.score += 1
15 score.save!
16
17 render :blank
18 end
19 end
20 end
21end
diff --git a/rails/app/helpers/lingo/application_helper.rb b/rails/app/helpers/lingo/application_helper.rb new file mode 100644 index 0000000..4d30003 --- /dev/null +++ b/rails/app/helpers/lingo/application_helper.rb
@@ -0,0 +1,4 @@
1module Lingo
2 module ApplicationHelper
3 end
4end
diff --git a/rails/app/helpers/lingo/scores_helper.rb b/rails/app/helpers/lingo/scores_helper.rb new file mode 100644 index 0000000..53b0031 --- /dev/null +++ b/rails/app/helpers/lingo/scores_helper.rb
@@ -0,0 +1,4 @@
1module Lingo
2 module ScoresHelper
3 end
4end
diff --git a/rails/app/jobs/lingo/application_job.rb b/rails/app/jobs/lingo/application_job.rb new file mode 100644 index 0000000..1dfcb44 --- /dev/null +++ b/rails/app/jobs/lingo/application_job.rb
@@ -0,0 +1,4 @@
1module Lingo
2 class ApplicationJob < ActiveJob::Base
3 end
4end
diff --git a/rails/app/mailers/lingo/application_mailer.rb b/rails/app/mailers/lingo/application_mailer.rb new file mode 100644 index 0000000..b86b722 --- /dev/null +++ b/rails/app/mailers/lingo/application_mailer.rb
@@ -0,0 +1,6 @@
1module Lingo
2 class ApplicationMailer < ActionMailer::Base
3 default from: "from@example.com"
4 layout "mailer"
5 end
6end
diff --git a/rails/app/models/concerns/.keep b/rails/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/rails/app/models/concerns/.keep
diff --git a/rails/app/models/lingo/application_record.rb b/rails/app/models/lingo/application_record.rb new file mode 100644 index 0000000..21a1824 --- /dev/null +++ b/rails/app/models/lingo/application_record.rb
@@ -0,0 +1,5 @@
1module Lingo
2 class ApplicationRecord < ActiveRecord::Base
3 self.abstract_class = true
4 end
5end
diff --git a/rails/app/models/lingo/score.rb b/rails/app/models/lingo/score.rb new file mode 100644 index 0000000..6df7dfb --- /dev/null +++ b/rails/app/models/lingo/score.rb
@@ -0,0 +1,4 @@
1module Lingo
2 class Score < ApplicationRecord
3 end
4end
diff --git a/rails/app/views/layouts/lingo/application.html.haml b/rails/app/views/layouts/lingo/application.html.haml new file mode 100644 index 0000000..6731e5a --- /dev/null +++ b/rails/app/views/layouts/lingo/application.html.haml
@@ -0,0 +1,9 @@
1!!! 5
2%html
3 %head
4 %title LINGO Bot Scoreboard
5 = stylesheet_link_tag "lingo/application", media: "all"
6 = csrf_meta_tags
7 %body
8 #header= image_tag "lingo/header.png"
9 #content= yield
diff --git a/rails/app/views/lingo/scores/index.html.haml b/rails/app/views/lingo/scores/index.html.haml new file mode 100644 index 0000000..f0f681d --- /dev/null +++ b/rails/app/views/lingo/scores/index.html.haml
@@ -0,0 +1,9 @@
1%h2 Bot Puzzles Scoreboard
2%table#scores
3 - @scores.each do |score|
4 %tr
5 %td.score-pfp
6 - if !score.avatar_url.nil?
7 = image_tag score.avatar_url
8 %td.score-name= score.username
9 %td.score-value= score.score