rails 4 and tons of stuff

This commit is contained in:
jomo
2014-04-14 06:26:37 +02:00
parent b740c4db3a
commit 7135d2690c
41 changed files with 349 additions and 206 deletions

View File

@@ -0,0 +1,24 @@
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → <%= link_to @forum.name, @forum %>
<h1>Edit 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>
<p><%= f.submit "Update forum", class: "btn blue" %></p>
<% end %>

View File

@@ -1,10 +1,9 @@
<div id="forum_groups">
<% @groups.each do |group| %>
<div class="item-group" id="forums-<%= group.id %>">
<div class="item-group" id="forum-<%= 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 bold">

View File

@@ -1,5 +1,5 @@
<%= link_to @group, forumgroup_path(@group) %> → New forum
<h1>New forum forum</h1>
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → New forum
<h1>New Forum</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
<%= form_for @forum do |f|%>
<table>
@@ -20,6 +20,6 @@
<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" %>
<%= f.hidden_field :forumgroup_id, value: @forum.group.id %>
<p><%= f.submit "Create forum", class: "btn blue" %></p>
<% end %>

View File

@@ -17,4 +17,6 @@
</div>
<% end %>
</div>
<p><%= link_to "New thread", new_forumthread_path(forum_id: @forum), class: "btn blue" %></p>
<% if @forum.can_write?(current_user) %>
<p><%= link_to "New thread", new_forumthread_path(forum: @forum), class: "btn blue" %></p>
<% end %>