Browse Source

add themes (light.css [empty], dark.css, neo_dark.css, solarized_dark.css); add theme as settings field

themes
Simon Vieille 3 months ago
parent
commit
b83ce52312
Signed by: deblan <simon@deblan.fr> GPG Key ID: 03383D15A1D31745
10 changed files with 329 additions and 2 deletions
  1. +23
    -0
      app/assets/stylesheets/themes/dark.css
  2. +0
    -0
      app/assets/stylesheets/themes/light.css
  3. +148
    -0
      app/assets/stylesheets/themes/neo_dark.css
  4. +137
    -0
      app/assets/stylesheets/themes/solarized_dark.css
  5. +1
    -1
      app/controllers/settings_controller.rb
  6. +3
    -0
      app/models/user.rb
  7. +2
    -0
      app/views/layouts/application.html.erb
  8. +10
    -0
      app/views/settings/index.html.erb
  9. +4
    -1
      config/initializers/assets.rb
  10. +1
    -0
      config/locales/fr.yml

+ 23
- 0
app/assets/stylesheets/themes/dark.css View File

@@ -0,0 +1,23 @@
ol.stories.list li.story div.details span.link a:link {
color: #6898ff;
}

ol.stories.list li.story div.details span.link a:visited {
color: #2858bf;
}

a {
color: #6898ff;
}

a.tag {
background-color: #000;
border: 1px solid #ccc;
color: #ccc;
}

body {
background: #000;
color: #ccc;
}


+ 0
- 0
app/assets/stylesheets/themes/light.css View File


+ 148
- 0
app/assets/stylesheets/themes/neo_dark.css View File

@@ -0,0 +1,148 @@
body {
background-color: #222;
color: #ddd;
}

a {
color: #ccf;
}

#wrapper textarea, #wrapper input, #wrapper button {
color: #ddd;
background-color: #000;
border-color: #444;
}

#header .headerlinks a.cur_url {
color: #fff;
}

#header #headertitle a {
color: #fff;
}

#header .headerlinks a {
color: #ccc;
}

#inside li .link a {
color: #ddf;
}

#inside li .byline {
color: #bbb;
}

#inside li .byline a {
color: #bbb;
}

#inside li .domain {
color: #bbb;
}

#inside .comment a {
color: #ccf;
}

#wrapper div.morelink a {
color: #ccc;
}

#wrapper div#footer a {
color: #ccc;
}

.comment:target {
background-color: #444;
}

/* tag badges */
#inside a.tag {
background-color: #000;
border-color: #444;
color: #aaa;
}

#inside a.tag.tag_is_media {
background-color: #622;
border-color: #944;
}

#inside a.tag.tag_announce, #inside a.tag.tag_ask, #inside a.tag.tag_show, #inside a.tag.tag_interview {
background-color: #226;
border-color: #449;
}

/* hats */
#inside span.hat span.crown {
background-color: #000;
border-color: #444;
}

#inside span.hat {
border-color: #444;
}

#inside span.hat span.crown, #inside span.hat a {
color: #aaa;
}

/* tag dropdown */
#inside .select2-container-multi .select2-choices {
background-color: #000;
border-color: #444;
}

#inside .select2-container .select2-drop {
background-color: #000;
border-color: #444;
}

/* search pager */
#inside div.page_link_buttons a {
color: #bbb;
background-color: #000;
border-color: #444;
}

#inside div.page_link_buttons a.cur, #inside div.page_link_buttons span {
color: #bbb;
background-color: #222;
border-color: #222;
}

/* history/filter table */
#inside table.data th {
background-color: #000;
border-color: #444;
}

#inside table.data tr.row0 td, table.data.zebra tr:nth-child(2n) td {
background-color: #222;
border-color: #444;
}

#inside table.data tr.row1 td, table.data.zebra tr:nth-child(2n+1) td {
background-color: #000;
border-color: #444;
}

/* mobile/responsive fixes */
ol.stories.list li.story div.story_liner {
background-color: inherit;
}

div#header, div#leader {
background-color: inherit;
border-bottom: 1px solid #444;
}

ol.stories.list li.story .mobile_comments {
background-color: #444;
}

ol.stories.list li.story {
border-bottom: 1px solid #444;
}


+ 137
- 0
app/assets/stylesheets/themes/solarized_dark.css View File

@@ -0,0 +1,137 @@
body {
background-color: #073642;
color: #93a1a1;
}

a {
color: #b58900;
}

#wrapper textarea, #wrapper input, #wrapper button {
color: #93a1a1;
background-color: #002b36;
border-color: #073642;
}

#header .headerlinks a.cur_url {
color: #2aa198;
}

#header #headertitle a {
color: #2aa198;
}

#header .headerlinks a {
color: #839496;
}

#inside li .link a {
color: #b58900;
}

#inside li .byline {
color: #839496;
}

#inside li .byline a {
color: #839496;
}

