Module: Depo::ViewHelpers
- Defined in:
- lib/depo/view_helpers.rb
Instance Method Summary collapse
-
#add_ext(str, ext) ⇒ Object
check if ext presented and add if not.
- #app_js ⇒ Object
- #app_package ⇒ Object
- #css ⇒ Object
- #djConfig ⇒ Object
- #dojo(opts) ⇒ Object
- #theme ⇒ Object
- #webroot ⇒ Object
Instance Method Details
#add_ext(str, ext) ⇒ Object
check if ext presented and add if not
18 19 20 |
# File 'lib/depo/view_helpers.rb', line 18 def add_ext(str,ext) ( str.strip=~/\.#{ext}$/ ) ? str.strip : "#{str.strip}.#{ext}" end |
#app_js ⇒ Object
39 40 41 |
# File 'lib/depo/view_helpers.rb', line 39 def app_js %Q[#{webroot}/#{app_package}/pages/#{@opts[:app]}.js] end |
#app_package ⇒ Object
13 14 15 |
# File 'lib/depo/view_helpers.rb', line 13 def app_package @app_package||=Depo.config.app_package end |
#css ⇒ Object
22 23 24 |
# File 'lib/depo/view_helpers.rb', line 22 def css %Q[#{webroot}/#{app_package}/themes/#{theme}/#{add_ext(@opts[:app],'css')}] end |
#djConfig ⇒ Object
9 10 11 |
# File 'lib/depo/view_helpers.rb', line 9 def djConfig Depo.config.env_dj_config(@opts[:env]) end |
#dojo(opts) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/depo/view_helpers.rb', line 26 def dojo(opts) return @dojo_tpl if @dojo_tpl raise "You must provide :app name in opts" unless opts[:app] @opts = opts @opts[:env] = (defined? RAILS_ENV && !opts[:env])? RAILS_ENV : opts[:env] tpl_string = File.read("#{File.dirname(__FILE__)}/templates/dojo_src.tpl") @dojo_tpl = ERB.new(tpl_string).result(binding) end |
#theme ⇒ Object
35 36 37 |
# File 'lib/depo/view_helpers.rb', line 35 def theme Depo.config.default_theme end |
#webroot ⇒ Object
5 6 7 |
# File 'lib/depo/view_helpers.rb', line 5 def webroot Depo.config.env_root_webpath(@opts[:env]) end |