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 %> +
+
\ No newline at end of file diff --git a/app/views/blogposts/edit.html.erb b/app/views/blogposts/edit.html.erb index eefc9ee..e2e87ec 100644 --- a/app/views/blogposts/edit.html.erb +++ b/app/views/blogposts/edit.html.erb @@ -1,8 +1,8 @@

Edit post

-

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 @@
<% @posts.each do |p| %>
- <%= link_to(image_tag(p.author.avatar_url(64), class: "avatar"), p.author, title: p.author.ign) %>
- <%= render partial: "users/username", locals: { user: p.author } %> + <%= link_to(image_tag(p.author.avatar_url(64), class: "avatar"), p.author, title: p.author.ign) %> + <%= render partial: "users/username", locals: { user: p.author } %> <%= link_to pluralize(p.comments.count, "Comment"), p %> diff --git a/app/views/blogposts/new.html.erb b/app/views/blogposts/new.html.erb index 8b82807..5f8f74a 100644 --- a/app/views/blogposts/new.html.erb +++ b/app/views/blogposts/new.html.erb @@ -1,7 +1,7 @@

New Post

-<%= simple_form_for @post do |f|%> - <%= f.input :title, placeholder: "Title" %> -

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 %>
- <%= link_to(image_tag(@post.author.avatar_url(64), class: "avatar"), @post.author, title: @post.author.ign) %>
- <%= render partial: "users/username", locals: { user: @post.author } %> + <%= link_to(image_tag(@post.author.avatar_url(64), class: "avatar"), @post.author, title: @post.author.ign) %> + <%= render partial: "users/username", locals: { user: @post.author } %> <%= link_to "edit", edit_blogpost_path(@post.id), class: "editlink" if mod? %>
diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 21be5f9..794323d 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,7 +1,9 @@
- <%= link_to(image_tag(c.author.avatar_url(64), class: "avatar"), c.author, title: c.author.ign) %>
"> - <%= render partial: "users/username", locals: { user: c.author } %> + <%= link_to(image_tag(c.author.avatar_url(64), class: "avatar"), c.author, title: c.author.ign) %> + <%= render partial: "users/username", locals: { user: c.author } %> + + <%= link_to "edit", edit_blogpost_comment_path(c.blogpost, c), class: "editlink" if (mod? || c.author.is?(current_user)) %>
diff --git a/app/views/comments/_new.html.erb b/app/views/comments/_new.html.erb index d1c0125..e29d5d8 100644 --- a/app/views/comments/_new.html.erb +++ b/app/views/comments/_new.html.erb @@ -1,8 +1,8 @@ <% if current_user %>

New comment

- <%= simple_form_for [@post, @comment] do |f| %> -

> quote
| _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.select :role_write_id, role_selection, include_blank: false %> -

<%= 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 @@
<% @groups.each do |group| %> -
+
<%= group.name %> <%= link_to "edit", edit_forumgroup_path(group), class: "editlink" if admin? %>
- <% group.forums.each do |f| %> + <% group.forums.sort_by{ |f| f.position || 0 }.each do |f| %> <% if f.can_read?(current_user) %> - <%= link_to f.name, f, class: "item" %> + <%= link_to f.name, f, id: "forum-#{f.id}", class: "item" %> <% end %> <% end %>
@@ -21,5 +21,5 @@ <% if admin? %> <%= link_to "New group", new_forumgroup_path, class: "btn blue" %> <% elsif mod? %> - <%= link_to "New group", nil, class: "btn blue", disabled: true %> + <%= link_to "New group", "#", class: "btn blue", disabled: true %> <% end %> \ No newline at end of file diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index cde5216..a6cbb9e 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -7,9 +7,9 @@
<% @threads.each do |thread| %>
- <%= link_to(image_tag(thread.author.avatar_url(64), class: "avatar"), thread.author, title: thread.author.ign) %>
- <%= render partial: "users/username", locals: { user: thread.author } %> + <%= link_to(image_tag(thread.author.avatar_url(64), class: "avatar"), thread.author, title: thread.author.ign) %> + <%= render partial: "users/username", locals: { user: thread.author } %> <%= link_to pluralize(thread.replies.count, "Reply"), thread %> diff --git a/app/views/forumthreads/edit.html.erb b/app/views/forumthreads/edit.html.erb index 9cd84b1..ec5bcc5 100644 --- a/app/views/forumthreads/edit.html.erb +++ b/app/views/forumthreads/edit.html.erb @@ -11,12 +11,21 @@ <%= f.label :locked %> <%= f.check_box :locked %> + + <%= f.label :forum_id, "Move thread" %> + <% + forums = [] + Forum.all.sort_by{ |f| f.forumgroup.position || 0 }.each do |f| + forums << ["#{f.forumgroup.name} → #{f.name}", f.id] + end + %> + <%= f.select :forum_id, forums %> + <% end %> -
- <%= f.text_field :title, placeholder: "Title" %> -
+ <%= f.text_field :title, placeholder: "Title" %> + <%= render partial: "mdhelp" %> <%= f.text_area :content, placeholder: "Text" %> -

