Commit f9add5f7d8e5ba5840d054b1409cd7924992ab4e
Committed by
Antonio Terceiro
1 parent
966b6500
Exists in
master
and in
23 other branches
Added scarletred theme to noosfero
site_title is added by theme favicon is added by theme or profile (ActionItem1529)
Showing
17 changed files
with
324 additions
and
9 deletions
Show diff stats
app/helpers/application_helper.rb
| ... | ... | @@ -371,6 +371,24 @@ module ApplicationHelper |
| 371 | 371 | nil |
| 372 | 372 | end |
| 373 | 373 | |
| 374 | + def theme_favicon | |
| 375 | + return '/designs/themes/' + current_theme + '/favicon.ico' if profile.nil? || profile.theme.nil? | |
| 376 | + if File.exists?(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')) | |
| 377 | + '/designs/themes/' + profile.theme + '/favicon.ico' | |
| 378 | + else | |
| 379 | + favicon = profile.articles.find_by_path('favicon.ico') | |
| 380 | + if favicon | |
| 381 | + favicon.public_filename | |
| 382 | + else | |
| 383 | + '/designs/themes/' + environment.theme + '/favicon.ico' | |
| 384 | + end | |
| 385 | + end | |
| 386 | + end | |
| 387 | + | |
| 388 | + def theme_site_title | |
| 389 | + theme_include('site_title') | |
| 390 | + end | |
| 391 | + | |
| 374 | 392 | def theme_header |
| 375 | 393 | theme_include('header') |
| 376 | 394 | end | ... | ... |
app/views/layouts/application-ng.rhtml
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | <!--<meta http-equiv="refresh" content="1"/>--> |
| 7 | 7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 8 | 8 | <meta name="description" content="<%= @environment.name %>" /> |
| 9 | - <link rel="shortcut icon" href="<%= image_path('/designs/themes/' + current_theme + '/favicon.ico') %>" type="image/x-icon" /> | |
| 9 | + <link rel="shortcut icon" href="<%= image_path(theme_favicon) %>" type="image/x-icon" /> | |
| 10 | 10 | <%= noosfero_javascript %> |
| 11 | 11 | <%= stylesheet_link_tag noosfero_stylesheets, :cache => 'cache' %> |
| 12 | 12 | <%= stylesheet_link_tag template_stylesheet_path %> |
| ... | ... | @@ -73,7 +73,7 @@ |
| 73 | 73 | </div><!-- end id="user" --> |
| 74 | 74 | |
| 75 | 75 | <h1 id="site-title"> |
| 76 | - <%= link_to content_tag('span', environment.name), environment.top_url %> | |
| 76 | + <%= theme_site_title %> | |
| 77 | 77 | </h1> |
| 78 | 78 | <div id="navigation"> |
| 79 | 79 | <ul> | ... | ... |
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +<%= link_to(image_tag("/designs/themes/noosfero/images/logo-noosfero.png"), environment.top_url) %> | ... | ... |
public/designs/themes/noosfero/style.css
| 1 | 1 | @import url(../base/style.css); |
| 2 | 2 | |
| 3 | -#site-title { | |
| 4 | - background: url(images/logo-noosfero.png) no-repeat; | |
| 5 | -} | |
| 6 | - | |
| 7 | -.docSize-LT-800 #site-title { | |
| 8 | - width: 100px; | |
| 9 | - background: url(images/logo-noosfero-no-text.png) no-repeat; | |
| 3 | +#site-title img { | |
| 4 | + left:-22px; | |
| 5 | + position:absolute; | |
| 6 | + top:-30px; | |
| 10 | 7 | } | ... | ... |
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +<div id="assets-menu"> | |
| 2 | + <ul> | |
| 3 | + <%= generate_assets_menu %> | |
| 4 | + </ul> | |
| 5 | +</div><!-- fim id="assets-menu" --> | |
| 6 | + | |
| 7 | +<script type="text/javascript"> | |
| 8 | + jQuery(document).ready(function() { | |
| 9 | + $ = jQuery; | |
| 10 | + $("#site-title, #assets-menu").mouseover(function() { | |
| 11 | + clearTimeout( window.closeAssetsTimeout ); | |
| 12 | + $("#assets-menu").slideDown("slow"); | |
| 13 | + }); | |
| 14 | + $("#site-title, #assets-menu").mouseout(function() { | |
| 15 | + window.closeAssetsTimeout = | |
| 16 | + setTimeout( '$("#assets-menu").slideUp("slow")', 500 ); | |
| 17 | + }); | |
| 18 | + }); | |
| 19 | +</script> | ... | ... |
188 Bytes
222 Bytes
266 Bytes
525 Bytes
198 Bytes
210 Bytes
189 Bytes
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +<%= link_to(image_tag("/designs/themes/#{environment.theme}/imgs/thin-logo.png"), environment.top_url) %> | ... | ... |
| ... | ... | @@ -0,0 +1,221 @@ |
| 1 | +@import url(../base/style.css); | |
| 2 | + | |
| 3 | +head { | |
| 4 | + margin: 0px; | |
| 5 | + padding: 0px; | |
| 6 | +} | |
| 7 | + | |
| 8 | +body { | |
| 9 | + margin: 0px auto; | |
| 10 | + padding: 0px; | |
| 11 | +} | |
| 12 | + | |
| 13 | +#wrap-1 { | |
| 14 | + position: relative; | |
| 15 | +} | |
| 16 | + | |
| 17 | +#wrap-2 { | |
| 18 | + margin-top: -4px; | |
| 19 | + padding-bottom: 0px; | |
| 20 | +} | |
| 21 | + | |
| 22 | +#navigation, | |
| 23 | +#navigation-end { | |
| 24 | + display: none; | |
| 25 | +} | |
| 26 | + | |
| 27 | +#theme-header { | |
| 28 | + height: 30px; | |
| 29 | +} | |
| 30 | + | |
| 31 | +/************************** user bar ***************************/ | |
| 32 | + | |
| 33 | +#user { | |
| 34 | + top: -23px; | |
| 35 | + right: 10px; | |
| 36 | + height: 20px; | |
| 37 | +} | |
| 38 | + | |
| 39 | +#user a, | |
| 40 | +#user a strong { | |
| 41 | + color: #A40000; | |
| 42 | +} | |
| 43 | + | |
| 44 | +/************************** navigation ***************************/ | |
| 45 | + | |
| 46 | +#navigation { | |
| 47 | + background: none; | |
| 48 | +} | |
| 49 | + | |
| 50 | +/************************** content ***************************/ | |
| 51 | + | |
| 52 | +#content { | |
| 53 | + margin-top: 0px; | |
| 54 | +} | |
| 55 | + | |
| 56 | +#boxes { | |
| 57 | + margin-top: 20px; | |
| 58 | +} | |
| 59 | + | |
| 60 | +#profile-header { | |
| 61 | + margin: -10px; | |
| 62 | + margin-bottom: 0px; | |
| 63 | + width: 958px; | |
| 64 | + max-width: none; | |
| 65 | + max-height: none; | |
| 66 | +} | |
| 67 | + | |
| 68 | +#profile-footer { | |
| 69 | + margin-left: -10px; | |
| 70 | + width: 958px; | |
| 71 | + max-width: none; | |
| 72 | +} | |
| 73 | + | |
| 74 | +#content .block-title, | |
| 75 | +#content .main-block h1, #not-found h1, #access-denied h1 { | |
| 76 | + border-bottom:2px solid #A40000; | |
| 77 | + color: #A40000; | |
| 78 | +} | |
| 79 | + | |
| 80 | +.profile-image-block p { | |
| 81 | + color: #A40000; | |
| 82 | +} | |
| 83 | + | |
| 84 | +.block a { | |
| 85 | + color: #A40000; | |
| 86 | +} | |
| 87 | + | |
| 88 | +.block a:visited { | |
| 89 | + color: #CC0000; | |
| 90 | +} | |
| 91 | + | |
| 92 | +.control-panel a, | |
| 93 | +.control-panel a:visited { | |
| 94 | + color: #000; | |
| 95 | +} | |
| 96 | + | |
| 97 | +.controller-profile_editor .control-panel a:hover { | |
| 98 | + background-color: #A40000; | |
| 99 | + color: #FFF; | |
| 100 | +} | |
| 101 | + | |
| 102 | +#content .link-list-block li a:hover { | |
| 103 | + background-color: #A40000; | |
| 104 | +} | |
| 105 | + | |
| 106 | +#content .link-list-block li a.link-this-page { | |
| 107 | + background-color: #CC0000; | |
| 108 | + border-right:2px solid #A40000; | |
| 109 | +} | |
| 110 | + | |
| 111 | +.template-rightbar #content .link-list-block li a.link-this-page, | |
| 112 | +#content .box-3 .link-list-block li a.link-this-page { | |
| 113 | + border-left: 2px solid #A40000; | |
| 114 | + border-right: none; | |
| 115 | + margin-left: -5px; | |
| 116 | + margin-right: 0px; | |
| 117 | + max-width: 170px; | |
| 118 | + -moz-border-radius-bottomleft: 0; | |
| 119 | + -moz-border-radius-topleft: 0; | |
| 120 | + -moz-border-radius-bottomright: 4px; | |
| 121 | + -moz-border-radius-topright: 4px; | |
| 122 | + -webkit-border-radius-bottomleft: 0; | |
| 123 | + -webkit-border-radius-topleft: 0; | |
| 124 | + -webkit-border-radius-bottomright: 4px; | |
| 125 | + -webkit-border-radius-topright: 4px; | |
| 126 | +} | |
| 127 | + | |
| 128 | +/************** blog **************/ | |
| 129 | + | |
| 130 | +#content .blog-posts { | |
| 131 | + margin-top: 30px; | |
| 132 | +} | |
| 133 | + | |
| 134 | +#content .blog-post .title a:hover { | |
| 135 | + color: #A40000; | |
| 136 | +} | |
| 137 | + | |
| 138 | +#article .blog-feed-link { | |
| 139 | + position: absolute; | |
| 140 | + right: 0px; | |
| 141 | + top: 28px; | |
| 142 | +} | |
| 143 | + | |
| 144 | +#article-tags { | |
| 145 | + margin-right: 30px; | |
| 146 | +} | |
| 147 | + | |
| 148 | +/************** environment bar **************/ | |
| 149 | + | |
| 150 | +#site-title { | |
| 151 | + position: absolute; | |
| 152 | + left: 10px; | |
| 153 | + top: -27px; | |
| 154 | + height: 40px; | |
| 155 | + width: 264px; | |
| 156 | +} | |
| 157 | + | |
| 158 | +#site-title a { | |
| 159 | + display: block; | |
| 160 | + top: 0px; | |
| 161 | + height: 20px; | |
| 162 | +} | |
| 163 | + | |
| 164 | +#assets-menu { | |
| 165 | + display: none; | |
| 166 | + position: absolute; | |
| 167 | + top: 26px; | |
| 168 | + left: 56px; | |
| 169 | + min-width: 140px; | |
| 170 | + z-index: 10; | |
| 171 | + border: 1px solid #D3D7CF; | |
| 172 | + border-top: none; | |
| 173 | + background: #EEE; | |
| 174 | + padding: 0px 4px 6px 4px; | |
| 175 | + -moz-border-radius-bottomleft: 10px; | |
| 176 | + -moz-border-radius-bottomright: 10px; | |
| 177 | + -webkit-border-radius-bottomleft: 10px; | |
| 178 | + -webkit-border-radius-bottomright: 10px; | |
| 179 | + border-radius-bottomleft: 10px; | |
| 180 | + border-radius-bottomright: 10px; | |
| 181 | +} | |
| 182 | + | |
| 183 | +#assets-menu ul, | |
| 184 | +#assets-menu li { | |
| 185 | + margin: 0px; | |
| 186 | + padding: 0px; | |
| 187 | + list-style: none; | |
| 188 | +} | |
| 189 | + | |
| 190 | +#assets-menu a { | |
| 191 | + text-decoration: none; | |
| 192 | + display: block; | |
| 193 | + padding: 2px 4px 2px 8px; | |
| 194 | + color: #555; | |
| 195 | + border: 1px solid #EEE; | |
| 196 | +} | |
| 197 | + | |
| 198 | +#assets-menu a:hover { | |
| 199 | + background: #FBFBFB; | |
| 200 | + border: 1px solid #F6F6F6; | |
| 201 | + color: #000; | |
| 202 | + -moz-border-radius: 5px; | |
| 203 | + -webkit-border-radius: 5px; | |
| 204 | + border-radius: 5px; | |
| 205 | +} | |
| 206 | + | |
| 207 | +/**************************** Comments *******************************/ | |
| 208 | + | |
| 209 | +#content .comments h3 { | |
| 210 | + color: #A40000; | |
| 211 | + border-bottom: 2px solid #A40000; | |
| 212 | +} | |
| 213 | + | |
| 214 | +.post_comment_box h4 { | |
| 215 | + background-color: #A40000; | |
| 216 | + color: #FFF; | |
| 217 | +} | |
| 218 | + | |
| 219 | +.post_comment_box.closed h4 { | |
| 220 | + border: none; | |
| 221 | +} | ... | ... |
No preview for this file type
test/unit/application_helper_test.rb
| ... | ... | @@ -154,6 +154,28 @@ class ApplicationHelperTest < Test::Unit::TestCase |
| 154 | 154 | assert_nil theme_footer |
| 155 | 155 | end |
| 156 | 156 | |
| 157 | + should 'render theme site title' do | |
| 158 | + stubs(:theme_path).returns('/user_themes/mytheme') | |
| 159 | + site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.rhtml' | |
| 160 | + | |
| 161 | + File.expects(:exists?).with(site_title_path).returns(true) | |
| 162 | + expects(:render).with(:file => site_title_path, :use_full_path => false).returns("Site title") | |
| 163 | + | |
| 164 | + assert_equal "Site title", theme_site_title | |
| 165 | + end | |
| 166 | + | |
| 167 | + should 'ignore unexisting theme site title' do | |
| 168 | + stubs(:theme_path).returns('/user_themes/mytheme') | |
| 169 | + site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.rhtml' | |
| 170 | + alternate_site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.html.erb' | |
| 171 | + | |
| 172 | + File.expects(:exists?).with(site_title_path).returns(false) | |
| 173 | + File.expects(:exists?).with(alternate_site_title_path).returns(false) | |
| 174 | + expects(:render).with(:file => site_title_path).never | |
| 175 | + | |
| 176 | + assert_nil theme_site_title | |
| 177 | + end | |
| 178 | + | |
| 157 | 179 | should 'expose theme owner' do |
| 158 | 180 | theme = mock |
| 159 | 181 | profile = mock |
| ... | ... | @@ -621,6 +643,40 @@ class ApplicationHelperTest < Test::Unit::TestCase |
| 621 | 643 | assert_equal ['Home Page', 'Products', 'Members', 'Agenda'], links.map{|i| i.keys.first} |
| 622 | 644 | end |
| 623 | 645 | |
| 646 | + should 'use favicon from environment theme if does not have profile' do | |
| 647 | + stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) | |
| 648 | + stubs(:profile).returns(nil) | |
| 649 | + assert_equal '/designs/themes/new-theme/favicon.ico', theme_favicon | |
| 650 | + end | |
| 651 | + | |
| 652 | + should 'use favicon from environment theme if the profile theme is nil' do | |
| 653 | + stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) | |
| 654 | + stubs(:profile).returns(fast_create(Profile)) | |
| 655 | + assert_equal '/designs/themes/new-theme/favicon.ico', theme_favicon | |
| 656 | + end | |
| 657 | + | |
| 658 | + should 'use favicon from profile theme if the profile has theme' do | |
| 659 | + stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) | |
| 660 | + stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme')) | |
| 661 | + File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', '/designs/themes/profile-theme', 'favicon.ico')).returns(true) | |
| 662 | + assert_equal '/designs/themes/profile-theme/favicon.ico', theme_favicon | |
| 663 | + end | |
| 664 | + | |
| 665 | + should 'use favicon from profile articles if the profile theme does not have' do | |
| 666 | + stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) | |
| 667 | + stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme')) | |
| 668 | + file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/favicon.ico', 'image/png'), :profile => profile) | |
| 669 | + File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')).returns(false) | |
| 670 | + assert_equal file.public_filename, theme_favicon | |
| 671 | + end | |
| 672 | + | |
| 673 | + should 'use favicon from environment if the profile theme and profile articles do not have' do | |
| 674 | + stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) | |
| 675 | + stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme')) | |
| 676 | + File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')).returns(false) | |
| 677 | + assert_equal '/designs/themes/new-theme/favicon.ico', theme_favicon | |
| 678 | + end | |
| 679 | + | |
| 624 | 680 | protected |
| 625 | 681 | |
| 626 | 682 | def url_for(args = {}) | ... | ... |