frontie 0.0.1 → 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.
@@ -0,0 +1,19 @@
1
+ module MapHelper
2
+
3
+ # Location and map helpers: Provide a google map link or image
4
+ # ------------------------------------------------------------------------------------------------------
5
+
6
+ # Return a Google Map link based on an address
7
+ def map_link address, text="map"
8
+ return if address.nil?
9
+ link_to "https://maps.google.com/?q=#{address}", :class => "map-link", :title => "View in Google Maps", :target => "_blank" do
10
+ "(#{text})"
11
+ end
12
+ end
13
+
14
+ # Return a google map image for a given location
15
+ def map_image location, width=500, height=275, zoom=15
16
+ image_tag("http://maps.googleapis.com/maps/api/staticmap?center=#{location.latitude},#{location.longitude}&zoom=#{zoom}&size=#{width}x#{height}&markers=color:blue%7Clabel:1%7C#{location.latitude},#{location.longitude}&sensor=false", :class => "map_image")
17
+ end
18
+
19
+ end
@@ -1,6 +1,7 @@
1
1
  require 'frontie/active_state_helper'
2
2
  require 'frontie/date_time_helper'
3
3
  require 'frontie/links_helper'
4
+ require 'frontie/map_helper'
4
5
  require 'frontie/utility_helper'
5
6
 
6
7
  module Frontie
@@ -14,6 +15,9 @@ module Frontie
14
15
  initializer 'links.helper' do |app|
15
16
  ActionView::Base.send :include, LinksHelper
16
17
  end
18
+ initializer 'map.helper' do |app|
19
+ ActionView::Base.send :include, MapHelper
20
+ end
17
21
  initializer 'utility.helper' do |app|
18
22
  ActionView::Base.send :include, UtilityHelper
19
23
  end
@@ -1,5 +1,18 @@
1
1
  module UtilityHelper
2
2
 
3
+ # Create a conditional <html> tag
4
+ def conditional_html lang = "en", &block
5
+ haml_concat Haml::Util::html_safe <<-"HTML".gsub( /^\s+/, '' )
6
+ <!--[if lt IE 7 ]><html lang="#{lang}" class="no-js ie6" > <![endif]-->
7
+ <!--[if IE 7 ]><html lang="#{lang}" class="no-js ie7" > <![endif]-->
8
+ <!--[if IE 8 ]><html lang="#{lang}" class="no-js ie8" > <![endif]-->
9
+ <!--[if IE 9 ]><html lang="#{lang}" class="no-js ie9" > <![endif]-->
10
+ <!--[if (gte IE 9)|!(IE)]><!--> <html lang="#{lang}" class="no-js" > <!--<![endif]-->
11
+ HTML
12
+ haml_concat capture( &block ) << Haml::Util::html_safe( "\n</html>" ) if block_given?
13
+ end
14
+
15
+
3
16
  # takes a string and will return the same string but with email addresses encoded and hyperlinked
4
17
  def emailitize text
5
18
  text.gsub(/([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})/i) {|m|
@@ -1,3 +1,3 @@
1
1
  module Frontie
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frontie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-18 00:00:00.000000000 Z
12
+ date: 2013-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -60,6 +60,7 @@ files:
60
60
  - lib/frontie/active_state_helper.rb
61
61
  - lib/frontie/date_time_helper.rb
62
62
  - lib/frontie/links_helper.rb
63
+ - lib/frontie/map_helper.rb
63
64
  - lib/frontie/railtie.rb
64
65
  - lib/frontie/utility_helper.rb
65
66
  - lib/frontie/version.rb
@@ -84,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
85
  version: '0'
85
86
  requirements: []
86
87
  rubyforge_project:
87
- rubygems_version: 1.8.25
88
+ rubygems_version: 1.8.23
88
89
  signing_key:
89
90
  specification_version: 3
90
91
  summary: Front-end Utilities for your Rails Applications