diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3716348f56..f0bdc9fc94 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,7 +9,6 @@ "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} }, "waitFor": "onCreateCommand", - "initializeCommand": "git submodule update --init --recursive", "postCreateCommand": ".devcontainer/setup.sh", "postAttachCommand": { "server": ".devcontainer/boot.sh" diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 59600e79d6..ff8fc6ddb8 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -1,5 +1,6 @@ #!/bin/sh +git submodule update --init --recursive # Setup database cp config/database.docker.yml config/database.yml createuser -s postgres diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9f58239650..8b1e31eeac 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,6 +2,11 @@ version: 2 updates: - package-ecosystem: npm directory: "/" + groups: + minor-and-patch: + update-types: + - "minor" + - "patch" schedule: interval: daily open-pull-requests-limit: 10 @@ -10,6 +15,11 @@ updates: directory: "/" schedule: interval: daily + groups: + minor-and-patch: + update-types: + - "minor" + - "patch" open-pull-requests-limit: 10 - package-ecosystem: "docker" diff --git a/.tool-versions b/.tool-versions index d701db1051..dd6dbc09a9 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ nodejs 18.18.2 -ruby 3.2.0 +ruby 3.3.0 yarn 1.22.19 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c11bf27cd2..722d1cfb17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,6 +11,7 @@ Please note: If you wanted to work on an issue, let us know by leaving a commen - `maintainers` label are internal tasks that will be completed by a Circuitverse core team member. - [good first issue](https://github.com/CircuitVerse/CircuitVerse/labels/good%20first%20issue) labeled issues are meant for newer developers. +- [pending triage](https://github.com/CircuitVerse/CircuitVerse/labels/pending%20triage) labeled issues are not verified by maintainers. - [feature](https://github.com/CircuitVerse/CircuitVerse/labels/%F0%9F%8C%9F%20feature) labeled issues are meant to propose new features. - [bugs](https://github.com/CircuitVerse/CircuitVerse/labels/%F0%9F%90%9E%20bug) labeled issues are meant to have errors in existing code base. - [documentation](https://github.com/CircuitVerse/CircuitVerse/labels/documentation) labeled issues are meant to have typo errors in documentation. @@ -76,7 +77,7 @@ Please note: If you wanted to work on an issue, let us know by leaving a commen - `no activity` labeled PRs are meant to have no activity in the PR from since a while. - `blocked` labeled PRs are meant not to go ahead for review. - `do not merge` labeled PRs are meant not to merge the PR right now(may be later). -- [awaiting-approval](https://github.com/CircuitVerse/CircuitVerse/labels/awaiting-approval) labeled PRs are meant to be waiting for other communtiy members. +- [awaiting-approval](https://github.com/CircuitVerse/CircuitVerse/labels/awaiting-approval) labeled PRs are meant to be waiting for other community members. ## Community Discussions about CircuitVerse issues and features take place on the repository's [Discussions](https://github.com/CircuitVerse/CircuitVerse/discussions) sections. Anybody is welcome to join these conversations. See the [README](README.md) for more information on communication channels. diff --git a/Gemfile b/Gemfile index 9cf7240831..0fdf4c2db8 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end +gem "rails_autolink" gem "acts_as_votable", "~> 0.14.0" gem "aws-sdk-rails" gem "dotenv-rails", groups: %i[development test] @@ -24,7 +25,7 @@ gem "view_component" # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem "rails", "~> 7.0" # Use Puma as the app server -gem "puma", "~> 6.3" +gem "puma", "~> 6.4" # Use SCSS for stylesheets gem "sass-rails", "~> 6.0" gem "terser" @@ -162,6 +163,7 @@ group :development do gem "sunspot_solr" gem "bundler-audit", "~> 0.9.1" gem 'database_consistency', require: false + gem "lookbook", ">= 2.2.0" end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/Gemfile.lock b/Gemfile.lock index c0ef9eb943..7323c913b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,77 +17,77 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.7.2) - actionpack (= 7.0.7.2) - activesupport (= 7.0.7.2) + actioncable (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.7.2) - actionpack (= 7.0.7.2) - activejob (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + actionmailbox (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.7.2) - actionpack (= 7.0.7.2) - actionview (= 7.0.7.2) - activejob (= 7.0.7.2) - activesupport (= 7.0.7.2) + actionmailer (7.0.8.1) + actionpack (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.7.2) - actionview (= 7.0.7.2) - activesupport (= 7.0.7.2) + actionpack (7.0.8.1) + actionview (= 7.0.8.1) + activesupport (= 7.0.8.1) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.7.2) - actionpack (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + actiontext (7.0.8.1) + actionpack (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.7.2) - activesupport (= 7.0.7.2) + actionview (7.0.8.1) + activesupport (= 7.0.8.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.7.2) - activesupport (= 7.0.7.2) + activejob (7.0.8.1) + activesupport (= 7.0.8.1) globalid (>= 0.3.6) - activemodel (7.0.7.2) - activesupport (= 7.0.7.2) + activemodel (7.0.8.1) + activesupport (= 7.0.8.1) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (7.0.7.2) - activemodel (= 7.0.7.2) - activesupport (= 7.0.7.2) - activestorage (7.0.7.2) - actionpack (= 7.0.7.2) - activejob (= 7.0.7.2) - activerecord (= 7.0.7.2) - activesupport (= 7.0.7.2) + activerecord (7.0.8.1) + activemodel (= 7.0.8.1) + activesupport (= 7.0.8.1) + activestorage (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activesupport (= 7.0.8.1) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.7.2) + activesupport (7.0.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) acts_as_votable (0.14.0) - addressable (2.8.5) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) ahoy_matey (4.0.3) activesupport (>= 5.2) @@ -180,7 +180,7 @@ GEM rails (>= 6.0) sprockets-rails will_paginate - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) connection_pool (2.4.1) countries (5.3.0) unaccent (~> 0.3) @@ -194,12 +194,12 @@ GEM crack (0.4.5) rexml crass (1.0.6) - css_parser (1.7.1) + css_parser (1.16.0) addressable csv (3.2.6) database_consistency (1.7.22) activerecord (>= 3.2) - date (3.3.3) + date (3.3.4) debug (1.8.0) irb (>= 1.5.0) reline (>= 0.3.1) @@ -266,12 +266,12 @@ GEM friendly_id (5.4.2) activerecord (>= 4.0.0) geocoder (1.7.3) - globalid (1.1.0) - activesupport (>= 5.0) - google-protobuf (3.23.2-arm64-darwin) - google-protobuf (3.23.2-x64-mingw32) - google-protobuf (3.23.2-x86_64-darwin) - google-protobuf (3.23.2-x86_64-linux) + globalid (1.2.1) + activesupport (>= 6.1) + google-protobuf (3.25.3) + google-protobuf (3.25.3-arm64-darwin) + google-protobuf (3.25.3-x86_64-darwin) + google-protobuf (3.25.3-x86_64-linux) googleapis-common-protos-types (1.6.0) google-protobuf (~> 3.14) hairtrigger (0.2.25) @@ -283,6 +283,7 @@ GEM hirb (0.7.3) hiredis (0.6.3) hkdf (0.3.0) + htmlbeautifier (1.4.2) htmlentities (4.3.4) http (4.4.0) addressable (~> 2.3) @@ -361,9 +362,21 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logger (1.5.3) - loofah (2.21.3) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) + lookbook (2.2.0) + activemodel + css_parser + htmlbeautifier (~> 1.3) + htmlentities (~> 4.3.4) + marcel (~> 1.0) + railties (>= 5.0) + redcarpet (~> 3.5) + rouge (>= 3.26, < 5.0) + view_component (>= 2.0) + yard (~> 0.9.25) + zeitwerk (~> 2.5) mail (2.8.1) mini_mime (>= 0.1.1) net-imap @@ -387,28 +400,30 @@ GEM mime-types-data (3.2022.0105) mini_magick (4.12.0) mini_mime (1.1.5) - minitest (5.20.0) + mini_portile2 (2.8.5) + minitest (5.22.2) msgpack (1.6.0) multi_xml (0.6.0) nested_form (0.3.2) - net-imap (0.3.7) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout - net-smtp (0.3.3) + net-smtp (0.4.0.1) net-protocol newrelic_rpm (8.14.0) - nio4r (2.5.9) - nokogiri (1.15.4-arm64-darwin) + nio4r (2.7.0) + nokogiri (1.16.2) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.15.4-x64-mingw32) + nokogiri (1.16.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-darwin) + nokogiri (1.16.2-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.2-x86_64-linux) racc (~> 1.4) noticed (1.6.3) http (>= 4.0.0) @@ -555,12 +570,12 @@ GEM pry-rails (0.3.9) pry (>= 0.10.4) public_suffix (5.0.4) - puma (6.3.1) + puma (6.4.2) nio4r (~> 2.0) pundit (2.3.0) activesupport (>= 3.0.0) - racc (1.7.1) - rack (2.2.8) + racc (1.7.3) + rack (2.2.8.1) rack-attack (6.6.1) rack (>= 1.0, < 3) rack-protection (3.0.5) @@ -569,20 +584,20 @@ GEM rack rack-test (2.1.0) rack (>= 1.3) - rails (7.0.7.2) - actioncable (= 7.0.7.2) - actionmailbox (= 7.0.7.2) - actionmailer (= 7.0.7.2) - actionpack (= 7.0.7.2) - actiontext (= 7.0.7.2) - actionview (= 7.0.7.2) - activejob (= 7.0.7.2) - activemodel (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + rails (7.0.8.1) + actioncable (= 7.0.8.1) + actionmailbox (= 7.0.8.1) + actionmailer (= 7.0.8.1) + actionpack (= 7.0.8.1) + actiontext (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activemodel (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) bundler (>= 1.15.0) - railties (= 7.0.7.2) + railties (= 7.0.8.1) rails-data-migrations (1.2.0) rails (>= 4.0.0) rails-dom-testing (2.2.0) @@ -606,15 +621,19 @@ GEM nested_form (~> 0.3) rails (>= 6.0, < 8) turbo-rails (~> 1.0) - railties (7.0.7.2) - actionpack (= 7.0.7.2) - activesupport (= 7.0.7.2) + rails_autolink (1.1.8) + actionview (> 3.1) + activesupport (> 3.1) + railties (> 3.1) + railties (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) @@ -637,6 +656,7 @@ GEM reverse_markdown (2.1.1) nokogiri rexml (3.2.6) + rouge (4.2.0) rsolr (2.2.1) builder (>= 2.1.2) faraday (>= 0.9.0) @@ -721,7 +741,7 @@ GEM rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) sexp_processor (4.16.0) - shoulda-matchers (5.1.0) + shoulda-matchers (6.1.0) activesupport (>= 5.2.0) sidekiq (7.1.4) concurrent-ruby (< 2) @@ -804,9 +824,9 @@ GEM climate_control (>= 0.0.3, < 1.0) terser (1.1.13) execjs (>= 0.3.0, < 3) - thor (1.2.2) + thor (1.3.1) tilt (2.0.10) - timeout (0.4.0) + timeout (0.4.1) tins (1.32.1) sync turbo-rails (1.4.0) @@ -834,7 +854,7 @@ GEM unf_ext (0.0.8.2-x64-mingw32) unicode-display_width (2.5.0) version_gem (1.1.1) - view_component (3.6.0) + view_component (3.9.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) method_source (~> 1.0) @@ -868,8 +888,8 @@ GEM will_paginate (>= 3.0.3) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.34) - zeitwerk (2.6.11) + yard (0.9.36) + zeitwerk (2.6.13) PLATFORMS arm64-darwin-21 @@ -925,6 +945,7 @@ DEPENDENCIES kt-paperclip language_filter listen (>= 3.0.5, < 3.9) + lookbook (>= 2.2.0) mailkick (~> 0.4.3) maintenance_tasks (~> 2.3) meta-tags @@ -960,7 +981,7 @@ DEPENDENCIES pg_search premailer-rails (~> 1.11, >= 1.11.1) pry-rails - puma (~> 6.3) + puma (~> 6.4) pundit rack-attack rails (~> 7.0) @@ -968,6 +989,7 @@ DEPENDENCIES rails-erd rails-i18n (~> 7.0.3) rails_admin (>= 3.0.0.rc3, < 4) + rails_autolink rbs_rails recaptcha redcarpet (~> 3.3, >= 3.3.4) @@ -1011,4 +1033,4 @@ DEPENDENCIES will_paginate-bootstrap BUNDLED WITH - 2.4.14 + 2.4.19 diff --git a/SETUP.md b/SETUP.md index 63ef01dddf..856f08b0fb 100644 --- a/SETUP.md +++ b/SETUP.md @@ -29,7 +29,7 @@ There are several ways to run your own instance of CircuitVerse: ## Tools Setup | Tool | Documentation Link | | --- | --- | -| Code Auto Completion | [Click Here](https://github.com/CircuitVerse/CircuitVerse/blob/master/LSP-SETUP.MD) | +| Code Auto Completion | [Click Here](https://github.com/CircuitVerse/CircuitVerse/blob/master/LSP-SETUP.md) | | Ruby Debugger | [Click Here](https://github.com/CircuitVerse/CircuitVerse/blob/master/DEBUGGER-SETUP.md) | ## Tests diff --git a/app/assets/images/empty_project/default.png b/app/assets/images/empty_project/default.png new file mode 100644 index 0000000000..8e183a8a21 Binary files /dev/null and b/app/assets/images/empty_project/default.png differ diff --git a/app/assets/stylesheets/commontator.scss b/app/assets/stylesheets/commontator.scss index 166e4e98f3..36cc4a3112 100644 --- a/app/assets/stylesheets/commontator.scss +++ b/app/assets/stylesheets/commontator.scss @@ -10,7 +10,6 @@ .actions { display: block; margin-top: 10px; - min-width: 150px; text-align: right; } @@ -18,7 +17,7 @@ background-color: $card-green; margin-top: 15px; padding: 10px 20px; - + overflow-wrap: break-word; .body { margin-bottom: 16px; diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss index b939baba45..093924fec3 100644 --- a/app/assets/stylesheets/components.scss +++ b/app/assets/stylesheets/components.scss @@ -55,7 +55,7 @@ transition: all .3s ease 0s; &:hover { - background-color: $secondary-green; + background-color: $primary-green; box-shadow: 0 7px 7px $white; color: $white; } diff --git a/app/assets/stylesheets/contribute.scss b/app/assets/stylesheets/contribute.scss index d6e7fc1198..492d12bff6 100644 --- a/app/assets/stylesheets/contribute.scss +++ b/app/assets/stylesheets/contribute.scss @@ -11,6 +11,11 @@ margin-top: 30px; padding-top: 20px; width: fit-content; + + &:hover{ + box-shadow: 0 15px 15px var(--shadow-color), 0 0 30px var(--shadow-color); + transform: scale(1.05); + } } .contribute-card-image { @@ -60,6 +65,10 @@ } } +.centered-paragraph { + text-align: center; +} + //breakpoints @media (max-width: 1199px) { .contribute-social-card { diff --git a/app/assets/stylesheets/editor.scss b/app/assets/stylesheets/editor.scss index 4ae0b29941..add9162924 100644 --- a/app/assets/stylesheets/editor.scss +++ b/app/assets/stylesheets/editor.scss @@ -22,6 +22,7 @@ button.trumbowyg-active { margin-bottom: 35px; margin-top: 0; padding: 0; + border-radius: 4px; button { transition: box-shadow .2s ease-in; diff --git a/app/assets/stylesheets/footer.scss b/app/assets/stylesheets/footer.scss index cd50a7b51b..73a391c4e5 100644 --- a/app/assets/stylesheets/footer.scss +++ b/app/assets/stylesheets/footer.scss @@ -72,6 +72,12 @@ .footer-sponsor-logo-text { margin-bottom: 0; padding-bottom: 0; + font-size: 0.8em; +} + +.footer-sponsor-logo-div{ + padding-left: 12px; + padding-right: 12px; } .footer-sponsor-logo { diff --git a/app/assets/stylesheets/groups.scss b/app/assets/stylesheets/groups.scss index 88dc6b1f19..9bdbe7adbb 100644 --- a/app/assets/stylesheets/groups.scss +++ b/app/assets/stylesheets/groups.scss @@ -274,10 +274,24 @@ } } -.group-invite-link-text { +#group-invite-link-container { border: 1.5px solid $secondary-green; - font-size: 12px; - text-align: left; + padding: 10px; + position: relative; + font-size: 12px; + border-radius: 5px; +} + +#copyIcon{ + top: 0; + right: 0; + position: absolute; + padding: 5px; +} + +.group-invite-link-text { + border: none; + outline: none; } //breakpoints @@ -344,6 +358,10 @@ max-width: 90%; } +.form-control { + border-radius: 4px; +} + .groups-background-card { margin-top: 50px; max-width: 80%; diff --git a/app/assets/stylesheets/home.scss b/app/assets/stylesheets/home.scss index 529341cc1b..88fe7d7a58 100644 --- a/app/assets/stylesheets/home.scss +++ b/app/assets/stylesheets/home.scss @@ -49,6 +49,13 @@ } //breakpoints +@media (max-width: 991px){ + .home-buttons-container{ + display: inline-flex; + text-wrap: nowrap; + align-items: center; + } +} @media (max-width: 768px) { .home-main-content { margin-bottom: 30px; @@ -83,6 +90,8 @@ .home-buttons-container { text-align: center; + display: block; + margin-left: -9px; } .home-container-fluid { diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index f535a6d840..bdcc4e059c 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -46,14 +46,14 @@ body { p { overflow: hidden; text-overflow: ellipsis; - } - &:hover .tooltiptext { - left: 50%; - opacity: 1; - transform: translateX(-50%); - visibility: visible; - z-index: 101; + &:hover .tooltiptext { + left: 50%; + opacity: 1; + transform: translateX(-50%); + visibility: visible; + z-index: 101; + } } } @@ -104,14 +104,26 @@ body { } } +@media (max-width: 400px) { + .anchor-text-button{ + width: 100%; + max-width: inherit; + } +} + //anchor +.anchor-text-button{ + border: 1px solid; +} .anchor-text { color: $secondary-green; font-weight: 500; - text-decoration: underline; + text-decoration: none; + margin-left: 9px; &:hover { color: $primary-green; + text-decoration: none; } } .anchor-text-left { @@ -192,3 +204,9 @@ body { margin-left: -4px; } } + +@media (max-width: 400px){ + .anchor-text-button{ + margin-left: -2px; + } +} diff --git a/app/assets/stylesheets/navbar.scss b/app/assets/stylesheets/navbar.scss index c6313797b6..5688f68668 100644 --- a/app/assets/stylesheets/navbar.scss +++ b/app/assets/stylesheets/navbar.scss @@ -55,6 +55,7 @@ color: $navbar-dark-grey; font-weight: 500; transition: all .3s ease-in; + border-radius: 4px; &:hover { background: $primary-green; @@ -62,6 +63,10 @@ } } +.rotate180::after { + transform: rotate(180deg); +} + .navbar-dropdown-toggle-hidden { .dropdown-toggle::after { display: none; @@ -108,7 +113,7 @@ display: none; margin-top: 0; padding: 20px; - position: fixed; + position: sticky; top: 96px; width: 100%; z-index: 90; @@ -155,6 +160,7 @@ min-width: 150px; padding: 5px; width: 100%; + border-radius: 4px; } .navbar-search-bar-select { @@ -179,6 +185,7 @@ max-width: 100px; min-width: 100px; padding-left: 5px; + border-radius: 4px; } .dropdown-menu { diff --git a/app/assets/stylesheets/projects.scss b/app/assets/stylesheets/projects.scss index 6f4f542005..ad8d66a0a0 100644 --- a/app/assets/stylesheets/projects.scss +++ b/app/assets/stylesheets/projects.scss @@ -8,10 +8,18 @@ padding-top: 20px; } +.form-control { + border-radius: 4px; +} + .projects-primary-checkpoint { max-width: 260px; } +.primary-checkpoint { + border-radius: 4px; +} + .projects-tag-form-group { h6 { display: inline-block; diff --git a/app/assets/stylesheets/search.scss b/app/assets/stylesheets/search.scss index 97858ad037..90096386b7 100644 --- a/app/assets/stylesheets/search.scss +++ b/app/assets/stylesheets/search.scss @@ -136,7 +136,9 @@ .search-usersearch-image { display: block; + height: 180px; margin-bottom: 20px; + object-fit: cover; width: 70%; } @@ -189,6 +191,10 @@ max-width: 60%; } } + + .search-usersearch-image { + width: 40%; + } } @media (max-width: 600px) { diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss index e00d015430..ef6ea67c05 100644 --- a/app/assets/stylesheets/users.scss +++ b/app/assets/stylesheets/users.scss @@ -119,6 +119,7 @@ .password-icon { color: $secondary-green; width: 40px; + cursor: pointer; } .users-password-input { @@ -320,6 +321,7 @@ align-items: center; display: flex; justify-content: space-between; + margin-bottom: 10px; input { border: 0; @@ -329,6 +331,7 @@ margin: 0; padding: 7px 10px 7px 35px; transition: .2s ease-in-out; + border-radius: 4px; &:focus { border-color: $primary-green; diff --git a/app/controllers/featured_circuits_controller.rb b/app/controllers/featured_circuits_controller.rb index 8d48170276..13bd2a8daf 100644 --- a/app/controllers/featured_circuits_controller.rb +++ b/app/controllers/featured_circuits_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class FeaturedCircuitsController < ApplicationController + include UsersCircuitverseHelper + before_action :authenticate_user!, except: [:index] before_action :set_and_authorize_featured, except: [:index] diff --git a/app/controllers/group_members_controller.rb b/app/controllers/group_members_controller.rb index a8aea8b95c..5ca0a05cf0 100644 --- a/app/controllers/group_members_controller.rb +++ b/app/controllers/group_members_controller.rb @@ -38,8 +38,7 @@ def create group_member_emails = group_member_params[:emails].grep(Devise.email_regexp) present_members = User.where(id: @group.group_members.pluck(:user_id)).pluck(:email) - newly_added = group_member_emails - present_members - + newly_added = group_member_emails - present_members - [current_user&.email] newly_added.each do |email| email = email.strip user = User.find_by(email: email) @@ -59,9 +58,7 @@ def create respond_to do |format| format.html do - redirect_to group_path(@group), - notice: Utils.mail_notice(group_member_params[:emails], group_member_emails, - newly_added) + redirect_to group_path(@group), notice: notice end end # redirect_to group_path(@group) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6620f10fb0..ceea976389 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -3,6 +3,7 @@ class ProjectsController < ApplicationController include ActionView::Helpers::SanitizeHelper include SanitizeDescription + include UsersCircuitverseHelper before_action :set_project, only: %i[show edit update destroy create_fork change_stars] before_action :authenticate_user!, only: %i[edit update destroy create_fork change_stars] diff --git a/app/controllers/simulator_controller.rb b/app/controllers/simulator_controller.rb index f206fbd2cf..22ff0e536e 100644 --- a/app/controllers/simulator_controller.rb +++ b/app/controllers/simulator_controller.rb @@ -55,14 +55,14 @@ def create @project.build_project_datum.data = sanitize_data(@project, params[:data]) @project.name = sanitize(params[:name]) @project.author = current_user - + # ActiveStorage + io_image_file = parse_image_data_url(params[:image]) + attach_circuit_preview(io_image_file) + # CarrierWave image_file = return_image_file(params[:image]) @project.image_preview = image_file - attach_circuit_preview(image_file) - @project.save! image_file.close - - File.delete(image_file) if check_to_delete(params[:image]) + @project.save! # render plain: simulator_path(@project) # render plain: user_project_url(current_user,@project) @@ -72,17 +72,18 @@ def create def update @project.build_project_datum unless ProjectDatum.exists?(project_id: @project.id) @project.project_datum.data = sanitize_data(@project, params[:data]) + # ActiveStorage @project.circuit_preview.purge if @project.circuit_preview.attached? + io_image_file = parse_image_data_url(params[:image]) + attach_circuit_preview(io_image_file) + # CarrierWave image_file = return_image_file(params[:image]) @project.image_preview = image_file - attach_circuit_preview(image_file) + image_file.close + File.delete(image_file) if check_to_delete(params[:image]) @project.name = sanitize(params[:name]) @project.save @project.project_datum.save - image_file.close - - File.delete(image_file) if check_to_delete(params[:image]) - render plain: "success" end @@ -149,8 +150,10 @@ def check_view_access end def attach_circuit_preview(image_file) + return unless image_file + @project.circuit_preview.attach( - io: File.open(image_file), + io: image_file, filename: "preview_#{Time.zone.now.to_f.to_s.sub('.', '')}.jpeg", content_type: "img/jpeg" ) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index e253043a52..1b9fcfc2fa 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -56,7 +56,7 @@ def generic_callback(provider) sign_in_and_redirect @user, event: :authentication set_flash_message(:notice, :success, kind: provider.capitalize) if is_navigational_format? elsif Flipper.enabled?(:block_registration) - redirect_to new_user_session_path, alert: "Registration is currently blocked" + redirect_to new_user_session_path, alert: t("registration_blocked") else session["devise.#{provider}_data"] = request.env["omniauth.auth"].except(:extra).except("extra") diff --git a/app/helpers/simulator_helper.rb b/app/helpers/simulator_helper.rb index ed21faa798..6b090618ec 100644 --- a/app/helpers/simulator_helper.rb +++ b/app/helpers/simulator_helper.rb @@ -12,6 +12,17 @@ def return_image_file(data_url) image_file = File.new("tmp/preview_#{Time.zone.now.to_f.to_s.sub('.', '')}.jpeg", "wb") image_file.write(jpeg) end + image_file + end + + def parse_image_data_url(data_url) + str = data_url[("data:image/jpeg;base64,".length)..] + if str.to_s.empty? + image_file = nil + else + jpeg = Base64.decode64(str) + image_file = StringIO.new(jpeg) + end image_file end diff --git a/app/helpers/users_circuitverse_helper.rb b/app/helpers/users_circuitverse_helper.rb index 7377b22401..8a250dbc8e 100644 --- a/app/helpers/users_circuitverse_helper.rb +++ b/app/helpers/users_circuitverse_helper.rb @@ -15,4 +15,30 @@ def user_profile_picture(attachment) image_path("thumb/Default.jpg") end end + + def project_image_preview(project, current_user) + if Flipper.enabled?(:active_storage_s3, current_user) + return_circuit_preview(project) + else + return_image_preview(project) + end + end + + private + + def return_circuit_preview(project) + if project.circuit_preview.attached? + project.circuit_preview + else + image_path("empty_project/default.png") + end + end + + def return_image_preview(project) + if project.image_preview.present? + project.image_preview.url + else + image_path("empty_project/default.png") + end + end end diff --git a/app/javascript/src/sass/color_theme.scss b/app/javascript/src/sass/color_theme.scss index 57fa6d1791..bb3bdbb629 100644 --- a/app/javascript/src/sass/color_theme.scss +++ b/app/javascript/src/sass/color_theme.scss @@ -312,7 +312,6 @@ $touch-menu:#454545; #tabsBar { background-color: var(--bg-tabs); border-top: 1px solid var(--br-primary); - border-bottom: 1px solid var(--br-primary); } #tabsBar .circuits { diff --git a/app/models/assignment.rb b/app/models/assignment.rb index 3fd6cb41eb..6e7fce8592 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class Assignment < ApplicationRecord - validates :name, length: { minimum: 1 } + validates :name, length: { minimum: 1 }, presence: true validates :grading_scale, inclusion: { in: %w[percent], message: "needs to be fixed at 1-100 for passing the grade back to LMS" @@ -21,7 +21,6 @@ class Assignment < ApplicationRecord has_noticed_notifications model_name: "NoticedNotification", dependent: :destroy def notify_recipient - @assignment = Assignment.find(id) group.group_members.each do |group_member| NewAssignmentNotification.with(assignment: self).deliver_later(group_member.user) end diff --git a/app/models/project.rb b/app/models/project.rb index 2a3bc70db1..47dd1f3a59 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -8,7 +8,7 @@ class Project < ApplicationRecord friendly_id :name, use: %i[slugged history] self.ignored_columns += ["data"] - validates :name, length: { minimum: 1, maximum: 60 } + validates :name, length: { minimum: 1 } validates :slug, uniqueness: true belongs_to :author, class_name: "User" @@ -25,7 +25,6 @@ class Project < ApplicationRecord has_many :taggings, dependent: :destroy has_many :tags, through: :taggings mount_uploader :image_preview, ImagePreviewUploader - # Mirror Uploads to ActiveStorage has_one_attached :circuit_preview has_one :featured_circuit has_one :grade, dependent: :destroy diff --git a/app/serializers/api/v1/project_serializer.rb b/app/serializers/api/v1/project_serializer.rb index f111ca3a65..b1a5dd1b71 100644 --- a/app/serializers/api/v1/project_serializer.rb +++ b/app/serializers/api/v1/project_serializer.rb @@ -41,6 +41,20 @@ class Api::V1::ProjectSerializer project.commontator_thread.is_closed? end + # :nocov: + attributes :image_preview do |project| + if project.circuit_preview.attached? + { + url: Rails.application.routes.url_helpers.rails_blob_url(project.circuit_preview, only_path: true) + } + else + { + url: ActionController::Base.helpers.asset_path("empty_project/default.png") + } + end + end + # :nocov: + belongs_to :author has_many :collaborators, serializer: Api::V1::UserSerializer end diff --git a/app/views/assignments/show.html.erb b/app/views/assignments/show.html.erb index 1c46e8c525..b1927a6d9a 100644 --- a/app/views/assignments/show.html.erb +++ b/app/views/assignments/show.html.erb @@ -21,7 +21,7 @@

