beef-text_elements 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/app/models/text_element.rb
CHANGED
@@ -6,21 +6,20 @@ class TextElement < ActiveRecord::Base
|
|
6
6
|
#get with the variable as the called method
|
7
7
|
def self.method_missing(method, *args)
|
8
8
|
method_name = method.to_s
|
9
|
-
uri = args[0].to_s
|
10
9
|
super(method, *args)
|
11
10
|
|
12
11
|
rescue NoMethodError
|
13
12
|
#retrieve a value
|
14
|
-
te = object(method_name
|
13
|
+
te = object(method_name)
|
15
14
|
"<div class=\"ugc\">#{te.value || dummy_text(method_name)}</div>"
|
16
15
|
end
|
17
16
|
|
18
17
|
#retrieve the actual Setting record
|
19
|
-
def self.object(var_name
|
20
|
-
TextElement.find_or_create_by_var(
|
18
|
+
def self.object(var_name)
|
19
|
+
TextElement.find_or_create_by_var(var_name.to_s)
|
21
20
|
end
|
22
21
|
|
23
22
|
def self.dummy_text(method_name)
|
24
|
-
"<p>You can edit this text in the CMS under text elements, it is called '#{method_name.titleize}'
|
23
|
+
"<p>You can edit this text in the CMS under text elements, it is called '#{method_name.titleize}' .</p>"
|
25
24
|
end
|
26
25
|
end
|
@@ -5,7 +5,6 @@
|
|
5
5
|
<tr>
|
6
6
|
<%= sortable_table_header :name => "Title", :sort => "var" %>
|
7
7
|
<%= sortable_table_header :name => "Content", :sort => "value" %>
|
8
|
-
<%= sortable_table_header :name => "Location", :sort => "uri" %>
|
9
8
|
<%= sortable_table_header :name => "Updated", :sort => "updated_at" %>
|
10
9
|
<th colspan="3">Actions</th>
|
11
10
|
</tr>
|
@@ -16,7 +15,6 @@
|
|
16
15
|
<tr>
|
17
16
|
<td class="title"><%=h text_element.var.titleize %></td>
|
18
17
|
<td><%= truncate(text_element.value_plain, 50, '…') %></td>
|
19
|
-
<td><%= link_to text_element.uri, text_element.uri %></td>
|
20
18
|
<td class="date"><%= text_element.updated_at.to_formatted_s(:short) %></td>
|
21
19
|
<td class="action"><%= link_to 'Edit', [:admin, text_element], :class => 'edit' %></td>
|
22
20
|
</tr>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beef-text_elements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve England
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-20 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -68,5 +68,5 @@ signing_key:
|
|
68
68
|
specification_version: 3
|
69
69
|
summary: For all those bits of text that don't need a full cms
|
70
70
|
test_files:
|
71
|
-
- test/test_helper.rb
|
72
71
|
- test/text_elements_test.rb
|
72
|
+
- test/test_helper.rb
|