diff --git a/Gemfile b/Gemfile index 4714ee3..a277484 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ gem 'activerecord-session_store' gem 'highlight_js-rails', github: 'RedstonerServer/highlight_js-rails' gem 'kaminari', github: 'jomo/kaminari', branch: 'patch-2' # pagination gem 'jquery-textcomplete-rails', github: 'RedstonerServer/jquery-textcomplete-rails' # @mentions +gem 'actionpack-action_caching' # Gems used only for assets and not required # in production environments by default. @@ -43,4 +44,4 @@ end group :production do # Use unicorn as the app server gem 'unicorn' -end \ No newline at end of file +end diff --git a/app/assets/stylesheets/dark.css.scss b/app/assets/stylesheets/dark.css.scss new file mode 100644 index 0000000..90c7fc0 --- /dev/null +++ b/app/assets/stylesheets/dark.css.scss @@ -0,0 +1,105 @@ +body { + background-color:rgb(50, 50, 50); + text-shadow:none !important; + color:rgb(190, 190, 190) !important; +} +::selection { + background-color:rgb(100, 150, 255); +} +a { + color:rgb(203, 75, 22); + border-color:black !important; +} +a:hover { + color:rgb(215, 100, 40); +} +#main-content { + border-color:black !important; + padding:30px 100px; + box-shadow:none; +} +#main-content-scroll { + padding: 131px 100px; + border: 1px solid #000; + box-shadow: 0 0 5px #000; +} +hr { + background-color:black !important; + border-color:black !important; +} +code { + background-color:rgb(30, 30, 30) !important; + border-color:black !important; + color:white !important; +} +#head_top { + width:100%; + z-index:100; +} +#head_scroll { + @extend #head_top; + position: fixed; + width: 100%; + z-index: 1; +} +div#userbar { + background-color:rgb(90, 90, 90) !important; + border-color:black !important; + color:white !important; + text-shadow:none !important; +} +#head a { + text-shadow:none !important; + color:white !important; +} +#head a:hover { + color:rgb(190, 190, 190) !important; +} +.header { + background-color:rgb(0, 0, 0); + border:none !important; +} +input[type="email"], input[type="text"], input[type="password"] { + background-color:rgb(110, 110, 110) !important; + color:white !important; +} +::placeholder { + color:lightgray; +} +.item { + background-color:rgb(40, 40, 40) !important; + border-color:black !important; +} +.item-group { + border-color:black !important; +} +div.header { + background-color:rgb(20, 20, 20) !important; +} +.avatar { + border-color:black !important; +} +.items { + border-color:black !important; +} +.markdown-help { + background-color:rgb(90, 90, 90); + color:white; + border-color:black; +} +textarea { + background-color:rgb(100, 100, 100); + color:white; +} +.headline { + border-color:black !important; +} +.role { + opacity:0.7 !important; +} +.label { + opacity:0.7 !important; +} +.notice { + color:white; +} diff --git a/app/assets/stylesheets/mobi.css.scss b/app/assets/stylesheets/mobi.css.scss index cc437cb..c1b44fd 100644 --- a/app/assets/stylesheets/mobi.css.scss +++ b/app/assets/stylesheets/mobi.css.scss @@ -4,12 +4,12 @@ th, td { // force tables into line-mode - // it's a bit ugly, but probably the best + // it''s a bit ugly, but probably the best // solution for small screens display: block; } - #head { + #head_top { #menu { #logo { display: none; @@ -17,10 +17,19 @@ } } + #head_scroll { + @extend #head_top; + position: fixed; +} + #main-content { padding: 30px 5px; } + #main-content-scroll { + padding: 181px 5px; + } + .front-page { h1 { font-size: 2em !important; @@ -66,4 +75,4 @@ margin: 50px 20px 0; } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/style.css.scss b/app/assets/stylesheets/style.css.scss index da15801..18042ad 100644 --- a/app/assets/stylesheets/style.css.scss +++ b/app/assets/stylesheets/style.css.scss @@ -80,7 +80,7 @@ a { } } -#head { +#head_top { background: #3f3f3f; #menu { @@ -181,6 +181,13 @@ a { } } +#head_scroll { + @extend #head_top; + position: fixed; + width: 100%; + z-index: 1; +} + .front-page { margin: auto; text-align: center; @@ -260,6 +267,11 @@ span.no-about { } } +#main-content-scroll { + @extend #main-content; + padding: 131px 100px; +} + #user-info { .user-avatar { margin-bottom: 30px; @@ -454,6 +466,7 @@ blockquote p { } .md_editor { + .field_container { position: relative; @@ -461,7 +474,7 @@ blockquote p { position: absolute; top: 1em; left: 1em; - z-index: 10; + z-index: 0; } .editor_field { @@ -671,6 +684,13 @@ tr.spacer { color: #ddd; } + &.variable-size { + background: #4096ee; + @media only screen and (max-width: 500px) { + font-size: 9px; + } + } + &.blue { background: #4096ee; diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 27e89af..16f42d3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -157,9 +157,9 @@ class UsersController < ApplicationController def update if (mod? && current_user.role >= @user.role ) || (@user.is?(current_user) && confirmed?) if mod? - userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :about, :role, :badge, :confirmed]) + userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :about, :role, :badge, :confirmed, :header_scroll, :utc_time, :dark]) else - userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :about]) + userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :about, :header_scroll, :utc_time, :dark]) end if userdata[:role] role = Role.get(userdata[:role]) @@ -241,6 +241,13 @@ class UsersController < ApplicationController end end + def edit_website_settings + unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin? + flash[:alert] = "You are not allowed to edit this user's website settings!" + redirect_to @user + end + end + def update_login if @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin? authenticated = !@user.is?(current_user) || @user.authenticate(params[:current_password]) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1419391..a1bf22c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -11,10 +11,12 @@ module ApplicationHelper end def ago(tm) - if tm + if tm && current_user.try(:utc_time) != true content_tag :time, title: tm.strftime("%e %b %Y, %H:%M %Z"), datetime: tm.to_datetime.rfc3339 do tm.strftime("%e %b %Y, %H:%M") end + else + tm end end @@ -90,4 +92,4 @@ module ApplicationHelper https://www.youtube-nocookie.com/embed/\\1?theme=light&vq=hd720&hd=1&iv_load_policy=3&showinfo=1&showsearch=0&rel=0&modestbranding&hd=1&autohide=1&html5=1&start=\\3'> ") end -end \ No newline at end of file +end diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 183a615..e6b5080 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -1,4 +1,9 @@ -