<%= 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.text_field :title, placeholder: "Title" %> -
+ <%= f.text_field :title, placeholder: "Title" %> + <%= render partial: "mdhelp" %> <%= f.text_area :content, placeholder: "Text" %> <%= f.hidden_field :forum_id %>

<%= 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(image_tag(@thread.author.avatar_url(64), class: "avatar"), @thread.author, title: @thread.author.ign) %>
- <%= render partial: "users/username", locals: { user: @thread.author } %> + <%= link_to(image_tag(@thread.author.avatar_url(64), class: "avatar"), @thread.author, title: @thread.author.ign) %> + <%= render partial: "users/username", locals: { user: @thread.author } %> <%= link_to "edit", edit_forumthread_path( @thread), class: "editlink" if (@thread.author.is?(current_user) || mod?) %>
+ <% if @thread.edited? %> +
+ Last edited by <%= link_to @thread.editor.name, @thread.editor %>. +
+ <% end %>

<%= 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 %>

<%= render_md(@info.content).html_safe %>
\ No newline at end of file diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb new file mode 100644 index 0000000..bb172f1 --- /dev/null +++ b/app/views/layouts/_footer.html.erb @@ -0,0 +1,12 @@ +<% users = User.select{|u| u.online?} %> + \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 696c5ad..7a1b396 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -11,11 +11,12 @@
We don't have a mobile style yet. It might look shitty.
Tip: Hold your device in landscape mode.
- <%= render "/layouts/head" %> + <%= render partial: "/layouts/head" %>
- <%= "
#{alert}
".html_safe if alert %> - <%= "
#{notice}
".html_safe if notice %> + <%= "
#{alert}
".html_safe if alert %> + <%= "
#{notice}
".html_safe if notice %> <%= yield %>
+ <%= render partial: "/layouts/footer" %> \ No newline at end of file diff --git a/app/views/redstoner_mailer/register_info_mail.html.erb b/app/views/redstoner_mailer/register_info_mail.html.erb index 792928c..836ea10 100644 --- a/app/views/redstoner_mailer/register_info_mail.html.erb +++ b/app/views/redstoner_mailer/register_info_mail.html.erb @@ -1,29 +1,39 @@ -

<%= @user.name %> has registered on redstoner.

-

- - - - - - - - - - - - - - - - - -
IGN<%= @user.ign %>
email<%= @user.email %>
Time<%= @user.created_at %>
IP<%= @user.last_ip %>
-

- -<% if @mcpw %> -

- - USER IS AN IDIOT! - -

-<% end %> \ No newline at end of file +

'<%= @user.name %>' has registered on redstoner.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + <% if @mcpw %> + + <% else %> + + <% end %> + +
IGN<%= @user.ign %>
UUID<%= @user.uuid %>
email<%= @user.email %>
Time<%= @user.created_at.strftime("%e. %b %Y, %H:%M") %>
Role<%= @user.role %>
IP<%= @user.last_ip %>
IdiotYES! (used his mc pass) >_<no
+
+<% debug = @user.attributes.dup %> +<% debug.delete("password_digest") %> +

Debug info:
<%= debug %>
\ No newline at end of file diff --git a/app/views/redstoner_mailer/register_mail.html.erb b/app/views/redstoner_mailer/register_mail.html.erb index dea9709..2f0438b 100644 --- a/app/views/redstoner_mailer/register_mail.html.erb +++ b/app/views/redstoner_mailer/register_mail.html.erb @@ -3,22 +3,17 @@ Hi <%= @user.name %>!

Thank you for registering on Redstoner.com!

-

