edit_mode 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -0
- data/README.md +5 -5
- data/edit_mode.gemspec +1 -0
- data/lib/edit_mode/helper.rb +32 -0
- data/lib/edit_mode/version.rb +1 -1
- data/spec/integration/show_only_in_edit_mode_spec.rb +3 -1
- data/spec/spec_helper.rb +1 -0
- data/test_app/README.md +5 -5
- metadata +20 -3
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# EditMode
|
1
|
+
# EditMode [![Build Status](https://secure.travis-ci.org/fiedl/edit_mode.png?branch=master)](http://travis-ci.org/fiedl/edit_mode)
|
2
2
|
|
3
3
|
<img src="https://github.com/fiedl/edit_mode/raw/master/test_app/app/assets/images/screenshot.png" height="300" align="right" vspace="20" hspace="20" />
|
4
4
|
|
@@ -19,8 +19,6 @@ The [code of this demo app can be found here](https://github.com/fiedl/edit_mode
|
|
19
19
|
|
20
20
|
## Installation
|
21
21
|
|
22
|
-
THIS IS NOT READY, YET.
|
23
|
-
|
24
22
|
Add this line to your application's Gemfile:
|
25
23
|
|
26
24
|
gem 'edit_mode'
|
@@ -33,8 +31,6 @@ Or install it yourself as:
|
|
33
31
|
|
34
32
|
$ gem install edit_mode
|
35
33
|
|
36
|
-
TODO: Include css and js.
|
37
|
-
|
38
34
|
### Include Assets
|
39
35
|
|
40
36
|
In `app/assets/javascripts/application.js`, add:
|
@@ -125,6 +121,10 @@ jQuery ->
|
|
125
121
|
)
|
126
122
|
```
|
127
123
|
|
124
|
+
## Documentation
|
125
|
+
|
126
|
+
http://rubydoc.info/github/fiedl/edit_mode/frames
|
127
|
+
|
128
128
|
## Contributing
|
129
129
|
|
130
130
|
1. Fork it
|
data/edit_mode.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.add_dependency "rails", ">= 3.2"
|
25
25
|
gem.add_dependency "jquery-rails"
|
26
26
|
|
27
|
+
gem.add_development_dependency "rake"
|
27
28
|
gem.add_development_dependency "rspec-rails", ">= 2.8.0"
|
28
29
|
gem.add_development_dependency "nokogiri", ">= 1.5.0"
|
29
30
|
gem.add_development_dependency "capybara"
|
data/lib/edit_mode/helper.rb
CHANGED
@@ -2,6 +2,22 @@ module EditMode
|
|
2
2
|
module EditModeHelpers
|
3
3
|
|
4
4
|
# Returns a span tag which is only shown in edit mode.
|
5
|
+
#
|
6
|
+
# show_only_in_edit_mode_span do
|
7
|
+
# content_tag :p do
|
8
|
+
# "This text is shown only in edit mode."
|
9
|
+
# end
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# will basically return
|
13
|
+
#
|
14
|
+
# <span class="show_only_in_edit_mode">
|
15
|
+
# <p>
|
16
|
+
# This text is shown only in edit mode.
|
17
|
+
# </p>
|
18
|
+
# </span>
|
19
|
+
#
|
20
|
+
# The rest is done via javascript.
|
5
21
|
def show_only_in_edit_mode_span( &block )
|
6
22
|
content_tag :span, :class => 'show_only_in_edit_mode' do
|
7
23
|
yield
|
@@ -9,6 +25,22 @@ module EditMode
|
|
9
25
|
end
|
10
26
|
|
11
27
|
# Returns a span tag which is only shown when *not* in edit mode.
|
28
|
+
#
|
29
|
+
# do_not_show_in_edit_mode_span do
|
30
|
+
# content_tag :p do
|
31
|
+
# "This text is not shown in edit mode."
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# will basically return
|
36
|
+
#
|
37
|
+
# <span class="do_not_show_in_edit_mode">
|
38
|
+
# <p>
|
39
|
+
# This text is not shown in edit mode.
|
40
|
+
# </p>
|
41
|
+
# </span>
|
42
|
+
#
|
43
|
+
# The rest is done via javascript.
|
12
44
|
def do_not_show_in_edit_mode_span( &block )
|
13
45
|
content_tag :span, :class => 'do_not_show_in_edit_mode' do
|
14
46
|
yield
|
data/lib/edit_mode/version.rb
CHANGED
@@ -3,7 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe "show only in edit mode span tags", js: true do
|
4
4
|
|
5
5
|
before do
|
6
|
-
|
6
|
+
@user = User.new( first_name: "John", last_name: "Doe", date_of_birth: "1995-12-21" )
|
7
|
+
@user.save
|
8
|
+
visit user_path( @user )
|
7
9
|
end
|
8
10
|
|
9
11
|
it "should not be visible when not in edit mode" do
|
data/spec/spec_helper.rb
CHANGED
data/test_app/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# EditMode
|
1
|
+
# EditMode [![Build Status](https://secure.travis-ci.org/fiedl/edit_mode.png?branch=master)](http://travis-ci.org/fiedl/edit_mode)
|
2
2
|
|
3
3
|
<img src="https://github.com/fiedl/edit_mode/raw/master/test_app/app/assets/images/screenshot.png" height="300" align="right" vspace="20" hspace="20" />
|
4
4
|
|
@@ -19,8 +19,6 @@ The [code of this demo app can be found here](https://github.com/fiedl/edit_mode
|
|
19
19
|
|
20
20
|
## Installation
|
21
21
|
|
22
|
-
THIS IS NOT READY, YET.
|
23
|
-
|
24
22
|
Add this line to your application's Gemfile:
|
25
23
|
|
26
24
|
gem 'edit_mode'
|
@@ -33,8 +31,6 @@ Or install it yourself as:
|
|
33
31
|
|
34
32
|
$ gem install edit_mode
|
35
33
|
|
36
|
-
TODO: Include css and js.
|
37
|
-
|
38
34
|
### Include Assets
|
39
35
|
|
40
36
|
In `app/assets/javascripts/application.js`, add:
|
@@ -125,6 +121,10 @@ jQuery ->
|
|
125
121
|
)
|
126
122
|
```
|
127
123
|
|
124
|
+
## Documentation
|
125
|
+
|
126
|
+
http://rubydoc.info/github/fiedl/edit_mode/frames
|
127
|
+
|
128
128
|
## Contributing
|
129
129
|
|
130
130
|
1. Fork it
|
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.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: rspec-rails
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +120,7 @@ extra_rdoc_files: []
|
|
104
120
|
files:
|
105
121
|
- .gitignore
|
106
122
|
- .rspec
|
123
|
+
- .travis.yml
|
107
124
|
- Gemfile
|
108
125
|
- Guardfile
|
109
126
|
- LICENSE
|
@@ -209,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
226
|
version: '0'
|
210
227
|
segments:
|
211
228
|
- 0
|
212
|
-
hash: -
|
229
|
+
hash: -333848685
|
213
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
231
|
none: false
|
215
232
|
requirements:
|
@@ -218,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
235
|
version: '0'
|
219
236
|
segments:
|
220
237
|
- 0
|
221
|
-
hash: -
|
238
|
+
hash: -333848685
|
222
239
|
requirements: []
|
223
240
|
rubyforge_project:
|
224
241
|
rubygems_version: 1.8.23
|