Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: content and aesthetics globally to add help text and action icons #435

Merged
merged 50 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
046e17e
open the link after clicking in a new tab
SirineMhedhbi Dec 20, 2023
c0ca8fd
add the icon of service link
SirineMhedhbi Dec 20, 2023
fcca0b9
update the text
SirineMhedhbi Dec 20, 2023
132fe5e
update the section Ontology relations network
SirineMhedhbi Dec 20, 2023
0f503d6
fix the display of portal name
SirineMhedhbi Dec 20, 2023
cc11528
capitalize items in support section
SirineMhedhbi Dec 20, 2023
a76821d
add fullscreen icon
SirineMhedhbi Jan 2, 2024
3680f4d
convert dates
SirineMhedhbi Jan 2, 2024
5c1bd6f
Remove points in feeback page
SirineMhedhbi Jan 2, 2024
9295e8d
fix local variables
SirineMhedhbi Jan 8, 2024
13863f4
add icones (edit/delete) in action
SirineMhedhbi Jan 8, 2024
d1e2ab8
change the display of items in property tab
SirineMhedhbi Jan 8, 2024
b590ef5
fix style of fair scores button
SirineMhedhbi Jan 8, 2024
6af1f82
add a logic to open DropdownContainerComponent
SirineMhedhbi Jan 8, 2024
4bc5d89
use has_ontology_language_input to refactor
SirineMhedhbi Jan 8, 2024
366dca8
change the text of tooltip
SirineMhedhbi Jan 8, 2024
6777666
change the title of modal
SirineMhedhbi Jan 8, 2024
e3472f6
add help text to switch input component
SirineMhedhbi Jan 8, 2024
d8cabf8
add helper text in edit submissions and delete the icon of url
SirineMhedhbi Jan 8, 2024
976b8fb
fix the full screen width and style
SirineMhedhbi Jan 8, 2024
46f13c3
change the text in the sort by
SirineMhedhbi Jan 8, 2024
474db4b
make the admin page on the center
SirineMhedhbi Jan 8, 2024
6f10ebe
fix the style of some classes on the admin, browse and edit submissio…
SirineMhedhbi Jan 8, 2024
afb970e
fix bug of the wrong uri in users section of admin page
SirineMhedhbi Jan 9, 2024
283e071
add a function to generate link_title with style
SirineMhedhbi Jan 9, 2024
08d1dbc
add the modified line
SirineMhedhbi Jan 9, 2024
33526e5
add the removed line
SirineMhedhbi Jan 9, 2024
6519245
Add a style to center the actions in both cases, whether the user is …
SirineMhedhbi Jan 9, 2024
1faf9f0
delete the change of style in tab_container
SirineMhedhbi Jan 9, 2024
305f8c1
add help text under version information in edit submission
SirineMhedhbi Jan 10, 2024
c9a12b6
change convert_dates into concept details component
SirineMhedhbi Jan 11, 2024
cf960a8
remove convert_dates from the wrong place
SirineMhedhbi Jan 11, 2024
d4badd9
move generate_link_title to right place
SirineMhedhbi Jan 11, 2024
0484e34
remove the wrong modification
SirineMhedhbi Jan 11, 2024
c7ba93d
add new component IconWithTooltipComponent
SirineMhedhbi Jan 11, 2024
3569e14
use the IconWithTooltipComponent to display icons with text
SirineMhedhbi Jan 11, 2024
4edefaf
adjust the icon size to be compatible with all icons in the portal
SirineMhedhbi Jan 11, 2024
f706b44
remove the not used functions
SirineMhedhbi Jan 11, 2024
8fef225
update the select in edit submissions with reveal component
SirineMhedhbi Jan 11, 2024
d940bf8
remove the show icon condition from summary section component
SirineMhedhbi Jan 12, 2024
b574afb
add fairness_link function into helper
SirineMhedhbi Jan 12, 2024
bcdcb5e
Reuse fairness_link with style
SirineMhedhbi Jan 12, 2024
f9d33ce
add functions for edit and service action
SirineMhedhbi Jan 12, 2024
a48032f
fix submission success message typo
syphax-bouazzouni Jan 14, 2024
23ea7b9
update reveal component to handle multiple containers
syphax-bouazzouni Jan 16, 2024
24bc13a
update ontology_language, visibility, status and view of to use the …
syphax-bouazzouni Jan 16, 2024
8d328a8
rescue concept details converted date parsing exceptions
syphax-bouazzouni Jan 16, 2024
2a62b9e
use generic variable for the colors of the ontology relation title
syphax-bouazzouni Jan 16, 2024
3478f64
make the notes metadata attribute long text
syphax-bouazzouni Jan 16, 2024
b16e4e8
add custom help text to deprecated metadata property
syphax-bouazzouni Jan 16, 2024
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 app/assets/images/icons/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/images/icons/full-screen.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/assets/images/json.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion app/assets/stylesheets/bioportal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,15 @@ tr.mainresource td {
margin-bottom: 1em;
}

