[#369] top menu & footer

This commit is contained in:
Alexander Machehin 2014-03-30 11:45:52 +06:00
parent 313056a8c6
commit a0f3225dad
12 changed files with 136 additions and 3 deletions

View File

@ -0,0 +1,5 @@
RosaABF.controller('ProjectsController', ['$scope', 'Projects', function($scope, Projects) {
$scope.projects = Projects.query();
$scope.public = true;
}]);

View File

@ -0,0 +1,3 @@
//= require jquery
// Loads all Bootstrap javascripts
//= require bootstrap

View File

@ -0,0 +1,38 @@
body {
background: $body-bg image-url("bg.png") repeat-x;
}
.top_menu {
margin-bottom: 0;
}
article.container-fluid {
background: #FFF;
}
$logo-mini-height: 32px;
a.navbar-brand, .navbar .navbar-right .avatar {
padding-top: ($navbar-height - $logo-mini-height) / 2;
}
footer {
padding-top: 20px;
padding-bottom: 20px;
text-align: center;
ul li {
display: inline;
padding: 0;
font-size: 12px;
color: $navbar-default-link-color;
a {
color: $navbar-default-link-color;
}
a:hover, a:focus {
color: $navbar-default-link-hover-color;
}
}
}

View File

@ -0,0 +1,9 @@
$body-bg: #1F60A1;
$navbar-default-bg: #3E73A2;
$navbar-default-link-color: #FFF;
$navbar-default-link-active-color: #FFF;
$navbar-height: 51px;
$navbar-default-link-hover-color: #CEE7FF;
@import "bootstrap";
@import "custom_bootstrap"

View File

@ -1,4 +1,5 @@
class HomeController < ApplicationController class HomeController < ApplicationController
layout 'bootstrap'
before_filter :authenticate_user!, only: [:activity, :issues, :pull_requests] before_filter :authenticate_user!, only: [:activity, :issues, :pull_requests]
def root def root

View File

@ -13,7 +13,7 @@ class ActivityFeed < ActiveRecord::Base
default_scope { order created_at: :desc } default_scope { order created_at: :desc }
scope :outdated, -> { offset(100) } scope :outdated, -> { offset(100) }
self.per_page = 10 self.per_page = 4
def partial def partial
'home/partials/' + self.kind 'home/partials/' + self.kind

View File

@ -0,0 +1,17 @@
!!!
%html
%head
%meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
= csrf_meta_tag
= display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-'
- if user_signed_in?
= auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name'])
%body
= render 'layouts/menu/new_top'
%article.container-fluid
.row= yield
= render 'layouts/menu/new_bottom'
= stylesheet_link_tag 'new_application'
= javascript_include_tag 'new_application'
=# javascript_include_tag 'moment/ru.js' if I18n.locale == :ru

View File

@ -0,0 +1,20 @@
%footer
%ul
%li= t('bottom_menu.copyright', year: Date.today.year)
%li ·
%li= image_tag 'flag.png', alt: 'flag'
%li ·
%li= link_to t('bottom_menu.about'), t('bottom_menu.about_url')
%li ·
%li= link_to t('bottom_menu.contacts'), t('bottom_menu.contacts_url')
%li ·
%li= link_to t('bottom_menu.tos'), tos_url
%li ·
%li= link_to t('bottom_menu.support'), contact_url
%li ·
%li= link_to t('bottom_menu.developer_api'), t('bottom_menu.developer_api_url')
-if pr = Project.find_by_owner_and_name('abf/abf-ideas')
%li ·
%li= link_to t('bottom_menu.abf_ideas'), project_issues_url(pr)
%li ·
%li= link_to t('bottom_menu.abf_blog'), t('bottom_menu.abf_blog_url')

View File

@ -0,0 +1,40 @@
%nav.navbar.navbar-default.top_menu{ role: "navigation" }
.container-fluid
/ Brand and toggle get grouped for better mobile display
.navbar-header
%button.navbar-toggle{ "data-target" => "#bs-example-navbar-collapse-1", "data-toggle" => "collapse", type: "button" }
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to image_tag('logo-mini.png', alt: 'ABF'), root_path, class: 'navbar-brand'
/ Collect the nav links, forms, and other content for toggling
#bs-example-navbar-collapse-1.collapse.navbar-collapse
%ul.nav.navbar-nav
- (collection = t 'top_menu').each do |base, title|
- if can? :index, base.to_s.classify.constantize
%li{ class: top_menu_class(base) }= link_to title, send("#{base}_path")
- if current_user.try(:admin?)
%li{ class: top_menu_class('admin') }= link_to t('admins_menu_header'), admin_users_path
= form_tag search_index_path, method: 'get', class: 'navbar-form navbar-left', role: 'search' do
.form-group
= text_field_tag 'query', @query, placeholder: t('layout.search.header'), class: 'form-control'
%ul.nav.navbar-nav.navbar-right
%li
.avatar= image_tag avatar_url(current_user), alt: 'avatar', height: "32"
- if current_user
%li.dropdown
%a.dropdown-toggle{ "data-toggle" => "dropdown", href: "#" }
= current_user.uname
%b.caret
%ul.dropdown-menu
%li= link_to current_user.uname, current_user
%li= link_to t('layout.settings.label'), profile_settings_path
%li.divider
%li= link_to t('layout.logout'), destroy_user_session_path, method: :delete
- else
%ul.nav.navbar-nav
%li= link_to t('layout.devise.shared_links.sign_up'), new_register_request_path
%li= link_to t('layout.devise.shared_links.sign_in'), new_user_session_path
/ /.navbar-collapse
/ /.container-fluid

View File

@ -63,7 +63,7 @@ Rosa::Application.configure do
config.assets.digest = true config.assets.digest = true
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w(login.css login.js reg_session.css tour.css tour.js gollum/editor/langs/*.js moment/ru.js) config.assets.precompile += %w(login.css login.js reg_session.css tour.css tour.js gollum/editor/langs/*.js moment/ru.js new_application.css new_application.js)
config.eager_load = true config.eager_load = true
end end

View File

@ -13,5 +13,5 @@
@import "codemirror/modes/rpm-spec"; @import "codemirror/modes/rpm-spec";
@import "codemirror/modes/tiddlywiki"; @import "codemirror/modes/tiddlywiki";
@import "bootstrap"; @import "old-bootstrap";
@import "chosen.scss"; @import "chosen.scss";