diff --git a/app/controllers/application.rb b/app/controllers/application.rb index f0b973a..6e73ba8 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -2,6 +2,12 @@ # available in all controllers. class ApplicationController < ActionController::Base + include ApplicationHelper + layout :get_layout + def get_layout + theme_option(:layout) || 'application' + end + filter_parameter_logging :password def log_processing diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 78ccb72..241cd15 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -290,7 +290,12 @@ module ApplicationHelper if in_theme result << theme_path end - result << '/stylesheets/' << name << '.css' + name += '.css' if ( name[-4..-1] != '.css' ) + if ( name[0..0] == '/' ) + result << name + else + result << '/stylesheets/' << name + end end def theme_path @@ -301,6 +306,10 @@ module ApplicationHelper end end + def theme_stylesheet_path + theme_path + '/style.css' + end + def current_theme return session[:theme] if (session[:theme]) p = profile @@ -311,13 +320,21 @@ module ApplicationHelper end end - def theme_footer - footer = ('../../public' + theme_path + '/footer.rhtml') - if File.exists?(RAILS_ROOT + '/app/views/' + footer) - render :file => footer + def theme_include(template) + file = ('../../public' + theme_path + '/' + template + '.rhtml') + if File.exists?(RAILS_ROOT + '/app/views/' + file) + render :file => file end end + def theme_header + theme_include('header') + end + + def theme_footer + theme_include('footer') + end + def is_testing_theme !@controller.session[:theme].nil? end @@ -727,13 +744,16 @@ module ApplicationHelper end end - def template_stylesheet_tag + def template_stylesheet_path if profile.nil? - stylesheet_link_tag '/designs/templates/default/stylesheets/style.css' + '/designs/templates/default/stylesheets/style.css' else - stylesheet_link_tag "/designs/templates/#{profile.layout_template}/stylesheets/style.css" + "/designs/templates/#{profile.layout_template}/stylesheets/style.css" end end + def template_stylesheet_tag + stylesheet_import template_stylesheet_path() + end def login_url options = Noosfero.url_options.merge({ :controller => 'account', :action => 'login' }) @@ -770,9 +790,11 @@ module ApplicationHelper end def meta_tags_for_article(article) - if article and (article.blog? or (article.parent and article.parent.blog?)) - blog = article.blog? ? article : article.parent - "" + if @controller.controller_name == 'content_viewer' + if article and (article.blog? or (article.parent and article.parent.blog?)) + blog = article.blog? ? article : article.parent + "" + end end end @@ -789,14 +811,40 @@ module ApplicationHelper end end - def icon_theme_stylesheet_tag + def icon_theme_stylesheet_path theme_path = "/designs/icons/#{environment.icon_theme}/style.css" if File.exists?(File.join(RAILS_ROOT, 'public', theme_path)) - stylesheet_link_tag theme_path + theme_path else - "\n" + - stylesheet_link_tag("/designs/icons/default/style.css") + '/designs/icons/default/style.css' end end + def icon_theme_stylesheet_tag + theme_path = "/designs/icons/#{environment.icon_theme}/style.css" + stylesheet_import icon_theme_stylesheet_path() + end + + def page_title + (@page ? @page.name + ' - ' : '') + + (@profile ? @profile.name + ' - ' : '') + + @environment.name + + (@category ? "→ #{@category.full_name}" : '') + end + + def noosfero_javascript + render :file => 'layouts/_javascript' + end + + def import_controller_stylesheets(options = {}) + stylesheet_import( "controller_"+ @controller.controller_name(), options ) + end + + def pngfix_stylesheet_path + 'iepngfix/iepngfix.css' + end + def pngfix_stylesheet + stylesheet_import pngfix_stylesheet_path() + end + end diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb index 8ce05c2..583cf7e 100644 --- a/app/helpers/blog_helper.rb +++ b/app/helpers/blog_helper.rb @@ -21,14 +21,20 @@ module BlogHelper :next_label => _('Older posts »') }) content = [] - articles.map{ |i| - css_add = '' - if i.published? || (user==i.profile) - css_add = '-not-published' if !i.published? - content << content_tag('div', display_post(i), :class => 'blog-post' + css_add, :id => "post-#{i.id}") + artic_len = articles.length + articles.each_with_index{ |art,i| + css_add = [ 'position-'+(i+1).to_s() ] + if art.published? || (user==art.profile) + css_add << 'first' if i == 0 + css_add << 'last' if i == (artic_len-1) + css_add << 'not-published' if !art.published? + content << content_tag('div', + display_post(art), + :class => 'blog-post ' + css_add.join(' '), + :id => "post-#{art.id}") end } - content.join("\n
\n") + (pagination or '') + content.join("\n
\n") + (pagination or '') end def display_post(article) diff --git a/app/helpers/boxes_helper.rb b/app/helpers/boxes_helper.rb index c9a5b6e..3f1fbbd 100644 --- a/app/helpers/boxes_helper.rb +++ b/app/helpers/boxes_helper.rb @@ -1,5 +1,17 @@ module BoxesHelper + def insert_boxes(content) + if @controller.send(:boxes_editor?) + content + display_boxes_editor(@controller.boxes_holder) + else + if @controller.send(:uses_design_blocks?) + display_boxes(@controller.boxes_holder, content) + else + content_tag('div', content, :class => 'no-boxes') + end + end + end + def box_decorator @box_decorator || DontMoveBlocks end @@ -204,10 +216,9 @@ module BoxesHelper @controller.boxes_holder.boxes.map(&:blocks).inject([]){|ac, a| ac + a} end - def import_blocks_stylesheets - blocks_css_files = current_blocks.map{|b|'blocks/' + b.css_class_name}.uniq - stylesheet_import(blocks_css_files) + "\n" + - stylesheet_import(blocks_css_files, :themed_source => true ) + def import_blocks_stylesheets(options = {}) + @blocks_css_files ||= current_blocks.map{|b|'blocks/' + b.css_class_name}.uniq + stylesheet_import(@blocks_css_files, options) end end diff --git a/app/views/cms/_blog.rhtml b/app/views/cms/_blog.rhtml index ecfcbc1..5e529af 100644 --- a/app/views/cms/_blog.rhtml +++ b/app/views/cms/_blog.rhtml @@ -1,6 +1,6 @@ <%= error_messages_for 'blog' %> -

