jrails_ui 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/Manifest +11 -0
- data/README +13 -0
- data/Rakefile +34 -0
- data/init.rb +2 -0
- data/install.rb +1 -0
- data/jrails_ui.gemspec +31 -0
- data/lib/jrails_ui.rb +71 -0
- data/lib/tasks/jrails_ui_tasks.rake +4 -0
- data/test/jrails_ui_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- data/uninstall.rb +1 -0
- metadata +87 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 [name of plugin creator]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest
ADDED
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/rdoctask'
|
6
|
+
|
7
|
+
Echoe.new('jrails_ui', '0.0.1') do |p|
|
8
|
+
p.description = "Helper Methods for use with websites implementing the jQuery-UI toolkit"
|
9
|
+
p.url = "http://github.com/windigo/jrails_ui"
|
10
|
+
p.author = "Jaden Carver"
|
11
|
+
p.email = "jaden.carver@gmail.com"
|
12
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
13
|
+
p.development_dependencies = []
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Default: run unit tests.'
|
17
|
+
task :default => :test
|
18
|
+
|
19
|
+
desc 'Test the jrails_ui plugin.'
|
20
|
+
Rake::TestTask.new(:test) do |t|
|
21
|
+
t.libs << 'lib'
|
22
|
+
t.libs << 'test'
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
24
|
+
t.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Generate documentation for the jrails_ui plugin.'
|
28
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
29
|
+
rdoc.rdoc_dir = 'rdoc'
|
30
|
+
rdoc.title = 'Jrails-ui'
|
31
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
32
|
+
rdoc.rdoc_files.include('README')
|
33
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
34
|
+
end
|
data/init.rb
ADDED
data/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
data/jrails_ui.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{jrails_ui}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jaden Carver"]
|
9
|
+
s.date = %q{2010-11-30}
|
10
|
+
s.description = %q{Helper Methods for use with websites implementing the jQuery-UI toolkit}
|
11
|
+
s.email = %q{jaden.carver@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["README", "lib/jrails_ui.rb", "lib/tasks/jrails_ui_tasks.rake"]
|
13
|
+
s.files = ["MIT-LICENSE", "README", "Rakefile", "init.rb", "install.rb", "lib/jrails_ui.rb", "lib/tasks/jrails_ui_tasks.rake", "test/jrails_ui_test.rb", "test/test_helper.rb", "uninstall.rb", "Manifest", "jrails_ui.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/windigo/jrails_ui}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Jrails_ui", "--main", "README"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{jrails_ui}
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
|
+
s.summary = %q{Helper Methods for use with websites implementing the jQuery-UI toolkit}
|
20
|
+
s.test_files = ["test/jrails_ui_test.rb", "test/test_helper.rb"]
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 3
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
+
else
|
28
|
+
end
|
29
|
+
else
|
30
|
+
end
|
31
|
+
end
|
data/lib/jrails_ui.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Jrails-ui
|
2
|
+
module ActionView
|
3
|
+
module Helpers
|
4
|
+
module JavaScriptHelper
|
5
|
+
|
6
|
+
def hash_to_jquery(hash)
|
7
|
+
'{'+hash.map { |k,v|
|
8
|
+
[k,
|
9
|
+
case v.class.name
|
10
|
+
when 'String'
|
11
|
+
"'#{v}'"
|
12
|
+
when 'Hash'
|
13
|
+
hash_to_jquery(v)
|
14
|
+
else
|
15
|
+
v.to_s
|
16
|
+
end
|
17
|
+
].join(':')
|
18
|
+
}.join(',')+'}'
|
19
|
+
end
|
20
|
+
|
21
|
+
def flash_messages
|
22
|
+
content_tag(:div, :class => "ui-widget flash") do
|
23
|
+
flash.map { |type,message|
|
24
|
+
state = case type
|
25
|
+
when :notice; 'highlight'
|
26
|
+
when :error; 'error'
|
27
|
+
end
|
28
|
+
icon = case type
|
29
|
+
when :notice; 'info'
|
30
|
+
when :error; 'alert'
|
31
|
+
end
|
32
|
+
content_tag(:div, content_tag(:span, "", :class => "ui-icon ui-icon-#{icon}", :style => "float: left; margin-right: 0.3em;")+message, :class => "ui-state-#{state} ui-corner-all #{type}", :style => "margin-top: 5px; padding: 0.7em;")
|
33
|
+
}.join
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def icon(name, options = {})
|
38
|
+
content_tag :span, " ", options.merge( :class => "ui-icon ui-icon-#{name}" )
|
39
|
+
end
|
40
|
+
|
41
|
+
def link_to_dialog(*args, &block)
|
42
|
+
div_id = "dialog#{args[1].gsub(/\//,'_')}"
|
43
|
+
|
44
|
+
dialog = {
|
45
|
+
:modal => true,
|
46
|
+
:draggable => false,
|
47
|
+
:resizable => false,
|
48
|
+
:width => 600
|
49
|
+
}.merge(args[2][:dialog] || {})
|
50
|
+
|
51
|
+
args[2].merge!(
|
52
|
+
:onclick => "$('##{div_id}').dialog(#{hash_to_jquery(dialog)});return false;"
|
53
|
+
)
|
54
|
+
|
55
|
+
args[2].delete(:dialog)
|
56
|
+
|
57
|
+
if block_given?
|
58
|
+
dialog_html = capture(&block)
|
59
|
+
else
|
60
|
+
render_options = args[2][:render] || {}
|
61
|
+
dialog_html = render(render_options)
|
62
|
+
end
|
63
|
+
|
64
|
+
link_html = link_to(*args)+content_tag(:div, dialog_html, :style => 'display:none;', :id => div_id, :title => args.first)
|
65
|
+
|
66
|
+
return block_given? ? concat(link_html) : link_html
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/test/test_helper.rb
ADDED
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jrails_ui
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jaden Carver
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-11-30 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Helper Methods for use with websites implementing the jQuery-UI toolkit
|
23
|
+
email: jaden.carver@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README
|
30
|
+
- lib/jrails_ui.rb
|
31
|
+
- lib/tasks/jrails_ui_tasks.rake
|
32
|
+
files:
|
33
|
+
- MIT-LICENSE
|
34
|
+
- README
|
35
|
+
- Rakefile
|
36
|
+
- init.rb
|
37
|
+
- install.rb
|
38
|
+
- lib/jrails_ui.rb
|
39
|
+
- lib/tasks/jrails_ui_tasks.rake
|
40
|
+
- test/jrails_ui_test.rb
|
41
|
+
- test/test_helper.rb
|
42
|
+
- uninstall.rb
|
43
|
+
- Manifest
|
44
|
+
- jrails_ui.gemspec
|
45
|
+
has_rdoc: true
|
46
|
+
homepage: http://github.com/windigo/jrails_ui
|
47
|
+
licenses: []
|
48
|
+
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options:
|
51
|
+
- --line-numbers
|
52
|
+
- --inline-source
|
53
|
+
- --title
|
54
|
+
- Jrails_ui
|
55
|
+
- --main
|
56
|
+
- README
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 11
|
74
|
+
segments:
|
75
|
+
- 1
|
76
|
+
- 2
|
77
|
+
version: "1.2"
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: jrails_ui
|
81
|
+
rubygems_version: 1.3.7
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Helper Methods for use with websites implementing the jQuery-UI toolkit
|
85
|
+
test_files:
|
86
|
+
- test/jrails_ui_test.rb
|
87
|
+
- test/test_helper.rb
|