Module: Pwb::ApplicationHelper
- Defined in:
- app/helpers/pwb/application_helper.rb
Instance Method Summary collapse
- #agency_info(agency, field_name, field_label_key, field_icon) ⇒ Object
-
#area_unit(property) ⇒ Object
def meta_tags(tags_array = []) tags_string = “” tags_array.each do |tag| tags_string += “<meta property=‘#:property’ content=‘#:content’ />” end content_for :page_head, tags_string # <meta property=“og:image” content=“
”> end. - #localized_link_to(locale_with_var = nil, options = nil, _html_options = nil) ⇒ Object
- #page_title(title_val) ⇒ Object
- #properties_carousel_footer ⇒ Object
- #simple_inmo_input(f, field_key, placeholder_key, input_type, required) ⇒ Object
- #simple_inmo_textarea(f, field_key, placeholder_key, _input_type, required, height = 150) ⇒ Object
- #social_media_link(agency, field_name, field_label, field_icon) ⇒ Object
- #t_or_unknown(key) ⇒ Object
Instance Method Details
#agency_info(agency, field_name, field_label_key, field_icon) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'app/helpers/pwb/application_helper.rb', line 164 def agency_info(agency, field_name, field_label_key, field_icon) if agency && agency[field_name].present? html = <<-HTML <h5><i class="fa #{field_icon}"></i>#{I18n.t field_label_key}</h5> <p>#{agency[field_name]}</p> HTML html.html_safe else "" end end |
#area_unit(property) ⇒ Object
def meta_tags(tags_array = [])
= ""
.each do |tag|
+= "<meta property='#{tag[:property]}' content='#{tag[:content]}' />"
end
content_for :page_head,
# <meta property="og:image" content="http://examples.opengraphprotocol.us/media/images/75.png">
end
24 25 26 27 28 29 30 |
# File 'app/helpers/pwb/application_helper.rb', line 24 def area_unit(property) area_unit = "m<sup>2</sup>" if property.area_unit && (property.area_unit == "sqft") area_unit = "sqft" end area_unit.html_safe end |
#localized_link_to(locale_with_var = nil, options = nil, _html_options = nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/helpers/pwb/application_helper.rb', line 32 def localized_link_to(locale_with_var = nil, = nil, = nil) link_class = locale_with_var["variant"] href = "/#{['locale']}" begin href = url_for() rescue ActionController::UrlGenerationError end link = "<a class='#{link_class}' href='#{href}'></a>" link.html_safe # if params["controller"] && params["controller"].include?("devise/") # link = "<a class='#{link_class}' href='/#{options["locale"]}'></a>" # return link.html_safe # else # return link_to "", options, html_options # end end |
#page_title(title_val) ⇒ Object
11 12 13 |
# File 'app/helpers/pwb/application_helper.rb', line 11 def page_title(title_val) content_for :page_title, title_val.to_s end |
#properties_carousel_footer ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/helpers/pwb/application_helper.rb', line 3 def # TODO: - diplay array of thumbnails below main # properties carousel is images count > ... # <a href="#" class="theater" rel="group" hidefocus="true"> # <%= opt_image_tag((@property_details.ordered_photo 3), :quality => "auto", class: "", alt: "") %> # </a> end |
#simple_inmo_input(f, field_key, placeholder_key, input_type, required) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'app/helpers/pwb/application_helper.rb', line 112 def simple_inmo_input(f, field_key, placeholder_key, input_type, required) placeholder = placeholder_key.present? ? I18n.t("placeHolders." + placeholder_key) : "" label_class = required ? "obligatorio" : "" html = <<-HTML <label class=#{label_class}> #{I18n.t(field_key)} </label> #{f.text_field field_key, :class => 'form-control texto', :type => input_type, :required => required, :"aria-required" => required, :placeholder => placeholder} <div class="validacion"></div> HTML html.html_safe end |
#simple_inmo_textarea(f, field_key, placeholder_key, _input_type, required, height = 150) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'app/helpers/pwb/application_helper.rb', line 128 def simple_inmo_textarea(f, field_key, placeholder_key, _input_type, required, height = 150) placeholder = placeholder_key.present? ? I18n.t("placeHolders." + placeholder_key) : "" label_class = required ? "obligatorio" : "" style = "height:#{height}px" html = <<-HTML <label class=#{label_class}> #{I18n.t(field_key)} </label> #{f.text_area field_key, :class => 'form-control', :style => style, :required => required, :"aria-required" => required, :placeholder => placeholder} <div class="validacion"></div> HTML html.html_safe end |
#social_media_link(agency, field_name, field_label, field_icon) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'app/helpers/pwb/application_helper.rb', line 145 def (agency, field_name, field_label, field_icon) = nil # binding.pry if agency..present? && agency.[field_name].present? = agency. end if html = <<-HTML <a href="#{agency.[field_name]}" title="#{field_label}" target="_blank" class=""> <i class="fa #{field_icon}"></i> </a> HTML html.html_safe else "" end end |
#t_or_unknown(key) ⇒ Object
50 51 52 53 54 55 56 |
# File 'app/helpers/pwb/application_helper.rb', line 50 def t_or_unknown(key) if key.is_a?(String) && key.empty? t "unknown" else t key end end |