<%= _('My Blog') %>

+

<%= _('My Blog') %>

<%= render :file => 'shared/tiny_mce' %> diff --git a/app/views/content_viewer/blog_page.rhtml b/app/views/content_viewer/blog_page.rhtml index 25e3a34..c594d05 100644 --- a/app/views/content_viewer/blog_page.rhtml +++ b/app/views/content_viewer/blog_page.rhtml @@ -1,7 +1,7 @@ <%= content_tag('em', _('(external feed was not loaded yet)'), :id => 'external-feed-info', :class => 'metadata') if article.blog? && article.external_feed && article.external_feed.enabled && article.external_feed.fetched_at.nil? %>
<%= article.body %>
-
+
<%= (children.compact.empty? ? content_tag('em', _('(no posts)')) : list_posts(user, children)) %>
diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml index 7e40129..be87cb6 100644 --- a/app/views/content_viewer/view_page.rhtml +++ b/app/views/content_viewer/view_page.rhtml @@ -17,7 +17,7 @@ } str %> - + <% end; end %> diff --git a/app/views/layouts/_javascript.rhtml b/app/views/layouts/_javascript.rhtml new file mode 100644 index 0000000..b5947c8 --- /dev/null +++ b/app/views/layouts/_javascript.rhtml @@ -0,0 +1,12 @@ +<%= javascript_include_tag 'default-config' %> +<%= javascript_include_tag :defaults %> +<%= javascript_include_tag 'jquery-latest.js' %> + +<%= javascript_include_tag 'thickbox.js' %> + +<%= javascript_include_tag 'menu' %> +<%= javascript_include_tag 'auto-open-menu' %> +<%= include_lightbox_header %> +<%= javascript_include_tag 'cms' if @controller.controller_name == 'cms' %> diff --git a/app/views/layouts/application-ng.rhtml b/app/views/layouts/application-ng.rhtml new file mode 100644 index 0000000..64ce1fb --- /dev/null +++ b/app/views/layouts/application-ng.rhtml @@ -0,0 +1,105 @@ + + + <%= page_title %> + <%= meta_tags_for_article(@page) %> + + + <%= noosfero_javascript %> + <%= import_blocks_stylesheets %> + <%= import_controller_stylesheets %> + <%= stylesheet_import( + %w( common help menu article button search ), + %w( blocks forms login-box thickbox profiles), + template_stylesheet_path(), + icon_theme_stylesheet_path(), + theme_stylesheet_path(), + pngfix_stylesheet_path() + ) %> + + " onresize="registerDocumentSize()"> + + + Ir para o conteúdo + +
+
+ <%= theme_header %> +
+
+
+ <% if logged_in? %> + <%= _('Welcome, %s.') % link_to('' + user.identifier + '', user.url, :id => "homepage-link", :title => _('Go to your homepage')) %> + <%= link_to('' + _('Administration') + '', user.admin_url, :id => "controlpanel", :title => _("Configure the system")) %> + <%= link_to('' + _('Control panel') + '', user.admin_url, :id => "controlpanel", :title => _("Configure your personal account and content")) %> + <%= link_to('' + _('Logout') + '', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) %> + <% else %> + <%= _('%s or %s') % [thickbox_inline_popup_link('' + _('Login') + '', 'inlineLoginBox', :id => 'link_login', :help => _('Click here to enter your username and password and be recognized by the system.')), link_to('' + _('Register') + '', :controller => 'account', :action => 'signup') ] %> + + <% end %> + +
+ +
<%=_('Press Enter to send the search query.')%>
+
+
+ +