#inside li .domain {
color: #839496;
}

#inside .comment a {
color: #b58900;
}

#wrapper div.morelink a {
color: #839496;
}

#wrapper div#footer a {
color: #839496;
}

/* header logo */
#wrapper #header #headerleft #l_holder {
background-color: #dc322f !important;
}

/* buttons */
div.voters .upvoter:hover, .upvoted div.voters .upvoter {
border-bottom-color: #dc322f;
}

/* tag badges */
#inside a.tag {
background-color: #002b36;
border-color: #073642;
color: #aaa;
}

#inside a.tag.tag_is_media {
background-color: #622;
border-color: #944;
}

#inside a.tag.tag_announce, #inside a.tag.tag_ask, #inside a.tag.tag_show, #inside a.tag.tag_interview {
background-color: #226;
border-color: #449;
}

/* hats */
#inside span.hat span.crown {
background-color: #002b36;
border-color: #073642;
}

#inside span.hat {
border-color: #073642;
}

#inside span.hat span.crown, #inside span.hat a {
color: #aaa;
}

/* tag dropdown */
#inside .select2-container-multi .select2-choices {
background-color: #002b36;
border-color: #073642;
}

#inside .select2-container .select2-drop {
background-color: #002b36;
border-color: #073642;
}

/* search pager */
#inside div.page_link_buttons a {
color: #839496;
background-color: #002b36;
border-color: #073642;
}

#inside div.page_link_buttons a.cur, #inside div.page_link_buttons span {
color: #839496;
background-color: #073642;
border-color: #073642;
}

/* history/filter table */
#inside table.data th {
background-color: #002b36;
border-color: #073642;
}

#inside table.data tr.row0 td, table.data.zebra tr:nth-child(2n) td {
background-color: #073642;
border-color: #073642;
}

#inside table.data tr.row1 td, table.data.zebra tr:nth-child(2n+1) td {
background-color: #002b36;
border-color: #073642;
}


+ 1
- 1
app/controllers/settings_controller.rb View File

@@ -246,7 +246,7 @@ private
:email_replies, :email_messages, :email_mentions,
:pushover_replies, :pushover_messages, :pushover_mentions,
:mailing_list_mode, :show_avatars, :show_story_previews,
:show_submitted_story_threads, :hide_dragons
:show_submitted_story_threads, :hide_dragons, :theme
)
end
end

+ 3
- 0
app/models/user.rb View File

@@ -51,11 +51,14 @@ class User < ActiveRecord::Base
s.string :twitter_oauth_token
s.string :twitter_oauth_token_secret
s.string :twitter_username
s.string :theme, :default => "light"
end

validates :email, :format => { :with => /\A[^@ ]+@[^@ ]+\.[^@ ]+\Z/ },
:uniqueness => { :case_sensitive => false }

validates :theme, inclusion: { in: ["light", "dark", "neo_dark", "solarized_dark"] }

validates :password, :presence => true, :on => :create

VALID_USERNAME = /[A-Za-z0-9][A-Za-z0-9_-]{0,24}/


+ 2
- 0
app/views/layouts/application.html.erb View File

@@ -25,6 +25,8 @@
Rails.application.name %></title>
<%= stylesheet_link_tag "application", :media => "all" %>
<% if @user %>
<%= stylesheet_link_tag "themes/" + @user.theme, :media => "all" %>

<%= javascript_include_tag "application" %>
<script>
Lobsters.curUser = '<%= @user.id %>';


+ 10
- 0
app/views/settings/index.html.erb View File

@@ -209,6 +209,16 @@
<%= f.check_box :hide_dragons %>
</div>

<div class="boxline">
<%= f.label :theme, t('.theme'), :class => "required" %>
<%= f.select :theme, [
["Light", "light"],
["Dark", "dark"],
["Neo Dark", "neo_dark"],
["Solarized Dark", "solarized_dark"]
]%>
</div

<br>
<%= f.submit t('.saveallsettings') %>
<% end %>


+ 4
- 1
config/initializers/assets.rb View File

@@ -5,4 +5,7 @@ Rails.application.config.assets.version = '1.0'

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( themes/light.css )
Rails.application.config.assets.precompile += %w( themes/dark.css )
Rails.application.config.assets.precompile += %w( themes/neo_dark.css )
Rails.application.config.assets.precompile += %w( themes/solarized_dark.css )

+ 1
- 0
config/locales/fr.yml View File

@@ -364,6 +364,7 @@ fr:
storypreview: "Montrer les aperçus des infos: "
useravatars: "Montrer les avatars des utilisateurs :"
hidedragons: "Cacher les dragons :"
theme: "Thème :"
saveallsettings: "Sauver tous les paramètres"
inviteuser: "Inviter un nouvel utilisateur"
cannotsendinvitations: "Vous ne pouvez pas envoyer d'invitations."


Loading…
Cancel
Save