LOTS of stuff

This commit is contained in:
jomo
2014-04-04 01:08:17 +02:00
parent 0604bbce63
commit f290258f26
62 changed files with 1457 additions and 655 deletions

View File

@@ -1,12 +1,13 @@
<div id="forum_groups">
<% @groups.each do |group| %>
<div class="item_group" id="forums-<%= group.id %>">
<div class="item-group" id="forums-<%= group.id %>">
<div class="header">
<%= group.name %>
<%= link_to "edit", edit_forumgroup_path(group), class: "editlink" if admin? %>
<%= link_to "+", new_forum_path(forumgroup: group), class: "editlink" if admin? %>
</div>
<div class="items">
<div class="items bold">
<% group.forums.each do |f| %>
<%= link_to f.name, f, class: "item" %>
<% end %>
@@ -14,4 +15,10 @@
</div>
<% end %>
</div>
</div>
<% if admin? %>
<%= link_to "New group", new_forumgroup_path, class: "btn blue" %>
<% elsif mod? %>
<%= link_to "New group", nil, class: "btn blue", disabled: true %>
<% end %>

View File

@@ -1,17 +1,25 @@
<%= link_to @group %> → New forum
<h1>New forum</h1>
<%= simple_form_for [@group, @forum] do |f|%>
<div id="form_labels">
<%= f.label :name %>
<%= f.label :position %>
<%= f.label :role_read_id, "Min read role" %>
<%= f.label :role_write_id, "Min write role" %>
</div>
<div id="form_inputs">
<%= f.input :name, placeholder: "Name" %>
<%= f.input :position, placeholder: "Position" %>
<%= f.input :role_read_id, as: :select, collection: Role.all_from(Role.get :default), include_blank: "None" %>
<%= f.input :role_write_id, as: :select, collection: Role.all_from(Role.get :default), include_blank: false %>
</div>
<%= f.submit "Create forum", class: "btn blue" %>
<% end %>
<%= link_to @group, forumgroup_path(@group) %> → New forum
<h1>New forum forum</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
<%= form_for @forum do |f|%>
<table>
<tr>
<td><%= f.label :name %></td>
<td><%= f.text_field :name, placeholder: "Name" %></td>
</tr>
<tr>
<td><%= f.label :position %></td>
<td><%= f.number_field :position, placeholder: "Position" %></td>
</tr>
<tr>
<td><%= f.label :role_read_id, "Min. read role" %></td>
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td>
</tr>
<tr>
<td><%= f.label :role_write_id, "Min. write role" %></td>
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
</tr>
</table>
<%= f.hidden_field :forumgroup_id, value: @group.id %>
<%= f.submit "Create forum", class: "btn blue" %>
<% end %>

View File

@@ -1,14 +1,20 @@
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → <%= link_to @forum %>
<p><%= link_to "New thread", new_forum_forumthread_path(@forum), class: "btn blue" %></p>
<h1><%= @forum %></h1>
<div id="forum_groups">
<div id="forum-<%= @forum.id %>" class="item_group">
<div class="header">
<%= @forum.name %> <%= link_to "edit", edit_forum_path(@forum), class: "editlink" %>
<% @threads.each do |thread| %>
<div class="item-group with-avatar" id="thread-<%= thread.id %>">
<%= link_to(image_tag(thread.author.avatar_url(64), class: "avatar"), thread.author, title: thread.author.ign) %>
<div class="header">
<%= render partial: "users/username", locals: { user: thread.author } %> <time><%= link_to thread.created_at.strftime("%e. %b %Y, %H:%m"), thread %></time>
<span class="comment-counter">
<%= link_to pluralize(thread.replies.count, "Reply"), thread %>
</span>
</div>
<div class="items bold">
<%= link_to thread.title, forumthread_path(thread), class: "item#{" locked" if thread.locked}#{" sticky" if thread.sticky}" %>
</div>
</div>
<div class="items">
<% @threads.each do |thread| %>
<%= link_to thread.title, forum_forumthread_path(@forum, thread), class: "item#{" locked" if thread.locked}#{" sticky" if thread.sticky}" %>
<% end %>
</div>
<% end %>
</div>
<p><%= link_to "New thread", new_forumthread_path(forum_id: @forum), class: "btn blue" %></p>