fleetio_spark 0.1.30 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spark/_icons.js +1 -1
- data/app/assets/javascripts/spark/{_tree.js → components/nav/_tree.js} +1 -1
- data/app/assets/javascripts/spark/{_sidebar.js → components/sidebar/_toggle.js} +1 -2
- data/app/assets/javascripts/spark/components/ui/_sticky_panel.js +185 -0
- data/app/assets/javascripts/spark/spark.js +4 -2
- data/app/assets/stylesheets/spark/_index.scss +1 -1
- data/app/assets/stylesheets/spark/components/_index.scss +15 -7
- data/app/assets/stylesheets/spark/components/app/_banner.scss +56 -0
- data/app/assets/stylesheets/spark/components/{header/_app-nav-header.scss → app/_header.scss} +22 -33
- data/app/assets/stylesheets/spark/components/app/_layout.scss +52 -0
- data/app/assets/stylesheets/spark/components/app/_sidebar.scss +54 -0
- data/app/assets/stylesheets/spark/components/app/sidebar/_header.scss +101 -0
- data/app/assets/stylesheets/spark/components/app/sidebar/_toggle.scss +109 -0
- data/app/assets/stylesheets/spark/components/nav/_breadcrumbs.scss +0 -0
- data/app/assets/stylesheets/spark/components/nav/_item.scss +57 -0
- data/app/assets/stylesheets/spark/components/nav/_sidebar.scss +0 -0
- data/app/assets/stylesheets/spark/components/nav/_tree.scss +4 -0
- data/app/assets/stylesheets/spark/components/nav/tree/_group.scss +42 -0
- data/app/assets/stylesheets/spark/components/ui/_sticky_panel.scss +9 -0
- data/app/assets/stylesheets/spark/components/ui/_toolbar.scss +14 -0
- data/app/assets/stylesheets/spark/{components → components_old}/_dropdown.scss +0 -0
- data/app/assets/stylesheets/spark/components_old/_index.scss +5 -0
- data/app/assets/stylesheets/spark/{components → components_old}/_modal.scss +0 -0
- data/app/assets/stylesheets/spark/{components → components_old}/_nav-menu.scss +0 -0
- data/app/assets/stylesheets/spark/{components → components_old}/_tooltip.scss +0 -0
- data/app/assets/stylesheets/spark/{components → components_old}/header/_index.scss +0 -1
- data/app/assets/stylesheets/spark/{components → components_old}/header/_search-results.scss +0 -0
- data/app/assets/stylesheets/spark/{components → components_old}/header/_search.scss +1 -0
- data/app/assets/stylesheets/spark/{components → components_old}/header/_trial-status.scss +0 -0
- data/app/assets/stylesheets/spark/core/_index.scss +0 -1
- data/app/assets/stylesheets/spark/core/_vars.scss +10 -6
- data/app/assets/svgs/spark/add.svg +1 -1
- data/app/components/spark/app/banner_component.rb +36 -0
- data/app/components/spark/app/header_component.rb +59 -0
- data/app/components/spark/app/layout_component.rb +59 -0
- data/app/components/spark/app/sidebar/header/_header.js +11 -0
- data/app/components/spark/app/sidebar/header_component.rb +40 -0
- data/app/components/spark/app/sidebar/toggle_component.rb +12 -0
- data/app/components/spark/app/sidebar_component.rb +9 -0
- data/app/components/spark/nav/breadcrumbs/_breadcrumbs.html.erb +0 -0
- data/app/components/spark/nav/breadcrumbs_component.rb +2 -0
- data/app/components/spark/nav/group_component.rb +30 -0
- data/app/components/spark/nav/item_component.rb +38 -0
- data/app/components/spark/nav/sidebar_component.rb +16 -0
- data/app/components/spark/nav/tree/group_component.rb +34 -0
- data/app/components/spark/nav/tree_component.rb +43 -0
- data/app/components/spark/ui/sticky_panel_component.rb +9 -0
- data/app/components/spark/ui/toolbar_component.rb +10 -0
- data/app/helpers/spark/nav_menu_helper.rb +0 -23
- data/config/esvg.yml +0 -3
- data/lib/fleetio_spark.rb +1 -0
- data/lib/fleetio_spark/helper.rb +1 -1
- data/lib/fleetio_spark/version.rb +1 -1
- data/public/spark-0.2.0.css +1 -0
- data/public/spark-0.2.0.css.gz +0 -0
- data/public/spark-0.2.0.js +2 -0
- data/public/spark-0.2.0.js.gz +0 -0
- data/public/spark-0.2.0.js.map +1 -0
- metadata +64 -29
- data/app/assets/stylesheets/spark/components/_sidebar.scss +0 -371
- data/app/assets/stylesheets/spark/components/_tree-nav.scss +0 -15
- data/app/assets/stylesheets/spark/core/_layout.scss +0 -105
- data/app/components/spark/_spark_components.scss +0 -1
- data/app/components/spark/header_message/_header_message.html.erb +0 -11
- data/app/components/spark/header_message/_header_message.scss +0 -83
- data/app/components/spark/header_message_component.rb +0 -23
- data/app/views/shared/spark/_app-account-header.html.slim +0 -10
- data/app/views/shared/spark/_app-admin-header.html.slim +0 -7
- data/public/spark-0.1.30.css +0 -1
- data/public/spark-0.1.30.css.gz +0 -0
- data/public/spark-0.1.30.js +0 -2
- data/public/spark-0.1.30.js.gz +0 -0
- data/public/spark-0.1.30.js.map +0 -1
@@ -15,12 +15,11 @@ $link-color: $fl-blue-600;
|
|
15
15
|
$link-hover-color: $fl-blue-700;
|
16
16
|
|
17
17
|
// Sidebar & Navbar
|
18
|
-
$sidebar-
|
19
|
-
$sidebar-
|
20
|
-
$sidebar-
|
21
|
-
$sidebar-
|
22
|
-
$app-
|
23
|
-
$app-admin-header-height: 39px;
|
18
|
+
$app-sidebar-width: 250px;
|
19
|
+
$app-sidebar-bg: $fl-blue-900;
|
20
|
+
$app-sidebar-item-hover: lighten($app-sidebar-bg, 2%);
|
21
|
+
$app-sidebar-item-active: darken($app-sidebar-bg, 4%);
|
22
|
+
$app-header-height: 60px;
|
24
23
|
|
25
24
|
// Search
|
26
25
|
$search-width: 450px;
|
@@ -42,6 +41,11 @@ $width-md: 1000px;
|
|
42
41
|
$width-lg: 1200px;
|
43
42
|
$width-xl: 1400px;
|
44
43
|
|
44
|
+
// Z-index globals
|
45
|
+
$z-ui-sticky-panel: 50;
|
46
|
+
$z-app-header: 100;
|
47
|
+
$z-app-search: 200;
|
48
|
+
|
45
49
|
// Transition timing & durations
|
46
50
|
$duration-short: .1s;
|
47
51
|
$duration: .2s;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<svg width="
|
1
|
+
<svg width="21" height="21" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
2
|
<path d="M0 12C0 12.3978 0.158035 12.7794 0.43934 13.0607C0.720644 13.342 1.10218 13.5 1.5 13.5H10.25C10.3163 13.5 10.3799 13.5263 10.4268 13.5732C10.4737 13.6201 10.5 13.6837 10.5 13.75V22.5C10.5 22.8978 10.658 23.2794 10.9393 23.5607C11.2206 23.842 11.6022 24 12 24C12.3978 24 12.7794 23.842 13.0607 23.5607C13.342 23.2794 13.5 22.8978 13.5 22.5V13.75C13.5 13.6837 13.5263 13.6201 13.5732 13.5732C13.6201 13.5263 13.6837 13.5 13.75 13.5H22.5C22.8978 13.5 23.2794 13.342 23.5607 13.0607C23.842 12.7794 24 12.3978 24 12C24 11.6022 23.842 11.2206 23.5607 10.9393C23.2794 10.658 22.8978 10.5 22.5 10.5H13.75C13.6837 10.5 13.6201 10.4737 13.5732 10.4268C13.5263 10.3799 13.5 10.3163 13.5 10.25V1.5C13.5 1.10218 13.342 0.720644 13.0607 0.43934C12.7794 0.158035 12.3978 0 12 0C11.6022 0 11.2206 0.158035 10.9393 0.43934C10.658 0.720644 10.5 1.10218 10.5 1.5V10.25C10.5 10.3163 10.4737 10.3799 10.4268 10.4268C10.3799 10.4737 10.3163 10.5 10.25 10.5H1.5C1.10218 10.5 0.720644 10.658 0.43934 10.9393C0.158035 11.2206 0 11.6022 0 12H0Z" fill="black"/>
|
3
3
|
</svg>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class App::BannerComponent < SparkComponents::Component
|
2
|
+
attribute type: "default", action_text: "Learn more"
|
3
|
+
attribute :message, :href, :icon
|
4
|
+
|
5
|
+
base_class "app-banner"
|
6
|
+
|
7
|
+
def render
|
8
|
+
theme_defaults
|
9
|
+
|
10
|
+
content_tag(:header, attrs) do
|
11
|
+
concat content_tag(:div, class: join_class('content')) {
|
12
|
+
concat @view.use_svg(icon, class: join_class('icon'), size: "icon_m")
|
13
|
+
concat content_tag(:div, message || self, class: join_class("message"))
|
14
|
+
}
|
15
|
+
if href
|
16
|
+
concat content_tag(:div, class: join_class("action")) {
|
17
|
+
@view.link_to( action_text, href, class: join_class("action-item"), target: "_blank" )
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def theme_defaults
|
24
|
+
add_class "theme-#{type}"
|
25
|
+
tag_attr role: "banner"
|
26
|
+
|
27
|
+
@icon ||= case type
|
28
|
+
when "default"
|
29
|
+
"message-text"
|
30
|
+
when "alert"
|
31
|
+
"message-alert"
|
32
|
+
when "admin"
|
33
|
+
"admin-user"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class App::HeaderComponent < SparkComponents::Component
|
2
|
+
|
3
|
+
element :search
|
4
|
+
element :actions do
|
5
|
+
aria_attr label: "site actions"
|
6
|
+
tag_attr role: "navigation"
|
7
|
+
base_class "app-header-actions"
|
8
|
+
end
|
9
|
+
|
10
|
+
def render
|
11
|
+
content_tag(:header, class: "app-header", role: "banner") do
|
12
|
+
concat component("app/sidebar/toggle")
|
13
|
+
concat logo
|
14
|
+
concat search
|
15
|
+
if trial || actions
|
16
|
+
concat content_tag(:nav, actions.attrs) {
|
17
|
+
concat trial
|
18
|
+
concat actions
|
19
|
+
}
|
20
|
+
end
|
21
|
+
concat self
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
element :logo do
|
26
|
+
attribute :image, :href
|
27
|
+
|
28
|
+
def render
|
29
|
+
link_to href, class: 'app-header-logo' do
|
30
|
+
image || @view.use_svg('logo', height: '30')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
element :trial do
|
36
|
+
attribute :end_date, :href
|
37
|
+
base_class "trial-status"
|
38
|
+
|
39
|
+
def render
|
40
|
+
add_class "trial-ended" if days < 1
|
41
|
+
add_class "trial-ending-soon" if 1 <= days && days < 5
|
42
|
+
|
43
|
+
content_tag( :div, attrs ) do
|
44
|
+
concat content_tag( :span, class: 'trial-status-text' ) { text }
|
45
|
+
concat " "
|
46
|
+
concat link_to "Manage", href, class: 'trial-status-link'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def days
|
51
|
+
[0, (end_date.to_date - Time.zone.now.to_date).to_i].max
|
52
|
+
end
|
53
|
+
|
54
|
+
def text
|
55
|
+
%(#{@view.pluralize(days, 'day')} left in trial)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class App::LayoutComponent < SparkComponents::Component
|
2
|
+
base_class "app-wrapper"
|
3
|
+
|
4
|
+
element :content do
|
5
|
+
base_class "app-content"
|
6
|
+
|
7
|
+
def render
|
8
|
+
data_attr scroll: true
|
9
|
+
content_tag(:div, @yield, attrs)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def render
|
14
|
+
add_class "with-sidebar" if @sidebar
|
15
|
+
@view.capture do
|
16
|
+
@banner.each { |item| concat(item) } if @banner
|
17
|
+
concat content_tag(:div, attrs) {
|
18
|
+
concat ie_fix
|
19
|
+
concat @sidebar
|
20
|
+
concat content_tag(:div, class: "app-main") {
|
21
|
+
concat @header
|
22
|
+
concat content
|
23
|
+
}
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def sidebar(options, &block)
|
29
|
+
@sidebar = compose('app/sidebar', options, &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
def header(options, &block)
|
33
|
+
@header = compose('app/header', options, &block)
|
34
|
+
end
|
35
|
+
|
36
|
+
def banner(options, &block)
|
37
|
+
@banner ||= []
|
38
|
+
@banner.push compose('app/banner', options, &block)
|
39
|
+
end
|
40
|
+
|
41
|
+
def compose(name, options, &block)
|
42
|
+
if options[:render]
|
43
|
+
@view.render(options[:render])
|
44
|
+
else
|
45
|
+
component(name, options, &block)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def ie_fix
|
50
|
+
content_tag(:script) do
|
51
|
+
%((function(){
|
52
|
+
if (!!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/))) {
|
53
|
+
var wrapper = document.querySelector('.app-wrapper')
|
54
|
+
wrapper.style.flexBasis = "calc(100vh - "+wrapper.offsetTop+"px)";
|
55
|
+
}
|
56
|
+
})()).html_safe
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
(function(){
|
2
|
+
window.requestAnimationFrame(function(){
|
3
|
+
var header = document.querySelector('.app-sidebar-header')
|
4
|
+
var sidebar = document.querySelector('.nav-tree')
|
5
|
+
|
6
|
+
if (sidebar && header) {
|
7
|
+
header.style.width = sidebar.clientWidth + 'px';
|
8
|
+
}
|
9
|
+
})
|
10
|
+
})()
|
11
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class App::Sidebar::HeaderComponent < SparkComponents::Component
|
2
|
+
attribute :account, :contact, :avatar
|
3
|
+
base_class "app-sidebar-header"
|
4
|
+
add_class "dropdown"
|
5
|
+
|
6
|
+
def render
|
7
|
+
@view.capture {
|
8
|
+
concat content_tag(:script, render_partial("app/sidebar/header/header.js"))
|
9
|
+
concat content_tag(:header, attrs) {
|
10
|
+
concat content_tag(:a, class: "dropdown-toggle", href: "javascript:void(0)", "data-toggle" => "dropdown") {
|
11
|
+
concat content_tag(:div, class: "details") {
|
12
|
+
concat account_tag
|
13
|
+
concat icon
|
14
|
+
concat user_tag
|
15
|
+
}
|
16
|
+
concat avatar_tag
|
17
|
+
}
|
18
|
+
concat self
|
19
|
+
}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def account_tag
|
24
|
+
content_tag(:div, account, class: "account-name")
|
25
|
+
end
|
26
|
+
|
27
|
+
def user_tag
|
28
|
+
content_tag(:div, contact, class: "user-name")
|
29
|
+
end
|
30
|
+
|
31
|
+
def avatar_tag
|
32
|
+
content_tag(:div, class: "user-avatar") {
|
33
|
+
@view.image_tag(avatar, alt: "User Photo")
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def icon
|
38
|
+
@view.use_svg('chevron-down', width: '9', class: 'dropdown-icon')
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class App::Sidebar::ToggleComponent < SparkComponents::Component
|
2
|
+
data_attr toggle_sidebar: 'true'
|
3
|
+
base_class "app-sidebar-toggle"
|
4
|
+
tag_attr href: "#"
|
5
|
+
def render
|
6
|
+
content_tag(:a, attrs) do
|
7
|
+
content_tag(:span, class: "icon-wrapper") {
|
8
|
+
content_tag(:span, nil, class: "close-sidebar-icon", "aria-label" => "toggle sidebar")
|
9
|
+
}
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Nav::GroupComponent < SparkComponents::Component
|
2
|
+
element :item, multiple: true, component: "nav/item"
|
3
|
+
attribute item_role: 'menuitem'
|
4
|
+
|
5
|
+
def pre_render
|
6
|
+
add_class "active" if active?
|
7
|
+
end
|
8
|
+
|
9
|
+
def render
|
10
|
+
unless items.empty?
|
11
|
+
content_tag(:ul, class: "nav-group", role: "group") do
|
12
|
+
items.each { |item|
|
13
|
+
concat content_tag(:li, item, class: "nav-item-wrapper", role: item_role)
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def new?
|
20
|
+
items.any?(&:new?)
|
21
|
+
end
|
22
|
+
|
23
|
+
def beta?
|
24
|
+
items.any?(&:beta?)
|
25
|
+
end
|
26
|
+
|
27
|
+
def active?
|
28
|
+
items.any?(&:active)
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Nav::ItemComponent < SparkComponents::Component
|
2
|
+
attribute :text, :icon, :detail, :active, :beta, :new, :href
|
3
|
+
attribute icon_size: '18px'
|
4
|
+
base_class "nav-item"
|
5
|
+
|
6
|
+
def pre_render
|
7
|
+
add_class "active" if active
|
8
|
+
tag_attr(href: href || "#")
|
9
|
+
end
|
10
|
+
|
11
|
+
def render
|
12
|
+
content_tag(:a, attrs) do
|
13
|
+
concat @view.use_svg(icon, width: icon_size, class: join_class("icon")) if icon
|
14
|
+
concat content_tag(:span, class: join_class("content")) {
|
15
|
+
concat content_tag(:span, text || self, class: join_class("text"))
|
16
|
+
concat content_tag(:span, label.upcase, class: [join_class("label"), label]) if label
|
17
|
+
}
|
18
|
+
concat content_tag(:span, detail, class: join_class("detail")) if detail
|
19
|
+
concat self if text
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def label
|
24
|
+
if is_new?
|
25
|
+
"new"
|
26
|
+
elsif beta
|
27
|
+
"beta"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def is_new?
|
32
|
+
if new.is_a?(String)
|
33
|
+
30.days.ago <= Time.zone.parse( new )
|
34
|
+
else
|
35
|
+
new
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Nav::SidebarComponent < SparkComponents::Component
|
2
|
+
aria_attr :label
|
3
|
+
base_class "sidebar-nav"
|
4
|
+
|
5
|
+
element :header
|
6
|
+
element :nav, component: "nav/group"
|
7
|
+
element :footer
|
8
|
+
|
9
|
+
def render
|
10
|
+
content_tag(:nav, attrs) do
|
11
|
+
concat header
|
12
|
+
concat nav
|
13
|
+
concat footer
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class Nav::Tree::GroupComponent < Nav::GroupComponent
|
2
|
+
attribute :icon, :text, expanded: false
|
3
|
+
tag_attr role: "treeitem"
|
4
|
+
base_class "nav-item-wrapper"
|
5
|
+
|
6
|
+
def pre_render
|
7
|
+
super
|
8
|
+
add_class "tree-node"
|
9
|
+
data_attr(node: node)
|
10
|
+
aria_attr(expanded: expanded?)
|
11
|
+
@item_role = item.respond_to?(:href) ? "none" : "treeitem"
|
12
|
+
end
|
13
|
+
|
14
|
+
def render
|
15
|
+
unless items.empty?
|
16
|
+
content_tag(:li, attrs) do
|
17
|
+
concat @view.component("nav/item", text: text, icon: icon, class: "tree-trigger") { expand_icon }
|
18
|
+
concat super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def expand_icon
|
24
|
+
@view.use_svg( 'chevron-down', class: "expand-icon", width: "9px" )
|
25
|
+
end
|
26
|
+
|
27
|
+
def node
|
28
|
+
@node ||= text.strip.downcase.gsub(/[\W,-]+/, '_')
|
29
|
+
end
|
30
|
+
|
31
|
+
def expanded?
|
32
|
+
@expanded || active?
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class Nav::TreeComponent < SparkComponents::Component
|
2
|
+
base_class "nav-tree"
|
3
|
+
tag_attr :id, role: "tree"
|
4
|
+
aria_attr :label
|
5
|
+
|
6
|
+
def pre_render
|
7
|
+
data_attr tree: id
|
8
|
+
end
|
9
|
+
|
10
|
+
element :item, multiple: true, component: "nav/item" do
|
11
|
+
add_class "tree-node"
|
12
|
+
end
|
13
|
+
|
14
|
+
element :group, component: "nav/tree/group" do
|
15
|
+
def render
|
16
|
+
parent.items << super unless items.empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
def expanded?
|
20
|
+
parent.group_expanded?(node) || active? || expanded
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def render
|
25
|
+
content_tag(:ul, attrs) do
|
26
|
+
items.each { |item|
|
27
|
+
# Wrap links in `<li>`s if it's a link
|
28
|
+
item = content_tag(:li, item, class: "nav-item-wrapper", role: "none") if item.respond_to?(:href)
|
29
|
+
concat item
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def group_expanded?(node)
|
35
|
+
@_cookie ||= begin
|
36
|
+
@view.parse_cookie( id )
|
37
|
+
rescue
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
41
|
+
@_cookie && !!@_cookie[ node ]
|
42
|
+
end
|
43
|
+
end
|