+ Title of the Site +

+ +
+ <%= insert_boxes(yield) %> +
+
+
+
+ + + diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index 8608daa..ea83245 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -1,31 +1,14 @@ - <%= - (@page ? @page.name + ' - ' : '') + - (@profile ? @profile.name + ' - ' : '') + - @environment.name + - (@category ? "→ #{@category.full_name}" : '') - %> + <%= page_title %> - <%= meta_tags_for_article(@page) if @controller.controller_name == 'content_viewer' %> - <%= javascript_include_tag 'default-config' %> - <%= javascript_include_tag :defaults %> - <%# javascript_include_tag 'animator' %> + <%= meta_tags_for_article(@page) %> - <%= javascript_include_tag 'jquery-latest.js' %> - - <%= javascript_include_tag 'thickbox.js' %> - - <%= javascript_include_tag 'menu' %> - <%= javascript_include_tag 'auto-open-menu' %> - <%= include_lightbox_header %> - <%= javascript_include_tag 'cms' if @controller.controller_name == 'cms' %> + <%= noosfero_javascript %> <%= theme_javascript %> <%# @@ -39,16 +22,17 @@ stylesheet_import( %w( common help menu article button search blocks forms login-box ), :themed_source => true ) + "\n" + # Load the boxes's css file if each exists: - import_blocks_stylesheets + + import_blocks_stylesheets + "\n" + + import_blocks_stylesheets(:themed_source => true) + "\n" + # Load the controller's css file if it exists: - stylesheet_import( "controller_"+ @controller.controller_name() ) + "\n" + - stylesheet_import( "controller_"+ @controller.controller_name(), :themed_source => true ) + import_controller_stylesheets + "\n" + + import_controller_stylesheets(:themed_source => true) %> <%= template_stylesheet_tag %> <%= icon_theme_stylesheet_tag %> - <%= stylesheet_link_tag 'iepngfix/iepngfix.css' %> + <%= pngfix_stylesheet %> - <%= yield %> - - <% end %> - <% end %> + <%= insert_boxes(yield) %> diff --git a/public/designs/themes/noosfero/stylesheets/common.css b/public/designs/themes/noosfero/stylesheets/common.css index 60d2525..42f174f 100644 --- a/public/designs/themes/noosfero/stylesheets/common.css +++ b/public/designs/themes/noosfero/stylesheets/common.css @@ -6,7 +6,7 @@ body.noosfero { #wrap { background-position: 50% 22px; background-repeat: repeat-x; - border: 3px solid #2A5896; + border: 3px solid #888; } .box-3 { @@ -27,7 +27,7 @@ a:hover, a:active { color: #08F } hr { border: none; - border-top: 2px dotted #2A5896; + border-top: 2px dotted black; } #footer { diff --git a/public/images/top-bar/assets-menu-bg-azul.gif b/public/images/top-bar/assets-menu-bg-azul.gif deleted file mode 100644 index 188ca98..0000000 Binary files a/public/images/top-bar/assets-menu-bg-azul.gif and /dev/null differ diff --git a/public/images/top-bar/assets-menu-top-azul.gif b/public/images/top-bar/assets-menu-top-azul.gif deleted file mode 100644 index baa4851..0000000 Binary files a/public/images/top-bar/assets-menu-top-azul.gif and /dev/null differ diff --git a/public/stylesheets/article.css b/public/stylesheets/article.css index 8892028..324cbcc 100644 --- a/public/stylesheets/article.css +++ b/public/stylesheets/article.css @@ -60,14 +60,14 @@ .article-comment { position: relative; - border: 1px solid #B8CFE7; + border: 1px solid #ccc; margin-bottom: 10px; padding: 4px; } .comment-from-owner { - border: 1px solid #3465A4; - background: #B8CFE7; + border: 1px solid #888; + background: #eee; } #article .article-comment h4 { @@ -106,7 +106,7 @@ a.comment-picture { } .comment-from-owner .comment-info { - color: #729FCF; + color: #666; } .comment-text { @@ -128,18 +128,18 @@ a.comment-picture { .post_comment_box h4 { padding: 1px 20px; margin: 0px; - background: #B8CFE7; + background: #eee; } .post_comment_box.closed h4 { display: inline; - border: 1px solid #729FCF; + border: 1px solid #888; cursor: pointer; } .post_comment_box.opened { - border: 1px solid #729FCF; - background: #B8CFE7; + border: 1px solid #888; + background: #eee; } .post_comment_box form { @@ -238,22 +238,22 @@ a.comment-picture { /* NOT PUBLISHED BLOG POSTS */ -.blog-post-not-published { +.blog-post.not-published { background: url(/images/hachure.png); opacity: 0.25; filter: alpha(opacity=25); zoom: 1; } -.blog-post-not-published a { +.blog-post.not-published a { text-decoration: none; } -#content .blog-post-not-published .created-at { +#content .blog-post.not-published .created-at { text-align: left; } -.blog-post-not-published .metadata { +.blog-post.not-published .metadata { display: block; text-align: center; font-size: small; diff --git a/public/stylesheets/button.css b/public/stylesheets/button.css index e678dba..c338939 100644 --- a/public/stylesheets/button.css +++ b/public/stylesheets/button.css @@ -1,6 +1,6 @@ -body.noosfero a.button, -body.noosfero a.button:visited, +a.button, a.button:visited, +body.noosfero a.button, body.noosfero a.button:visited, input.button { margin: 0px 2px; background-repeat: no-repeat; @@ -27,6 +27,8 @@ input.button { padding-right: 4px; } +a.button.with-text, +a.button.with-text:visited, body.noosfero a.button.with-text, body.noosfero a.button.with-text:visited, input.button.with-text { @@ -43,6 +45,9 @@ input.button.with-text { padding: 0px 2px 2px 20px; background-position: 3px 50%; } +.msie a.button.with-text, +.msie a.button.with-text:visited, +.msie input.button.with-text, body.noosfero.msie a.button.with-text, body.noosfero.msie a.button.with-text:visited, body.noosfero.msie input.button.with-text { @@ -51,14 +56,17 @@ body.noosfero.msie input.button.with-text { line-height: 20px; margin: 2px; } +.msie input.button.with-text, body.noosfero.msie input.button.with-text { line-height: 16px; padding: 0px 0px 1px 15px; background-position: 2px 50%; } +a.button:hover, body.noosfero a.button:hover, input.button:hover, +a.button.with-text:hover, body.noosfero a.button.with-text:hover, input.button.with-text:hover { border: 1px solid #678; diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css index adc1508..cc93122 100644 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@ -151,7 +151,7 @@ div#notice { #content h1, #content h2, #content h3, #content h4, #content h5, #content h6 { margin: 10px 0px; - color: #2A5896; + /*color: #2A5896;*/ } #content h1 { font-size: 24px } #content h2 { font-size: 20px } diff --git a/public/stylesheets/menu.css b/public/stylesheets/menu.css index 66f4a61..4911469 100644 --- a/public/stylesheets/menu.css +++ b/public/stylesheets/menu.css @@ -11,7 +11,7 @@ height: 22px; font-size: 11px; letter-spacing: -1px; - background: #2A5896 url(../images/white-pixel.gif) 0px 100% repeat-x; + background: #888 url(../images/white-pixel.gif) 0px 100% repeat-x; } #navigation_bar { @@ -135,12 +135,13 @@ width: 11px; height: 11px; overflow: hidden; - background: url(../images/top-bar/assets-menu-top-azul.gif); + /*background: url(../images/top-bar/assets-menu-top-azul.gif);*/ } #assets_menu_list { padding: 0px 0px 6px 5px; - background: url(../images/top-bar/assets-menu-bg-azul.gif) 0% 100%; + /*background: url(../images/top-bar/assets-menu-bg-azul.gif) 0% 100%;*/ + background-color: #888; } #assets_menu ul { @@ -278,8 +279,7 @@ position: absolute; top: 21px; right: 0px; - background: url(../images/top-bar/assets-menu-bg-azul.gif) 0% 100%; - border-right: 1px solid #FFF; + background: #888; } #user_menu ul { -- libgit2 0.21.2