[Logilogi-svn] SF.net SVN: logilogi:[1784] trunk
Status: Beta
Brought to you by:
wybow
|
From: <wy...@us...> - 2011-03-01 13:35:35
|
Revision: 1784
http://logilogi.svn.sourceforge.net/logilogi/?rev=1784&view=rev
Author: wybow
Date: 2011-03-01 13:35:29 +0000 (Tue, 01 Mar 2011)
Log Message:
-----------
Cleanup
Modified Paths:
--------------
trunk/app/models/global_config.rb
trunk/app/models/logi.rb
trunk/app/models/tag.rb
trunk/app/models/used_tag.rb
trunk/test/unit/user_test.rb
Modified: trunk/app/models/global_config.rb
===================================================================
--- trunk/app/models/global_config.rb 2011-03-01 08:17:28 UTC (rev 1783)
+++ trunk/app/models/global_config.rb 2011-03-01 13:35:29 UTC (rev 1784)
@@ -197,7 +197,8 @@
def #{kind.to_s}_tag_string=(string)
tag = Tag.from_s(string)
self.#{kind.to_s}_tag = tag
- UsedTag.use(tag)
+ UsedTag.use(tag#{(kind.to_s == "main_page" ?
+ "" : ", :cloud_visibility => false")})
end
EOS
end
Modified: trunk/app/models/logi.rb
===================================================================
--- trunk/app/models/logi.rb 2011-03-01 08:17:28 UTC (rev 1783)
+++ trunk/app/models/logi.rb 2011-03-01 13:35:29 UTC (rev 1784)
@@ -478,7 +478,11 @@
end
end
self.tags.each do |t|
- UsedTag.use(t)
+ if self.tags.size == 2 and self.tags[1].home_page?
+ UsedTag.use(t, :cloud_visibility => false)
+ else
+ UsedTag.use(t)
+ end
end
end
return true
Modified: trunk/app/models/tag.rb
===================================================================
--- trunk/app/models/tag.rb 2011-03-01 08:17:28 UTC (rev 1783)
+++ trunk/app/models/tag.rb 2011-03-01 13:35:29 UTC (rev 1784)
@@ -181,7 +181,7 @@
#
def system?
return (self == Tag.replace or self == Tag.untagged or
- self == Tag.sandbox)
+ self == Tag.sandbox or self == Tag.blog)
end
# Parsing
Modified: trunk/app/models/used_tag.rb
===================================================================
--- trunk/app/models/used_tag.rb 2011-03-01 08:17:28 UTC (rev 1783)
+++ trunk/app/models/used_tag.rb 2011-03-01 13:35:29 UTC (rev 1784)
@@ -88,11 +88,10 @@
#
# If needed, creates a UsedTag for it.
#
- def self.use(tag)
+ def self.use(tag, options = {})
u_t = UsedTag.or_new_from_tag(tag)
- # TODO make more efficient
- if tag.name? or tag.home_page? or tag.system?
- u_t.cloud_visibility = false
+ if !options[:cloud_visibility].nil?
+ u_t.cloud_visibility = options[:cloud_visibility]
end
u_t.increment
u_t.save
Modified: trunk/test/unit/user_test.rb
===================================================================
--- trunk/test/unit/user_test.rb 2011-03-01 08:17:28 UTC (rev 1783)
+++ trunk/test/unit/user_test.rb 2011-03-01 13:35:29 UTC (rev 1784)
@@ -52,9 +52,11 @@
u = User.new(:openid_identifier => 'http://top.castle.com',
:name => 'Bo Bény', :email => 'to...@ca...')
assert u.save
- assert_equal Tag.from_s("Bo_Bény"), u.home_page_tag
+ t = Tag.from_s("Bo_Bény")
+ assert_equal t, u.home_page_tag
assert_equal "Bo_Bény", u.default_prefs_profile.name
assert_volatile_to_logi('Bo_Bény/' + Tag.user.to_s)
+ assert !UsedTag.or_new_from_tag(t).cloud_visibility
end
def test_name_validation
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|