Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Badges #3

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NGROK_SUBDOMAIN=
REDIS_DB=0
REDIS_PORT=6379
REDIS_TTL=18000
REDIS_URL=redis://localhost
REDIS_URL=redis://localhost:6379/1
SENTRY_DSN=
SIDEKIQ_NAMESPACE=sidekiq_dev
SMTP_DEFAULT_FROM=
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ gem "rails-observers", "~> 0.1.5" # removal candidate
gem "redis", "~> 4.1"
gem "redis-namespace", "~> 1.7" # removal candidate
gem "redis-rails", "~> 5.0" # removal candidate
gem "rubycritic", "~> 4.5", require: false
gem "rubycritic-small-badge", "~> 0.2.1", require: false
gem "sass-rails", "~> 6.0" # removal candidate
gem "sentry-raven", "~> 3.0"
gem "sidekiq", "~> 6.0"
gem "skylight", "~> 4.3"
gem "stimulus_reflex", "~> 3.2"
gem "turbolinks", "~> 5.2"
gem "view_component", "~> 2.7"
gem "webpacker", "~> 4.0"
gem "webpacker", "~> 5.1"

group :development, :test do
gem "bullet", "~> 6.1"
Expand Down
66 changes: 62 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ GEM
activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 14.0)
ast (2.4.0)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
backport (1.1.2)
bcrypt (3.1.13)
benchmark (0.1.0)
Expand All @@ -93,23 +97,29 @@ GEM
code_analyzer (0.5.1)
sexp_processor
coderay (1.1.2)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
colorize (0.8.1)
concurrent-ruby (1.1.6)
connection_pool (2.2.2)
crass (1.0.6)
database_consistency (0.8.0)
activerecord (>= 3.2)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (4.7.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
docile (1.3.2)
dotenv (2.7.5)
dotenv-rails (2.7.5)
dotenv (= 2.7.5)
railties (>= 3.2, < 6.1)
e2mmap (0.1.0)
equalizer (0.0.11)
equatable (0.6.1)
erb_lint (0.0.33)
activesupport
Expand All @@ -130,6 +140,15 @@ GEM
ruby_parser (>= 3.14.1)
ffaker (2.15.0)
ffi (1.12.2)
flay (2.12.1)
erubis (~> 2.7.0)
path_expander (~> 1.0)
ruby_parser (~> 3.0)
sexp_processor (~> 4.0)
flog (4.6.4)
path_expander (~> 1.0)
ruby_parser (~> 3.1, > 3.1.0)
sexp_processor (~> 4.8)
friendly_id (5.3.0)
activerecord (>= 4.0.0)
globalid (0.4.2)
Expand All @@ -138,11 +157,13 @@ GEM
html_tokenizer (0.0.7)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
jaro_winkler (1.5.4)
jbuilder (2.10.0)
activesupport (>= 5.0.0)
json (2.3.0)
jwt (2.2.1)
kwalify (0.7.2)
launchy (2.5.0)
addressable (~> 2.7)
letter_opener (1.7.0)
Expand Down Expand Up @@ -203,12 +224,14 @@ GEM
pastel (0.7.3)
equatable (~> 0.6)
tty-color (~> 0.5)
path_expander (1.1.0)
pg (1.2.3)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
psych (3.1.0)
public_suffix (4.0.5)
puma (4.3.5)
nio4r (~> 2.0)
Expand Down Expand Up @@ -279,6 +302,13 @@ GEM
redis-store (>= 1.2, < 2)
redis-store (1.8.2)
redis (>= 4, < 5)
reek (6.0.1)
kwalify (~> 0.7.0)
parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
psych (~> 3.1.0)
rainbow (>= 2.0, < 4.0)
repo-small-badge (0.2.7)
victor (~> 0.2.8)
require_all (3.0.0)
responders (3.0.0)
actionpack (>= 5.0)
Expand All @@ -301,6 +331,19 @@ GEM
ruby_dep (1.5.0)
ruby_parser (3.14.2)
sexp_processor (~> 4.9)
rubycritic (4.5.0)
flay (~> 2.8)
flog (~> 4.4)
launchy (>= 2.0.0)
parser (>= 2.6.0)
rainbow (~> 3.0)
reek (~> 6.0, < 7.0)
ruby_parser (~> 3.8)
simplecov (>= 0.17.0)
tty-which (~> 0.4.0)
virtus (~> 1.0)
rubycritic-small-badge (0.2.1)
repo-small-badge (~> 0.2.7)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.3.0)
Expand All @@ -311,6 +354,7 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
semantic_range (2.3.0)
sentry-raven (3.0.0)
faraday (>= 1.0)
sexp_processor (4.14.1)
Expand All @@ -319,6 +363,10 @@ GEM
rack (~> 2.0)
rack-protection (>= 2.0.0)
redis (>= 4.1.0)
simplecov (0.18.5)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov-html (0.12.2)
skylight (4.3.0)
skylight-core (= 4.3.0)
skylight-core (4.3.0)
Expand Down Expand Up @@ -374,6 +422,7 @@ GEM
tty-cursor (~> 0.7)
tty-color (0.5.1)
tty-cursor (0.7.1)
tty-which (0.4.2)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
Expand All @@ -382,14 +431,21 @@ GEM
unicode-display_width (1.7.0)
unicode_utils (1.4.0)
uniform_notifier (1.13.0)
victor (0.2.8)
view_component (2.7.0)
activesupport (>= 5.0.0, < 7.0)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
warden (1.2.8)
rack (>= 2.0.6)
webpacker (4.2.2)
activesupport (>= 4.2)
webpacker (5.1.1)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket-driver (0.7.2)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
Expand Down Expand Up @@ -432,6 +488,8 @@ DEPENDENCIES
redis (~> 4.1)
redis-namespace (~> 1.7)
redis-rails (~> 5.0)
rubycritic (~> 4.5)
rubycritic-small-badge (~> 0.2.1)
sass-rails (~> 6.0)
sentry-raven (~> 3.0)
sidekiq (~> 6.0)
Expand All @@ -445,7 +503,7 @@ DEPENDENCIES
turbolinks (~> 5.2)
tzinfo-data
view_component (~> 2.7)
webpacker (~> 4.0)
webpacker (~> 5.1)