To use your account, you need to <%= link_to "confirm", confirm_user_path(@user, code: @user.email_token, only_path: false) %> your email address.

+

To use your account, you need to <%= link_to "confirm", confirm_user_path(@user, code: @user.email_token, only_path: false), style: "text-decoration: none; color: #4096EE;" %> your email address.

<% if @mcpw %> -
-

- - NEVER USE THE SAME PASSWORD TWICE! - -

-

- - You used your minecraft password on our website. Do not do that. It's just stupid. - -

+
+

WARNING!

+

Never use the same password on different sites, that is how accers gain access to accounts.

+

You have used your minecraft password on our website.
+ Don't do that! It's stupid.

+

If you are using this password elsewhere, change it. Now.

<% end %> @@ -30,7 +25,7 @@

-

If you have any questions or problems, just ask one of our <%= link_to "Staff", users_path(role: "staff", only_path: false) %> in-game.

+

If you have any questions or problems, just ask one of our <%= link_to "Staff", users_path(role: "staff", only_path: false), style: "text-decoration: none; color: #4096EE;" %> in-game.

Your Redstoner team

@@ -38,6 +33,11 @@

If you did not sign up on redstoner.com you can safely ignore this email!

-

You can contact us via: <%= link_to "Website", "root_path" %> | <%= link_to "Twitter", "https://twitter.com/RedstonerServer" %> | <%= link_to "Google+", "https://google.com/+Redstoner" %> | <%= link_to "Email", "mailto:redstonerserver+website@gmail.com" %>

+

You can contact us via: + <%= link_to "Website", "root_path", style: "text-decoration: none; color: #4096EE;" %> | + <%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | + <%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> | + <%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %> +

\ No newline at end of file diff --git a/app/views/statics/donate.html.erb b/app/views/statics/donate.html.erb index 3372955..55e1afe 100644 --- a/app/views/statics/donate.html.erb +++ b/app/views/statics/donate.html.erb @@ -24,21 +24,30 @@

Donate to Redstone Sheep

Sheep is our admin. He fixes everything & keeps the server running.

-
- + + + <% if current_user %> + + <% else %> + + <% end %> - +

Donate to PanFritz

Pan hosts the Server.

-
- + + <% if current_user %> + + <% else %> + + <% end %> - +
\ No newline at end of file diff --git a/app/views/statics/index.html.erb b/app/views/statics/index.html.erb index 2e58029..e4585cb 100644 --- a/app/views/statics/index.html.erb +++ b/app/views/statics/index.html.erb @@ -1,4 +1,3 @@ -
-

The loneliest page in the world

- -
\ No newline at end of file +

Redstoner

+

We need some text here

+

Any suggestions?

\ No newline at end of file diff --git a/app/views/threadreplies/_reply.html.erb b/app/views/threadreplies/_reply.html.erb index 2afea79..636a2bd 100644 --- a/app/views/threadreplies/_reply.html.erb +++ b/app/views/threadreplies/_reply.html.erb @@ -1,7 +1,9 @@
- <%= link_to(image_tag(reply.author.avatar_url(64), class: "avatar"), reply.author, title: reply.author.ign) %>
- <%= render partial: "users/username", locals: { user: reply.author } %> + <%= link_to(image_tag(reply.author.avatar_url(64), class: "avatar"), reply.author, title: reply.author.ign) %> + <%= render partial: "users/username", locals: { user: reply.author } %> + + <%= link_to "edit", edit_forumthread_threadreply_path(reply.thread, reply), class: "editlink" if mod? || reply.thread.author.is?(current_user) %>
diff --git a/app/views/threadreplies/edit.html.erb b/app/views/threadreplies/edit.html.erb index 5b6aba2..9371740 100644 --- a/app/views/threadreplies/edit.html.erb +++ b/app/views/threadreplies/edit.html.erb @@ -1,6 +1,8 @@ <%= link_to @reply.thread.forum.group, forumgroup_path(@reply.thread.forum.group) %> → <%= link_to @reply.thread.forum, @reply.thread.forum %> → <%= link_to @reply.thread %> → Edit reply

Edit reply

<%= form_for [@reply.thread, @reply] do |f| %> + <%= render partial: "mdhelp" %> <%= f.text_area :content, placeholder: "Text" %> -

<%= f.submit "Reply", class: "btn blue" %>

-<% end %> \ No newline at end of file +

