edit_mode 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,5 +4,5 @@ jQuery ->
4
4
  # The tool buttons and the .show_only_in_edit_mode elements first are hidden via css (in case JavaScript does not work).
5
5
  # In order to use .hide() and .show() of jQuery, we need to restore the display css property
6
6
  # and hide the elements via jQuery.
7
- $( ".save_button,.cancel_button,.show_only_in_edit_mode" ).css( "display", "inline-block" ).hide()
7
+ $( ".save_button,.cancel_button,.show_only_in_edit_mode" ).css( "visibility", "visible" ).hide()
8
8
 
@@ -1,3 +1,3 @@
1
1
 
2
2
  .show_only_in_edit_mode, .save_button, .cancel_button
3
- display: none
3
+ visibility: hidden
@@ -1,6 +1,28 @@
1
1
  module EditMode
2
2
  module EditModeHelpers
3
3
 
4
+ # Returns a span tag which contains a group of editable elements
5
+ # which should only be shown in edit mode.
6
+ #
7
+ # edit_mode_group_span do
8
+ # # tool buttons: edit, save, cancel
9
+ # # ...
10
+ # end
11
+ #
12
+ # will basically return
13
+ #
14
+ # <span class="edit_mode_group">
15
+ # ...
16
+ # </span>
17
+ #
18
+ # The rest is done via javascript.
19
+ def edit_mode_group_span( &block )
20
+ content_tag :span, :class => 'edit_mode_group' do
21
+ yield
22
+ end
23
+ end
24
+
25
+
4
26
  # Returns a span tag which is only shown in edit mode.
5
27
  #
6
28
  # show_only_in_edit_mode_span do
@@ -1,3 +1,3 @@
1
1
  module EditMode
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -2,6 +2,16 @@ require "spec_helper"
2
2
 
3
3
  describe EditMode::EditModeHelpers do
4
4
 
5
+ describe "#edit_mode_group_span" do
6
+
7
+ it "should generate the corresponding span" do
8
+ nokogiri = Nokogiri::HTML.parse( edit_mode_group_span { "<p>This text is inside an edit_mode_group.</p>" } )
9
+ span = nokogiri.css( "span" )
10
+ span.text.should == "<p>This text is inside an edit_mode_group.</p>"
11
+ end
12
+
13
+ end
14
+
5
15
  describe "#show_only_in_edit_mode_span" do
6
16
 
7
17
  it "should generate the corresponding span" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edit_mode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -226,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
226
226
  version: '0'
227
227
  segments:
228
228
  - 0
229
- hash: -333848685
229
+ hash: -267715791
230
230
  required_rubygems_version: !ruby/object:Gem::Requirement
231
231
  none: false
232
232
  requirements:
@@ -235,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  segments:
237
237
  - 0
238
- hash: -333848685
238
+ hash: -267715791
239
239
  requirements: []
240
240
  rubyforge_project:
241
241
  rubygems_version: 1.8.23