Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit bee54566778974274f4a4f1850f40942133e9970 @sandipransing committed Mar 15, 2010
@@ -0,0 +1,20 @@
+Copyright (c) 2010 [name of plugin creator]
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13 README
@@ -0,0 +1,13 @@
+RailsTooltip
+============
+
+Introduction goes here.
+
+
+Example
+=======
+
+Example goes here.
+
+
+Copyright (c) 2010 [name of plugin creator], released under the MIT license
@@ -0,0 +1,23 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the rails_tooltip plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the rails_tooltip plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'RailsTooltip'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,9 @@
+#demotip {
+ display:none;
+ background:transparent url(/images/black_arrow.png);
+ font-size:12px;
+ height:70px;
+ width:160px;
+ padding:25px;
+ color:#fff;
+}
@@ -0,0 +1,3 @@
+# Include hook code here
+require 'tooltip'
+ActionController::Base.send(:include, Tooltip)
@@ -0,0 +1 @@
+# Install hook code here
@@ -0,0 +1,36 @@
+module TinyMCE
+ module ClassMethods
+ def uses_tiny_mce(options = {})
+ tiny_mce_options = options.delete(:options) || nil
+ proc = Proc.new do |c|
+ c.instance_variable_set(:@tiny_mce_options, tiny_mce_options)
+ c.instance_variable_set(:@uses_tiny_mce, true)
+ end
+ before_filter(proc, options)
+ end
+ alias uses_text_editor uses_tiny_mce
+ end
+
+ module OptionValidator
+ class << self
+ cattr_accessor :plugins
+
+ def load
+ @@valid_options = File.open(File.dirname(__FILE__) + "/../tiny_mce_options.yml") { |f| YAML.load(f.read) }
+ end
+
+ def valid?(option)
+ @@valid_options.include?(option.to_s) || (plugins && plugins.include?(option.to_s.split('_')[0])) || option.to_s =~ /theme_advanced_container_/
+ end
+
+ def options
+ @@valid_options
+ end
+ end
+ end
+
+ def self.included(base)
+ base.extend(ClassMethods)
+ base.helper TinyMCEHelper
+ end
+end
@@ -0,0 +1,18 @@
+# RailsTooltip
+module Tooltip
+ module ClassMethods
+ def uses_tooltip(options = {})
+ tooltip_options = options.delete(:options) || nil
+ proc = Proc.new do |c|
+ c.instance_variable_set(:@uses_tooltip, true)
+ end
+ before_filter(proc, options)
+ end
+ end
+
+
+ def self.included(base)
+ base.extend(ClassMethods)
+ base.helper TooltipHelper
+ end
+end
@@ -0,0 +1,19 @@
+module TooltipHelper
+
+ def using_tooltip?
+ !@uses_tooltip.nil?
+ end
+
+ def tooltip_init_if_used( parent, child )
+ javascript_tag %{ $(document).ready(function() { $("##{parent} #{child}[title]").tooltip('#demotip'); }) } if @uses_tooltip
+ end
+
+ def rails_include_tooltip
+ %{ #{stylesheet_link_tag("tooltip") javascript_include_tag("jquery.tools.min")}}
+ end
+
+ def rails_tooltip_stuff_if_used
+ rails_include_tooltip if @uses_tooltip
+ end
+
+end
@@ -0,0 +1,16 @@
+# desc "Explaining what the task does"
+# task :rails_tooltip do
+# # Task goes here
+# end
+namespace :rails_tooltip do
+ desc 'Copy tooltip assets from plugin to app root'
+ task :install do
+ puts "** Copying tooltip plugin assets..."
+
+ source = File.join(RAILS_ROOT, '/vendor/plugins/rails_tooltip/assets/.')
+ FileUtils.cp_r source, RAILS_ROOT
+
+ puts "** Successfully installed tooltip assets"
+ end
+
+end
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class RailsTooltipTest < ActiveSupport::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
@@ -0,0 +1,3 @@
+require 'rubygems'
+require 'active_support'
+require 'active_support/test_case'
@@ -0,0 +1 @@
+# Uninstall hook code here

0 comments on commit bee5456

Please sign in to comment.