Sha256: 421abe773059263ffe3287754517598dda6b7de30a037bcf6953fb532e8658c6
Contents?: true
Size: 1.85 KB
Versions: 2
Compression:
Stored size: 1.85 KB
Contents
if defined?(ActionView) and defined?(ActionView::Base) class ActionView::Base def whowish_word_javascript_and_css(force = false) return "" if @whowish_word_config.edit_mode != true and force == false script_text = <<-HTML <script type="text/javascript"> $w(function() { $w.whowishWord(); }); </script> HTML return "<script src='/whowish_word_js?#{Time.now.to_i}' type='text/javascript'></script>".html_safe + \ "<link href='/whowish_word_css?#{Time.now.to_i}' rel='stylesheet' type='text/css' />".html_safe + \ script_text.html_safe end def global_word_for(namespace, id, *variables) if @whowish_word_config.edit_mode == true return WhowishWord.word_for_in_edit_mode(namespace, id, @whowish_word_config.locale, *variables) else return WhowishWord.word_for(namespace, id, @whowish_word_config.locale, *variables) end end def global_word_for_attr(namespace, id, *variables) if @whowish_word_config.edit_mode == true return WhowishWord.word_for_attr_in_edit_mode(namespace, id, @whowish_word_config.locale, *variables) else return WhowishWord.word_for_attr(namespace, id, @whowish_word_config.locale, *variables) end end def word_for(id, *variables) namespace = get_relative_view_path(@whowish_word_page) global_word_for(namespace, id, *variables) end def word_for_attr(id, *variables) namespace = get_relative_view_path(@whowish_word_page) global_word_for_attr(namespace, id, *variables) end private def get_relative_view_path(full_path) result = @whowish_word_page.match(/[\/\\](([^\/\\]+)[\/\\]([^\/\\]+))\Z/) return result[1] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whowish_word-0.3.3 | lib/whowish_word/action_view/base.rb |
whowish_word-0.3.2 | lib/whowish_word/action_view/base.rb |