beef-text_elements 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
@@ -4,14 +4,14 @@ require 'rake'
|
|
4
4
|
begin
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "text_elements"
|
7
|
+
gem.name = "beef-text_elements"
|
8
8
|
gem.summary = %Q{For all those bits of text that don't need a full cms}
|
9
9
|
gem.email = "steve@wearebeef.co.uk"
|
10
10
|
gem.homepage = "http://github.com/beef/text_elements"
|
11
11
|
gem.authors = ["Steve England"]
|
12
12
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
13
|
end
|
14
|
-
|
14
|
+
Jeweler::GemcutterTasks.new
|
15
15
|
rescue LoadError
|
16
16
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
17
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/app/models/text_element.rb
CHANGED
@@ -6,20 +6,21 @@ 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
|
9
10
|
super(method, *args)
|
10
11
|
|
11
12
|
rescue NoMethodError
|
12
13
|
#retrieve a value
|
13
|
-
te = object(method_name)
|
14
|
-
"<div class=\"ugc\">#{te.value || dummy_text}</div>"
|
14
|
+
te = object(method_name, uri)
|
15
|
+
"<div class=\"ugc\">#{te.value || dummy_text(method_name)}</div>"
|
15
16
|
end
|
16
17
|
|
17
18
|
#retrieve the actual Setting record
|
18
|
-
def self.object(var_name)
|
19
|
-
TextElement.find_or_create_by_var(var_name.to_s)
|
19
|
+
def self.object(var_name, uri)
|
20
|
+
TextElement.find_or_create_by_var(:var => var_name.to_s, :uri => uri)
|
20
21
|
end
|
21
22
|
|
22
|
-
def self.dummy_text
|
23
|
-
|
23
|
+
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}'</p>"
|
24
25
|
end
|
25
26
|
end
|
@@ -5,6 +5,7 @@
|
|
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" %>
|
8
9
|
<%= sortable_table_header :name => "Updated", :sort => "updated_at" %>
|
9
10
|
<th colspan="3">Actions</th>
|
10
11
|
</tr>
|
@@ -15,8 +16,9 @@
|
|
15
16
|
<tr>
|
16
17
|
<td class="title"><%=h text_element.var.titleize %></td>
|
17
18
|
<td><%= truncate(text_element.value_plain, 50, '…') %></td>
|
19
|
+
<td><%= link_to text_element.uri, text_element.uri %></td>
|
18
20
|
<td class="date"><%= text_element.updated_at.to_formatted_s(:short) %></td>
|
19
|
-
<td><%= link_to 'Edit', [:admin, text_element], :class => 'edit' %></td>
|
21
|
+
<td class="action"><%= link_to 'Edit', [:admin, text_element], :class => 'edit' %></td>
|
20
22
|
</tr>
|
21
23
|
<% end %>
|
22
24
|
</tbody>
|
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.3
|
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: 2009-
|
12
|
+
date: 2009-11-02 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -39,8 +39,10 @@ files:
|
|
39
39
|
- lib/text_elements.rb
|
40
40
|
- test/test_helper.rb
|
41
41
|
- test/text_elements_test.rb
|
42
|
-
has_rdoc:
|
42
|
+
has_rdoc: true
|
43
43
|
homepage: http://github.com/beef/text_elements
|
44
|
+
licenses: []
|
45
|
+
|
44
46
|
post_install_message:
|
45
47
|
rdoc_options:
|
46
48
|
- --charset=UTF-8
|
@@ -61,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
63
|
requirements: []
|
62
64
|
|
63
65
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.3.5
|
65
67
|
signing_key:
|
66
68
|
specification_version: 3
|
67
69
|
summary: For all those bits of text that don't need a full cms
|