beef-text_elements 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -1,24 +1,24 @@
1
1
  class TextElement < ActiveRecord::Base
2
- acts_as_textiled :value
3
-
2
+ acts_as_textiled :value if respond_to?(:acts_as_textiled)
3
+
4
4
  validates_presence_of :var
5
-
5
+
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
9
  super(method, *args)
10
-
10
+
11
11
  rescue NoMethodError
12
12
  #retrieve a value
13
13
  te = object(method_name)
14
14
  "<div class=\"ugc\">#{te.value || dummy_text(te)}</div>"
15
15
  end
16
-
16
+
17
17
  #retrieve the actual Setting record
18
18
  def self.object(var_name)
19
19
  TextElement.find_or_create_by_var(var_name.to_s)
20
20
  end
21
-
21
+
22
22
  def self.dummy_text(te)
23
23
  "<p>#{te.var.titleize} dummy text. You can edit this text <a href=\"/admin/text_elements/#{te.id}\">here</a></p>"
24
24
  end
@@ -1,4 +1,4 @@
1
- <h1>Listing Text Elements</h1>
1
+ <h1>Listing Text Elements</h1>
2
2
 
3
3
  <table>
4
4
  <thead>
@@ -14,11 +14,11 @@
14
14
  <% for text_element in @text_elements %>
15
15
  <tr>
16
16
  <td class="title"><%=h text_element.var.titleize %></td>
17
- <td><%= truncate(text_element.value_plain, 50, '&hellip;') %></td>
17
+ <td><%= truncate( strip_tags( text_element.value ), 50, '&hellip;') %></td>
18
18
  <td class="date"><%= text_element.updated_at.to_formatted_s(:short) %></td>
19
19
  <td class="action"><%= link_to 'Edit', [:admin, text_element], :class => 'edit', :title => 'Edit this element' %></td>
20
- </tr>
21
- <% end %>
20
+ </tr>
21
+ <% end %>
22
22
  </tbody>
23
23
  <tfoot>
24
24
  <tr>
@@ -36,7 +36,7 @@
36
36
 
37
37
  <% content_for :search do %>
38
38
  <h2>Search</h2>
39
-
39
+
40
40
  <% form_for :search, :html => {:method => 'get'} do |f| -%>
41
41
  <p>
42
42
  <%= f.label :title %><br/>
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beef-text_elements
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 6
9
+ version: 0.1.6
5
10
  platform: ruby
6
11
  authors:
7
12
  - Steve England
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-25 00:00:00 +00:00
17
+ date: 2010-07-05 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -52,21 +57,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
57
  requirements:
53
58
  - - ">="
54
59
  - !ruby/object:Gem::Version
60
+ segments:
61
+ - 0
55
62
  version: "0"
56
- version:
57
63
  required_rubygems_version: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - ">="
60
66
  - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
61
69
  version: "0"
62
- version:
63
70
  requirements: []
64
71
 
65
72
  rubyforge_project:
66
- rubygems_version: 1.3.5
73
+ rubygems_version: 1.3.6
67
74
  signing_key:
68
75
  specification_version: 3
69
76
  summary: For all those bits of text that don't need a full cms
70
77
  test_files:
71
- - test/text_elements_test.rb
72
78
  - test/test_helper.rb
79
+ - test/text_elements_test.rb