diff options
author | jessib <jessib@leap.se> | 2013-07-08 11:30:35 -0700 |
---|---|---|
committer | jessib <jessib@leap.se> | 2013-07-08 11:30:35 -0700 |
commit | fc3c5994df61de04b8b17b495a638efc0d760126 (patch) | |
tree | 644aa93dfd0a6da2ed9b20ba688712fb9082f425 /app | |
parent | cfb9e1d4c2e954222b77c4dd11e06ae3a0092be5 (diff) | |
parent | 3113f8b814417a896ad5340fda88927733f8ab22 (diff) |
Merge branch 'master' into feature/disable_account
Conflicts:
users/app/controllers/users_controller.rb
users/app/helpers/users_helper.rb
users/app/views/users/edit.html.haml
users/app/views/users/show.html.haml
users/config/locales/en.yml
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/application.js | 3 | ||||
-rw-r--r-- | app/assets/stylesheets/application.scss | 19 | ||||
-rw-r--r-- | app/assets/stylesheets/leap.scss | 194 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 12 | ||||
-rw-r--r-- | app/controllers/home_controller.rb | 3 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 38 | ||||
-rw-r--r-- | app/views/home/index.html.haml | 19 | ||||
-rw-r--r-- | app/views/layouts/_content.html.haml | 19 | ||||
-rw-r--r-- | app/views/layouts/_footer.html.haml | 0 | ||||
-rw-r--r-- | app/views/layouts/_header.html.haml | 11 | ||||
-rw-r--r-- | app/views/layouts/_masthead.html.haml | 4 | ||||
-rw-r--r-- | app/views/layouts/_messages.html.haml | 11 | ||||
-rw-r--r-- | app/views/layouts/_navigation.html.haml | 12 | ||||
-rw-r--r-- | app/views/layouts/application.html.haml | 26 |
14 files changed, 325 insertions, 46 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 049a392..cd90934 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -14,11 +14,10 @@ //= require jquery_ujs //= require srp //= require bootstrap -//= require bootstrap-editable -//= require bootstrap-editable-rails //= require rails.validations //= require rails.validations.simple_form +//= require leap //= require tickets //= require users diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 25e854e..28206b1 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,29 +1,24 @@ // // import custom scss, content to be set in deployment. // -@import "tail"; +@import "head"; // First import journal variables -@import "bootswatch/cerulean/variables"; +// @import "bootswatch/cerulean/variables"; // // import bootstrap. // @import "bootstrap"; -body { padding-top: 60px; } - @import "bootstrap-responsive"; -table.table-hover .btn { - opacity: 0; -} -table.table-hover tr:hover .btn { - opacity: 1; -} -@import "bootstrap-editable"; +// +// LEAP web app specific overrides +// +@import "leap"; // And finally bootswatch style itself -@import "bootswatch/cerulean/bootswatch"; +// @import "bootswatch/cerulean/bootswatch"; // // import custom scss, content to be set in deployment. diff --git a/app/assets/stylesheets/leap.scss b/app/assets/stylesheets/leap.scss new file mode 100644 index 0000000..b382773 --- /dev/null +++ b/app/assets/stylesheets/leap.scss @@ -0,0 +1,194 @@ +// +// LAYOUT +// + +// This is a trick to be able to use bootstrap fluid layout and also have a max-width. +// It is like having your cake and eating it too. +#main { + *zoom: 1; + margin-left: auto; + margin-right: auto; + width: 1000px; + max-width: 100%; +} + +// +// UTILITY +// + +//.debug { +// outline: 1px solid red; +//} + +.full-width { + width: 100%; +} + +.slim { + margin: 0; +} + +.first { + margin-top: 0; + padding-top: 0; +} + +.last { + margin-bottom: 0; + padding-bottom: 0; +} + +.hidden { + display: none; +} + +// +// ICONS +// + +[class^="big-icon-"], +[class*=" big-icon-"] { + display: inline-block; + width: 32px; + height: 32px; + @include ie7-restore-right-whitespace(); + line-height: 32px; + vertical-align: middle; + background-repeat: no-repeat; + margin-top: 1px; +} + +.big-icon-arrow-down { + background-image: url(/leap-img/32/arrow-down.png) +} + +// +// TYPOGRAPHY +// + +input.large { + font-size: $baseFontSize * 1.25; + line-height: $baseLineHeight * 1.5; +} + +.p { + @extend p; +} + +// +// BOOTSTRAP TWEAKS +// + +// +// Sometimes we really want full width controls, but this flies in the face of +// what bootstrap does for control sizes, so we have to step on bootstrap's +// toes a bit to make this work. +// +input, textarea { + &.full-width { + height: inherit; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + } +} + +// like a label, but with no background +.label-clear { + background-color: $white; + text-shadow: none; + color: $black; +} + +// force a black icon, even if bootstrap thinks differently +.icon-black { + background-image: url(/assets/glyphicons-halflings.png) !important; +} + +// override stupid bootstrap behavior of making the active tab appear non-clickable +// and links not being underline +.nav-tabs > li > a:hover, .sidenav > li > a:hover { + text-decoration: underline; +} +.nav-tabs > .active > a:hover { + cursor: pointer; +} + +// +// TICKETS +// + +.ticket { + td.user { + white-space: nowrap; + } + td.comment { + width: 100%; + } +} + +// +// BORING DEFAULT MASTHEAD +// + +#masthead { + background: #eee; + margin-bottom: 10px; + border-bottom: 1px solid #e6e6e6; + .title { + padding: 20px; + font-size: 1.25em; + } + .sitename { + font-weight: bold; + } +} + +.home-buttons { + text-align: center; + .first { + margin: 20px 0; + } + .download { + a.btn { + width: 14em; + } + } + a.btn { + font-weight: bold; + width: 11em; + margin: 10px auto; + display: block; + } +} + +// +// SIDE NAVIGATION +// + +.user_heading { + margin: 1em 0; + font-weight: bold; +} + +.sidenav { + @extend .nav-tabs; + @extend .nav-stacked; + box-shadow: 0 2px 4px rgba(0,0,0,.1); + li.active { + a, a:hover { + background-color: $linkColor; + color: $white; + border-color: darken($linkColor, 0%); + cursor: pointer; + } + } +} + +// +// USERS +// + +.overview li { + padding: 6px 0; +}
\ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 06b245a..62d9df2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,4 +3,16 @@ class ApplicationController < ActionController::Base ActiveSupport.run_load_hooks(:application_controller, self) + protected + + # + # Allows us to pass through bold text to flash messages. See format_flash() for where this is reversed. + # + # TODO: move to core + # + def bold(str) + "[b]#{str}[/b]" + end + helper_method :bold + end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 4e1983a..120541e 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,6 +1,9 @@ class HomeController < ApplicationController def index + if logged_in? + redirect_to user_overview_url(current_user) + end debugger if params[:debug] end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..1e79990 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,40 @@ module ApplicationHelper + + # + # determine title for the page + # + def html_title + if content_for?(:title) + yield(:title) + elsif @title + [@title, ' - ', APP_CONFIG[:domain]].join + else + APP_CONFIG[:domain] + end + end + + # + # markup for bootstrap icon + # + # http://twitter.github.io/bootstrap/base-css.html#icons + # + def icon(name, color=nil) + if color.nil? + color_class = nil + elsif color == :black + color_class = 'icon-black' + elsif color == :white + color_class = 'icon-white' + end + "<i class=\"icon-#{name} #{color_class}\"></i> ".html_safe + end + + def big_icon(name, color=nil) + "<i class=\"big-icon-#{name}\"></i> ".html_safe + end + + def format_flash(msg) + html_escape(msg).gsub('[b]', '<b>').gsub('[/b]', '</b>').html_safe + end + end diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index c02dcad..8c90436 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -1,11 +1,12 @@ -Try to fetch a -= link_to "cert", cert_path +%h1= t(:welcome, :provider => APP_CONFIG[:domain]) -%p -Create a -= link_to "ticket", new_ticket_path +%p + We provide secure communication services, including encrypted internet, email (coming soon), and chat (coming later). -- if logged_in? - %p - See all - = link_to "tickets", tickets_path += home_page_buttons + +- if Rails.env == 'development' + .row-fluid + %hr + %p + = link_to "fetch a cert", cert_path diff --git a/app/views/layouts/_content.html.haml b/app/views/layouts/_content.html.haml new file mode 100644 index 0000000..19af627 --- /dev/null +++ b/app/views/layouts/_content.html.haml @@ -0,0 +1,19 @@ +-# +-# Partial for displaying the page content. This is the only place that content should be displayed. +-# + +- if content_for?(:content) + - content = yield(:content) +- else + - content = yield + +- if @show_navigation + .span2 + = render 'layouts/navigation' + .span10 + = render 'layouts/messages' + = content +- else + .span12 + = render 'layouts/messages' + = content diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/views/layouts/_footer.html.haml diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml new file mode 100644 index 0000000..b459545 --- /dev/null +++ b/app/views/layouts/_header.html.haml @@ -0,0 +1,11 @@ +- if admin? + %ul.nav.nav-tabs + %li{:class => ("active" if controller?('users', 'email_settings', 'overviews') || params[:user_id])} + = link_to t(:users), users_path + %li{:class => ("active" if controller?('tickets') && !params[:user_id])} + = link_to t(:tickets), tickets_path + %li + = link_to t(:logout), logout_path, :method => :delete +- if @user && @show_navigation + .user_heading + = @user.email_address diff --git a/app/views/layouts/_masthead.html.haml b/app/views/layouts/_masthead.html.haml new file mode 100644 index 0000000..280f2c2 --- /dev/null +++ b/app/views/layouts/_masthead.html.haml @@ -0,0 +1,4 @@ +.title + %span.sitename + = APP_CONFIG[:domain] + = t(:user_control_panel)
\ No newline at end of file diff --git a/app/views/layouts/_messages.html.haml b/app/views/layouts/_messages.html.haml index 80e34d4..7ff985f 100644 --- a/app/views/layouts/_messages.html.haml +++ b/app/views/layouts/_messages.html.haml @@ -1,5 +1,6 @@ -- flash.each do |name, msg| - - if msg.is_a?(String) - %div{:class => "alert alert-#{name == :notice ? "success" : "error"}"} - %a.close{"data-dismiss" => "alert"} × - = content_tag :div, msg, :id => "flash_#{name}" +#messages + - flash.each do |name, msg| + - if msg.is_a?(String) + %div{:class => "alert alert-#{name == :notice ? "success" : "error"}"} + %a.close{"data-dismiss" => "alert"} × + = content_tag :div, format_flash(msg), :id => "flash_#{name}" diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index b75eed7..b42c1fe 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -1,6 +1,6 @@ -= link_to "Leap Web", root_path, :class => 'brand' -%ul.nav - // = render '/tickets/nav' - -%ul.nav.pull-right - = render '/sessions/nav' +%ul.nav.sidenav + = link_to_navigation t(:overview), user_overview_path(@user), :active => controller?(:overviews) + = link_to_navigation t(:account_settings), edit_user_path(@user), :active => controller?(:users) + = link_to_navigation t(:email_settings), edit_user_email_settings_path(@user), :active => controller?(:email_settings) + = link_to_navigation t(:support_tickets), auto_tickets_path(@user), :active => controller?(:tickets) + = link_to_navigation t(:logout), logout_path, :method => :delete diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index e6d22f0..380f92d 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,23 +1,25 @@ +- @show_navigation = true if @show_navigation.nil? && logged_in? !!! %html %head %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"} - %title= content_for?(:title) ? yield(:title) : "Leap Web" + %title= html_title %meta{:content => content_for?(:description) ? yield(:description) : "Leap Web", :name => "description"} = stylesheet_link_tag "application", :media => "all" = javascript_include_tag "application" = csrf_meta_tags = yield(:head) %body - %header.navbar.navbar-fixed-top - %nav.navbar-inner - .container - = render 'layouts/navigation' - #main{:role => "main"} - .container - .content - .row + #masthead + - if params[:controller] != 'home' + = render 'layouts/masthead' + #main + .container-fluid + - if logged_in? + .row-fluid .span12 - = render 'layouts/messages' - = yield - %footer + = render 'layouts/header' + .row-fluid + = render 'layouts/content' + #footer + = render 'layouts/footer' |