RUBY VERSION
ruby 2.6.6p146
Expand Down
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,15 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative "config/application"
require "rubycritic_small_badge"
require "rubycritic/rake_task"

Rails.application.load_tasks

RubyCriticSmallBadge.configure do |config|
config.minimum_score = 90
end
RubyCritic::RakeTask.new do |task|
task.options = %(--custom-format RubyCriticSmallBadge::Report
--minimum-score #{RubyCriticSmallBadge.config.minimum_score})
end
12 changes: 12 additions & 0 deletions app/components/application_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class ApplicationComponent < ViewComponent::Base
private

def find_or_fallback(supplied, valid, fallback)
if valid.include?(supplied)
supplied
else
raise ArgumentError if Rails.env.development?
fallback
end
end
end
8 changes: 8 additions & 0 deletions app/components/badge_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="w-full p-2 sm:w-1/3">
<div class="flex flex-col items-center h-full p-4 text-center bg-gray-800 rounded">
<%= tag.small(class: "text-xs text-red-500 tracking-widest font-medium") { org_name } if org_name %>
<h2 class="font-medium text-white title-font"><%= badge.title %></h2>
<%= image_tag badge.asset_url, class: "mt-3", alt: badge.title %>
<%# <%= tag.p(class: "text-gray-600") { badge.description } if badge.description %>
</div>
</div>
13 changes: 13 additions & 0 deletions app/components/badge_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class BadgeComponent < ApplicationComponent
def initialize(badge:)
@badge = badge
end

private

attr_reader :badge

def org_name
badge.organization ? badge.organization.name : false
end
end
1 change: 0 additions & 1 deletion app/components/example_component.html.erb

This file was deleted.

6 changes: 0 additions & 6 deletions app/components/example_component.rb

This file was deleted.

8 changes: 8 additions & 0 deletions app/components/flash_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<% flash.each do |msg_type, message| %>
<div class="alert <%= class_for(msg_type) %>">
<div class="container">
<button class="close" data-dismiss="alert"><span>×</span></button>
<%= message %>
</div>
</div>
<% end %>
22 changes: 22 additions & 0 deletions app/components/flash_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class FlashComponent < ApplicationComponent
def initialize(flash: nil)
@flash = flash
end

private

attr_reader :flash

def class_for(flash_type)
{
success: "alert-success",
error: "alert-danger",
alert: "alert-warning",
notice: "alert-info"
}.stringify_keys[flash_type.to_s] || flash_type.to_s
end

def render?
flash
end
end
12 changes: 12 additions & 0 deletions app/components/footer_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<footer>
<div class="border-t border-gray-800">
<div class="container flex flex-col flex-wrap px-5 py-4 mx-auto sm:flex-row">
<p class="text-sm text-center text-gray-600 sm:text-left">© 2020 Andrew Mason —
<a href="https://twitter.com/andrewmcodes" class="ml-1 text-gray-500" target="_blank" rel="noopener noreferrer">@andrewmcodes</a>
</p>
<span class="w-full mt-2 text-sm text-center text-gray-600 sm:ml-auto sm:mt-0 sm:w-auto sm:text-left">
Tools are fun until they aren't
</span>
</div>
</div>
</footer>
2 changes: 2 additions & 0 deletions app/components/footer_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class FooterComponent < ApplicationComponent
end
10 changes: 10 additions & 0 deletions app/components/form/errors_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div id="error_explanation" class="p-2 bg-gray-800 rounded-md border-red-50">
<h2 class="mb-1 text-xs font-medium tracking-widest text-red-500 title-font">
<%= pluralize(object.errors.count, "error") %> prohibited saving:
</h2>
<ul>
<% object.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
13 changes: 13 additions & 0 deletions app/components/form/errors_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Form::ErrorsComponent < ApplicationComponent
def initialize(object: nil)
@object = object
end

private

attr_reader :object

def render?
object&.errors&.any?
end
end
6 changes: 6 additions & 0 deletions app/components/header/navbar_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<nav class="flex flex-wrap items-center justify-center text-base md:mr-auto md:ml-4 md:py-1 md:pl-4 md:border-l md:border-gray-700">
<a class="mr-5 hover:text-white">First Link</a>
<a class="mr-5 hover:text-white">Second Link</a>
<a class="mr-5 hover:text-white">Third Link</a>
<a class="mr-5 hover:text-white">Fourth Link</a>
</nav>
4 changes: 4 additions & 0 deletions app/components/header/navbar_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Header
class NavbarComponent < ApplicationComponent
end
end
14 changes: 14 additions & 0 deletions app/components/header_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<header class="text-gray-500 bg-gray-900 body-font">
<div class="container flex flex-col flex-wrap items-center p-5 mx-auto md:flex-row">
<a class="flex items-center mb-4 font-medium text-white title-font md:mb-0">
<%= image_pack_tag 'ruby.svg', class: "w-10" %>
<span class="ml-3 text-xl">Rubyists.dev</span>
</a>
<%#= render(Header::NavbarComponent.new) %>
<button class="inline-flex items-center hidden px-3 py-1 mt-4 text-base bg-gray-800 border-0 rounded focus:outline-none hover:bg-gray-700 md:mt-0">Button
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="w-4 h-4 ml-1" viewBox="0 0 24 24">
<path d="M5 12h14M12 5l7 7-7 7"></path>
</svg>
</button>
</div>
</header>
2 changes: 2 additions & 0 deletions app/components/header_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class HeaderComponent < ApplicationComponent
end
10 changes: 10 additions & 0 deletions app/components/page_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="container px-5 py-12 mx-auto">
<div class="mb-20 text-center">
<%= tag.h1(class: "sm:text-3xl text-2xl font-medium text-center title-font text-white mb-4") { title } if title %>
<%= tag.p(class: "text-base leading-relaxed xl:w-2/4 lg:w-3/4 mx-auto") { subtitle } if subtitle %>
</div>
<div class="flex flex-wrap -mx-2 lg:w-4/5 sm:mx-auto sm:mb-2">
<%= body %>
</div>
<%= actions %>
</div>
Loading