icbm 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT_LICENSE +21 -0
- data/README.markdown +26 -0
- data/lib/icbm.rb +3 -0
- data/lib/icbm/content_block_helper.rb +8 -0
- data/lib/icbm/railtie.rb +8 -0
- metadata +71 -0
data/MIT_LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2009-2011 Nathan Humbert
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# ICBM (Integrated Content Block Management)
|
2
|
+
|
3
|
+
The intended goal of this gem is to provide a tool that makes it easy to add simple content managment features to pages on your site.
|
4
|
+
|
5
|
+
## Rails 3 Installation Instructions
|
6
|
+
Add the following to your gemfile
|
7
|
+
gem 'icbm'
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
Currently this gem requires your app to have a model by the name of "ContentBlock" which has 2 columns "key" and "value"
|
11
|
+
|
12
|
+
In your erb view you can place the following code
|
13
|
+
<%= block_content_for('name_of_this_content_block') do %>
|
14
|
+
Default view code goes here.
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
In your haml view you can place the following code
|
18
|
+
= block_content_for('name_of_this_content_block') do
|
19
|
+
Default view code goes here.
|
20
|
+
|
21
|
+
The result if there is no ContentBlock record with a key of 'name_of_this_content_block' will be the result of the default block of view code wrapped in a div
|
22
|
+
|
23
|
+
The result if there is a ContentBlock record with a key of 'name_of_this_content_block' will be the value field wrapped in a div
|
24
|
+
|
25
|
+
|
26
|
+
Copyright (c) 2009-2011 Nathan Humbert, released under the MIT license
|
data/lib/icbm.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
module ContentBlockHelper
|
2
|
+
def block_content_for(block_name, &default)
|
3
|
+
content_block = ContentBlock.find_by_key(block_name).try(:value)
|
4
|
+
content_block = capture(&default) if content_block.nil?
|
5
|
+
content = content_tag(:div, content_block.html_safe, :id => "content_block_#{block_name}", :class => 'content_block')
|
6
|
+
return content
|
7
|
+
end
|
8
|
+
end
|
data/lib/icbm/railtie.rb
ADDED
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: icbm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: "0.1"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Nathan Humbert
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-05-12 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: A content management gem for rails
|
22
|
+
email:
|
23
|
+
- nathan.humbert+icbm@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- README.markdown
|
32
|
+
- MIT_LICENSE
|
33
|
+
- lib/icbm/railtie.rb
|
34
|
+
- lib/icbm/content_block_helper.rb
|
35
|
+
- lib/icbm.rb
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/nathanhumbert/icbm
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
hash: 3
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.3.7
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: integrated_content_block_management
|
70
|
+
test_files: []
|
71
|
+
|