.feedback ul li, .enable-lists ul li {
.enable-lists ul li {
list-style-position: outside;
list-style-type: square;
margin-left: 1.5em;
}
.feedback ul li{
list-style-position: outside;
margin-left: 1.5em;
}

.enable-lists ul {
margin-bottom: 15px;
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/browse.scss
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@
padding: 14px 20px;
margin-bottom: 12px;
box-shadow: rgba(100, 100, 111, 0.08) 0 7px 29px 0;
.switch-filter{
justify-content: space-between;
margin-bottom: 23px;
}
}


Expand Down
3 changes: 1 addition & 2 deletions app/assets/stylesheets/components/switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
.switch-filter{
display:flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;

}
.switch-filter > p, .switch-filter > div{
font-size: 16px;
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/components/tabs_container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@
border: 1px solid var(--primary-color);
opacity: 100%;
}
.container{
overflow-x: auto;
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/nav_bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@

.top-nav-ul.show-responsive {
display: block;
text-decoration-style: none !important;
}

.nav-items.show-responsive {
Expand Down
28 changes: 27 additions & 1 deletion app/assets/stylesheets/summary.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,33 @@
text-align: right;
}


#networkContainer{
transition: transform 0.3s;
}

.active-fullscreen {
width: 100%;
height: 100vh;
position: fixed;
left: 0;
top: 0;
background-color: #ffffff;
z-index: 9999;
}
#fullscreen-button {
background-color: var(--primary-color);
-webkit-mask-image: url(asset-path('icons/full-screen.svg'));
mask-image: url(asset-path('icons/full-screen.svg'));
float: right;
position: relative;
bottom: 79px;
width: 32px;
height: 31px;
background-repeat: no-repeat!important;
background-position: 2px 2px;
right: 58px;
cursor: pointer;
}

div.vis-network div.vis-navigation {
div.vis-button.vis-up{
Expand Down
6 changes: 6 additions & 0 deletions app/assets/stylesheets/upload_ontology.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@
.upload-ontology-input-field-container .switch-filter p{
font-size: 12px !important;
}
.edit-ontology-tab .switch-filter {
img{
width: 15px;
height: 15px;
}
}
17 changes: 14 additions & 3 deletions app/components/concept_details_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,25 @@ def remove_owl_notation(string)

unless string.nil?
strings = string.split(":")
if strings.size<2
#return string.titleize
if strings.size < 2
# return string.titleize
return string
else
#return strings[1].titleize
# return strings[1].titleize
return strings[1]
end
end
end

def convert_dates(hash)
hash.transform_values do |property|
if property[:key].to_s.include?("modified") || property[:key].to_s.include?("created")
value = property[:values].first
parsed_date = l(Date.parse(value), format: :monthfull_day_year.to_sym) rescue value
property[:values] = [parsed_date]
end
property
end
end

end
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- if @bottom_keys.present?
= render DropdownContainerComponent.new(title: 'Raw data', id: "accordion-#{@id}") do
- top_set, leftover_set, bottom_set = filter_properties(@top_keys, @bottom_keys, @exclude_keys, prefix_properties(@concept_properties))
- leftover_set = convert_dates(leftover_set)
= render TableComponent.new(stripped: true) do |t|

- row_hash_properties(top_set, @acronym).each do |row|
Expand Down
6 changes: 5 additions & 1 deletion app/components/dropdown_container_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

class DropdownContainerComponent < ViewComponent::Base
renders_one :empty_state
def initialize(title:, id:, tooltip:nil)
def initialize(title:, id:, tooltip:nil, is_open: false)
super
@title = title
@id = id
@tooltip = tooltip
@is_open = is_open
end
def open_class
@is_open ? "show" : ""
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
= render Display::HeaderComponent.new(text: @title, tooltip: @tooltip)
= image_tag("summary/arrow-down.svg", class: 'ml-2')

.collapse{id: @id}
.collapse{id: @id, class: open_class}
- if content && !content.empty?
= content
- else
Expand Down
28 changes: 28 additions & 0 deletions app/components/icon_with_tooltip_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class IconWithTooltipComponent < ViewComponent::Base
def initialize(icon: "", link: "#", size: "small", target: '', title: '', style: '')
@icon = icon
@link = link
@size = size
@target = target
@title = title
@style = style
end

private

def size
case @size
when "small"
["32px", "1", "16px"]
when "medium"
["45px", "1", "23px"]
when "big"
["100px", "2.5", "50px"]
end
end

def icon_with_tooltip_style
"font-size: 50px; line-height: 0.5; #{@style}"
end
end

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
%a.icon-with-tooltip{href: @link, style: icon_with_tooltip_style, target: @target, title: @title, 'data-controller': 'tooltip'}
%span.icon
= inline_svg @icon
2 changes: 1 addition & 1 deletion app/components/input/input_field_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def error?
end

def help?
!@helper_text&.empty?
!@helper_text.blank?
end

def label?
Expand Down
12 changes: 6 additions & 6 deletions app/components/layout/reveal_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

class Layout::RevealComponent < ViewComponent::Base
renders_one :button
renders_many :containers

def initialize(init_show: false, show_condition: nil,hidden_class: 'd-none')
def initialize(selected: nil, possible_values: [], hidden_class: 'd-none', toggle: false)
@hidden_class = hidden_class
@init_show = init_show
@show_condition = show_condition
@possible_values = possible_values
@selected = selected
@toggle = toggle
end

def container_data
out = {
{
controller: 'reveal-component',
'reveal-component-hidden-class': @hidden_class
}
out['reveal-component-condition-value'] = @show_condition if @show_condition
out
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
%div{data: container_data}
%div{'data-action': "change->reveal-component#toggle"}
%div{'data-action': @toggle ? "change->reveal-component#toggle" : "change->reveal-component#select"}
= button
%div{'data-reveal-component-target': "item", class: @init_show ? '' : @hidden_class}
= content
- containers.each_with_index do |c, i|
%div{'data-reveal-component-target': "item", 'data-value': @possible_values[i] , class: @possible_values[i].eql?(@selected) ? '' : @hidden_class}
= c
120 changes: 61 additions & 59 deletions app/components/layout/reveal_component/reveal_component_controller.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,63 @@
import { Controller } from "@hotwired/stimulus"

export default class extends Controller{
static values = {
condition: String,
hiddenClass : {type: String, default: "d-none"}
}

static targets = ["hideButton", "showButton", 'item' ]

toggle(event) {
if (!this.conditionValue) {
this.#toggle(event)
} else if (this.#shown() && !this.#conditionChecked(event)) {
this.#toggle(event)
} else if (!this.#shown() && this.#conditionChecked(event)) {
this.#toggle(event)
}
}

show(event){
this.#getItems(event).classList.remove(this.hiddenClassValue)
this.hideButtonTarget.classList.remove(this.hiddenClassValue)
this.showButtonTarget.classList.add(this.hiddenClassValue)
}
hide(event){
this.#getItems(event).classList.add(this.hiddenClassValue)
this.hideButtonTarget.classList.add(this.hiddenClassValue)
this.showButtonTarget.classList.remove(this.hiddenClassValue)
}


#conditionChecked(event) {
return this.conditionValue === event.target.value
}

#shown() {
return !this.itemTargets[0].classList.contains(this.class);
}

#toggle(event) {
this.#getItems(event).forEach((s) => {
s.classList.toggle(this.hiddenClassValue);
});
}

