diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index b7fa836..5361191 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -371,6 +371,24 @@ module ApplicationHelper
nil
end
+ def theme_favicon
+ return '/designs/themes/' + current_theme + '/favicon.ico' if profile.nil? || profile.theme.nil?
+ if File.exists?(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico'))
+ '/designs/themes/' + profile.theme + '/favicon.ico'
+ else
+ favicon = profile.articles.find_by_path('favicon.ico')
+ if favicon
+ favicon.public_filename
+ else
+ '/designs/themes/' + environment.theme + '/favicon.ico'
+ end
+ end
+ end
+
+ def theme_site_title
+ theme_include('site_title')
+ end
+
def theme_header
theme_include('header')
end
diff --git a/app/views/layouts/application-ng.rhtml b/app/views/layouts/application-ng.rhtml
index f5c346d..8e1312a 100644
--- a/app/views/layouts/application-ng.rhtml
+++ b/app/views/layouts/application-ng.rhtml
@@ -6,7 +6,7 @@
-
+
<%= noosfero_javascript %>
<%= stylesheet_link_tag noosfero_stylesheets, :cache => 'cache' %>
<%= stylesheet_link_tag template_stylesheet_path %>
@@ -73,7 +73,7 @@
- <%= link_to content_tag('span', environment.name), environment.top_url %>
+ <%= theme_site_title %>
diff --git a/public/designs/themes/noosfero/site_title.rhtml b/public/designs/themes/noosfero/site_title.rhtml
new file mode 100644
index 0000000..f5cc1aa
--- /dev/null
+++ b/public/designs/themes/noosfero/site_title.rhtml
@@ -0,0 +1 @@
+<%= link_to(image_tag("/designs/themes/noosfero/images/logo-noosfero.png"), environment.top_url) %>
diff --git a/public/designs/themes/noosfero/style.css b/public/designs/themes/noosfero/style.css
index e871cc3..96427e5 100644
--- a/public/designs/themes/noosfero/style.css
+++ b/public/designs/themes/noosfero/style.css
@@ -1,10 +1,7 @@
@import url(../base/style.css);
-#site-title {
- background: url(images/logo-noosfero.png) no-repeat;
-}
-
-.docSize-LT-800 #site-title {
- width: 100px;
- background: url(images/logo-noosfero-no-text.png) no-repeat;
+#site-title img {
+ left:-22px;
+ position:absolute;
+ top:-30px;
}
diff --git a/public/designs/themes/scarletred/header.rhtml b/public/designs/themes/scarletred/header.rhtml
new file mode 100644
index 0000000..714dd59
--- /dev/null
+++ b/public/designs/themes/scarletred/header.rhtml
@@ -0,0 +1,19 @@
+
+
+
diff --git a/public/designs/themes/scarletred/imgs/comment-owner-bg-L.png b/public/designs/themes/scarletred/imgs/comment-owner-bg-L.png
new file mode 100644
index 0000000..c81eb82
Binary files /dev/null and b/public/designs/themes/scarletred/imgs/comment-owner-bg-L.png differ
diff --git a/public/designs/themes/scarletred/imgs/comment-owner-bg-N.png b/public/designs/themes/scarletred/imgs/comment-owner-bg-N.png
new file mode 100644
index 0000000..611d014
Binary files /dev/null and b/public/designs/themes/scarletred/imgs/comment-owner-bg-N.png differ
diff --git a/public/designs/themes/scarletred/imgs/comment-owner-bg-NL.png b/public/designs/themes/scarletred/imgs/comment-owner-bg-NL.png
new file mode 100644
index 0000000..6e765d1
Binary files /dev/null and b/public/designs/themes/scarletred/imgs/comment-owner-bg-NL.png differ
diff --git a/public/designs/themes/scarletred/imgs/comment-owner-bg-NO.png b/public/designs/themes/scarletred/imgs/comment-owner-bg-NO.png
new file mode 100644
index 0000000..df0415d
Binary files /dev/null and b/public/designs/themes/scarletred/imgs/comment-owner-bg-NO.png differ
diff --git a/public/designs/themes/scarletred/imgs/comment-owner-bg-O.png b/public/designs/themes/scarletred/imgs/comment-owner-bg-O.png
new file mode 100644
index 0000000..5cacb12
Binary files /dev/null and b/public/designs/themes/scarletred/imgs/comment-owner-bg-O.png differ
diff --git a/public/designs/themes/scarletred/imgs/comment-owner-bg-S.png b/public/designs/themes/scarletred/imgs/comment-owner-bg-S.png
new file mode 100644
index 0000000..f3293fb
Binary files /dev/null and b/public/designs/themes/scarletred/imgs/comment-owner-bg-S.png differ
diff --git a/public/designs/themes/scarletred/imgs/comment-owner-bg.png b/public/designs/themes/scarletred/imgs/comment-owner-bg.png
new file mode 100644
index 0000000..ccad53f
Binary files /dev/null and b/public/designs/themes/scarletred/imgs/comment-owner-bg.png differ
diff --git a/public/designs/themes/scarletred/site_title.rhtml b/public/designs/themes/scarletred/site_title.rhtml
new file mode 100644
index 0000000..37dc3c5
--- /dev/null
+++ b/public/designs/themes/scarletred/site_title.rhtml
@@ -0,0 +1 @@
+<%= link_to(image_tag("/designs/themes/#{environment.theme}/imgs/thin-logo.png"), environment.top_url) %>
diff --git a/public/designs/themes/scarletred/style.css b/public/designs/themes/scarletred/style.css
new file mode 100644
index 0000000..b57a101
--- /dev/null
+++ b/public/designs/themes/scarletred/style.css
@@ -0,0 +1,221 @@
+@import url(../base/style.css);
+
+head {
+ margin: 0px;
+ padding: 0px;
+}
+
+body {
+ margin: 0px auto;
+ padding: 0px;
+}
+
+#wrap-1 {
+ position: relative;
+}
+
+#wrap-2 {
+ margin-top: -4px;
+ padding-bottom: 0px;
+}
+
+#navigation,
+#navigation-end {
+ display: none;
+}
+
+#theme-header {
+ height: 30px;
+}
+
+/************************** user bar ***************************/
+
+#user {
+ top: -23px;
+ right: 10px;
+ height: 20px;
+}
+
+#user a,
+#user a strong {
+ color: #A40000;
+}
+
+/************************** navigation ***************************/
+
+#navigation {
+ background: none;
+}
+
+/************************** content ***************************/
+
+#content {
+ margin-top: 0px;
+}
+
+#boxes {
+ margin-top: 20px;
+}
+
+#profile-header {
+ margin: -10px;
+ margin-bottom: 0px;
+ width: 958px;
+ max-width: none;
+ max-height: none;
+}
+
+#profile-footer {
+ margin-left: -10px;
+ width: 958px;
+ max-width: none;
+}
+
+#content .block-title,
+#content .main-block h1, #not-found h1, #access-denied h1 {
+ border-bottom:2px solid #A40000;
+ color: #A40000;
+}
+
+.profile-image-block p {
+ color: #A40000;
+}
+
+.block a {
+ color: #A40000;
+}
+
+.block a:visited {
+ color: #CC0000;
+}
+
+.control-panel a,
+.control-panel a:visited {
+ color: #000;
+}
+
+.controller-profile_editor .control-panel a:hover {
+ background-color: #A40000;
+ color: #FFF;
+}
+
+#content .link-list-block li a:hover {
+ background-color: #A40000;
+}
+
+#content .link-list-block li a.link-this-page {
+ background-color: #CC0000;
+ border-right:2px solid #A40000;
+}
+
+.template-rightbar #content .link-list-block li a.link-this-page,
+#content .box-3 .link-list-block li a.link-this-page {
+ border-left: 2px solid #A40000;
+ border-right: none;
+ margin-left: -5px;
+ margin-right: 0px;
+ max-width: 170px;
+ -moz-border-radius-bottomleft: 0;
+ -moz-border-radius-topleft: 0;
+ -moz-border-radius-bottomright: 4px;
+ -moz-border-radius-topright: 4px;
+ -webkit-border-radius-bottomleft: 0;
+ -webkit-border-radius-topleft: 0;
+ -webkit-border-radius-bottomright: 4px;
+ -webkit-border-radius-topright: 4px;
+}
+
+/************** blog **************/
+
+#content .blog-posts {
+ margin-top: 30px;
+}
+
+#content .blog-post .title a:hover {
+ color: #A40000;
+}
+
+#article .blog-feed-link {
+ position: absolute;
+ right: 0px;
+ top: 28px;
+}
+
+#article-tags {
+ margin-right: 30px;
+}
+
+/************** environment bar **************/
+
+#site-title {
+ position: absolute;
+ left: 10px;
+ top: -27px;
+ height: 40px;
+ width: 264px;
+}
+
+#site-title a {
+ display: block;
+ top: 0px;
+ height: 20px;
+}
+
+#assets-menu {
+ display: none;
+ position: absolute;
+ top: 26px;
+ left: 56px;
+ min-width: 140px;
+ z-index: 10;
+ border: 1px solid #D3D7CF;
+ border-top: none;
+ background: #EEE;
+ padding: 0px 4px 6px 4px;
+ -moz-border-radius-bottomleft: 10px;
+ -moz-border-radius-bottomright: 10px;
+ -webkit-border-radius-bottomleft: 10px;
+ -webkit-border-radius-bottomright: 10px;
+ border-radius-bottomleft: 10px;
+ border-radius-bottomright: 10px;
+}
+
+#assets-menu ul,
+#assets-menu li {
+ margin: 0px;
+ padding: 0px;
+ list-style: none;
+}
+
+#assets-menu a {
+ text-decoration: none;
+ display: block;
+ padding: 2px 4px 2px 8px;
+ color: #555;
+ border: 1px solid #EEE;
+}
+
+#assets-menu a:hover {
+ background: #FBFBFB;
+ border: 1px solid #F6F6F6;
+ color: #000;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+}
+
+/**************************** Comments *******************************/
+
+#content .comments h3 {
+ color: #A40000;
+ border-bottom: 2px solid #A40000;
+}
+
+.post_comment_box h4 {
+ background-color: #A40000;
+ color: #FFF;
+}
+
+.post_comment_box.closed h4 {
+ border: none;
+}
diff --git a/public/designs/themes/scarletred/theme.yml b/public/designs/themes/scarletred/theme.yml
new file mode 100644
index 0000000..48a495a
--- /dev/null
+++ b/public/designs/themes/scarletred/theme.yml
@@ -0,0 +1,2 @@
+theme: "Scarlet Red theme"
+layout: "application-ng"
diff --git a/test/fixtures/files/favicon.ico b/test/fixtures/files/favicon.ico
new file mode 100644
index 0000000..1d7cca0
Binary files /dev/null and b/test/fixtures/files/favicon.ico differ
diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb
index fbc4f80..475016a 100644
--- a/test/unit/application_helper_test.rb
+++ b/test/unit/application_helper_test.rb
@@ -154,6 +154,28 @@ class ApplicationHelperTest < Test::Unit::TestCase
assert_nil theme_footer
end
+ should 'render theme site title' do
+ stubs(:theme_path).returns('/user_themes/mytheme')
+ site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.rhtml'
+
+ File.expects(:exists?).with(site_title_path).returns(true)
+ expects(:render).with(:file => site_title_path, :use_full_path => false).returns("Site title")
+
+ assert_equal "Site title", theme_site_title
+ end
+
+ should 'ignore unexisting theme site title' do
+ stubs(:theme_path).returns('/user_themes/mytheme')
+ site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.rhtml'
+ alternate_site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.html.erb'
+
+ File.expects(:exists?).with(site_title_path).returns(false)
+ File.expects(:exists?).with(alternate_site_title_path).returns(false)
+ expects(:render).with(:file => site_title_path).never
+
+ assert_nil theme_site_title
+ end
+
should 'expose theme owner' do
theme = mock
profile = mock
@@ -621,6 +643,40 @@ class ApplicationHelperTest < Test::Unit::TestCase
assert_equal ['Home Page', 'Products', 'Members', 'Agenda'], links.map{|i| i.keys.first}
end
+ should 'use favicon from environment theme if does not have profile' do
+ stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme'))
+ stubs(:profile).returns(nil)
+ assert_equal '/designs/themes/new-theme/favicon.ico', theme_favicon
+ end
+
+ should 'use favicon from environment theme if the profile theme is nil' do
+ stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme'))
+ stubs(:profile).returns(fast_create(Profile))
+ assert_equal '/designs/themes/new-theme/favicon.ico', theme_favicon
+ end
+
+ should 'use favicon from profile theme if the profile has theme' do
+ stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme'))
+ stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme'))
+ File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', '/designs/themes/profile-theme', 'favicon.ico')).returns(true)
+ assert_equal '/designs/themes/profile-theme/favicon.ico', theme_favicon
+ end
+
+ should 'use favicon from profile articles if the profile theme does not have' do
+ stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme'))
+ stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme'))
+ file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/favicon.ico', 'image/png'), :profile => profile)
+ File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')).returns(false)
+ assert_equal file.public_filename, theme_favicon
+ end
+
+ should 'use favicon from environment if the profile theme and profile articles do not have' do
+ stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme'))
+ stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme'))
+ File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')).returns(false)
+ assert_equal '/designs/themes/new-theme/favicon.ico', theme_favicon
+ end
+
protected
def url_for(args = {})
--
libgit2 0.21.2