<%= f.submit "Reply", class: "btn blue left" %>

+<% end %> +

<%= button_to "Delete reply", [@reply.thread, @reply], method: "delete", data: {confirm: "Delete reply forever?"}, class: "btn red right" %>

\ No newline at end of file diff --git a/app/views/users/change_password.html.erb b/app/views/users/change_password.html.erb index b5722d5..1ca943d 100644 --- a/app/views/users/change_password.html.erb +++ b/app/views/users/change_password.html.erb @@ -1,13 +1,8 @@

Change password

-<%= simple_form_for @user do |f| %> -
- -
-
- <%= f.input :current_password, :label => false %> - <%= f.input :email, :label => false %> - <%= f.input :password, :label => false %> - <%= f.input :password_confirmation, :label => false %> -
+<%= form_for @user do |f| %> + <%= f.text_field :current_password %> + <%= f.text_field :email %> + <%= f.text_field :password %> + <%= f.text_field :password_confirmation %> <% end %> \ No newline at end of file diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index bb13e54..778757e 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -1,34 +1,27 @@ -<% def can_edit?; (@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role); end %> +<% + def can_edit? + (@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role) + end +%> + <%= link_to (@user.is?(current_user) ? "Your profile" : @user.name), current_user %> → Edit

Edit profile

-<%= simple_form_for @user do |f| %> +<%= form_for @user do |f| %> - - - - <% if mod? %> - - - - @@ -36,36 +29,39 @@
<%= image_tag @user.avatar_url(128), :class => "user-avatar avatar", :alt => "avatar" %>
Display name - <%= f.input :name, :label => false, disabled: !can_edit? %> + <%= f.text_field :name, disabled: !can_edit? %>
In-game name - <%= f.input :ign, :label => false, disabled: !(mod? && current_user.role >= @user.role) %> -
Role <% if mod? && current_user.role >= @user.role %> - <%= f.association :role, :label => false, :collection => Role.all_to(current_user.role), :include_blank => false %> - <% else %> - <%= f.input :role, label: false, disabled: true %> + <%= f.select :role, Role.all_to(current_user.role) %> <% end %>
Skype username - <%= f.input :skype, label: false, placeholder: "Skype username", disabled: !can_edit? %> + <%= f.text_field :skype, placeholder: "Skype username", disabled: !can_edit? %>
Show Skype to - <%= f.input :skype_public, label: false, as: :select, collection: [["Staff only", false], ["All users", true]], include_blank: false, input_html: { disabled: !can_edit? } %> + <%= f.select :skype_public, [["Staff only", false], ["All users", true]], {}, { disabled: !can_edit? } %>
YouTube username - <%= f.input :youtube, :label => false, placeholder: "YouTube username", disabled: !can_edit? %> + <%= f.text_field :youtube, placeholder: "YouTube username", disabled: !can_edit? %>
Twitter username - <%= f.input :twitter, :label => false, placeholder: "Twitter username", disabled: !(@user.is?(current_user) && confirmed? || (mod? && current_user.role >= @user.role)) %> + <%= f.text_field :twitter, placeholder: "Twitter username", disabled: !(@user.is?(current_user) && confirmed? || (mod? && current_user.role >= @user.role)) %>
About you - <%= f.input :about, :label => false, :input_html => {:class => "vertical"}, placeholder: "Tell us something about you...", disabled: !can_edit? %> + <%= render partial: "mdhelp" %> + <%= f.text_area :about, class: "vertical", placeholder: "Tell us something about you...", disabled: !can_edit? %>
-<%= f.submit "Save profile", class: "btn blue", disabled: (!@user.confirmed? && @user.is?(current_user)) %> + +

<%= f.submit "Save profile", class: "btn blue", disabled: (!@user.confirmed? && @user.is?(current_user)) %>