#ItemById(event){
let button = event.target.closest("[data-id]");
return document.getElementById(button.dataset.id);
}
#getItems(event){
let items
if(this.hasItemTarget){
items = this.itemTarget
} else {
items = [this.#ItemById(event)]
}
return items
}
import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
static values = {
hiddenClass: { type: String, default: 'd-none' }
}

static targets = ['hideButton', 'showButton', 'item']

/*
Toggle all the items
*/
toggle (event) {
this.#getItems(event).forEach((s) => {
s.classList.toggle(this.hiddenClassValue)
})
}

/*
Hide all the items except the selected one
*/
select (event) {
let selectedValue = event.target.value
let items = this.#getItems(event)
items.forEach((s) => {
s.classList.add(this.hiddenClassValue)
})

items.forEach((s) => {
if (selectedValue === s.dataset.value) {
s.classList.remove(this.hiddenClassValue)
}
})
}

show (event) {
this.#getItems(event).forEach((s) => s.classList.remove(this.hiddenClassValue))
this.hideButtonTarget.classList.remove(this.hiddenClassValue)
this.showButtonTarget.classList.add(this.hiddenClassValue)
}

hide (event) {
this.#getItems(event).forEach((s) => s.classList.add(this.hiddenClassValue))
this.hideButtonTarget.classList.add(this.hiddenClassValue)
this.showButtonTarget.classList.remove(this.hiddenClassValue)
}

#ItemById (event) {
let button = event.target.closest('[data-id]')
return document.getElementById(button.dataset.id)
}

#getItems (event) {
let items
if (this.hasItemTarget) {
items = this.itemTargets
} else {
items = [this.#ItemById(event)]
}
return items
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- if internal_link?
= render ChipButtonComponent.new(url: @value.to_s.sub("data.", ""), text: @raw ? @value : @value.to_s.split("/").last, type: "clickable")
- elsif @value.to_s =~ /\A#{URI::regexp(%w[http https])}\z/
= render ChipButtonComponent.new(url: @value.to_s, text: @value.to_s, type: "clickable")
= render ChipButtonComponent.new(url: @value.to_s, text: @value.to_s, type: "clickable", target: "_blank")
- else
= render ChipButtonComponent.new( text: @value.to_s, type: "static")
Loading