fusionary-easel_helpers 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -4,6 +4,7 @@ lib/easel_helpers/helpers/flash_helper.rb
4
4
  lib/easel_helpers/helpers/form_helper.rb
5
5
  lib/easel_helpers/helpers/grid_helper.rb
6
6
  lib/easel_helpers/helpers/link_helper.rb
7
+ lib/easel_helpers/helpers/rjs_helper.rb
7
8
  lib/easel_helpers/helpers/structure_helper.rb
8
9
  lib/easel_helpers/helpers/table_helper.rb
9
10
  lib/easel_helpers/helpers.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.5") do |p|
6
+ Echoe.new("easel_helpers", "0.2.6") 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"
@@ -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"
5
+ s.version = "0.2.6"
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-05-22}
9
+ s.date = %q{2009-06-01}
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/flash_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/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/flash_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/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/flash_helper_test.rb", "test/form_helper_test.rb", "test/grid_helper_test.rb", "test/link_helper_test.rb", "test/structure_helper_test.rb", "test/table_helper_test.rb", "test/test_helper.rb"]
12
+ s.extra_rdoc_files = ["lib/easel_helpers/helpers/date_helper.rb", "lib/easel_helpers/helpers/flash_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/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/flash_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/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/flash_helper_test.rb", "test/form_helper_test.rb", "test/grid_helper_test.rb", "test/link_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/flash_helper_test.rb", "test/form_helper_test.rb", "test/grid_helper_test.rb", "test/link_helper_test.rb", "test/structure_helper_test.rb", "test/table_helper_test.rb", "test/test_helper.rb"]
21
+ s.test_files = ["test/date_helper_test.rb", "test/flash_helper_test.rb", "test/form_helper_test.rb", "test/grid_helper_test.rb", "test/link_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
@@ -0,0 +1,17 @@
1
+ module EaselHelpers
2
+ module Helpers
3
+ module RjsHelper
4
+
5
+ def inline_flash(page, flash, options = {})
6
+ container_id = options[:container] || "flash-container"
7
+
8
+ if options[:replace]
9
+ page.replace_html container_id, render_flash(flash)
10
+ else
11
+ page.insert_html :top, container_id, render_flash(flash)
12
+ end
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -5,6 +5,7 @@ require "easel_helpers/helpers/structure_helper"
5
5
  require "easel_helpers/helpers/table_helper"
6
6
  require "easel_helpers/helpers/grid_helper"
7
7
  require "easel_helpers/helpers/flash_helper"
8
+ require "easel_helpers/helpers/rjs_helper"
8
9
 
9
10
  module EaselHelpers
10
11
  module Helpers
@@ -15,11 +16,12 @@ module EaselHelpers
15
16
  include TableHelper
16
17
  include GridHelper
17
18
  include FlashHelper
19
+ include RjsHelper
18
20
 
19
21
  protected
20
22
 
21
23
  def other_than_grid?(classes)
22
- (standardize_css_classes(classes).map(&:to_s) - EaselHelpers::Helpers::GridHelper::MULTIPLE_FRACTIONS).any?
24
+ (standardize_css_classes(classes).map {|s| s.to_s } - EaselHelpers::Helpers::GridHelper::MULTIPLE_FRACTIONS).any?
23
25
  end
24
26
 
25
27
  def clean_css_classes(string_or_array, replace = {})
@@ -42,7 +44,7 @@ module EaselHelpers
42
44
  end
43
45
  end
44
46
 
45
- css_classes.map(&:strip).reject {|s| s.blank? }.uniq.join(" ").strip
47
+ css_classes.map {|s| s.strip }.reject {|s| s.blank? }.uniq.join(" ").strip
46
48
  end
47
49
 
48
50
  private
@@ -0,0 +1,29 @@
1
+ require 'test_helper'
2
+
3
+ class RjsHelperTest < ActiveSupport::TestCase
4
+ include EaselHelpers::Helpers::RjsHelper
5
+ include EaselHelpers::Helpers::FlashHelper
6
+
7
+ context "inline_flash" do
8
+ setup do
9
+ @page = Object.new
10
+ self.expects(:render_flash).with({:notice => "Test!"}).returns("string")
11
+ end
12
+
13
+ should "default to inserting flash within div#flash-container" do
14
+ @page.expects(:insert_html).with(:top, "flash-container", "string")
15
+ inline_flash(@page, {:notice => "Test!"})
16
+ end
17
+
18
+ should "allow assignment of container id" do
19
+ @page.expects(:insert_html).with(:top, "my-custom-id", "string")
20
+ inline_flash(@page, {:notice => "Test!"}, {:container => "my-custom-id"})
21
+ end
22
+
23
+ should "allow replacement of current flash container's HTML" do
24
+ @page.expects(:replace_html).with("flash-container", "string")
25
+ inline_flash(@page, {:notice => "Test!"}, {:replace => true})
26
+ end
27
+ end
28
+
29
+ end
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.5
4
+ version: 0.2.6
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-05-22 00:00:00 -07:00
12
+ date: 2009-06-01 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -63,6 +63,7 @@ extra_rdoc_files:
63
63
  - lib/easel_helpers/helpers/form_helper.rb
64
64
  - lib/easel_helpers/helpers/grid_helper.rb
65
65
  - lib/easel_helpers/helpers/link_helper.rb
66
+ - lib/easel_helpers/helpers/rjs_helper.rb
66
67
  - lib/easel_helpers/helpers/structure_helper.rb
67
68
  - lib/easel_helpers/helpers/table_helper.rb
68
69
  - lib/easel_helpers/helpers.rb
@@ -77,6 +78,7 @@ files:
77
78
  - lib/easel_helpers/helpers/form_helper.rb
78
79
  - lib/easel_helpers/helpers/grid_helper.rb
79
80
  - lib/easel_helpers/helpers/link_helper.rb
81
+ - lib/easel_helpers/helpers/rjs_helper.rb
80
82
  - lib/easel_helpers/helpers/structure_helper.rb
81
83
  - lib/easel_helpers/helpers/table_helper.rb
82
84
  - lib/easel_helpers/helpers.rb
@@ -93,6 +95,7 @@ files:
93
95
  - test/form_helper_test.rb
94
96
  - test/grid_helper_test.rb
95
97
  - test/link_helper_test.rb
98
+ - test/rjs_helper_test.rb
96
99
  - test/structure_helper_test.rb
97
100
  - test/table_helper_test.rb
98
101
  - test/test_helper.rb
@@ -133,6 +136,7 @@ test_files:
133
136
  - test/form_helper_test.rb
134
137
  - test/grid_helper_test.rb
135
138
  - test/link_helper_test.rb
139
+ - test/rjs_helper_test.rb
136
140
  - test/structure_helper_test.rb
137
141
  - test/table_helper_test.rb
138
142
  - test/test_helper.rb