many things, comments working.

This commit is contained in:
jomo
2013-06-24 13:29:39 +02:00
parent 7a894f4f6a
commit fb52e8bed2
44 changed files with 490 additions and 223 deletions

View File

@@ -1,5 +1,5 @@
<%= simple_form_for @post do |f|%>
<%= f.input :title %>
<%= f.input :text %>
<%= f.submit %>
<%= f.input :title, :label => false %>
<%= f.input :text, :label => false %>
<%= f.submit "Create Post" %>
<% end %>

View File

@@ -2,10 +2,19 @@
<div id="posts">
<% @posts.each do |p| %>
<div id="post">
<div id="post-title"><h2><%= link_to p.title, p %></h2><span class="comment-counter"><%= link_to pluralize(p.comments.count, "Comment"), p %></span></div>
<span class="post-info">by <%= link_to p.user.name, p.user %> on <%= p.created_at.strftime("%e. %b %Y") %></span>
<div id="post-content"><%= RbbCode.new.convert(p.text).html_safe %></div>
<div id="post-title">
<h2><%= link_to p.title, p %></h2>
<span class="comment-counter">
<%= link_to pluralize(p.comments.count, "Comment"), p %>
</span>
</div>
<span class="post-info">
by <%= link_to p.user.name, p.user %> on <%= p.created_at.strftime("%e. %b %Y") %>
</span>
<div id="post-content">
<%= RbbCode.new.convert(p.text).html_safe %>
</div>
</div>
<% end %>
<%= link_to 'New Blogpost', new_blogpost_path if current_user && current_user.rank >= Tools.rank_to_int(:mod) %>
<%= link_to 'Make new Post', new_blogpost_path if current_user && current_user.rank >= rank_to_int("mod") %>
</div>

View File

@@ -1,3 +1,3 @@
<h1>New Blogpost</h1>
<h1>New Post</h1>
<%= render 'form' %>

View File

@@ -1,6 +1,6 @@
<h1><%= @post.title %></h1>
<span class="post-info"><%= link_to @post.user.name, @post.user %> on <%= @post.created_at.strftime("%e. %b %Y") %>
<% if current_user.rank >= Tools.rank_to_int(:mod) %>
<% if current_user && current_user.rank >= rank_to_int("mod") %>
- <%= link_to "edit", edit_blogpost_path(@post.id) %>
<% end %>
</span>
@@ -9,19 +9,20 @@
</div>
<div id="comments">
<% @post.comments.each do |c| %>
<div class="comment">
<div class="comment <%= "author" if c.user == @post.user %>">
<span class="comment-info"><%= link_to c.user.name, c.user %> on <%= c.created_at.strftime("%e. %b %Y") %>
<% if current_user.rank >= Tools.rank_to_int(:mod) %>
<% if current_user && current_user.rank >= rank_to_int("mod") %>
- <%= link_to "edit", edit_blogpost_comment_path(c.id) %>
<% end %>
</span>
<div class="comment-content"><%= c.text %></div>
</div>
<% end %>
<% if current_user && current_user.rank >= Tools.rank_to_int(:visitor) %>
<% if current_user %>
<h3>New comment</h3>
<%= simple_form_for [@post, @comment] do |f| %>
<%= f.input :text, :label => false, :as => "text", :placeholder => "Comment" %><%= f.submit %>
<%= f.input :text, :label => false, :as => "text", :placeholder => "Comment" %>
<%= f.submit %>
<% end %>
<% end %>
</div>

View File

@@ -2,15 +2,16 @@
<%= link_to(root_path) do %>
<div id="logo"></div>
<% end %>
<div id="userinfo">
<div id="userinfo" <%= "class=\"logged-out\"".html_safe if !current_user %>>
<% if !current_user.nil? %>
<span id="userinfo-box">
<%= link_to current_user.name.truncate(14), current_user %><br/>
<%= link_to image_tag("logout.png"), logout_path %>
</span>
<%= link_to image_tag(Tools.avatar_url(current_user.id, 32), :class => "avatar"), current_user %>
<span id="userinfo-box">
<%= link_to current_user.name.truncate(14), current_user %><br/>
<%= link_to "Logout", logout_path %>
</span>
<%= link_to image_tag(avatar_url(current_user.id), :class => "avatar size32"), current_user %>
<% else %>
<%= link_to "Log in", login_path, :action => "new" %>
<%= link_to "Log in", login_path, :action => "new" %><br/>
<%= link_to "Register", register_path %>
<% end %>
</div>
<div id="menu">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -1,8 +1,14 @@
<h1>Log in</h1>
<%= form_tag login_path do |f| %>
<%= label_tag :email %><br/>
<%= text_field_tag :email %><br/>
<%= label_tag :password %><br/>
<%= password_field_tag :password %><br/>
<%= submit_tag %>
<div id="form_labels">
<%= label_tag :email %>
<%= label_tag :password %>
</div>
<div id="form_inputs">
<%= text_field_tag :email %>
<%= password_field_tag :password %>
</div>
<%= submit_tag "Log in" %>
<% end %>

View File

@@ -1,8 +0,0 @@
<%= simple_form_for @user do |f| %>
<%= f.input :name %>
<%= f.input :ign %>
<%= f.input :email %>
<%= f.input :password %>
<%= f.input :password_confirmation %>
<%= f.submit %>
<% end %>

View File

@@ -1,5 +1,10 @@
<h1>New user</h1>
<h1>Register</h1>
<%= render 'form' %>
<%= link_to 'Back', users_path %>
<%= simple_form_for @user do |f| %>
<%= f.input :name %>
<%= f.input :ign, label: "Ingame name" %>
<%= f.input :email %>
<%= f.input :password %>
<%= f.input :password_confirmation %>
<%= f.submit "Register" %>
<% end %>

View File

@@ -1,10 +1,14 @@
<div id="user-info"%>
<%= image_tag Tools.avatar_url(@user.id, 128), :class => "user-avatar", :alt => "avatar" %><br/>
<% if @user.banned %>
<span class="user-banned">This user is banned!</span>
<% end %>
IGN: <%= @user.ign %><br/>
Rank: <%= Tools.int_to_rank(@user.rank) %><br/>
Joined: <%= @user.created_at.strftime("%e. %b %Y") %><br/>
Last IP: <%= @user.last_ip %><br/>
About: <%= @user.about.blank? ? "<span class=\"no-about\">nothing</span>".html_safe : @user.about %>
<div id="user-info">
<div id="edit_profile"><%= link_to "edit profile", edit_user_path(@user), :class => "btn-blue" %></div>
<%= image_tag avatar_url(@user.id), :class => "user-avatar avatar", :alt => "avatar" %><br/>
<% if @user.banned %>
<span class="user-banned">This user is banned!</span>
<% end %>
IGN: <%= @user.ign %><br/>
Rank: <%= int_to_rank(@user.rank) %><br/>
Joined: <%= @user.created_at.strftime("%e. %b %Y") %><br/>
<% if current_user && current_user.rank >= rank_to_int("mod") %>
Last IP: <%= @user.last_ip %><br/>
<% end %>
About: <%= @user.about.blank? ? "<span class=\"no-about\">nothing</span>".html_safe : @user.about %>
</div>