+ <% if !@user.confirmed? %> <% if @user.is?(current_user) %> Please confirm your email adress first! @@ -73,5 +69,4 @@ This user has not confirmed his email! <% end %> <% end %> - <%= link_to "Cancel", @user, class: "btn red right" %> <% end %> \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index be736ec..c6d76a1 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -11,6 +11,7 @@ <%= link_to "revert", unbecome_users_path, :class => "btn blue" %> <% end %>
+
<% if @user.banned? %> This user is banned! @@ -63,7 +64,7 @@ <% end %> Joined - <%= @user.created_at.strftime("%e. %b %Y, %H:%m") %> + <%= @user.created_at.strftime("%e. %b %Y, %H:%M") %> <% if mod? || @user.is?(current_user) %> diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb deleted file mode 100644 index ce6b0e5..0000000 --- a/config/initializers/simple_form.rb +++ /dev/null @@ -1,142 +0,0 @@ -# Use this setup block to configure all options available in SimpleForm. -SimpleForm.setup do |config| - # Wrappers are used by the form builder to generate a - # complete input. You can remove any component from the - # wrapper, change the order or even add your own to the - # stack. The options given below are used to wrap the - # whole input. - config.wrappers :default, :class => :input, - :hint_class => :field_with_hint, :error_class => :field_with_errors do |b| - ## Extensions enabled by default - # Any of these extensions can be disabled for a - # given input by passing: `f.input EXTENSION_NAME => false`. - # You can make any of these extensions optional by - # renaming `b.use` to `b.optional`. - - # Determines whether to use HTML5 (:email, :url, ...) - # and required attributes - b.use :html5 - - # Calculates placeholders automatically from I18n - # You can also pass a string as f.input :placeholder => "Placeholder" - b.use :placeholder - - ## Optional extensions - # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup` - # to the input. If so, they will retrieve the values from the model - # if any exists. If you want to enable the lookup for any of those - # extensions by default, you can change `b.optional` to `b.use`. - - # Calculates maxlength from length validations for string inputs - b.optional :maxlength - - # Calculates pattern from format validations for string inputs - b.optional :pattern - - # Calculates min and max from length validations for numeric inputs - b.optional :min_max - - # Calculates readonly automatically from readonly attributes - b.optional :readonly - - ## Inputs - b.use :input - b.use :hint, :wrap_with => { :tag => :span, :class => :hint } - b.use :error, :wrap_with => { :tag => :span, :class => :error } - end - - # The default wrapper to be used by the FormBuilder. - config.default_wrapper = :default - - # Define the way to render check boxes / radio buttons with labels. - # Defaults to :nested for bootstrap config. - # :inline => input + label - # :nested => label > input - config.boolean_style = :nested - - # Default class for buttons - config.button_class = 'btn' - - # Method used to tidy up errors. Specify any Rails Array method. - # :first lists the first message for each field. - # Use :to_sentence to list all errors for each field. - # config.error_method = :first - - # Default tag used for error notification helper. - config.error_notification_tag = :div - - # CSS class to add for error notification helper. - config.error_notification_class = 'alert alert-error' - - # ID to add for error notification helper. - # config.error_notification_id = nil - - # Series of attempts to detect a default label method for collection. - # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] - - # Series of attempts to detect a default value method for collection. - # config.collection_value_methods = [ :id, :to_s ] - - # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. - # config.collection_wrapper_tag = nil - - # You can define the class to use on all collection wrappers. Defaulting to none. - # config.collection_wrapper_class = nil - - # You can wrap each item in a collection of radio/check boxes with a tag, - # defaulting to :span. Please note that when using :boolean_style = :nested, - # SimpleForm will force this option to be a label. - # config.item_wrapper_tag = :span - - # You can define a class to use in all item wrappers. Defaulting to none. - # config.item_wrapper_class = nil - - # How the label text should be generated altogether with the required text. - # config.label_text = lambda { |label, required| "#{required} #{label}" } - - # You can define the class to use on all labels. Default is nil. - config.label_class = 'control-label' - - # You can define the class to use on all forms. Default is simple_form. - # config.form_class = :simple_form - - # You can define which elements should obtain additional classes - # config.generate_additional_classes_for = [:wrapper, :label, :input] - - # Whether attributes are required by default (or not). Default is true. - # config.required_by_default = true - - # Tell browsers whether to use default HTML5 validations (novalidate option). - # Default is enabled. - config.browser_validations = false - - # Collection of methods to detect if a file type was given. - # config.file_methods = [ :mounted_as, :file?, :public_filename ] - - # Custom mappings for input types. This should be a hash containing a regexp - # to match as key, and the input type that will be used when the field name - # matches the regexp as value. - # config.input_mappings = { /count/ => :integer } - - # Custom wrappers for input types. This should be a hash containing an input - # type as key and the wrapper that will be used for all inputs with specified type. - # config.wrapper_mappings = { :string => :prepend } - - # Default priority for time_zone inputs. - # config.time_zone_priority = nil - - # Default priority for country inputs. - # config.country_priority = nil - - # Default size for text inputs. - # config.default_input_size = 50 - - # When false, do not use translations for labels. - # config.translate_labels = true - - # Automatically discover new inputs in Rails' autoload path. - # config.inputs_discovery = true - - # Cache SimpleForm inputs discovery - # config.cache_discovery = !Rails.env.development? -end diff --git a/config/locales/en.yml b/config/locales/en.yml index 54d36f5..d99b85c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,8 +1,4 @@ en: - simple_form: - required: - text: 'required' - mark: '' errors: format: "%{message}" activerecord: diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml deleted file mode 100644 index b7b292d..0000000 --- a/config/locales/simple_form.en.yml +++ /dev/null @@ -1,25 +0,0 @@ -en: - simple_form: - "yes": 'Yes' - "no": 'No' - required: - text: 'required' - mark: '' - # You can uncomment the line below if you need to overwrite the whole required html. - # When using html, text and mark won't be used. - html: '' - error_notification: - default_message: "Please fill out all required fields:" - # Labels and hints examples - # labels: - # defaults: - # password: 'Password' - # user: - # new: - # email: 'E-mail to sign in.' - # edit: - # email: 'E-mail.' - # hints: - # defaults: - # username: 'User name to sign in.' - # password: 'No special characters, please.' \ No newline at end of file diff --git a/db/migrate/02_create_users.rb b/db/migrate/02_create_users.rb index bb1a012..08bbce7 100644 --- a/db/migrate/02_create_users.rb +++ b/db/migrate/02_create_users.rb @@ -18,7 +18,7 @@ class CreateUsers < ActiveRecord::Migration t.boolean :confirmed, default: false t.datetime :last_seen - t.references :role, null: false + t.references :role, null: false, default: Role.get(:normal) t.timestamps end diff --git a/db/schema.rb b/db/schema.rb index f666e1a..3ea2027 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -109,9 +109,9 @@ ActiveRecord::Schema.define(version: 11) do t.string "email_token" t.boolean "confirmed", default: false t.datetime "last_seen" - t.integer "role_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "role_id", default: 3, null: false + t.datetime "created_at" + t.datetime "updated_at" end end diff --git a/db/seeds.rb b/db/seeds.rb index 40d358b..8db2ce9 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -18,7 +18,7 @@ deleted_user = User.create!( uuid: "8667ba71b85a4004af54457a9734eed7", name: "Deleted user", email: "redstonerserver@gmail.com", - ign: "Steve", + ign: "Notch", # just need any valid ign here, overriding later about: "Hey, apparently, I do no longer exist. This is just a placeholder profile", password: userpw, password_confirmation: userpw, diff --git a/lib/templates/erb/scaffold/_form.html.erb b/lib/templates/erb/scaffold/_form.html.erb deleted file mode 100644 index 201a069..0000000 --- a/lib/templates/erb/scaffold/_form.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%%= simple_form_for(@<%= singular_table_name %>) do |f| %> - <%%= f.error_notification %> - -
- <%- attributes.each do |attribute| -%> - <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %> - <%- end -%> -
- -
- <%%= f.button :submit %> -
-<%% end %> diff --git a/pp.svg b/pp.svg new file mode 100644 index 0000000..f75eb60 --- /dev/null +++ b/pp.svg @@ -0,0 +1 @@ + diff --git a/test/mailers/previews/registration_preview.rb b/test/mailers/previews/registration_preview.rb new file mode 100644 index 0000000..140c277 --- /dev/null +++ b/test/mailers/previews/registration_preview.rb @@ -0,0 +1,19 @@ +class RegistrationPreview < ActionMailer::Preview + @@user = User.new(id: 123, uuid: "aabbccddeeff11223344556677889900", ign: "fancy_user", name: "fancy_user", email_token: "abcdefg", email: "fancymail@example.com", created_at: Time.now, last_ip: "1.2.3.4") + + def register_mail_normal + RedstonerMailer.register_mail(@@user, false) + end + + def register_mail_idiot + RedstonerMailer.register_mail(@@user, true) + end + + def register_info_mail_normal + RedstonerMailer.register_info_mail(@@user, false) + end + + def register_info_mail_idiot + RedstonerMailer.register_info_mail(@@user, true) + end +end \ No newline at end of file