public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
allow setting of article permalink on create

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1816 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sat Aug 19 08:48:52 -0700 2006
commit  34b4b4b5220dd7e43cf4b3175da5aea173db8ce7
tree    216a9891ed2aa296207585dd7b3e963d26c927e9
parent  f242c1101df1993e70e76eb91421fe02896465ee
...
144
145
146
147
 
148
149
150
...
144
145
146
 
147
148
149
150
0
@@ -144,7 +144,7 @@ class Article < Content
0
 
0
   protected
0
     def create_permalink
0
- self.permalink = title.to_s.gsub(/\W+/, ' ').strip.downcase.gsub(/\ +/, '-')
0
+ self.permalink = title.to_s.gsub(/\W+/, ' ').strip.downcase.gsub(/\ +/, '-') if permalink.blank?
0
     end
0
 
0
     def convert_to_utc
...
8
9
10
 
 
 
 
 
11
12
13
...
8
9
10
11
12
13
14
15
16
17
18
0
@@ -8,6 +8,11 @@ class ArticleTest < Test::Unit::TestCase
0
     assert_equal 'this-is-a-tripped-out-title-1-well-not-really', a.permalink
0
   end
0
 
0
+ def test_should_set_permalink
0
+ a = create_article :title => 'This IS a Tripped out title!!.!1 (well/ not really)', :body => 'foo', :permalink => 'trippy'
0
+ assert_equal 'trippy', a.permalink
0
+ end
0
+
0
   def test_full_permalink
0
     date = 3.days.ago
0
     assert_equal ['', date.year, date.month, date.day, 'welcome-to-mephisto'].join('/'), contents(:welcome).full_permalink

Comments

    No one has commented yet.