From 1c4a689af77ccd40bd4556056756b69b5bb49c11 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 15 Feb 2012 20:37:15 -0800 Subject: [PATCH] DG MS; added a new layout for post pages. --- app/controllers/posts_controller.rb | 2 +- app/helpers/layout_helper.rb | 4 +- app/views/layouts/application.html.haml | 4 +- app/views/layouts/post.html.haml | 49 +++++++++++++++++++++ public/javascripts/app/app.js | 4 +- public/javascripts/app/views/header_view.js | 4 +- 6 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 app/views/layouts/post.html.haml diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 59a372585..35e92274c 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -34,7 +34,7 @@ class PostsController < ApplicationController format.xml{ render :xml => @post.to_diaspora_xml } format.mobile{render 'posts/show.mobile.haml'} format.json{ render :json => PostPresenter.new(@post).to_json } - format.any{render 'posts/show.html.haml'} + format.any{render 'posts/show.html.haml', :layout => 'layouts/post'} end else diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb index 4385281b8..27c5a839c 100644 --- a/app/helpers/layout_helper.rb +++ b/app/helpers/layout_helper.rb @@ -60,8 +60,8 @@ module LayoutHelper end end - def include_base_css_framework - if @aspect == :getting_started || @page == :logged_out + def include_base_css_framework(use_bootstrap=false) + if use_bootstrap || @aspect == :getting_started || @page == :logged_out include_stylesheets :bootstrap else include_stylesheets :blueprint, :media => 'screen' diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index c0388b861..340545364 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -46,8 +46,8 @@ %body = flash_messages - - unless current_user - %header + %header + - unless current_user = render 'layouts/header' .container diff --git a/app/views/layouts/post.html.haml b/app/views/layouts/post.html.haml new file mode 100644 index 000000000..439400509 --- /dev/null +++ b/app/views/layouts/post.html.haml @@ -0,0 +1,49 @@ +-# Copyright (c) 2010-2011, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + +!!! +%html{:lang => I18n.locale.to_s, :dir => (rtl?) ? 'rtl' : 'ltr'} + %head + %meta{:charset => 'utf-8'} + %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'} + %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"} + + %meta{:name => "description", :content => "Diaspora*"} + %meta{:name => "author", :content => "Diaspora, Inc."} + + %link{:rel => 'shortcut icon', :href => '/favicon.png'} + %link{:rel => 'apple-touch-icon', :href => '/apple-touch-icon.png'} + + %title + = page_title yield(:page_title) + + = include_base_css_framework(:bootstrap) + = include_stylesheets :login, :media => 'screen' + = include_stylesheets :default, :media => 'all' + + - if rtl? + = include_stylesheets :rtl, :media => 'all' + + = old_browser_js_support + + + = jquery_include_tag + - unless @landing_page + = include_javascripts :main, :templates + = load_javascript_locales + + = set_asset_host + = set_current_user_in_javascript + = translation_missing_warnings + = current_user_atom_tag + + = yield(:head) + = csrf_meta_tag + + %body + = flash_messages + + = yield diff --git a/public/javascripts/app/app.js b/public/javascripts/app/app.js index ef0e1d13d..2ec6f7055 100644 --- a/public/javascripts/app/app.js +++ b/public/javascripts/app/app.js @@ -19,7 +19,7 @@ var app = { if(this._user){ app.header = new app.views.Header; - $("body").prepend(app.header.el); + $("header").prepend(app.header.el); app.header.render(); } @@ -36,6 +36,6 @@ var app = { } }; -$(function() { +$(function() { app.initialize(); }); diff --git a/public/javascripts/app/views/header_view.js b/public/javascripts/app/views/header_view.js index 2b23cc2bc..b1ed5151f 100644 --- a/public/javascripts/app/views/header_view.js +++ b/public/javascripts/app/views/header_view.js @@ -1,8 +1,8 @@ app.views.Header = app.views.Base.extend({ - + templateName : "header", - tagName : "header", + className : "dark-header", events : { "click ul.dropdown li:first-child" : "toggleDropdown"