dead_simple_cms 0.12.1 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dead_simple_cms.rb +1 -1
- data/lib/dead_simple_cms/rails/action_view/form_builders/interface.rb +1 -1
- data/lib/dead_simple_cms/rails/action_view/presenter.rb +2 -2
- data/lib/dead_simple_cms/util.rb +14 -0
- data/lib/dead_simple_cms/version.rb +1 -1
- metadata +3 -3
- data/lib/dead_simple_cms/util/string.rb +0 -18
data/lib/dead_simple_cms.rb
CHANGED
@@ -55,7 +55,7 @@ module DeadSimpleCMS
|
|
55
55
|
section_or_group.groups.values.map do |group|
|
56
56
|
next if group.attributes.empty? && group.groups.empty?
|
57
57
|
fields_for(group.identifier, options) do |builder|
|
58
|
-
@template.content_tag(:fieldset, :id => Util
|
58
|
+
@template.content_tag(:fieldset, :id => Util.csserize(group.identifier)) do
|
59
59
|
# Following fieldset/legend convention: https://github.com/twitter/bootstrap/issues/1214
|
60
60
|
legend = @template.content_tag(:legend, group.label) unless group.root? # don't show the group name if it's the root group.
|
61
61
|
attributes = group.attributes.values.map { |attribute| builder.attribute(attribute) }.join.html_safe
|
@@ -33,13 +33,13 @@ module DeadSimpleCMS
|
|
33
33
|
JAVASCRIPT
|
34
34
|
js << javascript_include_tag(options.delete(:bootstrap_tab_js)) if options[:bootstrap_tab_js]
|
35
35
|
lis = DeadSimpleCMS.sections.values.map do |section|
|
36
|
-
section_id = Util
|
36
|
+
section_id = Util.csserize(section.identifier)
|
37
37
|
content_tag(:li, link_to(section.label, "##{section_id}", :id => "#{section_id}-tab"))
|
38
38
|
end.join.html_safe
|
39
39
|
tabs = content_tag(:ul, lis, :class => "nav nav-tabs", :id => "section-tabs")
|
40
40
|
sections = content_tag(:div, :class => "tab-content") do
|
41
41
|
DeadSimpleCMS.sections.values.map do |section|
|
42
|
-
content_tag(:div, section(section), :class => "tab-pane", :id => Util
|
42
|
+
content_tag(:div, section(section), :class => "tab-pane", :id => Util.csserize(section.identifier))
|
43
43
|
end.join.html_safe
|
44
44
|
end
|
45
45
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module DeadSimpleCMS
|
2
|
+
module Util
|
3
|
+
# Converts string into css DOM selector for use with class and ID. We
|
4
|
+
# currently do lowercase with dashes for cssnames.
|
5
|
+
def self.csserize(str)
|
6
|
+
name = str.to_s.dup
|
7
|
+
name.gsub!(/[^A-Za-z0-9]+/, " ") # can return nil
|
8
|
+
name.gsub!(/(\w)([A-Z])/, '\1-\2') # can return nil
|
9
|
+
name.squish!.downcase!
|
10
|
+
name.gsub!(" ", "-") # can return nil
|
11
|
+
name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dead_simple_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -162,9 +162,9 @@ files:
|
|
162
162
|
- lib/dead_simple_cms/storage/memory.rb
|
163
163
|
- lib/dead_simple_cms/storage/rails_cache.rb
|
164
164
|
- lib/dead_simple_cms/storage/redis.rb
|
165
|
+
- lib/dead_simple_cms/util.rb
|
165
166
|
- lib/dead_simple_cms/util/identifier.rb
|
166
167
|
- lib/dead_simple_cms/util/identifier/dictionary.rb
|
167
|
-
- lib/dead_simple_cms/util/string.rb
|
168
168
|
- lib/dead_simple_cms/version.rb
|
169
169
|
- spec/dead_simple_cms/attribute/collection_spec.rb
|
170
170
|
- spec/dead_simple_cms/attribute/type/all_spec.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module DeadSimpleCMS
|
2
|
-
module Util
|
3
|
-
module String
|
4
|
-
class << self
|
5
|
-
# Converts string into css DOM selector for use with class and ID. We
|
6
|
-
# currently do lowercase with dashes for cssnames.
|
7
|
-
def csserize(str)
|
8
|
-
name = str.to_s.dup
|
9
|
-
name.gsub!(/[^A-Za-z0-9]+/, " ") # can return nil
|
10
|
-
name.gsub!(/(\w)([A-Z])/, '\1-\2') # can return nil
|
11
|
-
name.squish!.downcase!
|
12
|
-
name.gsub!(" ", "-") # can return nil
|
13
|
-
name
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|