Skip to content

Commit

Permalink
Merge branch 'text-position-error#4369' of https://github.com/upsaura…
Browse files Browse the repository at this point in the history
…v12/CircuitVerse into text-position-error#4369
  • Loading branch information
upsaurav12 committed Jan 6, 2024
2 parents f1f85e4 + 8e9fd06 commit 53d16e6
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 10 deletions.
6 changes: 6 additions & 0 deletions app/assets/stylesheets/commontator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@

.new-comment {
display: block;
margin-top: 0.3rem;
}

.new-comment-link{
position: relative;
top: -3.3em;
}

//breakpoints
Expand Down
7 changes: 6 additions & 1 deletion app/assets/stylesheets/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ html {
scroll-behavior: smooth;
}

::selection {
background: $primary-green;
color: $white;
}

body {
font-family: 'Inter';
padding-top: 90px;
Expand Down Expand Up @@ -194,7 +199,7 @@ body {

.pagination {
max-width: none;
overflow-x: visible;
overflow-x: auto;
padding: 0;
white-space: nowrap;
}
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
top: 0;
width: 100%;
z-index: 100;
border-bottom: 1px solid $border-color;
}

.navbar-logo {
Expand Down
10 changes: 10 additions & 0 deletions app/assets/stylesheets/projects.scss
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@
width: 80%;
}

.char-counter {
color: $tooltip-grey;
font-size: 14px;
margin: 5px 0 0 auto;
}

.is-invalid {
color: $red;
}

//breakpoints
@media (max-width: 575px) {
.projects-collaborators-button-container {
Expand Down
2 changes: 1 addition & 1 deletion app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Project < ApplicationRecord
friendly_id :name, use: %i[slugged history]
self.ignored_columns += ["data"]

validates :name, length: { minimum: 1 }
validates :name, length: { minimum: 1, maximum: 60 }
validates :slug, uniqueness: true

belongs_to :author, class_name: "User"
Expand Down
2 changes: 1 addition & 1 deletion app/views/commontator/threads/_reply.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<p>You must <a href="/users/sign_in" class="anchor-text">login</a> before you can post a comment.</p>
<% else %>
<% if @commontator_new_comment.nil? %>
<div id="commontator-thread-<%= thread.id %>-new-comment-link" class="new-comment">
<div id="commontator-thread-<%= thread.id %>-new-comment-link" class="new-comment new-comment-link">
<%= link_to "+ Add Comment",
commontator.new_thread_comment_path(thread),
remote: true, class: "btn primary-button" %>
Expand Down
7 changes: 4 additions & 3 deletions app/views/commontator/threads/_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
</span>
</div>

<% if thread.config.comment_order != :l %>
<%= render partial: 'commontator/threads/reply', locals: { thread: thread, user: user } %>
<% end %>

<% if thread.config.comment_order == :l %>
<%= render partial: 'commontator/threads/reply', locals: { thread: thread, user: user } %>
<% end %>
Expand Down Expand Up @@ -100,9 +104,6 @@
</div>
</div>

<% if thread.config.comment_order != :l %>
<%= render partial: 'commontator/threads/reply', locals: { thread: thread, user: user } %>
<% end %>
</div>
<script>
<%= render partial: 'commontator/threads/hide_show_links', locals: { thread: thread }, formats: :js %>
Expand Down
23 changes: 21 additions & 2 deletions app/views/projects/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
</ul>
</div>
<% end %>
<div class="field form-group">
<div class="field form-group d-flex flex-column">
<h6><%= form.label :name %></h6>
<%= form.text_field :name, id: :project_name, class: "form-control form-input" %>
<%= form.text_field :name, id: :project_name, class: "form-control form-input", maxlength: 60 %>
<span id="name-counter" class="char-counter"></span>
</div>
<div class="field form-group projects-tag-form-group">
<h6><%= form.label :tag_list %></h6> <span><%= t("projects.form.tag_list_description") %></span>
Expand Down Expand Up @@ -76,4 +77,22 @@
});
$("#featuredCircuit").submit();
}

document.addEventListener('DOMContentLoaded', function () {
const nameField = document.getElementById('project_name');

nameField.addEventListener('input', function () {
const maxLength = parseInt(this.getAttribute('maxlength'));
const currentLength = this.value.length;

const nameCounter = document.getElementById('name-counter');
nameCounter.textContent = `${currentLength} / ${maxLength}`;

if (currentLength >= maxLength) {
nameCounter.classList.add('is-invalid');
} else {
nameCounter.classList.remove('is-invalid');
}
});
});
</script>
1 change: 0 additions & 1 deletion simulator/src/css/main.stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ input[type="text"]:focus {
font-size: 1em;
text-align: center;
display: inline-block;
white-space: nowrap;
width: 35vw;
height: 1.2rem;
overflow: hidden;
Expand Down
1 change: 0 additions & 1 deletion simulator/src/data/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export function setProjectName(name) {
name = stripTags(name);
projectName = name;
$('#projectName').html(name);
document.getElementById("projectName").setAttribute("title",name);
}

/**
Expand Down

0 comments on commit 53d16e6

Please sign in to comment.