fusionary-easel_helpers 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +1 -1
- data/Rakefile +1 -1
- data/easel_helpers.gemspec +5 -5
- data/lib/easel_helpers/helpers/{flash_helper.rb → message_helper.rb} +6 -6
- data/lib/easel_helpers/helpers/rjs_helper.rb +2 -2
- data/lib/easel_helpers/helpers.rb +2 -2
- data/test/{flash_helper_test.rb → message_helper_test.rb} +8 -8
- data/test/rjs_helper_test.rb +2 -2
- metadata +6 -6
data/Manifest
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
easel_helpers.gemspec
|
2
2
|
lib/easel_helpers/helpers/date_helper.rb
|
3
|
-
lib/easel_helpers/helpers/flash_helper.rb
|
4
3
|
lib/easel_helpers/helpers/form_helper.rb
|
5
4
|
lib/easel_helpers/helpers/grid_helper.rb
|
6
5
|
lib/easel_helpers/helpers/link_helper.rb
|
6
|
+
lib/easel_helpers/helpers/message_helper.rb
|
7
7
|
lib/easel_helpers/helpers/rjs_helper.rb
|
8
8
|
lib/easel_helpers/helpers/structure_helper.rb
|
9
9
|
lib/easel_helpers/helpers/table_helper.rb
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rake/testtask'
|
|
3
3
|
require 'rake/rdoctask'
|
4
4
|
require 'echoe'
|
5
5
|
|
6
|
-
Echoe.new("easel_helpers", "0.2.
|
6
|
+
Echoe.new("easel_helpers", "0.2.7") do |p|
|
7
7
|
p.description = "Fusionary Rails View Helpers"
|
8
8
|
p.url = "http://github.com/fusionary/easel_helpers"
|
9
9
|
p.author = "Joshua Clayton"
|
data/easel_helpers.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{easel_helpers}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.7"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Joshua Clayton"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-04}
|
10
10
|
s.description = %q{Fusionary Rails View Helpers}
|
11
11
|
s.email = %q{joshua.clayton@gmail.com}
|
12
|
-
s.extra_rdoc_files = ["lib/easel_helpers/helpers/date_helper.rb", "lib/easel_helpers/helpers/
|
13
|
-
s.files = ["easel_helpers.gemspec", "lib/easel_helpers/helpers/date_helper.rb", "lib/easel_helpers/helpers/
|
12
|
+
s.extra_rdoc_files = ["lib/easel_helpers/helpers/date_helper.rb", "lib/easel_helpers/helpers/form_helper.rb", "lib/easel_helpers/helpers/grid_helper.rb", "lib/easel_helpers/helpers/link_helper.rb", "lib/easel_helpers/helpers/message_helper.rb", "lib/easel_helpers/helpers/rjs_helper.rb", "lib/easel_helpers/helpers/structure_helper.rb", "lib/easel_helpers/helpers/table_helper.rb", "lib/easel_helpers/helpers.rb", "lib/easel_helpers/rails_partial_caching.rb", "lib/easel_helpers.rb", "README.textile", "tasks/easel_helpers_tasks.rake"]
|
13
|
+
s.files = ["easel_helpers.gemspec", "lib/easel_helpers/helpers/date_helper.rb", "lib/easel_helpers/helpers/form_helper.rb", "lib/easel_helpers/helpers/grid_helper.rb", "lib/easel_helpers/helpers/link_helper.rb", "lib/easel_helpers/helpers/message_helper.rb", "lib/easel_helpers/helpers/rjs_helper.rb", "lib/easel_helpers/helpers/structure_helper.rb", "lib/easel_helpers/helpers/table_helper.rb", "lib/easel_helpers/helpers.rb", "lib/easel_helpers/rails_partial_caching.rb", "lib/easel_helpers.rb", "Manifest", "MIT-LICENSE", "rails/init.rb", "Rakefile", "README.textile", "tasks/easel_helpers_tasks.rake", "test/date_helper_test.rb", "test/form_helper_test.rb", "test/grid_helper_test.rb", "test/link_helper_test.rb", "test/message_helper_test.rb", "test/rjs_helper_test.rb", "test/structure_helper_test.rb", "test/table_helper_test.rb", "test/test_helper.rb"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://github.com/fusionary/easel_helpers}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Easel_helpers", "--main", "README.textile"]
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.rubyforge_project = %q{easel_helpers}
|
19
19
|
s.rubygems_version = %q{1.3.2}
|
20
20
|
s.summary = %q{Fusionary Rails View Helpers}
|
21
|
-
s.test_files = ["test/date_helper_test.rb", "test/
|
21
|
+
s.test_files = ["test/date_helper_test.rb", "test/form_helper_test.rb", "test/grid_helper_test.rb", "test/link_helper_test.rb", "test/message_helper_test.rb", "test/rjs_helper_test.rb", "test/structure_helper_test.rb", "test/table_helper_test.rb", "test/test_helper.rb"]
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
24
24
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
@@ -1,23 +1,23 @@
|
|
1
1
|
module EaselHelpers
|
2
2
|
module Helpers
|
3
|
-
module
|
3
|
+
module MessageHelper
|
4
4
|
|
5
|
-
def
|
5
|
+
def messages(messages, options = {})
|
6
6
|
except_keys = [options[:except]].flatten.compact
|
7
7
|
only_keys = [options[:only]].flatten.compact
|
8
8
|
|
9
9
|
raise ArgumentError, ":only and :except options conflict; use one or the other" if except_keys.any? && only_keys.any?
|
10
10
|
|
11
11
|
keys = if except_keys.any?
|
12
|
-
|
12
|
+
messages.keys - except_keys
|
13
13
|
elsif only_keys.any?
|
14
|
-
|
14
|
+
messages.keys & only_keys
|
15
15
|
else
|
16
|
-
|
16
|
+
messages.keys
|
17
17
|
end
|
18
18
|
|
19
19
|
keys.map do |key|
|
20
|
-
content_tag :p,
|
20
|
+
content_tag :p, messages[key], :class => [key, "box", "single-line"].join(" ") unless messages[key].blank?
|
21
21
|
end.join
|
22
22
|
end
|
23
23
|
|
@@ -6,9 +6,9 @@ module EaselHelpers
|
|
6
6
|
container_id = options[:container] || "flash-container"
|
7
7
|
|
8
8
|
if options[:replace]
|
9
|
-
page.replace_html container_id,
|
9
|
+
page.replace_html container_id, messages(flash)
|
10
10
|
else
|
11
|
-
page.insert_html :top, container_id,
|
11
|
+
page.insert_html :top, container_id, messages(flash)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -4,7 +4,7 @@ require "easel_helpers/helpers/link_helper"
|
|
4
4
|
require "easel_helpers/helpers/structure_helper"
|
5
5
|
require "easel_helpers/helpers/table_helper"
|
6
6
|
require "easel_helpers/helpers/grid_helper"
|
7
|
-
require "easel_helpers/helpers/
|
7
|
+
require "easel_helpers/helpers/message_helper"
|
8
8
|
require "easel_helpers/helpers/rjs_helper"
|
9
9
|
|
10
10
|
module EaselHelpers
|
@@ -15,7 +15,7 @@ module EaselHelpers
|
|
15
15
|
include StructureHelper
|
16
16
|
include TableHelper
|
17
17
|
include GridHelper
|
18
|
-
include
|
18
|
+
include MessageHelper
|
19
19
|
include RjsHelper
|
20
20
|
|
21
21
|
protected
|
@@ -1,31 +1,31 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class MessageHelperTest < EaselHelpers::ViewTestCase
|
4
4
|
|
5
|
-
context "
|
5
|
+
context "messages" do
|
6
6
|
|
7
7
|
should "default with the correct structure" do
|
8
|
-
show_view %(<%=
|
8
|
+
show_view %(<%= messages(:structure => "Flash message") %>) do
|
9
9
|
assert_select "p.structure.box.single-line", "Flash message"
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
should "display all flash messages present" do
|
14
|
-
show_view %(<%=
|
14
|
+
show_view %(<%= messages(:structure => "Flash message", :error => "Warning message") %>) do
|
15
15
|
assert_select "p.structure", "Flash message"
|
16
16
|
assert_select "p.error", "Warning message"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
should "not display a flash if it is blank" do
|
21
|
-
show_view %(<%=
|
21
|
+
show_view %(<%= messages(:structure => "", :error => nil) %>) do
|
22
22
|
assert_select "p.structure", false
|
23
23
|
assert_select "p.error", false
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
should "filter by the :only option" do
|
28
|
-
show_view %(<%=
|
28
|
+
show_view %(<%= messages({:structure => "Flash message", :error => "Warning message", :notice => "Notice!"}, {:only => [:structure, :error]}) %>) do
|
29
29
|
assert_select "p.structure", "Flash message"
|
30
30
|
assert_select "p.error", "Warning message"
|
31
31
|
assert_select "p.notice", false
|
@@ -33,7 +33,7 @@ class FlashHelperTest < EaselHelpers::ViewTestCase
|
|
33
33
|
end
|
34
34
|
|
35
35
|
should "filter by the :except option" do
|
36
|
-
show_view %(<%=
|
36
|
+
show_view %(<%= messages({:structure => "Flash message", :error => "Warning message", :notice => "Notice!"}, {:except => [:structure, :error]}) %>) do
|
37
37
|
assert_select "p.structure", false
|
38
38
|
assert_select "p.error", false
|
39
39
|
assert_select "p.notice", "Notice!"
|
@@ -42,7 +42,7 @@ class FlashHelperTest < EaselHelpers::ViewTestCase
|
|
42
42
|
|
43
43
|
should "raise an error of :only and :except are both passed" do
|
44
44
|
assert_raise ArgumentError, /conflict/ do
|
45
|
-
show_view %(<%=
|
45
|
+
show_view %(<%= messages({:structure => "Flash message"}, {:except => [:structure, :error], :only => :structure}) %>)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/test/rjs_helper_test.rb
CHANGED
@@ -2,12 +2,12 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class RjsHelperTest < ActiveSupport::TestCase
|
4
4
|
include EaselHelpers::Helpers::RjsHelper
|
5
|
-
include EaselHelpers::Helpers::
|
5
|
+
include EaselHelpers::Helpers::MessageHelper
|
6
6
|
|
7
7
|
context "inline_flash" do
|
8
8
|
setup do
|
9
9
|
@page = Object.new
|
10
|
-
self.expects(:
|
10
|
+
self.expects(:messages).with({:notice => "Test!"}).returns("string")
|
11
11
|
end
|
12
12
|
|
13
13
|
should "default to inserting flash within div#flash-container" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fusionary-easel_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Clayton
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -59,10 +59,10 @@ extensions: []
|
|
59
59
|
|
60
60
|
extra_rdoc_files:
|
61
61
|
- lib/easel_helpers/helpers/date_helper.rb
|
62
|
-
- lib/easel_helpers/helpers/flash_helper.rb
|
63
62
|
- lib/easel_helpers/helpers/form_helper.rb
|
64
63
|
- lib/easel_helpers/helpers/grid_helper.rb
|
65
64
|
- lib/easel_helpers/helpers/link_helper.rb
|
65
|
+
- lib/easel_helpers/helpers/message_helper.rb
|
66
66
|
- lib/easel_helpers/helpers/rjs_helper.rb
|
67
67
|
- lib/easel_helpers/helpers/structure_helper.rb
|
68
68
|
- lib/easel_helpers/helpers/table_helper.rb
|
@@ -74,10 +74,10 @@ extra_rdoc_files:
|
|
74
74
|
files:
|
75
75
|
- easel_helpers.gemspec
|
76
76
|
- lib/easel_helpers/helpers/date_helper.rb
|
77
|
-
- lib/easel_helpers/helpers/flash_helper.rb
|
78
77
|
- lib/easel_helpers/helpers/form_helper.rb
|
79
78
|
- lib/easel_helpers/helpers/grid_helper.rb
|
80
79
|
- lib/easel_helpers/helpers/link_helper.rb
|
80
|
+
- lib/easel_helpers/helpers/message_helper.rb
|
81
81
|
- lib/easel_helpers/helpers/rjs_helper.rb
|
82
82
|
- lib/easel_helpers/helpers/structure_helper.rb
|
83
83
|
- lib/easel_helpers/helpers/table_helper.rb
|
@@ -91,10 +91,10 @@ files:
|
|
91
91
|
- README.textile
|
92
92
|
- tasks/easel_helpers_tasks.rake
|
93
93
|
- test/date_helper_test.rb
|
94
|
-
- test/flash_helper_test.rb
|
95
94
|
- test/form_helper_test.rb
|
96
95
|
- test/grid_helper_test.rb
|
97
96
|
- test/link_helper_test.rb
|
97
|
+
- test/message_helper_test.rb
|
98
98
|
- test/rjs_helper_test.rb
|
99
99
|
- test/structure_helper_test.rb
|
100
100
|
- test/table_helper_test.rb
|
@@ -132,10 +132,10 @@ specification_version: 3
|
|
132
132
|
summary: Fusionary Rails View Helpers
|
133
133
|
test_files:
|
134
134
|
- test/date_helper_test.rb
|
135
|
-
- test/flash_helper_test.rb
|
136
135
|
- test/form_helper_test.rb
|
137
136
|
- test/grid_helper_test.rb
|
138
137
|
- test/link_helper_test.rb
|
138
|
+
- test/message_helper_test.rb
|
139
139
|
- test/rjs_helper_test.rb
|
140
140
|
- test/structure_helper_test.rb
|
141
141
|
- test/table_helper_test.rb
|