mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 07:10:12 +01:00
Add theme selector to preferences and return the previous black theme as an alternative
This commit is contained in:
parent
2e9a0d2b4c
commit
9982217ee9
18 changed files with 64 additions and 22 deletions
12
app/assets/stylesheets/black.scss
Normal file
12
app/assets/stylesheets/black.scss
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
$gray-lighter: #EEE;
|
||||
$brand-primary: rgba(0, 0, 0, 0.75);
|
||||
$navbar-inverse-bg: $brand_primary;
|
||||
$navbar-inverse-color: $gray-lighter;
|
||||
$navbar-inverse-link-color: $gray-lighter;
|
||||
$link-color: #CC3334;
|
||||
$link-hover-color: #FFF;
|
||||
$link-bgcolor: $link-color;
|
||||
$box-tablink-color: unset;
|
||||
|
||||
// Import all components
|
||||
@import 'manifest';
|
||||
|
|
@ -75,11 +75,17 @@ p {
|
|||
}
|
||||
|
||||
a, a:link, a:active, a:visited {
|
||||
color: $link-color;
|
||||
text-decoration: none;
|
||||
padding-left: 1px;
|
||||
padding-right: 1px;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: $link-hover-color;
|
||||
background-color: $link-bgcolor;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 304%;
|
||||
font-weight: bold;
|
||||
|
|
@ -816,11 +822,11 @@ form {
|
|||
#todo_new_action_container, #project_new_project_container, #context_new_container, #recurring_new_container {
|
||||
width: 270px;
|
||||
padding: 5px 10px;
|
||||
background-color: #3C6997;
|
||||
color: lighten(#000, 93.5%);
|
||||
background-color: $brand-primary;
|
||||
color: $gray-lighter;
|
||||
border-radius: 5px;
|
||||
a {
|
||||
color: lighten(#000, 85%);
|
||||
color: $box-tablink-color;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,4 +3,10 @@ $brand-primary: #3C6997;
|
|||
$navbar-inverse-bg: $brand_primary;
|
||||
$navbar-inverse-color: $gray-lighter;
|
||||
$navbar-inverse-link-color: $gray-lighter;
|
||||
$link-color: unset;
|
||||
$link-hover-color: unset;
|
||||
$link-bgcolor: unset;
|
||||
$box-tablink-color: lighten(#000, 85%);
|
||||
|
||||
// Import all components
|
||||
@import 'manifest';
|
||||
|
|
@ -28,8 +28,6 @@
|
|||
}
|
||||
|
||||
.bootstrap {
|
||||
@import "colors";
|
||||
|
||||
@import "bootstrap-sprockets";
|
||||
@import "bootstrap";
|
||||
@import "tracks-logo";
|
||||
|
|
@ -7,6 +7,7 @@ class ApplicationController < ActionController::Base
|
|||
protect_from_forgery with: :exception
|
||||
|
||||
include LoginSystem
|
||||
include Common
|
||||
helper_method :current_user, :prefs, :format_date
|
||||
|
||||
layout proc{ |controller| controller.mobile? ? "mobile" : "application" }
|
||||
|
|
@ -16,6 +17,7 @@ class ApplicationController < ActionController::Base
|
|||
before_action :set_time_zone
|
||||
before_action :set_zindex_counter
|
||||
before_action :set_locale
|
||||
before_action :set_theme
|
||||
append_before_action :set_group_view_by
|
||||
prepend_before_action :login_required
|
||||
prepend_before_action :enable_mobile_content_negotiation
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
class LoginController < ApplicationController
|
||||
include Common
|
||||
|
||||
layout 'login'
|
||||
skip_before_action :set_session_expiration
|
||||
skip_before_action :login_required
|
||||
before_action :login_optional
|
||||
before_action :get_current_user
|
||||
before_action :set_theme
|
||||
|
||||
protect_from_forgery :except => [:check_expiry, :login]
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ private
|
|||
:staleness_starts, :due_style, :locale, :title_date_format, :time_zone,
|
||||
:show_hidden_projects_in_sidebar, :show_project_on_todo_done,
|
||||
:review_period, :refresh, :verbose_action_descriptors,
|
||||
:mobile_todos_per_page, :sms_email, :sms_context_id)
|
||||
:mobile_todos_per_page, :sms_email, :sms_context_id, :theme)
|
||||
end
|
||||
|
||||
def user_params
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
module ApplicationHelper
|
||||
|
||||
def group_view_by_menu_entry
|
||||
# not set, no menu entry
|
||||
return "" if @group_view_by.nil?
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ class Preference < ApplicationRecord
|
|||
belongs_to :user
|
||||
belongs_to :sms_context, :class_name => 'Context'
|
||||
|
||||
def self.themes
|
||||
{ :black => 'black', :light_blue => 'light_blue'}
|
||||
end
|
||||
|
||||
def self.due_styles
|
||||
{ :due_in_n_days => 0, :due_on => 1}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<%= stylesheet_link_tag "application", :media => "all" %>
|
||||
<%= stylesheet_link_tag @user_theme, :media => "all" %>
|
||||
<%= stylesheet_link_tag "print", :media => "print" %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
<%= csrf_meta_tags %>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<%= favicon_link_tag 'favicon.ico' %>
|
||||
<%= favicon_link_tag 'apple-touch-icon.png', :rel => 'apple-touch-icon', :type => 'image/png' %>
|
||||
<title><%= @page_title -%></title>
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<%= stylesheet_link_tag @user_theme %>
|
||||
</head>
|
||||
<body class="bootstrap">
|
||||
<%= yield %>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
<div class="form-group">
|
||||
<%= pref_with_select_field('prefs', "due_style", [[t('models.preference.due_styles')[0],Preference.due_styles[:due_in_n_days]],[t('models.preference.due_styles')[1],Preference.due_styles[:due_on]]]) %>
|
||||
</div>
|
||||
|
|
@ -38,3 +37,6 @@
|
|||
<div class="form-group">
|
||||
<%= pref('prefs', "sms_context") { select('prefs', 'sms_context_id', current_user.contexts.map{|c| [c.name, c.id]}, {}, class: "form-control") } %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= pref_with_select_field('prefs', 'theme', [[t('models.preference.themes.black'), Preference.themes[:black]], [t('models.preference.themes.light_blue'), Preference.themes[:light_blue]]]) %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,4 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
|
|||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in the app/assets
|
||||
# folder are already added.
|
||||
Rails.application.config.assets.precompile += %w( print.css mobile.css jquery-ui/datepicker-*.js swf_fu.js )
|
||||
|
||||
# add /app/assets/swfs to asset pipeline for charts
|
||||
Rails.application.config.assets.paths << Rails.root.join("app", "assets", "swfs")
|
||||
Rails.application.config.assets.precompile += %w( light_blue.css black.css print.css mobile.css jquery-ui/datepicker-*.js )
|
||||
|
|
|
|||
|
|
@ -132,6 +132,9 @@ en:
|
|||
due_styles:
|
||||
- Due in ___ days
|
||||
- Due on _______
|
||||
themes:
|
||||
black: Black
|
||||
light_blue: Light blue
|
||||
datetime:
|
||||
prompts:
|
||||
minute: Minute
|
||||
|
|
|
|||
|
|
@ -2,17 +2,14 @@
|
|||
authentication_schemes:
|
||||
- "database"
|
||||
|
||||
|
||||
# You'll probably want to change this to the time zone of the computer where
|
||||
# Tracks is running. Run rake time:zones:local have Rails suggest time zone
|
||||
# names on your system
|
||||
time_zone: "UTC"
|
||||
|
||||
|
||||
# setting this to true will make the cookies only available over HTTPS
|
||||
secure_cookies: false
|
||||
|
||||
|
||||
# Your secret key for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
|
|
@ -32,22 +29,22 @@ force_ssl: false
|
|||
# address rather than the From: address.
|
||||
# email_dispatch: 'to'
|
||||
|
||||
|
||||
# If you want to send all email to a specific user, uncomment the following line
|
||||
# and set the environment variable TRACKS_MAIL_RECEIVER to the login name of the
|
||||
# user that will receive all email
|
||||
# email_dispatch: 'single_user'
|
||||
|
||||
|
||||
# Set this to the subdirectory you're hosting tracks in and uncomment if
|
||||
# applicable. NOTE: you will also need to set up your web server to deal with
|
||||
# the relative URL. Mongrel, for example, has a --prefix option.
|
||||
# subdir: "/tracks"
|
||||
|
||||
|
||||
# Set to true to allow anyone to sign up for a username.
|
||||
open_signups: false
|
||||
|
||||
# Default theme and theme for the login form.
|
||||
# default_theme: light_blue
|
||||
|
||||
# Set to require TOS approval on signup.
|
||||
#tos_link: "https://www.example.com"
|
||||
|
||||
|
|
@ -64,7 +61,6 @@ open_signups: false
|
|||
# on the signup page
|
||||
admin_email: my.email@domain.com
|
||||
|
||||
|
||||
# Map of allowed incoming email addresses to real users
|
||||
# Requires email_dispatch == 'to'
|
||||
# This allows you to specify _who_ can send email Todos to your list
|
||||
|
|
|
|||
5
db/migrate/20200820000743_add_theme_to_preference.rb
Normal file
5
db/migrate/20200820000743_add_theme_to_preference.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddThemeToPreference < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :preferences, :theme, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2020_08_10_123316) do
|
||||
ActiveRecord::Schema.define(version: 2020_08_20_000743) do
|
||||
|
||||
create_table "attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||
t.integer "todo_id"
|
||||
|
|
@ -87,6 +87,7 @@ ActiveRecord::Schema.define(version: 2020_08_10_123316) do
|
|||
t.integer "sms_context_id"
|
||||
t.string "locale"
|
||||
t.integer "review_period", default: 14, null: false
|
||||
t.string "theme"
|
||||
t.index ["user_id"], name: "index_preferences_on_user_id"
|
||||
end
|
||||
|
||||
|
|
|
|||
9
lib/common.rb
Normal file
9
lib/common.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
module Common
|
||||
def set_theme
|
||||
if prefs && prefs.theme
|
||||
@user_theme = prefs.theme.parameterize.underscore
|
||||
else
|
||||
@user_theme = SITE_CONFIG['default_theme'] || 'light_blue'
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue