diff --git a/Gemfile.lock b/Gemfile.lock index da02402..b99a9fa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,7 +89,7 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) rake (10.0.4) - rb-readline (0.5.0) + rb-readline (0.4.2) rdoc (3.12.2) json (~> 1.4) ref (1.0.4) @@ -135,7 +135,7 @@ DEPENDENCIES hirb jquery-rails rails (= 3.2.12) - rb-readline + rb-readline (~> 0.4.2) sanitize sass-rails (~> 3.2.3) simple_form diff --git a/app/assets/images/bg.png b/app/assets/images/bg.png index 130fa4d..2d93493 100644 Binary files a/app/assets/images/bg.png and b/app/assets/images/bg.png differ diff --git a/app/assets/stylesheets/mobi.css.scss b/app/assets/stylesheets/mobi.css.scss index 07231e3..aeb5313 100644 --- a/app/assets/stylesheets/mobi.css.scss +++ b/app/assets/stylesheets/mobi.css.scss @@ -5,9 +5,8 @@ and (max-width: 999px) #mobile-info { background: none repeat scroll 0 0 #AB0000; color: #FFFFFF; - font-weight: bold; - padding: 1em; text-align: center; display: block; + font-size: 0.7em; } } \ No newline at end of file diff --git a/app/assets/stylesheets/screen.css.scss b/app/assets/stylesheets/screen.css.scss index 5cf8bc2..664b1e3 100644 --- a/app/assets/stylesheets/screen.css.scss +++ b/app/assets/stylesheets/screen.css.scss @@ -1,17 +1,27 @@ /* CSS for PCs only */ @media only screen -and (min-width: 1000px) +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; } body { background-image: url('/assets/bg.png'); - background-color: #252525; - background-attachment: fixed; + background-color: #F0F2F2; + color: #222; } #mobile-info { @@ -41,20 +51,23 @@ and (min-width: 1000px) } } #head { - width: 800px; - margin: -10px auto 20px auto; - padding: 20px 13px 13px 13px; background-image: url('/assets/head_bg.png'); - box-shadow: 0 0 10px -7px inset; - border-bottom: 1px solid #fff; - border-radius: 0 0 10px 10px; - overflow: hidden; + width: 100%; + max-width: 1000px; + margin: auto; + #logo { float: left; + margin: 10px; + max-width: 100%; + img { + max-width: 100%; + height: auto; + } } #userinfo { float: right; - padding: 0 10px; + margin: 10px; img.avatar { border: 1px solid #000; border-radius: 16px; @@ -72,21 +85,22 @@ and (min-width: 1000px) line-height: 1em; } } - a { - color: #787878; - &:hover { - color: #AB0000; - } - } #menu { width: 100%; - background: url('/assets/head_bg.png') #fff; + background: #686969; input { display: inline; } ul { float: left; margin: 0; + padding: 0; + a { + color: #bbb; + &:hover { + color: #fff; + } + } li { float: left; height: 100%; @@ -119,10 +133,10 @@ and (min-width: 1000px) } #main-content { - width: 650px; - margin: 0 auto; - background: #eee; padding: 30px; + width: 100%; + max-width: 1000px; + margin: auto; h1 { font-weight: normal; @@ -142,10 +156,13 @@ and (min-width: 1000px) .post-title { margin-bottom: 10px; word-wrap: break-word; + h1 { + text-transform: capitalize; + } h2 { font-weight: normal; color: #700; - text-transform: uppercase; + text-transform: capitalize; display: inline; font-size: 200%; } @@ -248,25 +265,23 @@ and (min-width: 1000px) .comment { margin-bottom: 12px; padding: 15px; - box-shadow: 0 0 10px #bbb inset; + border: 1px solid #555; &:hover .editlink { opacity: 1; margin-right: 0; } &.author { - background: #dadada; - box-shadow: 0 0 10px #a7a7a7 inset; + border: 1px solid #633; } .comment-content { word-wrap: break-word; overflow: hidden; } } - textarea { - width: 480px; - height: 106px; - max-width: 610px; - } + } + + #markdown-note { + margin: 0; } input , select, textarea { @@ -278,15 +293,13 @@ and (min-width: 1000px) } input[type=text], input[type=email], input[type=password], textarea { - border: 1px solid #aaa; - border-radius: 3px; - background: #eee; - margin: 4px; - box-shadow: 0 0 5px #959595 inset; - height: 17px; - width: 300px; - padding: 1px 3px; + background: #ddd; + border: none; display: block; + height: 3em; + margin: 0 0 1px 0; + padding: 0.5em 1em; + width: 100%; } input, select, textarea { @@ -299,7 +312,11 @@ and (min-width: 1000px) textarea { max-width: 100% !important; height: 200px; - padding: 5px 3px; + padding: 1em; + min-height: 3.5em; + &.comment { + height: 75px; + } &.full-width { width: 100%; } @@ -368,16 +385,21 @@ and (min-width: 1000px) box-shadow: 0 0 10px #000; } - .btn-blue { - border: 1px solid; + .btn { + margin: 1px 1px 0 0; padding: 6px; - background: #4096ee; cursor: default; color: #fff; + border: none; + &.blue { + background: #4096ee; + } + &.red { + background: #ee4040; + } &:hover { box-shadow: 0 0 5px #095fb7 inset; color: #fff; - outline: none; } } @@ -463,7 +485,7 @@ and (min-width: 1000px) } } - .red { + .red-alert { color: #AB0000; font-weight: bold; } diff --git a/app/controllers/blogposts_controller.rb b/app/controllers/blogposts_controller.rb index 9d5077f..ba20e5f 100644 --- a/app/controllers/blogposts_controller.rb +++ b/app/controllers/blogposts_controller.rb @@ -46,7 +46,8 @@ class BlogpostsController < ApplicationController def update @post = Blogpost.find(params[:id]) if mod? - if @post.update_attributes(params[:blogpost]) + @post.user_editor = current_user + if @post.update_attributes(params[:blogpost] ? params[:blogpost].slice(:title, :content, :user_editor) : {}) redirect_to @post, notice: 'Post has been updated.' else flash[:alert] = "There was a problem while updating the post" diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index d1c714c..d3260fe 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -22,13 +22,14 @@ class SessionsController < ApplicationController user.last_login = Time.now user.save if user.disabled? - flash[:alert] = "This user has been disabled!" + flash[:alert] = "Your account has been disabled!" redirect_to login_path elsif user.banned? flash[:alert] = "You are banned!" redirect_to user else session[:user_id] = user.id + flash[:alert] = "Remember to validate your email! Your account might be deleted" if user.unconfirmed? redirect_to root_path, :notice => "Logged in!" end else diff --git a/app/models/blogpost.rb b/app/models/blogpost.rb index 04cd57d..c6a1409 100644 --- a/app/models/blogpost.rb +++ b/app/models/blogpost.rb @@ -13,4 +13,9 @@ class Blogpost < ActiveRecord::Base User.first end end + + def editor + @editor ||= user_editor + end + end diff --git a/app/views/blogposts/edit.html.erb b/app/views/blogposts/edit.html.erb index 7d4b736..e94e620 100644 --- a/app/views/blogposts/edit.html.erb +++ b/app/views/blogposts/edit.html.erb @@ -1,10 +1,10 @@

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.input :content, :label => false, input_html: {class: "full-width vertical"} %> - <%= f.submit "Update Post", :id => "edit_create_post" %> + <%= f.submit "Update Post", :id => "edit_create_post", class: "btn blue" %> <% end %>
- <%= button_to "Delete post", @post, :method => "delete", :confirm => "Delete post + comments forever?" %> + <%= button_to "Delete post", @post, :method => "delete", :confirm => "Delete post + comments forever?", class: "btn red" %>
diff --git a/app/views/blogposts/index.html.erb b/app/views/blogposts/index.html.erb index 5997e4f..3f8da5c 100644 --- a/app/views/blogposts/index.html.erb +++ b/app/views/blogposts/index.html.erb @@ -15,5 +15,5 @@ <% end %> - <%= button_to 'Make new Post', new_blogpost_path, method: "get" if mod? %> + <%= button_to 'Make new Post', new_blogpost_path, method: "get", class: "btn blue" if mod? %> diff --git a/app/views/blogposts/new.html.erb b/app/views/blogposts/new.html.erb index 63d1017..8df6c7f 100644 --- a/app/views/blogposts/new.html.erb +++ b/app/views/blogposts/new.html.erb @@ -1,6 +1,7 @@

New 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.input :content, :label => false, input_html: {class: "full-width vertical"} %> - <%= f.submit "Update Post", :id => "edit_create_post" %> + <%= f.input :title, placeholder: "Title" %> + <%= f.input :content, placeholder: "Text", input_html: {class: "full-width vertical"} %> + <%= f.submit "Create Post", id: "edit_create_post", class: "btn blue" %> <% end %> diff --git a/app/views/comments/_new.html.erb b/app/views/comments/_new.html.erb index 230d171..2fad495 100644 --- a/app/views/comments/_new.html.erb +++ b/app/views/comments/_new.html.erb @@ -1,7 +1,7 @@ <% if current_user %>

New comment

<%= simple_form_for [@post, @comment] do |f| %> - <%= f.input :content, :label => false, :as => "text", :placeholder => "Comment" %> - <%= f.submit %> + <%= f.input :content, :label => false, :as => "text", :placeholder => "Comment", input_html: {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 2283625..6ffba95 100644 --- a/app/views/comments/edit.html.erb +++ b/app/views/comments/edit.html.erb @@ -2,8 +2,8 @@ <%= simple_form_for [@comment.blogpost, @comment] do |f| %> <%= f.input :content, :label => false, :as => "text", :placeholder => "Comment" %> - <%= f.submit "Update Comment", :id => "edit_create_comment" %> + <%= f.submit "Update Comment", :id => "edit_create_comment", class: "btn blue" %> <% end %>
- <%= button_to "Delete comment", [@comment.blogpost, @comment] , :method => "delete", :confirm => "Delete comment forever?" %> + <%= button_to "Delete comment", [@comment.blogpost, @comment] , :method => "delete", :confirm => "Delete comment forever?", class: "btn red" %>
\ No newline at end of file diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 596f073..1d960fa 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -16,14 +16,10 @@
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index edb4b0e..11336fb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,13 +2,14 @@ Redstoner + <%= stylesheet_link_tag "application", :media => "all" %> <%= csrf_meta_tags %> <%= favicon_link_tag "favicon.ico" %> <%= javascript_include_tag "application" %> -
Sorry, we don't have a mobile style yet. It's all ugly for now.
+
We don't have a mobile style yet. It might look shitty.
Tip: Turn your device to landscape.
<%= render "/layouts/head" %>
<%= "
#{alert}
".html_safe if alert %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index e3b1d6f..d512b9b 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -63,6 +63,6 @@ <%= f.submit "Save profile", disabled: @user.unconfirmed? %> <% if @user.unconfirmed? %> - Please confirm your email adress first. + Please confirm your email adress first. <% end %> <% end %> \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index f0be84a..a2c0c93 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -2,13 +2,13 @@

<%= @user.name %>

<% if @user.is?(current_user) || (mod? && current_user.role >= @user.role) %> -
<%= link_to "edit profile", edit_user_path(@user), :class => "btn-blue" %>
+
<%= link_to "edit profile", edit_user_path(@user), :class => "btn blue" %>
<% end %>
<% if !session[:original_user_id] && admin? %> - <%= link_to "become this user", become_user_path(@user), :class => "btn-blue" %> + <%= link_to "become this user", become_user_path(@user), :class => "btn blue" %> <% elsif session[:original_user_id] %> - <%= link_to "revert", unbecome_users_path, :class => "btn-blue" %> + <%= link_to "revert", unbecome_users_path, :class => "btn blue" %> <% end %>
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index e3f8d09..ce6b0e5 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -40,7 +40,7 @@ SimpleForm.setup do |config| b.optional :readonly ## Inputs - b.use :label_input + b.use :input b.use :hint, :wrap_with => { :tag => :span, :class => :hint } b.use :error, :wrap_with => { :tag => :span, :class => :error } end