From 4e185bbaa7925b3b7e9fc996cb6e587591ef6e28 Mon Sep 17 00:00:00 2001 From: pixeldesu Date: Sun, 19 Apr 2015 16:49:53 +0200 Subject: [PATCH] change Bootswatch theme, general theme changes, list group helper --- Gemfile | 2 +- Gemfile.lock | 4 +- app/assets/stylesheets/application.css.scss | 4 +- app/assets/stylesheets/base.css.scss | 11 ++++ app/assets/stylesheets/scss/navbar.scss | 16 +++++- app/assets/stylesheets/scss/user.scss | 6 +-- app/helpers/application_helper.rb | 18 +++++++ app/views/layouts/_profile.html.haml | 51 ++++++++++--------- .../_notification_tabs.html.haml | 13 +++-- app/views/shared/_sidebar.html.haml | 11 ++-- app/views/static/about.html.haml | 17 ++++--- app/views/user/_settings_tabs.html.haml | 11 ++-- 12 files changed, 104 insertions(+), 60 deletions(-) diff --git a/Gemfile b/Gemfile index da648c94..9c48ce5a 100644 --- a/Gemfile +++ b/Gemfile @@ -29,7 +29,7 @@ gem 'devise-async' gem 'bootstrap_form' gem 'font-kit-rails' gem 'nprogress-rails' -gem 'font-awesome-rails', '~> 4.2.0.0' +gem 'font-awesome-rails', '~> 4.3.0.0' gem 'rails-assets-growl' gem "paperclip", "~> 4.2" gem 'delayed_paperclip' diff --git a/Gemfile.lock b/Gemfile.lock index 0ccea24c..e5e5c83a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,7 +105,7 @@ GEM multipart-post (>= 1.2, < 3) faraday_middleware (0.9.1) faraday (>= 0.7.4, < 0.10) - font-awesome-rails (4.2.0.0) + font-awesome-rails (4.3.0.0) railties (>= 3.2, < 5.0) font-kit-rails (1.1.0) rails @@ -372,7 +372,7 @@ DEPENDENCIES devise-async factory_girl_rails faker - font-awesome-rails (~> 4.2.0.0) + font-awesome-rails (~> 4.3.0.0) font-kit-rails foreman haml diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 26273c74..bbe044c2 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -41,11 +41,11 @@ $navbar-inverse-toggle-hover-bg: #512da8; $navbar-inverse-toggle-icon-bar-bg: #7e57c2; $navbar-inverse-toggle-border-color: #512da8; -@import "bootswatch/paper/variables"; +@import "bootswatch/cosmo/variables"; @import "bootstrap"; body { padding-top: $navbar-height; } -@import "bootswatch/paper/bootswatch"; +@import "bootswatch/cosmo/bootswatch"; @import "base"; diff --git a/app/assets/stylesheets/base.css.scss b/app/assets/stylesheets/base.css.scss index 911a7c3b..64492254 100644 --- a/app/assets/stylesheets/base.css.scss +++ b/app/assets/stylesheets/base.css.scss @@ -124,4 +124,15 @@ body { .links { padding-bottom: 10px; +} + +.panel { + -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.25); + box-shadow: 0 3px 9px rgba(0, 0, 0, 0.25); + -webkit-background-clip: padding-box; + background-clip: padding-box; +} + +.panel-default { + border-color: transparent; } \ No newline at end of file diff --git a/app/assets/stylesheets/scss/navbar.scss b/app/assets/stylesheets/scss/navbar.scss index 1511f8fb..388d08de 100644 --- a/app/assets/stylesheets/scss/navbar.scss +++ b/app/assets/stylesheets/scss/navbar.scss @@ -1,11 +1,13 @@ .navbar .nav .badge { padding: 3px 6px 3px; background-color: $navbar-inverse-link-active-bg; + color: #fff; } .navbar .nav .active .badge, li.dropdown.open a.dropdown-toggle span.badge { padding: 3px 6px 3px; background-color: $navbar-inverse-bg; + color: #fff; } .navbar--inbox-animation { @@ -117,6 +119,16 @@ } .profile--image-dropdown > a { - padding-top: 16px !important; - padding-bottom: 16px !important; + padding: 0px !important; +} + +.profile--image-avatar { + min-height: 50px; + min-width: 50px; + height: 50px; + width: 50px; +} + +.navbar-inverse { + border: none; } \ No newline at end of file diff --git a/app/assets/stylesheets/scss/user.scss b/app/assets/stylesheets/scss/user.scss index 9111b7c3..f53cc3ab 100644 --- a/app/assets/stylesheets/scss/user.scss +++ b/app/assets/stylesheets/scss/user.scss @@ -67,8 +67,6 @@ } .profile--avatar { - border-top-left-radius: 2px; - border-top-right-radius: 2px; width: 100%; height: auto; border: medium none; @@ -77,8 +75,8 @@ .profile--panel-badge { width: 100%; text-align: center; - padding-top: 0.05em; - padding-bottom: 0.05em; + padding-top: 0.15em; + padding-bottom: 0.15em; text-transform: uppercase; font-weight: bold; margin: 0; diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5873f7db..627f3408 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -20,6 +20,24 @@ module ApplicationHelper content_tag(:li, link_to(body.html_safe, path), class: ("#{'active ' if current_page? path}#{options[:class]}")) end + + def list_group_item(body, path, options = {}) + options = { + badge: nil, + badge_color: nil, + class: '' + }.merge(options) + + unless options[:badge].nil? or options[:badge] == 0 + # TODO: make this prettier? + body << " #{ + content_tag(:span, options[:badge], class: ("badge#{ + " badge-#{options[:badge_color]}" unless options[:badge_color].nil? + }"))}" + end + + content_tag(:a, body.html_safe, href: path, class: ("list-group-item #{'active ' if current_page? path}#{options[:class]}")) + end ## # diff --git a/app/views/layouts/_profile.html.haml b/app/views/layouts/_profile.html.haml index 49d16329..b7ab872a 100644 --- a/app/views/layouts/_profile.html.haml +++ b/app/views/layouts/_profile.html.haml @@ -1,33 +1,36 @@ %li.dropdown.profile--image-dropdown %a.dropdown-toggle{href: "#", "data-toggle" => "dropdown"} - %img.img-rounded.answerbox--img.hidden-xs{src: current_user.profile_picture.url(:small)} + %img.profile--image-avatar.hidden-xs{src: current_user.profile_picture.url(:small)} %span.visible-xs = current_user.screen_name %b.caret - %ul.dropdown-menu.profile--dropdown - %li.hidden-xs - .media.profile--dropdown-media - .pull-left - %img.img-rounded.profile--dropdown-img{src: current_user.profile_picture.url(:medium)} - .media-body - - if current_user.display_name.blank? - .profile--dropdown-username - %a{href: show_user_profile_path(current_user.screen_name)} - = current_user.screen_name - - else - .profile--dropdown-displayname - %a{href: show_user_profile_path(current_user.screen_name)} - = current_user.display_name - .profile--username - = current_user.screen_name - %li.divider.hidden-xs - %li.visible-xs= link_to "View profile", show_user_profile_path(current_user.screen_name) - %li= link_to "Settings", edit_user_registration_path + %ul.dropdown-menu + %li.dropdown-header.hidden-xs= current_user.screen_name + %li + %a{href: show_user_profile_path(current_user.screen_name)} + %i.fa.fa-fw.fa-user + View profile + %li + %a{href: edit_user_registration_path} + %i.fa.fa-fw.fa-cog + Settings %li.divider - if current_user.admin? - %li= link_to "Kontrollzentrum", rails_admin_path - %li= link_to "Sidekiq", sidekiq_web_path + %li + %a{href: rails_admin_path} + %i.fa.fa-fw.fa-cogs + Kontrollzentrum + %li + %a{href: sidekiq_web_path} + %i.fa.fa-fw.fa-bar-chart + Sidekiq - if current_user.mod? - %li= link_to "Moderation panel", moderation_path + %li + %a{href: moderation_path} + %i.fa.fa-fw.fa-gavel + Moderation Panel %li.divider - %li= link_to "Logout", destroy_user_session_path, method: :delete \ No newline at end of file + %li + %a{href: destroy_user_session_path, data: {method: :delete} } + %i.fa.fa-fw.fa-sign-out + Logout \ No newline at end of file diff --git a/app/views/notifications/_notification_tabs.html.haml b/app/views/notifications/_notification_tabs.html.haml index 16f73e5d..7224f9db 100644 --- a/app/views/notifications/_notification_tabs.html.haml +++ b/app/views/notifications/_notification_tabs.html.haml @@ -1,9 +1,8 @@ .col-md-3.col-xs-12.col-sm-3 .panel.panel-default.hidden-xs - .panel-body - %ul.nav.nav-pills.nav-stacked - = nav_entry "All notifications", notifications_path - = nav_entry "Answers", notifications_path('answer') - = nav_entry "Smiles", notifications_path('smile') - = nav_entry "Comments", notifications_path('comment') - = nav_entry "Followers", notifications_path('relationship') \ No newline at end of file + .list-group + = list_group_item "All notifications", notifications_path, badge: Notification.where(new: true).count + = list_group_item "Answers", notifications_path('answer'), badge: Notification.where(target_type: "Answer", new: true).count + = list_group_item "Smiles", notifications_path('smile'), badge: Notification.where(target_type: "Smile", new: true).count + = list_group_item "Comments", notifications_path('comment'), badge: Notification.where(target_type: "Comment", new: true).count + = list_group_item "Followers", notifications_path('relationship'), badge: Notification.where(target_type: "Relationship", new: true).count \ No newline at end of file diff --git a/app/views/shared/_sidebar.html.haml b/app/views/shared/_sidebar.html.haml index 34018942..ec135868 100644 --- a/app/views/shared/_sidebar.html.haml +++ b/app/views/shared/_sidebar.html.haml @@ -23,12 +23,11 @@ %h4.entry-text#friend-count= current_user.friend_count %h6.entry-subtext Following .panel.panel-default.hidden-xs - .panel-body - %ul.nav.nav-pills.nav-stacked - = nav_entry "Timeline", root_path - = nav_entry "Public", public_timeline_path - - current_user.groups.each do |group| - = nav_entry group.display_name, group_timeline_path(group.name) + %ul.nav.nav-pills.nav-stacked + = list_group_item "Timeline", root_path + = list_group_item "Public", public_timeline_path + - current_user.groups.each do |group| + = list_group_item group.display_name, group_timeline_path(group.name) - unless @group.nil? .panel.panel-default.profile--panel.hidden-xs .panel-heading diff --git a/app/views/static/about.html.haml b/app/views/static/about.html.haml index 439835cf..7f200cbb 100644 --- a/app/views/static/about.html.haml +++ b/app/views/static/about.html.haml @@ -7,8 +7,9 @@ .row .col-sm-4 .panel.panel-default + .panel-heading + %h3.panel-title The Team .panel-body - %h3 The Team The people behind = succeed '!' do = APP_CONFIG['site_name'] @@ -22,8 +23,9 @@ %h4.entry-text.entry-about= adm['about_text'] %h6.entry-subtext= adm['subtext'] .panel.panel-default + .panel-heading + %h3.panel-title Moderators .panel-body - %h3 Moderators The people on = APP_CONFIG['site_name'] that look after you! @@ -33,8 +35,9 @@ %img.img-rounded.answerbox--img-small{src: mod.profile_picture.url(:small)} .col-sm-4 .panel.panel-default + .panel-heading + %h3.panel-title Unfinished Project .panel-body - %h3 Unfinished %p = APP_CONFIG['site_name'] is running on unfinished code, full of bugs. Caveat emptor. @@ -48,9 +51,10 @@ Still have some questions? Check our = link_to "FAQ!", help_faq_path .panel.panel-default + .panel-heading + %h3.panel-title Statistics .panel-body - There are lies, damned lies, and then there are... - %h3 Statistics + %p All-time statistics for #{APP_CONFIG['site_name']} .row .col-xs-6 %h4.entry-text#asked-count= Question.count @@ -71,8 +75,9 @@ %h6.entry-subtext Users .col-sm-4 .panel.panel-default + .panel-heading + %h3.panel-title Funding .panel-body - %h3 Funding Currently Retrospring is running of the developers funds and will be able to sustain at the current needs of servers. Hereby we want to thank the people who previously donated to our project and helped it grow. Everyone shown at the bottom of this panel has contributed to the project with donations or great input. %ul.about--moderator - User.where(supporter: true).each do |sup| diff --git a/app/views/user/_settings_tabs.html.haml b/app/views/user/_settings_tabs.html.haml index 8bfe3c00..5583da38 100644 --- a/app/views/user/_settings_tabs.html.haml +++ b/app/views/user/_settings_tabs.html.haml @@ -1,11 +1,10 @@ .col-md-3.col-xs-12.col-sm-3 .panel.panel-default - .panel-body - %ul.nav.nav-pills.nav-stacked - = nav_entry "Account", edit_user_registration_path - = nav_entry "Profile", edit_user_profile_path - = nav_entry "Privacy", edit_user_privacy_path - = nav_entry "Sharing", services_path + .list-group + = list_group_item "Account", edit_user_registration_path + = list_group_item "Profile", edit_user_profile_path + = list_group_item "Privacy", edit_user_privacy_path + = list_group_item "Sharing", services_path .hidden-xs= render "shared/links" \ No newline at end of file