right-rails 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@ module RightRails::Helpers::Basic
23
23
  end
24
24
 
25
25
  # use the sources in the development environment
26
- if defined? RAILS_ENV && RAILS_ENV == 'development'
26
+ if defined?(RAILS_ENV) && RAILS_ENV == 'development'
27
27
  scripts.collect!{ |name| name + '-src' }
28
28
  end
29
29
 
@@ -119,7 +119,7 @@ module RightRails::Helpers::Forms
119
119
  #
120
120
  def rater_display(value, options={})
121
121
  content_tag :div, (0...(options[:size] || 5)).to_a.collect{ |i|
122
- content_tag :div, '', :class => i < value ? 'right-rater-glow' : nil
122
+ content_tag :div, '&#9733;', :class => i < value ? 'right-rater-glow' : nil
123
123
  }.join(''), :class => 'right-rater right-rater-disabled'
124
124
  end
125
125
 
@@ -6,9 +6,12 @@ module RightRails::Helpers::Misc
6
6
  # Just a simple flashes generator, might be replaced in the application
7
7
  #
8
8
  def flashes
9
- content_tag(:div, flash.collect{ |key, text|
9
+ items = flash.collect{ |key, text|
10
10
  content_tag(:div, text, :class => key)
11
- }.sort, :id => :flashes, :style => (flash.empty? ? 'display: none' : nil))
11
+ }.sort.join("")
12
+
13
+ content_tag(:div, items.send(''.respond_to?(:html_safe) ? :html_safe : :to_s),
14
+ :id => :flashes, :style => (flash.empty? ? 'display: none' : nil))
12
15
  end
13
16
 
14
17
 
@@ -33,10 +36,12 @@ module RightRails::Helpers::Misc
33
36
  escape = options[:escape].nil? ? true : options[:escape]
34
37
  field = args.first
35
38
 
36
- content_tag :ul, entries.collect{ |entry|
39
+ items = entries.collect{ |entry|
37
40
  entry = entry.send(field) if field
38
41
  content_tag :li, highlight ? highlight(entry, highlight) : escape ? h(entry) : entry
39
- }
42
+ }.join("")
43
+
44
+ content_tag :ul, items.send(''.respond_to?(:html_safe) ? :html_safe : :to_s)
40
45
  end
41
46
 
42
47
 
@@ -41,14 +41,6 @@ describe RightRails::Helpers::Basic do
41
41
  rightjs_scripts
42
42
  end
43
43
 
44
- it "should use the source scripts in the development environment" do
45
- should_receive(:javascript_include_tag).with(*%w{right-src right/rails-src})
46
-
47
- RAILS_ENV = 'development'
48
-
49
- rightjs_scripts
50
- end
51
-
52
44
  it "should build a script-generator for the rjs method" do
53
45
  rjs.should be_a(RightRails::JavaScriptGenerator)
54
46
  end
@@ -70,4 +62,20 @@ describe RightRails::Helpers::Basic do
70
62
  page.boo.boo.boo
71
63
  end.to_s.should == 'javascript_tag'
72
64
  end
65
+
66
+ describe "in the development mode" do
67
+ before :all do
68
+ Kernel::RAILS_ENV = 'development'
69
+ end
70
+
71
+ after :all do
72
+ Kernel::RAILS_ENV = 'production'
73
+ end
74
+
75
+ it "should use the source scripts" do
76
+ should_receive(:javascript_include_tag).with(*%w{right-src right/rails-src})
77
+
78
+ rightjs_scripts
79
+ end
80
+ end
73
81
  end
@@ -46,6 +46,6 @@ describe RightRails::Helpers::Forms do
46
46
 
47
47
  it "should generate the #rater_display tag" do
48
48
  rater_display(4).should ==
49
- %Q{<div class="right-rater right-rater-disabled"><div class="right-rater-glow">★</div><div class="right-rater-glow">★</div><div class="right-rater-glow">★</div><div class="right-rater-glow">★</div><div>★</div></div>}
49
+ %Q{<div class="right-rater right-rater-disabled"><div class="right-rater-glow">&#9733;</div><div class="right-rater-glow">&#9733;</div><div class="right-rater-glow">&#9733;</div><div class="right-rater-glow">&#9733;</div><div>&#9733;</div></div>}
50
50
  end
51
51
  end
@@ -17,6 +17,16 @@ module ActionView::Helpers::RailsLegacyHelper
17
17
  link_to_function(name, remote_function(options), html_options || options.delete(:html))
18
18
  end
19
19
 
20
+ def link_to_function(name, *args, &block)
21
+ html_options = args.extract_options!.symbolize_keys
22
+
23
+ function = block_given? ? update_page(&block) : args[0] || ''
24
+ onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function}; return false;"
25
+ href = html_options[:href] || '#'
26
+
27
+ content_tag(:a, name, html_options.merge(:href => href, :onclick => onclick))
28
+ end
29
+
20
30
  def button_to_remote(name, options = {}, html_options = {})
21
31
  button_to_function(name, remote_function(options), html_options)
22
32
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nikolay Nemshilov
@@ -14,11 +14,11 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-28 00:00:00 +03:00
17
+ date: 2010-03-31 00:00:00 +04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
21
- description: RightRails provides support of the RightJS framework with transparent Rails/Prototype replacements, plus it has a new RJS processor, the most common ajax operations interface, RightJS own features support, remote files uploading handler, etc.
21
+ description: RightRails provides support of the RightJS JavaScript framework. It has transparent Prototype helpers replacement, plus there is a new RJS processor, the most common ajax operations interface, RightJS own features support, remote files uploading handler, etc.
22
22
  email: nemshilov@gmail.com
23
23
  executables: []
24
24
 
@@ -113,9 +113,7 @@ has_rdoc: true
113
113
  homepage: http://github.com/MadRabbit/right-rails
114
114
  licenses: []
115
115
 
116
- post_install_message: "\n\
117
- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< RIGHT RAILS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n Please run the following command to copy RightJS scripts and modules in place\n \n script/generate right_rails\n\n\
118
- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< RIGHT RAILS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n "
116
+ post_install_message:
119
117
  rdoc_options: []
120
118
 
121
119
  require_paths: