This commit is contained in:
jomo
2013-10-14 02:40:44 +02:00
parent acd4c5198f
commit 7c578874c9
17 changed files with 101 additions and 75 deletions

View File

@@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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"

View File

@@ -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

View File

@@ -13,4 +13,9 @@ class Blogpost < ActiveRecord::Base
User.first
end
end
def editor
@editor ||= user_editor
end
end

View File

@@ -1,10 +1,10 @@
<h1>Edit post</h1>
<p id="markdown-note">Note: You can use <%= link_to "Markdown", "https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet", target: "_blank" %>!</p>
<%= 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 %>
<div id="delete_post">
<%= 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" %>
</div>

View File

@@ -15,5 +15,5 @@
</div>
</div>
<% 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? %>
</div>

View File

@@ -1,6 +1,7 @@
<h1>New Post</h1>
<p id="markdown-note">Note: You can use <%= link_to "Markdown", "https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet", target: "_blank" %>!</p>
<%= 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 %>

View File

@@ -1,7 +1,7 @@
<% if current_user %>
<h3>New comment</h3>
<%= 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 %>

View File

@@ -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 %>
<div id="delete_comment">
<%= 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" %>
</div>

View File

@@ -16,14 +16,10 @@
<div class="clear"></div>
<div id="menu">
<ul>
<%= link_to root_path do %>
<li>Home</li>
<% end %>
<li>Info</li>
<%= link_to forumgroups_path do %>
<li>Forums</li>
<% end %>
<li>Donate</li>
<%= link_to root_path do %><li>Home</li><% end %>
<%= link_to root_path do %><li>Info</li><% end %>
<%= link_to forumgroups_path do %><li>Forums</li><% end %>
<%= link_to root_path do %><li>Donate</li><% end %>
</ul>
<div class="clear"></div>
</div>

View File

@@ -2,13 +2,14 @@
<html>
<head>
<title>Redstoner</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<%= stylesheet_link_tag "application", :media => "all" %>
<%= csrf_meta_tags %>
<%= favicon_link_tag "favicon.ico" %>
<%= javascript_include_tag "application" %>
</head>
<body>
<div id="mobile-info">Sorry, we don't have a mobile style yet. It's all ugly for now.</div>
<div id="mobile-info">We don't have a mobile style yet. It might look shitty.<br>Tip: Turn your device to landscape.</div>
<%= render "/layouts/head" %>
<div id="main-content">
<%= "<div id='alert' class='flash'>#{alert}</div>".html_safe if alert %>

View File

@@ -63,6 +63,6 @@
</table>
<%= f.submit "Save profile", disabled: @user.unconfirmed? %>
<% if @user.unconfirmed? %>
<span class='red'>Please confirm your email adress first.</span>
<span class='red-alert'>Please confirm your email adress first.</span>
<% end %>
<% end %>

View File

@@ -2,13 +2,13 @@
<h1><%= @user.name %></h1>
<% if @user.is?(current_user) || (mod? && current_user.role >= @user.role) %>
<div class="profile-action" ><%= link_to "edit profile", edit_user_path(@user), :class => "btn-blue" %></div>
<div class="profile-action" ><%= link_to "edit profile", edit_user_path(@user), :class => "btn blue" %></div>
<% end %>
<div class="profile-action" >
<% 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 %>
</div>

View File

@@ -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