diff --git a/Gemfile b/Gemfile index eca0bd3..938e7e2 100644 --- a/Gemfile +++ b/Gemfile @@ -28,6 +28,7 @@ gem "simple_form", "4.0.1" gem "administrate", "0.10.0" gem "will_paginate", "3.1.6" gem "administrate-field-carrierwave", "0.3.2" +gem "trix", "0.10.1" gem "gdpr_rails", "0.3.3" gem "omniauth-facebook", "5.0.0" gem "friendly_id", "5.2.0" @@ -55,6 +56,7 @@ group :test do gem "rspec-rails", "3.7.2" gem "factory_bot_rails", "4.10.0" end + group :production do gem "fog-aws", "3.0.0" end diff --git a/Gemfile.lock b/Gemfile.lock index 18be5d1..112a8be 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -396,6 +396,8 @@ GEM thor (0.20.0) thread_safe (0.3.6) tilt (2.0.8) + trix (0.10.1) + rails tzinfo (1.2.5) thread_safe (~> 0.1) uglifier (4.1.18) @@ -464,6 +466,7 @@ DEPENDENCIES slim-rails (= 3.1.3) spring (= 2.0.2) spring-watcher-listen (= 2.0.1) + trix (= 0.10.1) tzinfo-data uglifier (= 4.1.18) web-console (= 3.6.2) diff --git a/app/assets/javascripts/administrate/application.js b/app/assets/javascripts/administrate/application.js new file mode 100644 index 0000000..95c2736 --- /dev/null +++ b/app/assets/javascripts/administrate/application.js @@ -0,0 +1,7 @@ +//= require jquery +//= require jquery_ujs +//= require selectize +//= require moment +//= require datetime_picker +//= require_tree . +//= require trix diff --git a/app/assets/javascripts/administrate/components/date_time_picker.js b/app/assets/javascripts/administrate/components/date_time_picker.js new file mode 100644 index 0000000..f6b29d1 --- /dev/null +++ b/app/assets/javascripts/administrate/components/date_time_picker.js @@ -0,0 +1,10 @@ +$(function () { + $('[data-type="time"]').datetimepicker({ + debug: false, + format: "HH:mm:ss", + }); + $('[data-type="datetime"]').datetimepicker({ + debug: false, + format: "YYYY-MM-DD HH:mm:ss", + }); +}); diff --git a/app/assets/javascripts/administrate/components/has_many_form.js b/app/assets/javascripts/administrate/components/has_many_form.js new file mode 100644 index 0000000..883fd6d --- /dev/null +++ b/app/assets/javascripts/administrate/components/has_many_form.js @@ -0,0 +1,3 @@ +$(function() { + $(".field-unit--has-many select").selectize({}); +}); diff --git a/app/assets/javascripts/administrate/components/table.js b/app/assets/javascripts/administrate/components/table.js new file mode 100644 index 0000000..9325a39 --- /dev/null +++ b/app/assets/javascripts/administrate/components/table.js @@ -0,0 +1,23 @@ +$(function() { + var keycodes = { space: 32, enter: 13 }; + + var visitDataUrl = function(event) { + if (event.type == "click" || + event.keyCode == keycodes.space || + event.keyCode == keycodes.enter) { + + if (event.target.href) { + return; + } + + var dataUrl = $(event.target).closest("tr").data("url"); + var selection = window.getSelection().toString(); + if (selection.length === 0 && dataUrl) { + window.location = dataUrl; + } + } + }; + + $("table").on("click", ".js-table-row", visitDataUrl); + $("table").on("keydown", ".js-table-row", visitDataUrl); +}); diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 5cae5cd..4c9d767 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -14,4 +14,7 @@ //= require popper //= require bootstrap-sprockets //= require activestorage -//= require_tree . +//= require cable +//= require static_page +//= require cable +//= require trix \ No newline at end of file diff --git a/app/assets/stylesheets/administrate/application.scss b/app/assets/stylesheets/administrate/application.scss new file mode 100644 index 0000000..40035a0 --- /dev/null +++ b/app/assets/stylesheets/administrate/application.scss @@ -0,0 +1,33 @@ +// = require trix + +@charset "utf-8"; + +@import "reset/normalize"; + +@import "selectize"; +@import "datetime_picker"; + +@import "library/clearfix"; +@import "library/data-label"; +@import "library/variables"; + +@import "base/forms"; +@import "base/layout"; +@import "base/lists"; +@import "base/tables"; +@import "base/typography"; + +@import "components/app-container"; +@import "components/attributes"; +@import "components/buttons"; +@import "components/cells"; +@import "components/field-unit"; +@import "components/flashes"; +@import "components/form-actions"; +@import "components/main-content"; +@import "components/navigation"; +@import "components/pagination"; +@import "components/search"; + +@import "utilities/text-color"; + diff --git a/app/assets/stylesheets/administrate/base/_forms.scss b/app/assets/stylesheets/administrate/base/_forms.scss new file mode 100644 index 0000000..26b3e82 --- /dev/null +++ b/app/assets/stylesheets/administrate/base/_forms.scss @@ -0,0 +1,107 @@ +fieldset { + background-color: transparent; + border: 0; + margin: 0; + padding: 0; +} + +legend { + font-weight: $bold-font-weight; + margin: 0; + padding: 0; +} + +label { + display: block; + font-weight: $bold-font-weight; + margin: 0; +} + +input, +select { + display: block; + font-family: $base-font-family; + font-size: $base-font-size; +} + +input, +select, +textarea { + display: block; + font-family: $base-font-family; + font-size: 16px; +} + +[type="color"], +[type="date"], +[type="datetime-local"], +[type="email"], +[type="month"], +[type="number"], +[type="password"], +[type="search"], +[type="tel"], +[type="text"], +[type="time"], +[type="url"], +[type="week"], +input:not([type]), +textarea { + appearance: none; + background-color: $white; + border: $base-border; + border-radius: $base-border-radius; + padding: 0.5em; + transition: border-color $base-duration $base-timing; + width: 100%; + + &:hover { + border-color: mix($black, $base-border-color, 20%); + } + + &:focus { + border-color: $action-color; + outline: none; + } + + &:disabled { + background-color: mix($black, $white, 5%); + cursor: not-allowed; + + &:hover { + border: $base-border; + } + } + + &::placeholder { + font-style: italic; + } +} + +textarea { + resize: vertical; +} + +[type="checkbox"], +[type="radio"] { + display: inline; + margin-right: $small-spacing / 2; +} + +[type="file"] { + width: 100%; +} + +select { + width: 100%; +} + +[type="checkbox"], +[type="radio"], +[type="file"], +select { + &:focus { + outline: $focus-outline; + outline-offset: $focus-outline-offset; + } +} diff --git a/app/assets/stylesheets/administrate/base/_layout.scss b/app/assets/stylesheets/administrate/base/_layout.scss new file mode 100644 index 0000000..9b6d184 --- /dev/null +++ b/app/assets/stylesheets/administrate/base/_layout.scss @@ -0,0 +1,20 @@ +html { + background-color: $base-background-color; + box-sizing: border-box; +} + +*, +*::before, +*::after { + box-sizing: inherit; +} + +figure { + margin: 0; +} + +img, +picture { + margin: 0; + max-width: 100%; +} diff --git a/app/assets/stylesheets/administrate/base/_lists.scss b/app/assets/stylesheets/administrate/base/_lists.scss new file mode 100644 index 0000000..56aac3b --- /dev/null +++ b/app/assets/stylesheets/administrate/base/_lists.scss @@ -0,0 +1,19 @@ +ul, +ol { + list-style-type: none; + margin: 0; + padding: 0; +} + +dl { + margin-bottom: $small-spacing; + + dt { + font-weight: $bold-font-weight; + margin-top: $small-spacing; + } + + dd { + margin: 0; + } +} diff --git a/app/assets/stylesheets/administrate/base/_tables.scss b/app/assets/stylesheets/administrate/base/_tables.scss new file mode 100644 index 0000000..36e1ad4 --- /dev/null +++ b/app/assets/stylesheets/administrate/base/_tables.scss @@ -0,0 +1,55 @@ +table { + border-collapse: collapse; + font-size: 0.9em; + text-align: left; + width: 100%; + + a { + color: inherit; + text-decoration: none; + } +} + +thead { + font-weight: $bold-font-weight; +} + +tr { + border-bottom: $base-border; +} + +tbody tr { + &:hover { + background-color: $base-background-color; + cursor: pointer; + } + + &:focus { + outline: $focus-outline; + outline-offset: -($focus-outline-width); + } +} + +td, +th { + font-feature-settings: "kern", "liga", "clig", "calt", "lnum", "tnum"; + font-kerning: normal; + font-variant-ligatures: common-ligatures, contextual; + font-variant-numeric: lining-nums, tabular-nums; + padding: 0.75rem; + vertical-align: middle; +} + +td:first-child, +th:first-child { + padding-left: 2rem; +} + +td:last-child, +th:last-child { + padding-right: 2rem; +} + +td img { + max-height: 2rem; +} diff --git a/app/assets/stylesheets/administrate/base/_typography.scss b/app/assets/stylesheets/administrate/base/_typography.scss new file mode 100644 index 0000000..ebf6636 --- /dev/null +++ b/app/assets/stylesheets/administrate/base/_typography.scss @@ -0,0 +1,45 @@ +body { + color: $base-font-color; + font-family: $base-font-family; + font-size: $base-font-size; + line-height: $base-line-height; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-family: $heading-font-family; + font-size: $base-font-size; + line-height: $heading-line-height; + margin: 0; +} + +p { + margin: 0 0 $small-spacing; +} + +a { + color: $action-color; + text-decoration-skip: ink; + transition: color $base-duration $base-timing; + + &:hover { + color: mix($black, $action-color, 25%); + } + + &:focus { + outline: $focus-outline; + outline-offset: $focus-outline-offset; + } +} + +hr { + border-bottom: $base-border; + border-left: 0; + border-right: 0; + border-top: 0; + margin: $base-spacing 0; +} diff --git a/app/assets/stylesheets/administrate/components/_app-container.scss b/app/assets/stylesheets/administrate/components/_app-container.scss new file mode 100644 index 0000000..9ac19f0 --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_app-container.scss @@ -0,0 +1,9 @@ +.app-container { + align-items: stretch; + display: flex; + margin-left: auto; + margin-right: auto; + max-width: 100rem; + min-height: 100vh; + padding: $base-spacing; +} diff --git a/app/assets/stylesheets/administrate/components/_attributes.scss b/app/assets/stylesheets/administrate/components/_attributes.scss new file mode 100644 index 0000000..6ab0c83 --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_attributes.scss @@ -0,0 +1,26 @@ +.attribute-label { + @include data-label; + clear: left; + float: left; + margin-bottom: $base-spacing; + margin-top: 0; + text-align: right; + width: calc(15% - 1rem); +} + +.preserve-whitespace { + white-space: pre-wrap; + word-wrap: break-word; +} + +.attribute-data { + float: left; + margin-bottom: $base-spacing; + margin-left: 2rem; + width: calc(85% - 1rem); +} + +.attribute--nested { + border: $base-border; + padding: $small-spacing; +} diff --git a/app/assets/stylesheets/administrate/components/_buttons.scss b/app/assets/stylesheets/administrate/components/_buttons.scss new file mode 100644 index 0000000..ff745fa --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_buttons.scss @@ -0,0 +1,43 @@ +button, +input[type="button"], +input[type="reset"], +input[type="submit"], +.button { + appearance: none; + background-color: $action-color; + border: 0; + border-radius: $base-border-radius; + color: $white; + cursor: pointer; + display: inline-block; + font-family: $base-font-family; + font-size: $base-font-size; + -webkit-font-smoothing: antialiased; + font-weight: $bold-font-weight; + line-height: 1; + padding: $small-spacing $base-spacing; + text-decoration: none; + transition: background-color $base-duration $base-timing; + user-select: none; + vertical-align: middle; + white-space: nowrap; + + &:hover { + background-color: mix($black, $action-color, 20%); + color: $white; + } + + &:focus { + outline: $focus-outline; + outline-offset: $focus-outline-offset; + } + + &:disabled { + cursor: not-allowed; + opacity: 0.5; + + &:hover { + background-color: $action-color; + } + } +} diff --git a/app/assets/stylesheets/administrate/components/_cells.scss b/app/assets/stylesheets/administrate/components/_cells.scss new file mode 100644 index 0000000..cb79245 --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_cells.scss @@ -0,0 +1,45 @@ +.cell-label { + &:hover { + a { + color: $action-color; + } + + svg { + fill: $action-color; + transform: rotate(180deg); + } + } + + a { + color: inherit; + display: inline-block; + transition: color $base-duration $base-timing; + width: 100%; + } +} + +.cell-label--asc, +.cell-label--desc { + font-weight: $bold-font-weight; +} + +.cell-label__sort-indicator { + float: right; + margin-left: 5px; + + svg { + fill: $hint-grey; + height: 13px; + transition: transform $base-duration $base-timing; + width: 13px; + } +} + +.cell-label__sort-indicator--desc { + transform: rotate(180deg); +} + +.cell-data--number, +.cell-label--number { + text-align: right; +} diff --git a/app/assets/stylesheets/administrate/components/_field-unit.scss b/app/assets/stylesheets/administrate/components/_field-unit.scss new file mode 100644 index 0000000..0908bd4 --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_field-unit.scss @@ -0,0 +1,36 @@ +.field-unit { + @include administrate-clearfix; + align-items: center; + display: flex; + margin-bottom: $base-spacing; + position: relative; + width: 100%; +} + +.field-unit__label { + float: left; + margin-left: 1rem; + text-align: right; + width: calc(15% - 1rem); +} + +.field-unit__field { + float: left; + margin-left: 2rem; + width: 45%; +} + +.field-unit--nested { + border: $base-border; + margin-left: 7.5%; + padding: $small-spacing; + width: 50%; + + .field-unit__field { + width: calc(75% - 1rem); + } + + .field-unit__label { + width: calc(25% - 1rem); + } +} diff --git a/app/assets/stylesheets/administrate/components/_flashes.scss b/app/assets/stylesheets/administrate/components/_flashes.scss new file mode 100644 index 0000000..48c3e68 --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_flashes.scss @@ -0,0 +1,28 @@ +$base-spacing: 1.5em !default; +$flashes: ( + "alert": #fff6bf, + "error": #fbe3e4, + "notice": #e5edf8, + "success": #e6efc2, +) !default; + +@each $flash-type, $color in $flashes { + .flash-#{$flash-type} { + background-color: $color; + color: mix($black, $color, 60%); + display: block; + margin-bottom: $base-spacing / 2; + padding: $base-spacing / 2; + text-align: center; + + a { + color: mix($black, $color, 70%); + text-decoration: underline; + + &:focus, + &:hover { + color: mix($black, $color, 90%); + } + } + } +} diff --git a/app/assets/stylesheets/administrate/components/_form-actions.scss b/app/assets/stylesheets/administrate/components/_form-actions.scss new file mode 100644 index 0000000..d87d174 --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_form-actions.scss @@ -0,0 +1,3 @@ +.form-actions { + margin-left: calc(15% + 2rem); +} diff --git a/app/assets/stylesheets/administrate/components/_main-content.scss b/app/assets/stylesheets/administrate/components/_main-content.scss new file mode 100644 index 0000000..8d8cf0e --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_main-content.scss @@ -0,0 +1,29 @@ +.main-content { + background-color: $white; + border-radius: $base-border-radius; + box-shadow: 0 0 6px 0 rgba($black, 0.12), + 0 2px 2px rgba($black, 0.2); + flex: 1 1 100%; + padding-bottom: 10vh; +} + +.main-content__header, +.main-content__body { + padding: 1rem 2rem; +} + +.main-content__body--flush { + padding-left: 0; + padding-right: 0; +} + +.main-content__header { + align-items: center; + border-bottom: $base-border; + display: flex; +} + +.main-content__page-title { + font-size: 1.6em; + margin-right: auto; +} diff --git a/app/assets/stylesheets/administrate/components/_navigation.scss b/app/assets/stylesheets/administrate/components/_navigation.scss new file mode 100644 index 0000000..8432ccb --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_navigation.scss @@ -0,0 +1,33 @@ +$_navigation-link-padding: 0.6em; + +.navigation { + flex: 1 0 10rem; + padding-bottom: $base-spacing; + padding-right: calc(#{$base-spacing} - #{$_navigation-link-padding}); + padding-top: $base-spacing; +} + +.navigation__link { + background-color: transparent; + color: $base-font-color; + display: block; + line-height: 1; + margin-left: -($_navigation-link-padding); + padding: $_navigation-link-padding; + transition: background-color $base-duration $base-timing, + color $base-duration $base-timing; + + &:not(:last-of-type) { + margin-bottom: $small-spacing; + } + + &:hover { + background-color: mix($black, $base-background-color, 5%); + border-radius: $base-border-radius; + color: $base-font-color; + } +} + +.navigation__link--active { + font-weight: $bold-font-weight; +} diff --git a/app/assets/stylesheets/administrate/components/_pagination.scss b/app/assets/stylesheets/administrate/components/_pagination.scss new file mode 100644 index 0000000..90b7f1b --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_pagination.scss @@ -0,0 +1,18 @@ +.pagination { + margin-top: $base-spacing; + padding-left: $base-spacing; + padding-right: $base-spacing; + text-align: center; + + .first, + .prev, + .page, + .next, + .last { + margin: $small-spacing; + } + + .current { + font-weight: $bold-font-weight; + } +} diff --git a/app/assets/stylesheets/administrate/components/_search.scss b/app/assets/stylesheets/administrate/components/_search.scss new file mode 100644 index 0000000..ee0c669 --- /dev/null +++ b/app/assets/stylesheets/administrate/components/_search.scss @@ -0,0 +1,46 @@ +$_search-icon-size: 1rem; + +.search { + margin-left: auto; + margin-right: 2rem; + max-width: 20rem; + position: relative; + width: 100%; +} + +.search__input { + border-radius: 100rem; + padding-left: $_search-icon-size * 2.5; + padding-right: $_search-icon-size * 2.5; +} + +.search__eyeglass-icon { + fill: $grey-7; + height: $_search-icon-size; + left: $_search-icon-size; + position: absolute; + top: 50%; + transform: translateY(-50%); + width: $_search-icon-size; +} + +.search__clear-link { + height: $_search-icon-size; + position: absolute; + right: $_search-icon-size * 0.75; + top: 50%; + transform: translateY(-50%); + width: $_search-icon-size; +} + +.search__clear-icon { + fill: $grey-5; + height: $_search-icon-size; + position: absolute; + transition: fill $base-duration $base-timing; + width: $_search-icon-size; + + &:hover { + fill: $action-color; + } +} diff --git a/app/assets/stylesheets/administrate/library/_clearfix.scss b/app/assets/stylesheets/administrate/library/_clearfix.scss new file mode 100644 index 0000000..0109aeb --- /dev/null +++ b/app/assets/stylesheets/administrate/library/_clearfix.scss @@ -0,0 +1,7 @@ +@mixin administrate-clearfix { + &::after { + clear: both; + content: ""; + display: block; + } +} diff --git a/app/assets/stylesheets/administrate/library/_data-label.scss b/app/assets/stylesheets/administrate/library/_data-label.scss new file mode 100644 index 0000000..2efcd28 --- /dev/null +++ b/app/assets/stylesheets/administrate/library/_data-label.scss @@ -0,0 +1,8 @@ +@mixin data-label { + color: $hint-grey; + font-size: 0.8em; + font-weight: 400; + letter-spacing: 0.0357em; + position: relative; + text-transform: uppercase; +} diff --git a/app/assets/stylesheets/administrate/library/_variables.scss b/app/assets/stylesheets/administrate/library/_variables.scss new file mode 100644 index 0000000..327e23c --- /dev/null +++ b/app/assets/stylesheets/administrate/library/_variables.scss @@ -0,0 +1,63 @@ +// Typography +$base-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", + "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", + sans-serif !default; +$heading-font-family: $base-font-family !default; + +$base-font-size: 1em !default; + +$bold-font-weight: 700 !default; + +$base-line-height: 1.5 !default; +$heading-line-height: 1.2 !default; + +// Other Sizes +$base-border-radius: 4px !default; +$base-spacing: $base-line-height * 1em !default; +$small-spacing: $base-spacing / 2 !default; + +// Colors +$white: #fff !default; +$black: #000 !default; + +$blue: #1976d2 !default; +$red: #d32f2f !default; +$light-yellow: #f0cd66 !default; +$light-green: #4ab471 !default; + +$grey-0: #f6f7f7 !default; +$grey-1: #dfe0e1 !default; +$grey-2: #cfd8dc !default; +$grey-5: #adb5bd !default; +$grey-7: #293f54 !default; + +$hint-grey: #7b808c !default; + +// Font Colors +$base-font-color: $grey-7 !default; +$action-color: $blue !default; + +// Background Colors +$base-background-color: $grey-0 !default; + +// Focus +$focus-outline-color: transparentize($action-color, 0.4); +$focus-outline-width: 3px; +$focus-outline: $focus-outline-width solid $focus-outline-color; +$focus-outline-offset: 1px; + +// Flash Colors +$flash-colors: ( + alert: $light-yellow, + error: $red, + notice: mix($white, $blue, 50%), + success: $light-green +); + +// Border +$base-border-color: $grey-1 !default; +$base-border: 1px solid $base-border-color !default; + +// Transitions +$base-duration: 250ms !default; +$base-timing: ease-in-out !default; diff --git a/app/assets/stylesheets/administrate/reset/_normalize.scss b/app/assets/stylesheets/administrate/reset/_normalize.scss new file mode 100644 index 0000000..fa4e73d --- /dev/null +++ b/app/assets/stylesheets/administrate/reset/_normalize.scss @@ -0,0 +1,447 @@ +/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in + * IE on Windows Phone and in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers (opinionated). + */ + +body { + margin: 0; +} + +/** + * Add the correct display in IE 9-. + */ + +article, +aside, +footer, +header, +nav, +section { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * Add the correct display in IE 9-. + * 1. Add the correct display in IE. + */ + +figcaption, +figure, +main { /* 1 */ + display: block; +} + +/** + * Add the correct margin in IE 8. + */ + +figure { + margin: 1em 40px; +} + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * 1. Remove the gray background on active links in IE 10. + * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. + */ + +a { + background-color: transparent; /* 1 */ + -webkit-text-decoration-skip: objects; /* 2 */ +} + +/** + * 1. Remove the bottom border in Chrome 57- and Firefox 39-. + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Prevent the duplicate application of `bolder` by the next rule in Safari 6. + */ + +b, +strong { + font-weight: inherit; +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font style in Android 4.3-. + */ + +dfn { + font-style: italic; +} + +/** + * Add the correct background and color in IE 9-. + */ + +mark { + background-color: #ff0; + color: #000; +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Add the correct display in IE 9-. + */ + +audio, +video { + display: inline-block; +} + +/** + * Add the correct display in iOS 4-7. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Remove the border on images inside links in IE 10-. + */ + +img { + border-style: none; +} + +/** + * Hide the overflow in IE. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers (opinionated). + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: sans-serif; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` + * controls in Android 4. + * 2. Correct the inability to style clickable types in iOS and Safari. + */ + +button, +html [type="button"], /* 1 */ +[type="reset"], +[type="submit"] { + -webkit-appearance: button; /* 2 */ +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * 1. Add the correct display in IE 9-. + * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Remove the default vertical scrollbar in IE. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10-. + * 2. Remove the padding in IE 10-. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding and cancel buttons in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-cancel-button, +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in IE 9-. + * 1. Add the correct display in Edge, IE, and Firefox. + */ + +details, /* 1 */ +menu { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Scripting + ========================================================================== */ + +/** + * Add the correct display in IE 9-. + */ + +canvas { + display: inline-block; +} + +/** + * Add the correct display in IE. + */ + +template { + display: none; +} + +/* Hidden + ========================================================================== */ + +/** + * Add the correct display in IE 10-. + */ + +[hidden] { + display: none; +} diff --git a/app/assets/stylesheets/administrate/utilities/_text-color.scss b/app/assets/stylesheets/administrate/utilities/_text-color.scss new file mode 100644 index 0000000..6086047 --- /dev/null +++ b/app/assets/stylesheets/administrate/utilities/_text-color.scss @@ -0,0 +1,3 @@ +.text-color-red { + color: $red; +} diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 71d16a8..086f0ab 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -13,6 +13,13 @@ *= require bootstrap_and_overrides *= require static_page *= require _colors - *= require_tree . + *= require dictionary_page + *= require edit_profile_page + *= require header + *= require profile_page + *= require sign_in_page + *= require sign_up_page + *= require test_page + *= require trix *= require_self */ diff --git a/app/controllers/admin/cards_controller.rb b/app/controllers/admin/cards_controller.rb index d06d0a5..d9d5a20 100644 --- a/app/controllers/admin/cards_controller.rb +++ b/app/controllers/admin/cards_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Admin class CardsController < Admin::ApplicationController # To customize the behavior of this controller, diff --git a/app/controllers/admin/dictionaries_controller.rb b/app/controllers/admin/dictionaries_controller.rb index 4d0edf9..e07ef45 100644 --- a/app/controllers/admin/dictionaries_controller.rb +++ b/app/controllers/admin/dictionaries_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Admin class DictionariesController < Admin::ApplicationController # To customize the behavior of this controller, diff --git a/app/controllers/admin/words_controller.rb b/app/controllers/admin/words_controller.rb index 96514cd..bfe30b7 100644 --- a/app/controllers/admin/words_controller.rb +++ b/app/controllers/admin/words_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Admin class WordsController < Admin::ApplicationController # To customize the behavior of this controller, diff --git a/app/dashboards/card_dashboard.rb b/app/dashboards/card_dashboard.rb index 73b230b..a09d5e1 100644 --- a/app/dashboards/card_dashboard.rb +++ b/app/dashboards/card_dashboard.rb @@ -1,5 +1,8 @@ +# frozen_string_literal: true + require "administrate/base_dashboard" +# class CardDashboard class CardDashboard < Administrate::BaseDashboard # ATTRIBUTE_TYPES # a hash that describes the type of each of the model's fields. diff --git a/app/dashboards/image_question_dashboard.rb b/app/dashboards/image_question_dashboard.rb index f8fe3a5..2c2a4d7 100644 --- a/app/dashboards/image_question_dashboard.rb +++ b/app/dashboards/image_question_dashboard.rb @@ -22,7 +22,7 @@ class ImageQuestionDashboard < Administrate::BaseDashboard image_on_index: true, ), remove_image: Field::Boolean, - text: Field::String, + text: TrixField, correct_answer: Field::String, first_option: Field::String, second_option: Field::String, diff --git a/app/dashboards/radio_image_question_dashboard.rb b/app/dashboards/radio_image_question_dashboard.rb index 7030606..12efd35 100644 --- a/app/dashboards/radio_image_question_dashboard.rb +++ b/app/dashboards/radio_image_question_dashboard.rb @@ -22,7 +22,7 @@ class RadioImageQuestionDashboard < Administrate::BaseDashboard image_on_index: true, ), remove_image: Field::Boolean, - text: Field::String, + text: TrixField, correct_answer: Field::String, first_option: Field::String, second_option: Field::String, diff --git a/app/dashboards/radio_image_text_question_dashboard.rb b/app/dashboards/radio_image_text_question_dashboard.rb index eaec8ec..87ecc66 100644 --- a/app/dashboards/radio_image_text_question_dashboard.rb +++ b/app/dashboards/radio_image_text_question_dashboard.rb @@ -22,7 +22,7 @@ class RadioImageTextQuestionDashboard < Administrate::BaseDashboard image_on_index: true, ), remove_image: Field::Boolean, - text: Field::String, + text: TrixField, correct_answer: Field::String, first_option: Field::String, second_option: Field::String, diff --git a/app/dashboards/radio_question_dashboard.rb b/app/dashboards/radio_question_dashboard.rb index baad4ba..dfcef28 100644 --- a/app/dashboards/radio_question_dashboard.rb +++ b/app/dashboards/radio_question_dashboard.rb @@ -17,7 +17,7 @@ class RadioQuestionDashboard < Administrate::BaseDashboard lesson: Field::BelongsTo, id: Field::Number, title: Field::String, - text: Field::String, + text: TrixField, correct_answer: Field::String, first_option: Field::String, second_option: Field::String, diff --git a/app/dashboards/text_question_dashboard.rb b/app/dashboards/text_question_dashboard.rb index 9e58637..de70c08 100644 --- a/app/dashboards/text_question_dashboard.rb +++ b/app/dashboards/text_question_dashboard.rb @@ -22,7 +22,7 @@ class TextQuestionDashboard < Administrate::BaseDashboard image_on_index: true, ), remove_image: Field::Boolean, - text: Field::String, + text: TrixField, correct_answer: Field::String, first_option: Field::String, second_option: Field::String, diff --git a/app/fields/trix_field.rb b/app/fields/trix_field.rb new file mode 100644 index 0000000..f487dba --- /dev/null +++ b/app/fields/trix_field.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "administrate/field/base" + +# class TrixField +class TrixField < Administrate::Field::Base + def to_s + data + end +end diff --git a/app/models/user.rb b/app/models/user.rb index 1c54fe5..25d8e7c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,7 +3,7 @@ # Comment for User model class User < ApplicationRecord extend FriendlyId - friendly_id :username, :use => [:slugged, :finders] + friendly_id :username, use: [:slugged, :finders] has_many :user_courses has_many :courses, through: :user_courses diff --git a/app/views/fields/trix_field/_form.html.erb b/app/views/fields/trix_field/_form.html.erb new file mode 100644 index 0000000..6395070 --- /dev/null +++ b/app/views/fields/trix_field/_form.html.erb @@ -0,0 +1,7 @@ +
+ <%= f.label field.attribute %> +
+
+ <%= f.text_field field.attribute, id: field.attribute %> + +
diff --git a/app/views/fields/trix_field/_index.html.erb b/app/views/fields/trix_field/_index.html.erb new file mode 100644 index 0000000..6d9dbc9 --- /dev/null +++ b/app/views/fields/trix_field/_index.html.erb @@ -0,0 +1 @@ +<%= field.to_s %> diff --git a/app/views/fields/trix_field/_show.html.erb b/app/views/fields/trix_field/_show.html.erb new file mode 100644 index 0000000..6d9dbc9 --- /dev/null +++ b/app/views/fields/trix_field/_show.html.erb @@ -0,0 +1 @@ +<%= field.to_s %> diff --git a/config/initializers/carrier_wave.rb b/config/initializers/carrier_wave.rb index 0239d50..baafdf2 100644 --- a/config/initializers/carrier_wave.rb +++ b/config/initializers/carrier_wave.rb @@ -4,7 +4,7 @@ if Rails.env.production? CarrierWave.configure do |config| - config.fog_provider = 'fog/aws' + config.fog_provider = "fog/aws" config.fog_credentials = { provider: "AWS", diff --git a/config/schedule.rb b/config/schedule.rb index 2d8378a..2bab6ae 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Use this file to easily define all of your cron jobs. # # It's helpful, but not entirely necessary to understand cron before proceeding.