<%= t("assignments.assignment_data.name_html", name: @assignment.name) %>

<%= t("assignments.assignment_data.group_html", group_name: @assignment.group.name) %>

-

<%= t("assignments.deadline") %> +

<%= t("assignments.deadline") %>  data-month=<%= deadline_month(@assignment) %> data-day=<%= deadline_day(@assignment) %> data-hour=<%= deadline_hour(@assignment) %> data-minute=<%= deadline_minute(@assignment) %> data-second=<%= deadline_second(@assignment) %>><%= @assignment.deadline %>

diff --git a/app/views/circuitverse/contribute.html.erb b/app/views/circuitverse/contribute.html.erb index f5c875457b..661f2cd979 100644 --- a/app/views/circuitverse/contribute.html.erb +++ b/app/views/circuitverse/contribute.html.erb @@ -5,7 +5,7 @@

<%= t("circuitverse.contribute.main_heading") %>

<%= t("circuitverse.contribute.main_description") %>

-

<%= t("circuitverse.contribute.submain_description") %>

+

<%= t("circuitverse.contribute.submain_description") %>

diff --git a/app/views/circuitverse/index.html.erb b/app/views/circuitverse/index.html.erb index af158923a3..a3e61c78c1 100644 --- a/app/views/circuitverse/index.html.erb +++ b/app/views/circuitverse/index.html.erb @@ -39,8 +39,8 @@

<%= t("circuitverse.index.main_heading") %>


<%= t("circuitverse.index.main_description") %>

- <%= t("launch_simulator") %>   - <%= t("circuitverse.index.learn_logic_design") %> + <%= t("launch_simulator") %> + <%= t("circuitverse.index.learn_logic_design") %>
@@ -172,7 +172,7 @@ <% @featured_circuits.each do |circuit| %>
- <%= image_tag circuit.image_preview.url, alt: circuit.name, class: "card-img-top circuit-card-image", height: "180", width: "288" %> + <%= image_tag project_image_preview(circuit, current_user), alt: circuit.name, class: "card-img-top circuit-card-image", height: "180", width: "288" %>