neo_components 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/app/assets/icons/academy.svg +3 -0
- data/app/assets/icons/adjustments-horizontal.svg +3 -0
- data/app/assets/icons/adjustments-vertical.svg +3 -0
- data/app/assets/icons/arrow-down-tray.svg +3 -0
- data/app/assets/icons/arrow-left.svg +3 -0
- data/app/assets/icons/arrow-long-down.svg +3 -0
- data/app/assets/icons/arrow-long-right.svg +3 -0
- data/app/assets/icons/arrow-long-up.svg +3 -0
- data/app/assets/icons/arrow-right.svg +3 -0
- data/app/assets/icons/arrow-up-tray.svg +3 -0
- data/app/assets/icons/arrow-uturn-left.svg +3 -0
- data/app/assets/icons/arrow-uturn-right.svg +3 -0
- data/app/assets/icons/assign-user.svg +13 -0
- data/app/assets/icons/at-symbol.svg +3 -0
- data/app/assets/icons/bars-4.svg +3 -0
- data/app/assets/icons/bell.svg +3 -0
- data/app/assets/icons/book.svg +3 -0
- data/app/assets/icons/bookmark.svg +3 -0
- data/app/assets/icons/building-office-2.svg +3 -0
- data/app/assets/icons/calendar.svg +3 -0
- data/app/assets/icons/celebration.svg +15 -0
- data/app/assets/icons/check-badge-solid.svg +3 -0
- data/app/assets/icons/check-circle-solid.svg +3 -0
- data/app/assets/icons/check-circle.svg +3 -0
- data/app/assets/icons/check-list.svg +12 -0
- data/app/assets/icons/check.svg +3 -0
- data/app/assets/icons/chevron-double-right.svg +3 -0
- data/app/assets/icons/chevron-down.svg +3 -0
- data/app/assets/icons/chevron-left.svg +3 -0
- data/app/assets/icons/chevron-right.svg +3 -0
- data/app/assets/icons/chevron-up.svg +3 -0
- data/app/assets/icons/circle-stack.svg +3 -0
- data/app/assets/icons/clipboard-document-check-solid.svg +4 -0
- data/app/assets/icons/clipboard-document-check.svg +3 -0
- data/app/assets/icons/clock.svg +3 -0
- data/app/assets/icons/complete.svg +3 -0
- data/app/assets/icons/course.svg +3 -0
- data/app/assets/icons/device-phone-mobile.svg +3 -0
- data/app/assets/icons/document-arrow-up.svg +4 -0
- data/app/assets/icons/document-text.svg +4 -0
- data/app/assets/icons/ellipsis-vertical.svg +3 -0
- data/app/assets/icons/exclaimation-circle-solid.svg +3 -0
- data/app/assets/icons/eye.svg +4 -0
- data/app/assets/icons/flag.svg +3 -0
- data/app/assets/icons/funnel.svg +3 -0
- data/app/assets/icons/green-circle.svg +3 -0
- data/app/assets/icons/green-tick.svg +3 -0
- data/app/assets/icons/grid.svg +6 -0
- data/app/assets/icons/home.svg +3 -0
- data/app/assets/icons/i-vector.svg +3 -0
- data/app/assets/icons/lessons.svg +11 -0
- data/app/assets/icons/magnifying-glass.svg +3 -0
- data/app/assets/icons/minus.svg +3 -0
- data/app/assets/icons/numbered-list.svg +3 -0
- data/app/assets/icons/pencil.svg +3 -0
- data/app/assets/icons/play.svg +3 -0
- data/app/assets/icons/plus.svg +3 -0
- data/app/assets/icons/power.svg +3 -0
- data/app/assets/icons/question-mark-circle.svg +3 -0
- data/app/assets/icons/quiz-score.svg +15 -0
- data/app/assets/icons/re-invite.svg +3 -0
- data/app/assets/icons/red-circle.svg +3 -0
- data/app/assets/icons/share.svg +3 -0
- data/app/assets/icons/smiley-five.svg +5 -0
- data/app/assets/icons/smiley-four.svg +5 -0
- data/app/assets/icons/smiley-one.svg +5 -0
- data/app/assets/icons/smiley-three.svg +5 -0
- data/app/assets/icons/smiley-two.svg +5 -0
- data/app/assets/icons/sparkle.svg +3 -0
- data/app/assets/icons/star-transparent.svg +3 -0
- data/app/assets/icons/stop.svg +4 -0
- data/app/assets/icons/support-placeholder.svg +4 -0
- data/app/assets/icons/tag.svg +4 -0
- data/app/assets/icons/timer.svg +5 -0
- data/app/assets/icons/transcript.svg +31 -0
- data/app/assets/icons/trash.svg +3 -0
- data/app/assets/icons/upload-info.svg +7 -0
- data/app/assets/icons/user-circle.svg +3 -0
- data/app/assets/icons/user-group.svg +3 -0
- data/app/assets/icons/user.svg +3 -0
- data/app/assets/icons/users.svg +3 -0
- data/app/assets/icons/winner.svg +35 -0
- data/app/assets/icons/x-circle-solid.svg +3 -0
- data/app/assets/icons/x-circle.svg +3 -0
- data/app/assets/icons/x-mark.svg +3 -0
- data/app/assets/stylesheets/breadcrumbs.tailwind.css +45 -0
- data/app/assets/stylesheets/buttons.tailwind.css +98 -0
- data/app/assets/stylesheets/course_progress.css +75 -0
- data/app/assets/stylesheets/custom.css +67 -0
- data/app/assets/stylesheets/date_picker.tailwind.css +7 -0
- data/app/assets/stylesheets/directives.tailwind.css +3 -0
- data/app/assets/stylesheets/dropdown.tailwind.css +11 -0
- data/app/assets/stylesheets/file_selector.tailwind.css +47 -0
- data/app/assets/stylesheets/icons.css.erb +244 -0
- data/app/assets/stylesheets/inputs.tailwind.css +53 -0
- data/app/assets/stylesheets/menu_component.tailwind.css +39 -0
- data/app/assets/stylesheets/mobile_inputs.tailwind.css +11 -0
- data/app/assets/stylesheets/modalbox.tailwind.css +35 -0
- data/app/assets/stylesheets/profile_icon.tailwind.css +15 -0
- data/app/assets/stylesheets/textarea.tailwind.css +43 -0
- data/app/assets/stylesheets/tooltip.css +88 -0
- data/app/assets/stylesheets/typography.tailwind.css +70 -0
- data/app/helpers/ui_helper.rb +31 -0
- data/app/helpers/view_component/accordion_component.rb +12 -0
- data/app/helpers/view_component/breadcrumbs_component.rb +30 -0
- data/app/helpers/view_component/button_component.rb +180 -0
- data/app/helpers/view_component/chip_component.rb +54 -0
- data/app/helpers/view_component/component_helper.rb +21 -0
- data/app/helpers/view_component/course_card_component.rb +9 -0
- data/app/helpers/view_component/course_carousal_component.rb +14 -0
- data/app/helpers/view_component/course_select_component.rb +32 -0
- data/app/helpers/view_component/doc_section_component.rb +10 -0
- data/app/helpers/view_component/icon_component.rb +24 -0
- data/app/helpers/view_component/input_component/date_picker_component.rb +127 -0
- data/app/helpers/view_component/input_component/dropdown_component.rb +99 -0
- data/app/helpers/view_component/input_component/file_selector_component.rb +123 -0
- data/app/helpers/view_component/input_component/input_checkbox_component.rb +54 -0
- data/app/helpers/view_component/input_component/input_mobile_component.rb +68 -0
- data/app/helpers/view_component/input_component/input_radio_component.rb +54 -0
- data/app/helpers/view_component/input_component/input_text_component.rb +137 -0
- data/app/helpers/view_component/input_component/textarea_component.rb +101 -0
- data/app/helpers/view_component/input_component.rb +290 -0
- data/app/helpers/view_component/input_textarea_component.rb +28 -0
- data/app/helpers/view_component/long_course_card_component.rb +10 -0
- data/app/helpers/view_component/member_list_component.rb +17 -0
- data/app/helpers/view_component/menu_component.rb +31 -0
- data/app/helpers/view_component/menu_component_helper.rb +22 -0
- data/app/helpers/view_component/menu_item.rb +12 -0
- data/app/helpers/view_component/modal_box_component.rb +29 -0
- data/app/helpers/view_component/modal_component.rb +12 -0
- data/app/helpers/view_component/notification_bar_component.rb +22 -0
- data/app/helpers/view_component/paginator_component.rb +9 -0
- data/app/helpers/view_component/profile_icon_component.rb +46 -0
- data/app/helpers/view_component/progress_component.rb +12 -0
- data/app/helpers/view_component/table_component.rb +22 -0
- data/app/helpers/view_component/typography_component.rb +83 -0
- data/app/javascript/neo_components/controllers/collapsible_controller.js +37 -0
- data/app/javascript/neo_components/controllers/date_picker_controller.js +17 -0
- data/app/javascript/neo_components/controllers/file_selector_controller.js +145 -0
- data/app/javascript/neo_components/controllers/input_mobile_controller.js +7 -0
- data/app/javascript/neo_components/controllers/menu_component_controller.js +26 -0
- data/app/javascript/neo_components/controllers/modal_loader_controller.js +13 -0
- data/app/javascript/neo_components/controllers/modals_controller.js +26 -0
- data/app/javascript/neo_components/controllers/notification_bar_controller.js +9 -0
- data/app/javascript/neo_components/controllers/pagination_controller.js +11 -0
- data/app/javascript/neo_components/controllers/tab_change_controller.js +23 -0
- data/app/javascript/neo_components/controllers/tabs_controller.js +29 -0
- data/app/javascript/neo_components/controllers/text_clamp_controller.js +29 -0
- data/app/views/shared/components/_progress_bar_short.html.erb +8 -0
- data/app/views/shared/components/_tooltip.html.erb +7 -0
- data/app/views/view_components/accordion_component/_accordion.html.erb +22 -0
- data/app/views/view_components/breadcrumbs_component/_breadcrumbs.html.erb +38 -0
- data/app/views/view_components/button_component/_button.html.erb +13 -0
- data/app/views/view_components/buttons/_danger.html.erb +30 -0
- data/app/views/view_components/buttons/_primary.html.erb +31 -0
- data/app/views/view_components/buttons/_secondary.html.erb +29 -0
- data/app/views/view_components/chip_component/_chip_component.html.erb +9 -0
- data/app/views/view_components/course_carousal/_course_card_component.html.erb +65 -0
- data/app/views/view_components/course_carousal/_course_carousal_body_component.html.erb +25 -0
- data/app/views/view_components/course_carousal/_course_carousal_component.html.erb +8 -0
- data/app/views/view_components/course_carousal/_long_course_card_component.html.erb +70 -0
- data/app/views/view_components/course_select/_course_select_component.html.erb +19 -0
- data/app/views/view_components/course_select/_list_component.html.erb +14 -0
- data/app/views/view_components/course_select/_list_item_component.html.erb +86 -0
- data/app/views/view_components/course_select/_load_more.html.erb +17 -0
- data/app/views/view_components/course_select/_search_component.html.erb +48 -0
- data/app/views/view_components/course_select/_sidebar_component.html.erb +41 -0
- data/app/views/view_components/doc_section/_doc_section_component.html.erb +6 -0
- data/app/views/view_components/inputs/_checkbox_field.html.erb +19 -0
- data/app/views/view_components/inputs/_date_select_component.html.erb +37 -0
- data/app/views/view_components/inputs/_dropdown_field.html.erb +22 -0
- data/app/views/view_components/inputs/_file_selector.html.erb +16 -0
- data/app/views/view_components/inputs/_input_checkbox_component.html.erb +7 -0
- data/app/views/view_components/inputs/_input_mobile_component.html.erb +16 -0
- data/app/views/view_components/inputs/_input_radio_component.html.erb +7 -0
- data/app/views/view_components/inputs/_input_text_component.html.erb +16 -0
- data/app/views/view_components/inputs/_mobile_field.html.erb +31 -0
- data/app/views/view_components/inputs/_radio_field.html.erb +25 -0
- data/app/views/view_components/inputs/_text_field.html.erb +52 -0
- data/app/views/view_components/inputs/_textarea.html.erb +26 -0
- data/app/views/view_components/inputs/date_picker_component/_date_picker.html.erb +16 -0
- data/app/views/view_components/inputs/date_picker_component/_input_box.html.erb +34 -0
- data/app/views/view_components/inputs/dropdown_component/_dropdown.html.erb +16 -0
- data/app/views/view_components/inputs/dropdown_component/_select_box.html.erb +10 -0
- data/app/views/view_components/inputs/file_selector_component/_file_selector_box.html.erb +76 -0
- data/app/views/view_components/inputs/input_checkbox/_checkbox.html.erb +20 -0
- data/app/views/view_components/inputs/input_mobile/_code.html.erb +13 -0
- data/app/views/view_components/inputs/input_mobile/_mobile_box.html.erb +4 -0
- data/app/views/view_components/inputs/input_mobile/_number.html.erb +13 -0
- data/app/views/view_components/inputs/input_radio/_radio_button.html.erb +14 -0
- data/app/views/view_components/inputs/input_text/_text_box.html.erb +33 -0
- data/app/views/view_components/inputs/textarea_component/_text_area_box.html.erb +16 -0
- data/app/views/view_components/inputs/textarea_component/_textarea.html.erb +16 -0
- data/app/views/view_components/member_list/_member_list.html.erb +4 -0
- data/app/views/view_components/member_list/_member_search.html.erb +15 -0
- data/app/views/view_components/member_list/_members.html.erb +65 -0
- data/app/views/view_components/menu_component/_menu_component.html.erb +16 -0
- data/app/views/view_components/menu_component/_menu_item_button.html.erb +17 -0
- data/app/views/view_components/menu_component/_menu_item_link.html.erb +5 -0
- data/app/views/view_components/menu_component_old/_menu_component.html.erb +17 -0
- data/app/views/view_components/menu_component_old/_menu_item_button.html.erb +7 -0
- data/app/views/view_components/menu_component_old/_menu_item_link.html.erb +5 -0
- data/app/views/view_components/modal_component/_modal_box_component.html.erb +28 -0
- data/app/views/view_components/modals/_modal_component.html.erb +25 -0
- data/app/views/view_components/notification_bar/_notification_bar.html.erb +17 -0
- data/app/views/view_components/paginator/_next_page.html.erb +7 -0
- data/app/views/view_components/paginator/_paginator_component.html.erb +6 -0
- data/app/views/view_components/paginator/_prev_page.html.erb +7 -0
- data/app/views/view_components/profile_icon_component/_profile_icon.html.erb +3 -0
- data/app/views/view_components/progress_component/_progressbar.html.erb +5 -0
- data/app/views/view_components/typography/_h1_component.html.erb +1 -0
- data/app/views/view_components/typography/_h2_component.html.erb +1 -0
- data/app/views/view_components/typography/_h3_component.html.erb +1 -0
- data/app/views/view_components/typography/_heading_component.html.erb +3 -0
- data/app/views/view_components/typography/_link_component.html.erb +1 -0
- data/app/views/view_components/typography/_linked_text_component.html.erb +3 -0
- data/app/views/view_components/typography/_text_component.html.erb +1 -0
- data/config/importmap.rb +5 -0
- data/lib/neo_components/engine.rb +38 -0
- data/lib/neo_components/version.rb +5 -0
- data/lib/neo_components.rb +4 -0
- metadata +327 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
|
|
3
|
+
export default class extends Controller {
|
|
4
|
+
static targets = ["tabContent", "tabLink"];
|
|
5
|
+
|
|
6
|
+
changeTab(event) {
|
|
7
|
+
event.preventDefault();
|
|
8
|
+
const selectedTab = event.currentTarget.dataset.tab;
|
|
9
|
+
|
|
10
|
+
this.tabContentTargets.forEach((el) => {
|
|
11
|
+
el.classList.toggle("hidden", el.dataset.tab !== selectedTab);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
this.setActiveTab(selectedTab);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
setActiveTab(activeTab) {
|
|
18
|
+
this.tabLinkTargets.forEach((link) => {
|
|
19
|
+
const isActive = link.dataset.tab === activeTab;
|
|
20
|
+
link.classList.toggle("active-border", isActive);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
export default class extends Controller {
|
|
4
|
+
static targets = ["tabItem", "panelItem"]
|
|
5
|
+
static classes = ["active"]
|
|
6
|
+
static values = { panelHtml: String }
|
|
7
|
+
|
|
8
|
+
connect() {
|
|
9
|
+
this.tabItemTarget.classList.add(...this.activeClasses)
|
|
10
|
+
}
|
|
11
|
+
select(event) {
|
|
12
|
+
const currentTabIndex = this.tabItemTargets.indexOf(event.currentTarget)
|
|
13
|
+
|
|
14
|
+
this.tabItemTargets.forEach((item, idx) => {
|
|
15
|
+
if (currentTabIndex === idx) {
|
|
16
|
+
item.classList.add(...this.activeClasses)
|
|
17
|
+
} else {
|
|
18
|
+
item.classList.remove(...this.activeClasses)
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
this.panelItemTargets.forEach((panel, idx) => {
|
|
22
|
+
if (currentTabIndex === idx) {
|
|
23
|
+
panel.classList.remove('hidden')
|
|
24
|
+
} else {
|
|
25
|
+
panel.classList.add('hidden')
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
export default class extends Controller {
|
|
4
|
+
static targets = ["longText", "showMoretoggle"]
|
|
5
|
+
static values = {
|
|
6
|
+
css: String
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
connect() {
|
|
10
|
+
this.showMoretoggleTargets.forEach((showMoretoggle, idx) => {
|
|
11
|
+
if (!this.isOverflowing(idx)) {
|
|
12
|
+
showMoretoggle.classList.add("hidden")
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
showMoretoggle(event) {
|
|
18
|
+
const clickedIndex = this.showMoretoggleTargets.indexOf(event.currentTarget)
|
|
19
|
+
const longTextTarget = this.longTextTargets[clickedIndex]
|
|
20
|
+
longTextTarget.classList.toggle(this.cssValue)
|
|
21
|
+
const isClamped = longTextTarget.classList.contains(this.cssValue)
|
|
22
|
+
event.currentTarget.textContent = isClamped ? "Show more" : "Show less"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
isOverflowing(idx) {
|
|
26
|
+
const longTextTarget = this.longTextTargets[idx]
|
|
27
|
+
return longTextTarget.scrollHeight > longTextTarget.clientHeight
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<% if local_assigns[:progress].present? %>
|
|
2
|
+
<div class="flex flex-col items-center gap-1">
|
|
3
|
+
<span class="text-xs font-bold text-primary"><%= progress %>%</span>
|
|
4
|
+
<div class="h-1 grow bg-line-colour-light w-full">
|
|
5
|
+
<div class="h-1 bg-primary" style="width: <%= progress %>%"></div>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
<% end %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<div class="border-b border-line-colour last:border-0"
|
|
2
|
+
data-controller="collapsible"
|
|
3
|
+
data-collapsible-open-value="<%= open %>">
|
|
4
|
+
<div class="">
|
|
5
|
+
<div data-action="click->collapsible#toggle"
|
|
6
|
+
class="flex gap-2 items-center py-4 px-5 <%= icon_position_style %> w-full group cursor-pointer hover:bg-primary-light-50 <%= wrapper_class %>">
|
|
7
|
+
<%= header %>
|
|
8
|
+
|
|
9
|
+
<div data-collapsible-target="icon" class="text-primary transition-transform duration-300 ease-in-out transform">
|
|
10
|
+
<%= icon 'chevron-down', css: 'w-5 h-5' %>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div data-collapsible-target="content" class="hidden">
|
|
15
|
+
<% if content %>
|
|
16
|
+
<%= content %>
|
|
17
|
+
<% else %>
|
|
18
|
+
<p>No content available</p>
|
|
19
|
+
<% end %>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<div class="breadcrumbs-wrapper main-text-sm-normal hidden md:block">
|
|
2
|
+
<div class="breadcrumbs-list-container">
|
|
3
|
+
<% breadcrumbs.intermediate_links.each do |title, link| %>
|
|
4
|
+
<div class="relative group inline-block">
|
|
5
|
+
<div class="breadcrumbs-list">
|
|
6
|
+
<span class="breadcrumbs-list-content">
|
|
7
|
+
<% if link.present? %>
|
|
8
|
+
<%= link_to title, link, class: 'breadcrumbs-intermediate-link' %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<span class="breadcrumbs-intermediate-link"><%= title %></span>
|
|
11
|
+
<% end %>
|
|
12
|
+
<%= icon("chevron-right", css: 'breadcrumbs-divider-arrow') %>
|
|
13
|
+
</span>
|
|
14
|
+
</div>
|
|
15
|
+
<span class="absolute breadcrumbs-tooltip">
|
|
16
|
+
<%= title %>
|
|
17
|
+
</span>
|
|
18
|
+
</div>
|
|
19
|
+
<% end %>
|
|
20
|
+
|
|
21
|
+
<% if (title, link = breadcrumbs.last_link) %>
|
|
22
|
+
<div class="relative group inline-block">
|
|
23
|
+
<div class="breadcrumbs-list">
|
|
24
|
+
<span class="breadcrumbs-list-content">
|
|
25
|
+
<% if link.present? %>
|
|
26
|
+
<%= link_to title, link, class: 'breadcrumbs-last-link' %>
|
|
27
|
+
<% else %>
|
|
28
|
+
<span class="breadcrumbs-last-link"><%= title %></span>
|
|
29
|
+
<% end %>
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
<span class="absolute breadcrumbs-tooltip">
|
|
33
|
+
<%= title %>
|
|
34
|
+
</span>
|
|
35
|
+
</div>
|
|
36
|
+
<% end %>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% button_content = capture do %>
|
|
2
|
+
<%= tag.div(**button.html_options,
|
|
3
|
+
class: [
|
|
4
|
+
button.base_styles,
|
|
5
|
+
button.color_styles,
|
|
6
|
+
button.sizing_styles].join(' ')) do %>
|
|
7
|
+
<% content = button.text.present? ? content_tag(:div, button.text, class: button.text_styles) : nil %>
|
|
8
|
+
<% icon = icon(button.icon_name, css: button.icon_styles) if button.icon_name.present? %>
|
|
9
|
+
<%= arrange_tags(icon, content, button.icon_position) %>
|
|
10
|
+
<% end %>
|
|
11
|
+
<% end %>
|
|
12
|
+
|
|
13
|
+
<%= button.tooltip_text.present? ? render('shared/components/tooltip', tooltip_position: button.tooltip_position, tooltip_text: button.tooltip_text) { button_content } : button_content %>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<% button_content = capture do %>
|
|
2
|
+
<% disabled_class = disabled ? 'pointer-events-none opacity-50 cursor-not-allowed' : '' %>
|
|
3
|
+
<% if size == "xl" %>
|
|
4
|
+
<%= tag.div(**html_options, class: "inline-flex h-14 items-center justify-center gap-2 rounded-lg border bg-white px-6 py-3 border-danger text-danger hover:border-primary hover:text-primary #{disabled_class}") do %>
|
|
5
|
+
<% content = content_tag(:div, label, class: "text-xl font-semibold font-['Poppins'] leading-7") if label.present? %>
|
|
6
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-5 w-5") if icon_name.present? %>
|
|
7
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% elsif size == "lg" %>
|
|
10
|
+
<%= tag.div(**html_options, class: "inline-flex h-10 items-center justify-center gap-2 rounded-md border bg-white px-4 py-2 border-danger text-danger hover:border-primary hover:text-primary #{disabled_class}") do %>
|
|
11
|
+
<% content = content_tag(:div, label, class: "text-base font-medium font-['Poppins'] leading-normal") if label.present? %>
|
|
12
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-4 w-4") if icon_name.present? %>
|
|
13
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% elsif size == "md" %>
|
|
16
|
+
<%= tag.div(**html_options, class: "inline-flex h-9 items-center justify-center gap-2 rounded-md border bg-white px-4 py-2 border-danger text-danger hover:border-primary hover:text-primary #{disabled_class}") do %>
|
|
17
|
+
<% content = content_tag(:div, label, class: "text-sm font-medium font-['Poppins'] leading-tight") if label.present? %>
|
|
18
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-[14px] w-[14px]") if icon_name.present? %>
|
|
19
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% elsif size == "sm" %>
|
|
22
|
+
<%= tag.div(**html_options, class: "inline-flex h-6 items-center justify-center gap-2 rounded-sm border bg-white px-3 py-1 border-danger text-danger hover:border-primary hover:text-primary #{disabled_class}") do %>
|
|
23
|
+
<% content = content_tag(:div, label, class: "text-xs font-normal font-['Poppins'] leading-none") if label.present? %>
|
|
24
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-3 w-3") if icon_name.present? %>
|
|
25
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
26
|
+
<% end %>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% end %>
|
|
29
|
+
|
|
30
|
+
<%= local_assigns[:tooltip_text].present? ? render('shared/components/tooltip', tooltip_position: tooltip_position, tooltip_text: tooltip_text) { button_content } : button_content %>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<% button_content = capture do %>
|
|
2
|
+
<% disabled_class = disabled ? 'opacity-50 cursor-not-allowed' : '' %>
|
|
3
|
+
|
|
4
|
+
<% if size == "xl" %>
|
|
5
|
+
<%= tag.div(**html_options, class: "inline-flex h-14 items-center justify-center gap-2 rounded-lg px-6 py-3 text-white bg-primary hover:bg-primary-light #{disabled_class}") do %>
|
|
6
|
+
<% content = content_tag(:div, label, class: "text-white text-xl font-semibold font-['Poppins'] leading-7") if label.present? %>
|
|
7
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-5 w-5") if icon_name.present? %>
|
|
8
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% elsif size == "lg" %>
|
|
11
|
+
<%= tag.div(**html_options, class: "inline-flex h-10 items-center justify-center gap-2 rounded-md px-4 py-2 text-white bg-primary hover:bg-primary-light #{disabled_class}") do %>
|
|
12
|
+
<% content = content_tag(:div, label, class: "text-white text-base font-medium font-['Poppins'] leading-normal") if label.present? %>
|
|
13
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-4 w-4") if icon_name.present? %>
|
|
14
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% elsif size == "md" %>
|
|
17
|
+
<%= tag.div(**html_options, class: "inline-flex h-9 items-center justify-center gap-2 rounded-md px-4 py-2 text-white bg-primary hover:bg-primary-light #{disabled_class}") do %>
|
|
18
|
+
<% content = content_tag(:div, label, class: "text-white text-sm font-medium font-['Poppins'] leading-tight") if label.present? %>
|
|
19
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-[14px] w-[14px]") if icon_name.present? %>
|
|
20
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
21
|
+
<% end %>
|
|
22
|
+
<% elsif size == "sm" %>
|
|
23
|
+
<%= tag.div(**html_options, class: "inline-flex h-6 items-center justify-center gap-2 rounded-sm px-3 py-1 text-white bg-primary hover:bg-primary-light #{disabled_class}") do %>
|
|
24
|
+
<% content = content_tag(:div, label, class: "text-white text-xs font-normal font-['Poppins'] leading-none") if label.present? %>
|
|
25
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-3 w-3") if icon_name.present? %>
|
|
26
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% end %>
|
|
29
|
+
<% end %>
|
|
30
|
+
|
|
31
|
+
<%= tooltip_text.present? ? render('shared/components/tooltip', tooltip_position:, tooltip_text:) { button_content } : button_content %>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<% button_content = capture do %>
|
|
2
|
+
<% disabled_class = disabled ? 'opacity-50 cursor-not-allowed' : 'hover:border-primary hover:text-primary' %>
|
|
3
|
+
<% if size == "xl" %>
|
|
4
|
+
<%= tag.div(**html_options, class: "inline-flex h-14 items-center justify-center gap-2 rounded-lg border bg-white px-6 py-3 border-slate-grey-50 text-letter-color-light #{disabled_class}") do %>
|
|
5
|
+
<% content = content_tag(:div, label, class: "text-xl font-semibold font-['Poppins'] leading-7 cursor-inherit") if label.present? %>
|
|
6
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-5 w-5 cursor-inherit") if icon_name.present? %>
|
|
7
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% elsif size == "lg" %>
|
|
10
|
+
<%= tag.div(**html_options, class: "inline-flex h-10 items-center justify-center gap-2 rounded-md border bg-white px-4 py-2 border-slate-grey-50 text-letter-color-light #{disabled_class}") do %>
|
|
11
|
+
<% content = content_tag(:div, label, class: "text-base font-medium font-['Poppins'] leading-normal cursor-inherit") if label.present? %>
|
|
12
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-4 w-4 cursor-inherit") if icon_name.present? %>
|
|
13
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% elsif size == "md" %>
|
|
16
|
+
<%= tag.div(**html_options, class: "inline-flex h-9 items-center justify-center gap-2 rounded-md border bg-white px-4 py-2 border-slate-grey-50 text-letter-color-light #{disabled_class}") do %>
|
|
17
|
+
<% content = content_tag(:div, label, class: "text-sm font-medium font-['Poppins'] leading-tight cursor-inherit") if label.present? %>
|
|
18
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-[14px] w-[14px] cursor-inherit") if icon_name.present? %>
|
|
19
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% elsif size == "sm" %>
|
|
22
|
+
<%= tag.div(**html_options, class: "inline-flex h-6 items-center justify-center gap-2 rounded-sm border bg-white px-3 py-1 border-slate-grey-50 text-letter-color-light #{disabled_class}") do %>
|
|
23
|
+
<% content = content_tag(:div, label, class: "text-xs font-normal font-['Poppins'] leading-none cursor-inherit") if label.present? %>
|
|
24
|
+
<% icon = icon(icon_name || "adjustments-vertical", css: "h-3 w-3 cursor-inherit") if icon_name.present? %>
|
|
25
|
+
<%= arrange_tags(icon, content, icon_position) %>
|
|
26
|
+
<% end %>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% end %>
|
|
29
|
+
<%= local_assigns[:tooltip_text].present? ? render('shared/components/tooltip', tooltip_position: , tooltip_text: ) { button_content } : button_content %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<div class="flex w-fit gap-1 items-center rounded h-5 px-1 py-0.5 border <%= border_style %> <%= bg_style %>">
|
|
2
|
+
<% if icon_name.present? %>
|
|
3
|
+
<%= icon(icon_name, span_css: icon_style, css: 'h-4 w-4') %>
|
|
4
|
+
<% end %>
|
|
5
|
+
<span class="whitespace-nowrap general-text-sm-normal text-center justify-start <%= text_style %>"><%= text %></span>
|
|
6
|
+
<% if close %>
|
|
7
|
+
<%= icon("x-circle", span_css: close_style, css: 'h-4 w-4') %>
|
|
8
|
+
<% end %>
|
|
9
|
+
</div>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<div class="inline-block rounded box-shadow-medium border border-line-colour-light relative max-h-[298px]">
|
|
2
|
+
<div class="w-full rounded md:max-w-[310px] relative">
|
|
3
|
+
<div class="absolute top-0 right-0 z-10 flex flex-wrap justify-start gap-2 heading">
|
|
4
|
+
<% course.tags.each do |tag| %>
|
|
5
|
+
<% if tag.tag_type == "level" %>
|
|
6
|
+
<span class="px-2 py-1 text-xs font-medium bg-secondary text-white">
|
|
7
|
+
<%= tag.name %>
|
|
8
|
+
</span>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
11
|
+
</div>
|
|
12
|
+
<%= image_tag course_banner(course, :horizontal), class: 'w-screen h-[120px] rounded-t object-cover' %>
|
|
13
|
+
<div class="flex flex-col justify-between">
|
|
14
|
+
<div class="p-4">
|
|
15
|
+
<p class="mb-2 overflow-hidden text-ellipsis heading heading-semibold text-primary h-12 line-clamp-2">
|
|
16
|
+
<%= course.title %>
|
|
17
|
+
</p>
|
|
18
|
+
<div class="flex justify-between mt-2">
|
|
19
|
+
<div class="flex items-center">
|
|
20
|
+
<span class="icon icon-lessons h-3.5 w-3.5 bg-primary"></span>
|
|
21
|
+
<span class="ml-2 text-xs font-medium"><%= pluralize(modules_count(course), 'module') %></span>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="flex items-center">
|
|
24
|
+
<span class="icon icon-clock h-3.5 w-3.5 bg-primary"></span>
|
|
25
|
+
<span class="ml-2 text-xs font-medium"><%= course_duration(course) %></span>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="flex items-center">
|
|
28
|
+
<span class="icon icon-user h-3.5 w-3.5 bg-primary"></span>
|
|
29
|
+
<span class="ml-2 text-xs font-medium"><%= enroll_count(course) %></span>
|
|
30
|
+
</div>
|
|
31
|
+
<% if course.rating.present? %>
|
|
32
|
+
<div class="flex items-center">
|
|
33
|
+
<%= icon("star-transparent", css: "h-4 w-4 text-primary fill-primary") %>
|
|
34
|
+
<span class="ml-2 text-xs font-medium"><%= course.rating.ceil %></span>
|
|
35
|
+
</div>
|
|
36
|
+
<% end %>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="flex flex-col gap-3 mt-3">
|
|
39
|
+
<div class="flex flex-wrap gap-2 h-[24px] heading">
|
|
40
|
+
<% course.tags.each do |tag| %>
|
|
41
|
+
<% if tag.tag_type == "category" %>
|
|
42
|
+
<span class="px-2 py-1 text-xs font-medium bg-primary-light-50 rounded">
|
|
43
|
+
<%= tag.name %>
|
|
44
|
+
</span>
|
|
45
|
+
<% end %>
|
|
46
|
+
<% end %>
|
|
47
|
+
</div>
|
|
48
|
+
<% if local_assigns[:enrollment].present? %>
|
|
49
|
+
<div class=" flex flex-row items-center justify-between gap-2">
|
|
50
|
+
<div class="w-[83px]">
|
|
51
|
+
<%= render 'shared/components/progress_bar_short', progress: enrollment.progress %>
|
|
52
|
+
</div>
|
|
53
|
+
<% if enrollment.deadline_present? %>
|
|
54
|
+
<div class="text-xs flex flex-row items-center gap-2">
|
|
55
|
+
<span class="h-3.5 w-3.5 icon icon-calendar bg-letter-color"></span>
|
|
56
|
+
<%= pluralize(days_remaining(enrollment.deadline_at), "day") %> left
|
|
57
|
+
</div>
|
|
58
|
+
<% end %>
|
|
59
|
+
</div>
|
|
60
|
+
<% end %>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<div class="relative flex w-full" id="<%= dom_key("course-carousal") %>">
|
|
2
|
+
<div class="absolute -left-3 z-50 flex h-full items-center hover:text-primary hover:cursor-pointer"
|
|
3
|
+
data-course-carousal-target="prevArrow"
|
|
4
|
+
data-action="click->course-carousal#shiftWindowLeft">
|
|
5
|
+
<%= icon("chevron-left", css: "icon-medium") %>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="mx-5 flex flex-row flex-nowrap justify-between overflow-y-auto scroll-smooth"
|
|
9
|
+
data-course-carousal-target="courseCarousalBody">
|
|
10
|
+
<% courses.each do |course| %>
|
|
11
|
+
<%= link_to course_path(course) do %>
|
|
12
|
+
<div class="mx-1 transform transition-transform duration-500 scale-100"
|
|
13
|
+
data-course-carousal-target="cardComponent">
|
|
14
|
+
<%= course_card_component(course: course) %>
|
|
15
|
+
</div>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% end %>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="absolute -right-3 z-50 flex h-full items-center hover:text-primary hover:cursor-pointer"
|
|
21
|
+
data-course-carousal-target="nextArrow"
|
|
22
|
+
data-action="click->course-carousal#shiftWindowRight">
|
|
23
|
+
<%= icon("chevron-right", css: "icon-medium") %>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<div class="w-full" data-controller="course-carousal">
|
|
2
|
+
<div class="my-4">
|
|
3
|
+
<span class="font-['Poppins'] text-xl font-semibold"><%= title %></span> <span class="text-letter-color-light">(<%= pluralize(count, 'course') %>)</span>
|
|
4
|
+
<%= link_to 'View more', load_path, class: 'text-xs text-primary hover:cursor-pointer underline', data: { course_carousal_component_target: 'loadPath' } %>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<%= course_carousal_body_component(courses:) %>
|
|
8
|
+
</div>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<div class="rounded-xl border border-line-colour-light relative max-h-[104px] md:max-h-[132px]">
|
|
2
|
+
<div class="w-full rounded relative flex gap-1">
|
|
3
|
+
<div class="absolute top-0 left-0 z-10 flex flex-wrap justify-start gap-2 heading">
|
|
4
|
+
<% course.tags.each do |tag| %>
|
|
5
|
+
<% if tag.tag_type == "level" %>
|
|
6
|
+
<span class="px-2 py-1 text-xs font-medium bg-secondary text-primary-dark rounded-tl-xl rounded-br-xl">
|
|
7
|
+
<%= tag.name %>
|
|
8
|
+
</span>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div class="relative">
|
|
14
|
+
<%= image_tag course_banner(course, :horizontal), class: 'w-[100px] md:w-[297px] h-[104px] md:h-[132px] rounded-l-xl object-cover' %>
|
|
15
|
+
<span class="absolute bottom-0 right-4 z-10 flex rounded-t-md bg-primary-light-100 general-text-sm-normal py-0.5 px-1 text-primary-dark">
|
|
16
|
+
<%= course_duration(course) %>
|
|
17
|
+
</span>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="flex justify-between flex-grow p-4 md:p-5 gap-3 ">
|
|
21
|
+
<div class="flex flex-col gap-3">
|
|
22
|
+
<div class="flex justify-between">
|
|
23
|
+
<div class="max-w-[148px] md:max-w-[716px]">
|
|
24
|
+
<p class="main-text-md-medium text-primary overflow-hidden md:whitespace-nowrap md:text-ellipsis line-clamp-2">
|
|
25
|
+
<%= course.title %>
|
|
26
|
+
</p>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="flex gap-3 md:gap-4">
|
|
31
|
+
<% if course.rating.present? %>
|
|
32
|
+
<div class="flex items-center">
|
|
33
|
+
<%= icon("star-transparent", css: "h-4 w-4 text-primary fill-primary") %>
|
|
34
|
+
<span class="ml-2 general-text-sm-normal"><%= course.rating %></span>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="w-px h-full bg-slate-grey-light md:hidden"></div>
|
|
37
|
+
|
|
38
|
+
<% end %>
|
|
39
|
+
<div class="flex gap-3 md:gap-1">
|
|
40
|
+
<div class="flex items-center">
|
|
41
|
+
<%= icon("book", css: "h-4 w-4 text-primary") %>
|
|
42
|
+
<span class="ml-2 general-text-sm-normal"><%= modules_count(course) %></span>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="w-px h-full bg-slate-grey-light"></div>
|
|
45
|
+
<div class="flex items-center">
|
|
46
|
+
<%= icon("user", css: "h-4 w-4 text-primary") %>
|
|
47
|
+
<span class="ml-2 general-text-sm-normal"><%= enroll_count(course) %></span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div class="flex flex-wrap gap-2 h-[24px] hidden md:block">
|
|
53
|
+
<% course.tags.each do |tag| %>
|
|
54
|
+
<% if tag.tag_type == "category" %>
|
|
55
|
+
<%= chip_component(text: tag.name , colorscheme: 'primary', icon_name: 'check') %>
|
|
56
|
+
<% end %>
|
|
57
|
+
<% end %>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<% unless program.present? %>
|
|
62
|
+
<%# TODO: Bookmark is temporarily hidden. Enable once the feature is finalized. %>
|
|
63
|
+
<div class="border border-primary rounded-full min-w-8 md:min-w-10 h-8 md:h-10 flex justify-center hidden">
|
|
64
|
+
<%= icon("bookmark", css: "h-5 w-5 text-primary") %>
|
|
65
|
+
</div>
|
|
66
|
+
<% end %>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div id="course-select-component" data-controller="course-select" data-show-duration="<%= show_duration %>">
|
|
2
|
+
<%= _course_select_search_component(search_context:, tags:) %>
|
|
3
|
+
<%= form_with url: submit_path, method: :post do |form| %>
|
|
4
|
+
<% if search_context.team_assign? %>
|
|
5
|
+
<%= form.hidden_field :team_id, value: search_context.team.id %>
|
|
6
|
+
<% elsif search_context.user_assign? %>
|
|
7
|
+
<%= form.hidden_field :user_id, value: search_context.user.id %>
|
|
8
|
+
<% end %>
|
|
9
|
+
|
|
10
|
+
<div id="course-select-list">
|
|
11
|
+
<%= _course_select_list_component(search_context:, courses:) %>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div id="footer" class="sticky right-8 bottom-0 -mb-8 flex w-full flex-col items-center justify-end gap-4 bg-white py-6 text-sm md:flex-row">
|
|
15
|
+
<%= form.button 'Assign Course', class: 'bg-primary text-white px-4 py-2 rounded w-full md:w-auto md:order-2' %>
|
|
16
|
+
<%= link_to 'Cancel', cancel_link, class: 'w-full md:w-auto text-center md:text-left md:order-1' %>
|
|
17
|
+
</div>
|
|
18
|
+
<% end %>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<% if courses.empty? %>
|
|
3
|
+
<div class="text-notice">No courses to select</div>
|
|
4
|
+
<% else %>
|
|
5
|
+
|
|
6
|
+
<ul id="course-list" class="flex flex-col gap-4 overflow-y-auto p-1 h-[700px]">
|
|
7
|
+
<% courses.each do |course| %>
|
|
8
|
+
<%= _course_select_list_item_component(course: course) %>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
|
|
12
|
+
<%= _course_select_load_more(search_context: search_context, courses: courses) %>
|
|
13
|
+
<% end %>
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<li id="<%= dom_id(course, "unassigned") %>" class="w-full" data-controller="course-select-item" data-course-select-item-course-select-outlet='#course-select-component'>
|
|
2
|
+
<div class="relative flex w-full flex-col rounded p-6 box-shadow-medium md:flex-row">
|
|
3
|
+
<div class="absolute top-1 left-1 z-10 flex flex-wrap justify-start gap-2 heading">
|
|
4
|
+
<% course.tags.each do |tag| %>
|
|
5
|
+
<% if tag.tag_type == "level" %>
|
|
6
|
+
<span class="px-2 py-1 text-xs font-medium text-white bg-secondary">
|
|
7
|
+
<%= tag.name %>
|
|
8
|
+
</span>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<%= image_tag course_banner(course, :vertical), class: 'h-[118px] w-[152px] md:h-[208px] md:w-[140px] rounded-l object-cover' %>
|
|
14
|
+
|
|
15
|
+
<div class="flex w-full flex-col gap-4 pt-2 md:ps-4">
|
|
16
|
+
<div class="relative">
|
|
17
|
+
<%= check_box_tag 'course_ids[]', # name
|
|
18
|
+
course.id, # value
|
|
19
|
+
false, # checked?
|
|
20
|
+
id: dom_id(course, "course_ids"),
|
|
21
|
+
class: 'absolute -top-32 md:top-0 right-0 w-6 h-6 border-2 rounded border-slate-grey-50 checked:bg-slate-grey-50 checked:border-slate-grey-50 checked:focus:bg-slate-grey-50 focus:ring-0',
|
|
22
|
+
data: { action: 'course-select-item#toggleDurationSelect' } %>
|
|
23
|
+
|
|
24
|
+
<div class="flex flex-col gap-4">
|
|
25
|
+
<p class="overflow-hidden text-ellipsis text-primary heading heading-semibold">
|
|
26
|
+
<%= course.title %>
|
|
27
|
+
</p>
|
|
28
|
+
<div class="flex justify-start space-x-1 md:space-x-4">
|
|
29
|
+
<div class="flex items-center">
|
|
30
|
+
<span class="icon icon-lessons h-3.5 w-3.5 bg-primary"></span>
|
|
31
|
+
<span class="ml-2 text-xs font-medium"><%= pluralize(modules_count(course), 'module') %></span>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="flex items-center">
|
|
34
|
+
<span class="icon icon-clock h-3.5 w-3.5 bg-primary"></span>
|
|
35
|
+
<span class="ml-2 text-xs font-medium"><%= course_duration(course) %></span>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="flex items-center">
|
|
38
|
+
<span class="icon icon-user h-3.5 w-3.5 bg-primary"></span>
|
|
39
|
+
<span class="ml-2 text-xs font-medium"><%= enroll_count(course) %></span>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<p class="overflow-hidden text-ellipsis text-sm font-medium tracking-tight max-h-[20px] heading">Course
|
|
43
|
+
Description</p>
|
|
44
|
+
<div class="rounded-lg p-4 text-justify text-sm tracking-tight bg-primary-light-50">
|
|
45
|
+
<div class="flex h-full items-center overflow-hidden text-sm">
|
|
46
|
+
<%= course_description(course) %>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div>
|
|
50
|
+
<div class="flex h-full items-center overflow-hidden text-sm">
|
|
51
|
+
<% course.tags.each do |tag| %>
|
|
52
|
+
<% if tag.tag_type == "category" %>
|
|
53
|
+
<span class="rounded px-2 py-1 text-xs font-medium bg-primary-light-50">
|
|
54
|
+
<%= tag.name %>
|
|
55
|
+
</span>
|
|
56
|
+
<% end %>
|
|
57
|
+
<% end %>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div class="invisible absolute -top-24 -right-4 flex flex-col items-end gap-2 opacity-0 md:top-0 md:right-12 md:flex-row md:items-center" data-course-select-item-target="durationContainer">
|
|
63
|
+
<label for="duration" class="text-sm font-medium heading md:text-base">Assign Duration:</label>
|
|
64
|
+
<div class="flex flex-row items-center">
|
|
65
|
+
<%= date_field_tag :date, nil,
|
|
66
|
+
id: "datePicker",
|
|
67
|
+
class: "invisible p-0 w-[2px]",
|
|
68
|
+
data: {
|
|
69
|
+
action: "change->course-select-item#datePicked",
|
|
70
|
+
course_select_item_target: "datePicker"
|
|
71
|
+
} %>
|
|
72
|
+
|
|
73
|
+
<%= select_tag 'duration[]', options_for_select(options_for_duration),
|
|
74
|
+
id: 'duration',
|
|
75
|
+
disabled: true,
|
|
76
|
+
class: 'border border-line-colour-light box-shadow-small rounded focus:ring-0 p-0 px-2 h-6 w-28 text-sm',
|
|
77
|
+
data: { course_select_item_target: 'dateSelector', duration: 'duration' } %>
|
|
78
|
+
<div class="relative flex items-center pl-2">
|
|
79
|
+
<span class="cursor-pointer icon-small icon icon-calendar bg-letter-color" data-action="click->course-select-item#openDatePicker"></span>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</li>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div class="mt-4" id="load-more">
|
|
2
|
+
<% if courses.next_page.nil? %>
|
|
3
|
+
<%= button(label: 'Load more', type: 'secondary', disabled: true) %>
|
|
4
|
+
<% elsif search_context.team_assign? %>
|
|
5
|
+
<%= link_to load_more_searches_path(context: search_context.context, team_id: search_context.team.id, page: courses.next_page), data: { turbo_stream: true } do %>
|
|
6
|
+
<%= button(label: 'Load more', type: 'secondary') %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% elsif search_context.user_assign? %>
|
|
9
|
+
<%= link_to load_more_searches_path(context: search_context.context, user_id: search_context.user.id, page: courses.next_page), data: { turbo_stream: true } do %>
|
|
10
|
+
<%= button(label: 'Load more', type: 'secondary') %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% elsif search_context.program? %>
|
|
13
|
+
<%= link_to load_more_searches_path(context: search_context.context, program_id: search_context.program.id, page: courses.next_page), data: { turbo_stream: true } do %>
|
|
14
|
+
<%= button(label: 'Load more', type: 'secondary') %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% end %>
|
|
17
|
+
</div>
|