Module: Platformx::LayoutHelpers
- Defined in:
- lib/platformx/layout.rb
Overview
Layout helpers
Instance Method Summary collapse
-
#x_accordian_bottom ⇒ String
Accordian (bottom) view helper.
-
#x_accordian_top(tag: "p", id: "accordian", title: "") ⇒ Object
Accordian (top) view helper.
-
#x_card_bottom ⇒ String
Card (bottom) view helper.
-
#x_card_top(title: "", subtitle: "", card_class: "", header_css: "", buttons: "", modal_cog_url: "") ⇒ String
Card (top) view helper.
-
#x_gravitar(email: "") ⇒ String
Gravitar view helper.
-
#x_number_widget(label: "", value: "", icon: "", info_modal: "", inversed: false) ⇒ String
Dashboard Number Widget.
-
#x_panel_bottom ⇒ String
Panel bttom view helper.
-
#x_panel_top(title: "", panel_class: "") ⇒ String
Panel top view helper.
-
#x_tabs(active: "", tabs: array) ⇒ String
Student Tabs Nav.
Instance Method Details
#x_accordian_bottom ⇒ String
Accordian (bottom) view helper
99 100 101 102 103 104 105 106 107 108 |
# File 'lib/platformx/layout.rb', line 99 def x_accordian_bottom panel =<<EOS <!-- End Accordian --> </div> </div> </div> </div> EOS return panel end |
#x_accordian_top(tag: "p", id: "accordian", title: "") ⇒ Object
Accordian (top) view helper
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/platformx/layout.rb', line 78 def x_accordian_top(tag: "p", id: "accordian", title: "") panel =<<EOS <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <#{tag} class=""> <a data-target="#accordian_#{id}" href="#" data-toggle="collapse"> #{title} <b class="caret"></b> </a> </#{tag}> </div> <div id="accordian_#{id}" class="panel-collapse collapse"> <div class="panel-body"> <!-- Start Accordian --> EOS return panel end |
#x_card_bottom ⇒ String
Card (bottom) view helper
69 70 71 72 73 74 75 |
# File 'lib/platformx/layout.rb', line 69 def x_card_bottom panel =<<EOS </div> </div> EOS return panel end |
#x_card_top(title: "", subtitle: "", card_class: "", header_css: "", buttons: "", modal_cog_url: "") ⇒ String
Card (top) view helper
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/platformx/layout.rb', line 43 def x_card_top(title: "",subtitle: "", card_class: "", header_css: "", buttons: "", modal_cog_url: "") modal_cog_html = "" unless modal_cog_url == "" modal_cog_html = "<a href='#{modal_cog_url}' class='btn btn-button btn-sm' data-toggle='modal'><i class='fa fa-cog'></i></a>" end if title != "" title =<<EOS <div class="header #{header_css}"> <h4 class="title pull-left">#{title}</h4> <div class="pull-right title_right">#{} #{modal_cog_html}</div> <div class="clearfix"></div> <p class="category">#{subtitle}</p> </div> EOS end panel =<<EOS <div class="card #{card_class}"> #{title} <div class="content"> EOS return panel end |
#x_gravitar(email: "") ⇒ String
Gravitar view helper
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/platformx/layout.rb', line 113 def x_gravitar(email: "") hash = "" if !email.nil? # get the email from URL-parameters or what have you and make lowercase email_address = email.downcase # create the md5 hash hash = Digest::MD5.hexdigest(email_address) end # compile URL which can be used in <img src="RIGHT_HERE"... image_src = "https://www.gravatar.com/avatar/#{hash}?d=mm" return image_src end |
#x_number_widget(label: "", value: "", icon: "", info_modal: "", inversed: false) ⇒ String
Dashboard Number Widget
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/platformx/layout.rb', line 176 def (label: "", value: "", icon: "", info_modal: "", inversed: false) icon_html = "" unless icon == "" icon_html = "<i class='fa #{icon}'></i> " end info_modal_html = "" unless info_modal == "" info_modal_html = "<a href='#{info_modal}' class='' data-toggle='modal'><i class='fa fa-info-circle'></i></a>" end if inversed == false =<<EOS <div class="x_number_widget_wrapper"> <div class="x_number_widget_value">#{value}</div> <div class="x_number_widget_label">#{icon_html}#{label} #{info_modal_html}</div> </div> EOS else =<<EOS <div class="x_number_widget_wrapper_inversed"> <div class="x_number_widget_label">#{icon_html}#{label} #{info_modal_html}</div> <div class="x_number_widget_value">#{value}</div> </div> EOS end return end |
#x_panel_bottom ⇒ String
Panel bttom view helper
28 29 30 31 32 33 34 |
# File 'lib/platformx/layout.rb', line 28 def x_panel_bottom panel =<<EOS </div> </div> EOS return panel end |
#x_panel_top(title: "", panel_class: "") ⇒ String
Panel top view helper
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/platformx/layout.rb', line 10 def x_panel_top(title: "", panel_class: "") if title != "" title=<<EOS <div class="panel-heading"> <h3 class="panel-title">#{title}</h3> </div> EOS end panel =<<EOS <div class="panel #{panel_class}"> #{title} <div class="panel-body"> EOS return panel end |
#x_tabs(active: "", tabs: array) ⇒ String
Student Tabs Nav
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/platformx/layout.rb', line 133 def x_tabs(active: "", tabs: array) tab_builder = "" tabs.each do |t| s = "" if t[:name] == active active_s = "active" else active_s = "" end if t[:icon].present? icon = "<i class='fa #{t[:icon]}'></i> " else icon = "" end s =<<EOS <li class="#{active_s}"> <a href="#{t[:url]}">#{icon}#{t[:name]}</a> </li> EOS tab_builder << s end tab_wrapper =<<EOS <div class="tabs_wrapper"> <ul class="nav nav-tabs flex-wrap" role="tablist"> #{tab_builder} </ul> </div> EOS return tab_wrapper end |