diff --git a/Gemfile b/Gemfile index 83ec607..1104ca8 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,6 @@ gem 'mysql2' gem 'jquery-rails' gem 'therubyracer' gem 'bcrypt-ruby' # To use ActiveModel's has_secure_password -gem 'simple_form' gem 'sanitize' gem 'redcarpet' gem 'hirb' #pretty console output diff --git a/Gemfile.lock b/Gemfile.lock index 187761e..ee5fb0a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -112,9 +112,6 @@ GEM sass (~> 3.2.0) sprockets (~> 2.8, <= 2.11.0) sprockets-rails (~> 2.0) - simple_form (3.0.2) - actionpack (~> 4.0) - activemodel (~> 4.0) sprockets (2.11.0) hike (~> 1.2) multi_json (~> 1.0) @@ -160,7 +157,6 @@ DEPENDENCIES rest-client sanitize sass-rails - simple_form therubyracer uglifier webrick diff --git a/app/assets/images/double_p.svg b/app/assets/images/double_p.svg new file mode 100644 index 0000000..7840944 --- /dev/null +++ b/app/assets/images/double_p.svg @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/app/assets/images/lock-pin.png b/app/assets/images/lock-pin.png index 5f5a353..971f375 100644 Binary files a/app/assets/images/lock-pin.png and b/app/assets/images/lock-pin.png differ diff --git a/app/assets/images/pin.png b/app/assets/images/pin.png index d3d8453..c4967ab 100644 Binary files a/app/assets/images/pin.png and b/app/assets/images/pin.png differ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index a2e29b5..d99f535 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,7 +1,6 @@ /* *= require_self *= require style.css - *= require screen.css *= require mobi.css *= require highlight/tomorrow-night.css */ \ No newline at end of file diff --git a/app/assets/stylesheets/mobi.css.scss b/app/assets/stylesheets/mobi.css.scss index ca3b162..4c1cfd5 100644 --- a/app/assets/stylesheets/mobi.css.scss +++ b/app/assets/stylesheets/mobi.css.scss @@ -2,14 +2,23 @@ @media only screen and (max-width: 999px) { + + #mobile-info { - background: none repeat scroll 0 0 #AB0000; - color: #FFFFFF; + background: none repeat scroll 0 0 #ab0000; + color: #fff; text-align: center; display: block; font-size: 0.7em; } + th, td { + // force tables into line-mode + // it's a bit ugly, but probably the best + // solution for small screens + display: block; + } + #head { text-align: left; } @@ -24,4 +33,21 @@ and (max-width: 999px) margin-right: 0; } + .item-group { + margin: 30px 0; + + &.with-avatar { + margin-left: 0; + .avatar { + float: none; + margin: 0; + border: none; + height: 32px; + width: 32px; + vertical-align: middle; + } + } + } + + } \ No newline at end of file diff --git a/app/assets/stylesheets/screen.css.scss b/app/assets/stylesheets/screen.css.scss deleted file mode 100644 index 705fcf3..0000000 --- a/app/assets/stylesheets/screen.css.scss +++ /dev/null @@ -1,614 +0,0 @@ -@keyframes wiggle { - 0% {transform: rotate(-3deg);} - 100% {transform: rotate(3deg);} -} -@-webkit-keyframes wiggle { - 0% {transform: rotate(-3deg);} - 100% {transform: rotate(3deg);} -} - - -@media only screen -and (min-width: 0px) //TODO -{ - - *, *:before, *:after, *:hover, *:active, *:focus { - -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; - outline: none !important; - } - - *::-moz-focus-inner { - border: 0; - outline: none !important; - } - - html { - overflow-y: scroll; - padding: 0 !important; - margin: 0 !important; - } - - body { - background-color: #F2F2F2; - color: #3F3F3F; - padding: 0 !important; - margin: 0 !important; - } - - #mobile-info { - display: none; - } - - a { - color: #AB0000; - text-decoration: none; - &:hover { - color: #F00; - } - } - - .flash { - text-align: center; - padding: 10px; - font-weight: bold; - cursor: pointer; - notice { - background: #8e8; - border-bottom: 3px dashed #8d8; - } - alert { - background: #ebb; - border-bottom: 3px dashed #fdd; - } - } - #head { - #menu { - background: #3F3F3F; - height: 50px; - border-bottom: 1px solid #363636; - position: relative; - #logo { - width: 100px; - height: 100px; - position: absolute; - background: url(image_path('logo.png')) no-repeat; - background-position: 0 -100px; - left: 85px; - &:hover { - transition: all 0.3s ease 0s; - background-position: 0 0; - } - } - ul { - margin: 0 0 0 185px; - padding: 0; - list-style: none; - line-height: 0; - a { - display: inline-block; - color: #fff; - &:hover { - color: #f66; - } - } - li { - margin: 15px 10px; - font-size: 20px; - line-height: 1em; - } - } - } - #userbar { - border-bottom: 1px solid #d1d1d1; - height: 50px; - line-height: 50px; - text-align: right; - display: inline-block; - width: 100%; - background: #eaeaea; - #userinfo { - display: inline-block; - margin-right: 10px; - text-shadow: 0 1px 1px #fff; - a { - color: #3F3F3F; - &:hover { - color: #f00; - } - } - img.avatar { - border: 1px solid #000; - border-radius: 16px; - vertical-align: middle; - height: 32px; - width: 32px; - &:hover { - box-shadow: 0 0 2px; - } - } - #userinfo-box { - display: inline-block; - text-align: right; - vertical-align: middle; - line-height: 1em; - } - } - } - } - img.user-avatar { - border: 1px solid #000; - border-radius: 4px; - height: 128px; - width: 128px; - } - - img.avatar { - image-rendering: optimizeSpeed; - image-rendering:-moz-crisp-edges; - image-rendering:-o-crisp-edges; - image-rendering: optimize-contrast; - image-rendering: -webkit-optimize-contrast; - -ms-interpolation-mode: nearest-neighbor; - } - - span.no-about { - color: #888; - font-style: italic; - } - - #main-content { - padding: 30px 100px; - width: 100%; - margin: auto; - - h1 { - font-weight: normal; - font-size: 200%; - margin: 0; - text-shadow: 0 1px #999; - } - } - - #user-info { - .user-avatar { - margin-bottom: 30px; - } - } - - .user-avatar { - display: block; - } - - .post, .thread { - margin-bottom: 50px; - .post-content, .thread-content { - margin-top: 10px; - clear: both; - word-wrap: break-word; - overflow: hidden; - img { - max-width: 100%; - } - } - .post-title, .thread-title { - margin-bottom: 10px; - word-wrap: break-word; - h1 { - text-transform: capitalize; - } - h2 { - font-weight: normal; - text-transform: capitalize; - display: inline; - font-size: 200%; - } - .comment-counter { - float: right; - } - } - table { - tr, td, th { - border-collapse: collapse; - border: 1px solid #aaa; - } - tbody { - tr:nth-child(odd) { - background: #FFF; - } - tr:nth-child(even) { - background: #DDD - } - } - td, th { - padding: 0.3em 1em; - } - thead { - background: #3F3F3F; - color: #fff; - } - } - } - - pre { - border-radius: 2px; - position: relative; - background: #3F3F3F; - &:after { - color: #fff; - content: attr(lang); // show language on top right - font-style: italic; - margin: 10px; - position: absolute; - right: -10px; - top: 0; - opacity: 0; - transition: all 0.3s; - cursor: default; - } - &:hover:after { - opacity: 1; - right: 0; - } - code { - padding: 0; - box-shadow: 0 0 16px #222 inset; - background: #3F3F3F !important; - border: none; - border-radius: 3px; - } - } - - code { - background: #A2A2A2; - padding: 2px 5px; - border-radius: 3px; - color: #000; - border: 1px solid #888; - display: inline-block; - line-height: 1em; - } - - table, tr, td, th { - border-collapse: collapse; - } - - blockquote { - background: #F9F9F9; - border-left: 3px solid #3F3F3F; - display: inline-block; - margin: 0; - padding: 2px 5px 2px 2px; - } - - blockquote p { - display: inline; - } - - - .user { - display: inline-block; - a.role { - display: inline-block; - color: #fff !important; - font-weight: bold; - padding: 0 0.5em; - border-radius: 3px; - &.superadmin, &.admin { - background: #d22 !important; - } - &.mod { - background: #6af !important; - } - &.normal { - background: #aaa !important; - } - &.banned, &.disabled { - background: #ccc !important; - text-decoration: line-through !important; - color: #888 !important; - } - &:hover { - color: #ddd !important; - } - } - .donor { - background: #f60 !important; - border-radius: 3px; - color: #fff !important; - font-weight: bold !important; - margin-left: 3px; - padding: 0 0.5em; - display: inline-block; - } - .ign { - display: block; - color: #000; - font-style: italic; - } - } - - #comments { - margin: 50px 0 0 40px; - } - - #markdown-note { - margin: 0; - } - - select { - text-indent: 0.01px; - text-overflow: ""; - } - - input , select, textarea { - margin: 4px; - vertical-align: middle; - &[type=submit] { - margin: 0; - } - option { - padding: 0.5em; - &:hover { - background: #0f0; - color: #00f; - } - &:nth-child(even) { - background: #eee; - } - &:nth-child(odd) { - background: #ccc; - } - } - } - - input[type=text], input[type=email], input[type=password], input[type=number], textarea, select { - background: #ddd; - border: none; - height: 3em; - margin: 4px 0 0 0; - padding: 0.5em 1em; - width: 100%; - } - - input, select, textarea { - &.disabled, &[disabled] { - box-shadow: none; - background: #ddd; - } - } - - textarea { - max-width: 100% !important; - height: 200px; - padding: 1em; - min-height: 3.5em; - &.comment { - height: 75px; - } - &.full-width { - width: 100%; - } - &.vertical { - resize: vertical; - } - &.horizontal { - resize: horizontal; - } - } - - tr.special_edit { - background: #faa; - font-style: italic; - font-weight: bold; - box-shadow: 0 0 5px #faa; - } - - .field_with_errors { - input, select, textarea { - border: 1px solid #f00; - box-shadow: 0 0 5px #faa inset; - border-bottom: none; - } - .validation-error, .error { - display: inline-block; - padding: 0 1em; - width: 100%; - background: #faa; - font-weight: bold; - border: 1px solid #f00; - border-top: none; - } - } - - #form_labels { - text-align: right; - float: left; - label { - display: block; - padding: 0.5em; - } - } - #form_inputs { - input, select, textarea { - width: 400px; - } - } - - .profile-action { - float: right; - } - - .user-unconfirmed, .user-banned { - background: #AB0000; - color: white; - font-weight: bold; - padding: 4px 10px; - display: inline-block; - border-radius: 3px; - margin: 10px 0; - } - - .btn { - margin: 1px 1px 0 0; - padding: 6px; - cursor: default; - color: #fff; - border: none; - font-size: 12px; - line-height: normal; - display: inline-block; - &[disabled], &[disabled]:hover { - box-shadow: 0 0 5px #ddd inset; - color: #ddd; - } - &.blue { - background: #4096ee; - &[disabled] { - background: #96C1EE; - } - } - &.red { - background: #ee4040; - &[disabled] { - background: #EE8383; - } - } - &.left { - float: left; - } - &.right { - float: right; - } - &:hover { - box-shadow: 0 0 5px #095fb7 inset; - color: #fff; - } - } - - #userlist { - .list-user { - margin: 15px 0; - a img { - vertical-align: middle; - border: 1px solid; - border-radius: 3px; - color: #222; - &:hover { - color: #AB0000; - } - } - .detail { - display: inline-block; - vertical-align: middle; - margin-left: 3px; - } - } - } - - .editlink { - float: right; - opacity: 0; - margin-right: -10px; - transition: opacity 0.3s, margin 0.3s; - } - - #blogpost_text { - width: 100%; - } - - .clear { - clear: both; - display: block; - visibility: hidden; - } - - .item-group { - margin: 30px 0; - &.with-avatar { - margin-left: 70px; - .avatar { - float: left; - margin-left: -70px; - border: 1px solid #ccc; - border-radius: 5px; - } - } - &:hover .editlink { - opacity: 1; - margin-right: 0; - } - .header { - background: #3F3F3F; - border-radius: 5px 5px 0 0; - padding: 0.5em; - border-bottom: 1px solid #ccc; - color: #fff; - text-shadow: 0 1px 1px #222; - a { - color: #fff; - &:hover { - color: #f66; - } - } - } - .items { - border: 1px solid #ddd; - border-top: none; - border-bottom: none; - .item { - display: block; - padding: 0.5em; - border-bottom: 1px solid #ddd; - &.locked:before { - content: "(locked) "; - color: #000; - } - &.sticky:before { - content: "(sticky) "; - color: #000; - } - &.lockedsticky:before { - content: "(locked sticky) "; - color: #000; - } - &.content { - .headline { - margin: 0; - border-bottom: 1px solid #ddd; - } - } - } - } - } - - .bold { - font-weight: bold; - } - - iframe.youtube { - border: none; - width: 640px; - max-width: 100%; - height: 360px; - } - - mark { - background: #faa; - padding: 0 2px; - border-radius: 3px; - } - - .comment-counter { - float: right; - } - - .red-alert { - color: #AB0000; - font-weight: bold; - } - - img { - max-width: 100%; - } - -} \ No newline at end of file diff --git a/app/assets/stylesheets/style.css.scss b/app/assets/stylesheets/style.css.scss index 9e79250..5890679 100644 --- a/app/assets/stylesheets/style.css.scss +++ b/app/assets/stylesheets/style.css.scss @@ -1,11 +1,722 @@ +@keyframes wiggle { + 0% {transform: rotate(-3deg);} + 100% {transform: rotate(3deg);} +} +@-webkit-keyframes wiggle { + 0% {transform: rotate(-3deg);} + 100% {transform: rotate(3deg);} +} +@keyframes target { + 0% {background-color: #ff8;} +} +@-webkit-keyframes target { + 0% {background-color: #ff8;} +} +*, *:before, *:after, *:hover, *:active, *:focus { + -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; + outline: none !important; + } -/* Global CSS for all screen sizes */ +*::-moz-focus-inner { + border: 0; + outline: none !important; +} +html { + overflow-y: scroll; + padding: 0 !important; + margin: 0 !important; +} body { - margin: 0; - padding: 0; + background-color: #f2f2f2; + color: #3f3f3f; + padding: 0 !important; + margin: 0 !important; font: 14px/1.6 'Oswald','Calibri','Arial','DejaVu Sans', 'Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; +} + +::selection { + color: #fff; + background: #363636; +} + +::-moz-selection { + color: #fff; + background: #363636; +} + +#mobile-info { + display: none; +} + +a { + color: #ab0000; + text-decoration: none; + + &:hover { + color: #f00; + } +} + +.flash { + text-align: center; + padding: 10px; + font-weight: bold; + cursor: pointer; + + &.notice { + background: #8e8; + border-bottom: 3px dashed #8d8; + } + + &.alert { + background: #ebb; + border-bottom: 3px dashed #fdd; + } +} +#head { + #menu { + background: #3f3f3f; + height: 50px; + border-bottom: 1px solid #363636; + position: relative; + #logo { + width: 100px; + height: 100px; + position: absolute; + background: url(image_path('logo.png')) no-repeat; + background-position: 0 -100px; + left: 85px; + &:hover { + transition: all 0.3s ease 0; + background-position: 0 0; + } + } + + ul { + margin: 0 0 0 185px; + padding: 0; + list-style: none; + line-height: 0; + a { + display: inline-block; + color: #fff; + &:hover { + color: #f66; + } + } + li { + margin: 15px 10px; + font-size: 20px; + line-height: 1em; + } + } + } + + #userbar { + border-bottom: 1px solid #d1d1d1; + height: 50px; + line-height: 50px; + text-align: right; + display: inline-block; + width: 100%; + background: #eaeaea; + #userinfo { + display: inline-block; + margin-right: 10px; + text-shadow: 0 1px 1px #fff; + a { + color: #3f3f3f; + &:hover { + color: #f00; + } + } + img.avatar { + border: 1px solid #000; + border-radius: 16px; + vertical-align: middle; + height: 32px; + width: 32px; + &:hover { + box-shadow: 0 0 2px; + } + } + #userinfo-box { + display: inline-block; + text-align: right; + vertical-align: middle; + line-height: 1em; + } + } + } +} +img.user-avatar { + border: 1px solid #000; + border-radius: 4px; + height: 128px; + width: 128px; +} + +img.avatar { + image-rendering: -moz-crisp-edges; + image-rendering: -o-crisp-edges; + image-rendering: -webkit-optimize-contrast; + image-rendering: crisp-edges; + -ms-interpolation-mode: nearest-neighbor; +} + +span.no-about { + color: #888; + font-style: italic; +} + +#main-content { + padding: 30px 100px; + width: 1600px; + max-width: 100%; + margin: auto; + border-bottom: 1px solid #ddd; + box-shadow: 0 10px 10px #ddd; + + h1 { + font-weight: normal; + font-size: 200%; + margin: 0; + text-shadow: 0 1px #999; + word-wrap: break-word; + } +} + +#user-info { + .user-avatar { + margin-bottom: 30px; + } +} + +.user-avatar { + display: block; +} + +.post, .thread, .thread-reply { + margin-bottom: 50px; + .post-content, .thread-content { + margin-top: 10px; + clear: both; + word-wrap: break-word; + overflow: hidden; + img { + max-width: 100%; + } + } + .post-title, .thread-title { + margin-bottom: 10px; + word-wrap: break-word; + h1 { + text-transform: capitalize; + } + h2 { + font-weight: normal; + text-transform: capitalize; + display: inline; + font-size: 200%; + } + .comment-counter { + float: right; + } + } + table { + tr, td, th { + border-collapse: collapse; + border: 1px solid #aaa; + } + tbody { + tr:nth-child(odd) { + background: #fff; + } + tr:nth-child(even) { + background: #ddd; + } + } + td, th { + padding: 0.3em 1em; + } + thead { + background: #3f3f3f; + color: #fff; + } + } +} + +pre { + border-radius: 2px; + position: relative; + background: #3f3f3f; + &:after { + color: #fff; + content: attr(lang); // show language on top right + font-style: italic; + margin: 10px; + position: absolute; + right: -10px; + top: 0; + opacity: 0; + transition: all 0.3s; + cursor: default; + } + &:hover:after { + opacity: 1; + right: 0; + } + + // code blocks + code { + padding: 0; + box-shadow: 0 0 16px #222 inset; + background: #3f3f3f !important; + border: none; + border-radius: 3px; + } +} + +// inline code +code { + background: #ddd; + padding: 2px; + border-radius: 3px; + color: #000; + border: 1px solid #aaa; + display: inline-block; + line-height: 1em; +} + +table, tr, td, th { + border-collapse: collapse; + word-wrap: break-word; +} + +blockquote { + background: #f9f9f9; + border-left: 3px solid #3f3f3f; + display: inline-block; + margin: 0; + padding: 2px 5px 2px 2px; +} + +blockquote p { + display: inline; +} + + +.user { + display: inline-block; + a.role { + display: inline-block; + color: #fff !important; + font-weight: bold; + padding: 4px 0.5em; + border-radius: 3px; + text-shadow: none; + line-height: 1em; + margin: 1px 0; + + &.superadmin, &.admin { + background: #d22 !important; + } + + &.mod { + background: #6af !important; + } + + &.normal { + background: #aaa !important; + } + + &.banned, &.disabled { + background: #ccc !important; + text-decoration: line-through !important; + color: #888 !important; + } + + &:hover { + color: #ddd !important; + } + } + .donor { + background: #f60 !important; + border-radius: 3px; + color: #fff !important; + font-weight: bold !important; + margin-left: 3px; + padding: 0 0.5em; + display: inline-block; + } + .ign { + display: block; + color: #000; + font-style: italic; + } +} + +#comments { + margin: 50px 0 0 40px; +} + +.markdown-help { + margin: 4px 0 -4px; + background: #ddd; + padding: 0.5em 1em; + border-bottom: 1px solid; +} + +select { + text-indent: 0.01px; + text-overflow: ""; +} + +input , select, textarea { + margin: 4px; + vertical-align: middle; + &[type=submit] { + margin: 0; + } + option { + padding: 0.5em; + + &:hover { + background: #0f0; + color: #00f; + } + + &:nth-child(even) { + background: #eee; + } + + &:nth-child(odd) { + background: #ccc; + } + } +} + +input[type=text], input[type=email], input[type=password], input[type=number], textarea, select { + background: #ddd; + border: none; + height: 3em; + margin: 4px 0 0; + padding: 0.5em 1em; + width: 100%; + } + +input, select, textarea { + &.disabled, &[disabled] { + box-shadow: none; + background: #ddd; + } +} + +textarea { + max-width: 100% !important; + height: 300px; + width: 100%; + padding: 1em; + min-height: 3.5em; + + &.comment { + height: 75px; + } + + &.full-width { + width: 100%; + } + + &.vertical { + resize: vertical; + } + + &.horizontal { + resize: horizontal; + } +} + +tr.spacer { + height: 2em; +} + +.field_with_errors { + input, select, textarea { + border: 1px solid #f00; + box-shadow: 0 0 5px #faa inset; + border-bottom: none; + } + + .validation-error, .error { + display: inline-block; + padding: 0 1em; + width: 100%; + background: #faa; + font-weight: bold; + border: 1px solid #f00; + border-top: none; + } +} + +.profile-action { + float: right; +} + +.user-unconfirmed, .user-banned { + background: #ab0000; + color: #fff; + font-weight: bold; + padding: 4px 10px; + display: inline-block; + border-radius: 3px; + margin: 10px 0; +} + +.btn { + margin: 1px 1px 0 0; + padding: 6px; + cursor: default; + color: #fff; + border: none; + font-size: 12px; + line-height: normal; + display: inline-block; + + &[disabled], &[disabled]:hover { + box-shadow: 0 0 5px #ddd inset; + color: #ddd; + } + + &.blue { + background: #4096ee; + + &[disabled] { + background: #96c1ee; + } + } + + &.red { + background: #ee4040; + &[disabled] { + background: #ee8383; + } + } + + &.dark { + background: #363636; + } + + &.donate { + padding-right: 30px; + + &.paypal { + background-image: url(image_path('/assets/double_p.svg')); + background-repeat: no-repeat; + background-position: right 6px center; + } + } + + &:hover { + box-shadow: 0 0 5px #095fb7 inset; + color: #fff; + } +} + +#userlist { + .list-user { + margin: 15px 0; + + a img { + vertical-align: middle; + border: 1px solid; + border-radius: 3px; + color: #222; + &:hover { + color: #ab0000; + } + } + + .detail { + display: inline-block; + vertical-align: middle; + margin-left: 3px; + } + } +} + +.editlink { + float: right; + opacity: 0; + margin-right: -10px; + transition: opacity 0.3s, margin 0.3s; +} + +#blogpost_text { + width: 100%; +} + +.clear { + clear: both; + display: block; + visibility: hidden; +} + +.item-group { + margin: 30px 0; + + &.with-avatar { + margin-left: 70px; + .avatar { + margin: -7px 0 0 -77px; + border: 1px solid #ccc; + border-radius: 5px; + float: left; + } + } + + &:hover .editlink { + opacity: 1; + margin-right: 0; + } + + &:target { + animation: target 2.5s; + -webkit-animation: target 2.5s; + } + + .header { + background: #3f3f3f; + border-radius: 5px 5px 0 0; + padding: 0.5em; + border-bottom: 1px solid #ccc; + color: #fff; + text-shadow: 0 1px 1px #222; + a { + color: #fff; + &:hover { + color: #f66; + } + } + } + + .items { + border: 1px solid #ddd; + border-top: none; + border-bottom: none; + + .item { + display: block; + padding: 0.5em; + border-bottom: 1px solid #ddd; + &:target { + animation: target 2.5s; + -webkit-animation: target 2.5s; + } + + &.locked:before { + content: " "; + background: url(image_path("lock.png")) no-repeat center center; + margin-right: 5px; + display: inline-block; + width: 20px; + height: 20px; + vertical-align: middle; + } + + &.sticky:before { + content: " "; + background: url(image_path("pin.png")) no-repeat center center; + margin-right: 5px; + display: inline-block; + width: 20px; + height: 20px; + vertical-align: middle; + } + + &.lockedsticky:before { + content: " "; + background: url(image_path("lock-pin.png")) no-repeat center center; + margin: -7px 5px -3px 0; + display: inline-block; + width: 20px; + height: 30px; + vertical-align: middle; + } + + &.content { + .headline { + margin: 0; + border-bottom: 1px solid #ddd; + } + overflow-x: auto; + } + } + } +} + +.donation { + margin-bottom: 3em; +} + +.bold { + font-weight: bold; +} + +iframe.youtube { + border: none; + width: 640px; + max-width: 100%; + height: 360px; +} + +mark { + background: #faa; + padding: 0 2px; + border-radius: 3px; +} + +.comment-counter { + float: right; +} + +.red-alert { + color: #ab0000; + font-weight: bold; +} + +table { + width: 100%; + max-width: 100%; + table-layout: fixed; +} + +img { + max-width: 100%; +} + +.left { + float: left; +} + +.right { + float: right; +} + +#footer { + padding: 0 100px 30px; + width: 1600px; + max-width: 100%; + margin: auto; + text-align: center; + + .note { + color: #888; + font-size: 12px; + font-style: italic; + margin-top: 5em; + } } \ No newline at end of file diff --git a/app/controllers/forumgroups_controller.rb b/app/controllers/forumgroups_controller.rb index 754ece0..bff18c5 100644 --- a/app/controllers/forumgroups_controller.rb +++ b/app/controllers/forumgroups_controller.rb @@ -5,7 +5,7 @@ class ForumgroupsController < ApplicationController end def show - redirect_to forums_path + "#forum-#{params[:id]}" + redirect_to forums_path + "#group-#{params[:id]}" end def edit diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 390024d..8244810 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -3,11 +3,15 @@ class ForumsController < ApplicationController def index @groups = Forumgroup.select {|g| g.can_read?(current_user) } - @groups.sort_by!{|g| g[:position]} + @groups.sort_by!{ |g| g.position || 0 } end def show - @threads = @forum.forumthreads.order("sticky desc, updated_at desc") + @threads = @forum.forumthreads.to_a + @threads.sort_by! do |t| + # sticky goes first, then sort by last activity (new replies) + [t.sticky ? 0 : 1, -(t.replies.last.try(:created_at) || t.created_at).to_i] + end end def edit diff --git a/app/controllers/forumthreads_controller.rb b/app/controllers/forumthreads_controller.rb index 060fd55..368a5d5 100644 --- a/app/controllers/forumthreads_controller.rb +++ b/app/controllers/forumthreads_controller.rb @@ -12,7 +12,7 @@ class ForumthreadsController < ApplicationController def update if mod? || @thread.author.is?(current_user) @thread.user_editor = current_user - @thread.attributes = thread_params([:user_editor]) + @thread.attributes = (mod? ? thread_params([:sticky, :locked, :forum_id]) : thread_params) if @thread.save redirect_to @thread, notice: 'Post has been updated.' else diff --git a/app/controllers/youtube.regex b/app/controllers/youtube.regex deleted file mode 100644 index e3b665d..0000000 --- a/app/controllers/youtube.regex +++ /dev/null @@ -1,6 +0,0 @@ -[yt](729o_Xwg1WU) - -\[yt\]\(([a-zA-Z0-9\-_]+)\) - - -https://www.youtube.com/embed/{id}?theme=light&iv_load_policy=3&showinfo=1&showsearch=0&rel=0&modestbranding&hd=1&autohide=1&html5=1 \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5444ac9..1afeeaf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -20,6 +20,7 @@ module ApplicationHelper filter_html: true, no_styles: true, safe_links_only: true, + with_toc_data: true, hard_wrap: true, link_attributes: {target: "_blank", rel: "nofollow"} }) @@ -46,6 +47,7 @@ module ApplicationHelper no_images: true, no_styles: true, safe_links_only: true, + with_toc_data: false, hard_wrap: false, link_attributes: {target: "_blank", rel: "nofollow"} }) diff --git a/app/mailers/redstoner_mailer.rb b/app/mailers/redstoner_mailer.rb index 62c0741..c92fec3 100644 --- a/app/mailers/redstoner_mailer.rb +++ b/app/mailers/redstoner_mailer.rb @@ -3,13 +3,13 @@ class RedstonerMailer < ActionMailer::Base default from: "info@redstoner.com" default reply_to: "redstonerserver+website@gmail.com" - def register_mail(user, uses_mc_pass) + def register_mail(user, uses_mc_pass) @user = user @mcpw = uses_mc_pass mail(to: @user.email, subject: "Registration on Redstoner.com", from: "info@redstoner.com", reply_to: "redstonerserver+website@gmail.com") end - def register_info_mail(user, uses_mc_pass) + def register_info_mail(user, uses_mc_pass) @user = user @mcpw = uses_mc_pass mail(to: "redstonerserver@gmail.com", subject: "#{@user.name} registered on Redstoner.com", from: "info@redstoner.com", reply_to: "redstonerserver+website@gmail.com") diff --git a/app/models/blogpost.rb b/app/models/blogpost.rb index 61351c4..0aefbdb 100644 --- a/app/models/blogpost.rb +++ b/app/models/blogpost.rb @@ -15,7 +15,12 @@ class Blogpost < ActiveRecord::Base end def editor + # can be nil @editor ||= user_editor end + def edited? + !!user_editor_id + end + end diff --git a/app/models/comment.rb b/app/models/comment.rb index d4829d1..80bd530 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -16,4 +16,13 @@ class Comment < ActiveRecord::Base User.first end end + + def editor + # can be nil + @editor ||= user_editor + end + + def edited? + !!user_editor_id + end end \ No newline at end of file diff --git a/app/models/forumthread.rb b/app/models/forumthread.rb index 6be73dd..c6070a7 100644 --- a/app/models/forumthread.rb +++ b/app/models/forumthread.rb @@ -23,9 +23,14 @@ class Forumthread < ActiveRecord::Base end def editor + # can be nil @editor ||= user_editor end + def edited? + !!user_editor_id + end + def replies threadreplies end diff --git a/app/models/role.rb b/app/models/role.rb index cd93ad9..47da692 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -15,8 +15,14 @@ class Role < ActiveRecord::Base !!(Role.find_by_name(name) == self) end - def self.get (name) - Role.find_by_name(name) + def self.get (input) + if input.is_a?(String) || input.is_a?(Symbol) + Role.find_by_name(input) + elsif input.is_a?(Fixnum) + Role.find_by_id(input) + elsif input.is_a?(Role) + return input + end end def <=> (role) diff --git a/app/models/threadreply.rb b/app/models/threadreply.rb index bf45c4c..ea874f1 100644 --- a/app/models/threadreply.rb +++ b/app/models/threadreply.rb @@ -21,6 +21,11 @@ class Threadreply < ActiveRecord::Base end def editor + # can be nil @editor ||= user_editor end + + def edited? + !!user_editor_id + end end \ No newline at end of file diff --git a/app/models/user.rb b/app/models/user.rb index 1880027..0606cd5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,7 +7,7 @@ class User < ActiveRecord::Base has_secure_password - before_validation :strip_whitespaces, :set_uuid, :set_name, :set_role, :set_email_token + before_validation :strip_whitespaces, :set_uuid, :set_name, :set_email_token validates_presence_of :password, :password_confirmation, :email_token, :on => :create validates_presence_of :name, :email, :ign @@ -38,6 +38,10 @@ class User < ActiveRecord::Base !!self.confirmed end + def online? + last_seen && last_seen > 5.minutes.ago + end + #roles def disabled? !!(self.role == :disabled) @@ -179,10 +183,6 @@ class User < ActiveRecord::Base self.name ||= self.ign end - def set_role - self.role ||= Role.get(:normal) - end - def account_exists? profile = self.get_profile if !profile || profile["demo"] == true diff --git a/app/views/application/_mdhelp.html.erb b/app/views/application/_mdhelp.html.erb new file mode 100644 index 0000000..cb21e63 --- /dev/null +++ b/app/views/application/_mdhelp.html.erb @@ -0,0 +1,12 @@ +
> quote| + _underline_ | + *italic* | + **bold** | +
`code` |
+ ==mark== |
+ [link](https://example.com)
+
+ <%= link_to "more...", "/info/1", target: "_blank", class: "right", tabindex: -1 %>
+
+Note: You can use <%= link_to "Markdown", "https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet", target: "_blank" %>!
-<%= simple_form_for @post do |f|%> - <%= f.input :title, :label => false %> - <%= f.text_area :content, :label => false, input_html: {class: "full-width vertical"} %> +<%= form_for @post do |f|%> + <%= f.text_field :title %> + <%= render partial: "mdhelp" %> + <%= f.text_area :content, class: "vertical" %><%= f.submit "Update Post", class: "btn blue left" %>
<% end %><%= button_to "Delete post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right" %>
\ No newline at end of file diff --git a/app/views/blogposts/index.html.erb b/app/views/blogposts/index.html.erb index b3bc1aa..d23cc8c 100644 --- a/app/views/blogposts/index.html.erb +++ b/app/views/blogposts/index.html.erb @@ -3,9 +3,9 @@Note: You can use <%= link_to "Markdown", "https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet", target: "_blank" %>!
- <%= f.text_area :content, placeholder: "Text", input_html: {class: "full-width vertical"} %> +<%= form_for @post do |f|%> + <%= f.text_field :title, placeholder: "Title" %> + <%= render partial: "mdhelp" %> + <%= f.text_area :content, placeholder: "Text", input_html: {class: "vertical"} %><%= f.submit "Create Post", class: "btn blue left" %>
<% end %> diff --git a/app/views/blogposts/show.html.erb b/app/views/blogposts/show.html.erb index 87905cd..e2610a2 100644 --- a/app/views/blogposts/show.html.erb +++ b/app/views/blogposts/show.html.erb @@ -1,8 +1,8 @@ <%= link_to "News", blogposts_path %> → <%= link_to @post.title %>
New comment
- <%= simple_form_for [@post, @comment] do |f| %> - | _underline_ | *italic* | **bold** |`code`| ==mark== | [link](https://example.com) - <%= f.input :content, :label => false, :as => "text", :placeholder => "Comment", input_html: {class: "comment"} %> - <%= f.submit class: "btn blue" %> + <%= form_for [@post, @comment] do |f| %> + <%= render partial: "mdhelp" %> + <%= f.text_area :content, placeholder: "Comment", class: "comment" %> +<%= f.submit class: "btn blue" %>
<% end %> <% end %> \ No newline at end of file diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb index 092f0a3..4dce085 100644 --- a/app/views/comments/edit.html.erb +++ b/app/views/comments/edit.html.erb @@ -1,7 +1,8 @@Edit comment
-<%= simple_form_for [@comment.blogpost, @comment] do |f| %> - <%= f.input :content, label: false, as: "text", placeholder: "Comment" %> +<%= form_for [@comment.blogpost, @comment] do |f| %> + <%= render partial: "mdhelp" %> + <%= f.text_area :content, placeholder: "Comment" %><%= f.submit "Update Comment", class: "btn blue left" %>
<% end %><%= button_to "Delete comment", [@comment.blogpost, @comment] , method: "delete", data: {confirm: "Delete comment forever?"}, class: "btn red right" %>
\ No newline at end of file diff --git a/app/views/forumgroups/edit.html.erb b/app/views/forumgroups/edit.html.erb index 9b4f731..6edb410 100644 --- a/app/views/forumgroups/edit.html.erb +++ b/app/views/forumgroups/edit.html.erb @@ -32,6 +32,6 @@<%= f.submit "Update group", class: "btn blue" %>
+<%= f.submit "Update group", class: "btn blue left" %>
<% end %><%= button_to "Delete group", @post, :method => "delete", data: {confirm: "Delete group?\nForums + Threads will not be accessible!"}, class: "btn red right" %>
\ No newline at end of file diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index a4224a7..bc9123c 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -1,15 +1,15 @@<%= f.submit "Update thread", class: "btn blue" %>
+<%= f.submit "Update thread", class: "btn blue left" %>
<% end %> <%= button_to "Delete thread", @thread, :method => "delete", data: {confirm: "Delete thread & comments forever?"}, class: "btn red right" %> \ No newline at end of file diff --git a/app/views/forumthreads/new.html.erb b/app/views/forumthreads/new.html.erb index 2b35721..5e62f14 100644 --- a/app/views/forumthreads/new.html.erb +++ b/app/views/forumthreads/new.html.erb @@ -13,9 +13,8 @@ <% end %> -<%= f.submit "Create thread", class: "btn blue" %>
diff --git a/app/views/forumthreads/show.html.erb b/app/views/forumthreads/show.html.erb index 0faea1f..bc74bc3 100644 --- a/app/views/forumthreads/show.html.erb +++ b/app/views/forumthreads/show.html.erb @@ -1,11 +1,16 @@ <%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → <%= link_to @thread %><%= link_to truncate(@thread.title, length: 60, omission: " …"), p %>
<%= render_md(@thread.content).html_safe %> diff --git a/app/views/info/edit.html.erb b/app/views/info/edit.html.erb index b32d6ae..dc64104 100644 --- a/app/views/info/edit.html.erb +++ b/app/views/info/edit.html.erb @@ -1,7 +1,8 @@Edit Info
<%= form_for @info do |f|%> - <%= f.text_field :title, :label => false %> - <%= f.text_area :content, :label => false, input_html: {class: "full-width vertical"} %> + <%= f.text_field :title%> + <%= render partial: "mdhelp" %> + <%= f.text_area :content, class: "vertical" %><%= f.submit "Update Info", class: "btn blue left" %>
<% end %><%= button_to "Delete Info", @info, method: "delete", data: {confirm: "Delete Info forever?"}, class: "btn red right" %>
\ No newline at end of file diff --git a/app/views/info/index.html.erb b/app/views/info/index.html.erb index 12c33a9..52f2a45 100644 --- a/app/views/info/index.html.erb +++ b/app/views/info/index.html.erb @@ -1,9 +1,9 @@Info
+<% if mod? %> + <%= link_to "New Info", new_info_path, class: "btn blue" %> +<% end %><% @info.each do |info| %>- <%= link_to info.title, info %>
<% end %>
-
-<% if mod? %> - <%= link_to "New Info", new_info_path, class: "btn blue" %> -<% end %> \ No newline at end of file + \ No newline at end of file diff --git a/app/views/info/new.html.erb b/app/views/info/new.html.erb index 11f7aa8..011cf1f 100644 --- a/app/views/info/new.html.erb +++ b/app/views/info/new.html.erb @@ -1,6 +1,7 @@New Info
<%= form_for @info, url: info_index_path do |f|%> <%= f.text_field :title, placeholder: "Title" %> - <%= f.text_area :content, placeholder: "Text", input_html: {class: "full-width vertical"} %> + <%= render partial: "mdhelp" %> + <%= f.text_area :content, placeholder: "Text", class: "vertical" %><%= f.submit "Create Info", class: "btn blue left" %>
<% end %> \ No newline at end of file diff --git a/app/views/info/show.html.erb b/app/views/info/show.html.erb index 36e6f7d..2737f13 100644 --- a/app/views/info/show.html.erb +++ b/app/views/info/show.html.erb @@ -1,3 +1,5 @@ <%= link_to "Info", info_index_path %> → <%= @info.title %> +<%= link_to "Edit Info", edit_info_path(@info), class: "btn blue right" %> +<%= @info.title %>
Users currently online: <%= users.length %>
+ <% users.each do |u| %> + <%= render partial: "users/username", locals: { user: u } %> + <% end %> +Tip: Hold your device in landscape mode.