Added groups styling

This commit is contained in:
Luke Barratt 2014-04-27 01:34:38 +01:00
parent 02a300bf97
commit 4facbc0cc3
9 changed files with 212 additions and 122 deletions

View file

@ -57,4 +57,4 @@
@import "pages/bans";
@import "pages/issues";
@import "pages/servers";
@import "pages/groups";

View file

@ -0,0 +1,57 @@
/*
Groups List
*/
table.groups {
.name {
width: 50%;
}
.created {
width: 20%;
}
.founder {
width: 20%;
}
.actions {
width: 10%;
text-align: right;
}
}
/*
Groups Page
*/
#group {
table.roles {
.name,
.username {
width: 20%;
}
.role {
width: 60%;
}
.fields {
margin: 0;
float: left;
}
.controls {
margin: 0;
float: right;
.remove {
margin-bottom: 0;
margin-right: 0;
}
}
}
}

View file

@ -137,3 +137,31 @@ form.article {
margin-top: em(20);
}
}
/*
Admin Articles Page
*/
div.admin.articles {
.title {
width: 40%;
}
.category {
width: 20%;
}
.created {
width: 20%;
}
.author {
width: 10%;
}
.actions {
width: 10%;
text-align: right;
}
}

View file

@ -43,7 +43,7 @@ class Group < ActiveRecord::Base
end
def can_destroy? cuser
cuser and cuser.admin?
cuser and cuser.admin? and id != Group::ADMINS
end
def self.staff

View file

@ -1,34 +1,30 @@
<h1>
Draft Articles
</h1>
<div class="admin articles">
<h1 class="title">Articles Admin</h1>
<% @articles.each do |key, articles| %>
<div class="box wide">
<h3>
<%= h key %>
</h3>
<% @articles.each do |key, articles| %>
<h3 class="title"><%=h key %></h3>
<table class="data">
<table class="striped">
<tr>
<th>Title</th>
<th>Category</th>
<th>Created</th>
<th>Author</th>
<th>Options</th>
<th class="title">Title</th>
<th class="category">Category</th>
<th class="created">Created</th>
<th class="author">Author</th>
<th class="actions"></th>
</tr>
<% for article in articles %>
<tr class="<%= cycle('even', 'odd') %>">
<tr>
<td><%= namelink article %></td>
<td><%= h article.category %></td>
<td><%= shorttime article.created_at %></td>
<td><%= namelink article.user %></td>
<td>
<%= link_to 'Edit', edit_article_path(article) %>
<%= link_to 'Destroy', article, :confirm => 'Are you sure?', :method => :delete %>
<td class="actions">
<%= link_to icon('pencil'), edit_article_path(article) %>
<%= link_to icon('times'), article, confirm: 'Are you sure?', method: :delete %>
</td>
</tr>
<% end %>
</table>
</div>
<% end %>
<% end %>
</div>

View file

@ -1,71 +1,82 @@
<h1>Editing group: <%= h @group.name %></h1>
<div id="group">
<h1 class="title">Editing Group: <%= h @group.name %></h1>
<div id="groupTab">
<ul id="groupTab-nav" class="tabs">
<li><a href="#groupTabGeneral">General</a></li>
<li><a href="#groupTabMembers">Members</a></li>
</ul>
<div id="group" class="tabbed">
<ul id="group-nav" class="tabs">
<li><a href="#general">General</a></li>
<li><a href="#members">Members</a></li>
</ul>
<div class="box wide tabs">
<div class="tab" id="groupTabGeneral">
<%= form_for(@group) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.submit "Update" %>
</p>
<% end %>
</div>
<div class="tabbed-contents">
<div class="tab" id="general">
<%= form_for(@group, html: { class: 'square' }) do |f| %>
<%= render 'shared/errors', messages: @group.errors.full_messages %>
<div class="tab" id="groupTabMembers">
<table class="data">
<tr>
<th>Username</th>
<th>Real Name</th>
<th>Task</th>
<th>Options</th>
</tr>
<div class="fields horizontal">
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<% # TODO fixaa tämä
@group.groupers.each do |grouper| %>
<tr class="<%= cycle('even', 'odd') %>">
<%= form_for grouper do |g| %>
<div class="controls">
<%= f.submit 'Update' %>
</div>
<% end %>
</div>
<div class="tab" id="members">
<table class="roles striped">
<tr>
<th class="username">Username</th>
<th class="name">Real Name</th>
<th class="role">Task</th>
</tr>
<% @group.groupers.each do |grouper| %>
<tr>
<td><%= namelink grouper.user %></td>
<td><%= h grouper.user.realname %></td>
<td>
<%= g.text_field :task, :size => 20 %>
<td class="actions">
<%= form_for grouper do |g| %>
<div class="fields inline">
<%= g.text_field :task, size: 20 %>
</div>
<div class="controls">
<%= g.submit 'Update', class: 'button tiny' %>
<%= link_to 'Remove', grouper, method: :delete, class: 'button remove' %>
</div>
<% end %>
</td>
<td>
<%#= link_to_function "Update", "$('edit_grouper_#{grouper.id}').submit()" %>
<%#= link_to "Update", group_path(@group, grouper => { :task => "truc" }), :method => :put %>
<%= g.submit "Update" %>
<%= link_to "Remove", grouper, :method => :delete %>
</td>
<% end %>
</tr>
<% end %>
</table>
</tr>
<% end %>
</table>
<%= form_for @group.groupers.build do |f| %>
<%= f.hidden_field :group_id %>
<p>
Add a <%= link_to_function 'user', "findUser('username')" %>:
<%= f.text_field :username %></p>
<%= f.label :task %>
<%= f.text_field :task %>
<%= f.submit "Add" %>
</p>
<% end %>
<div class="add">
<h3>Add a Member</h3>
<%= form_for @group.groupers.build, html: { class: 'square' } do |f| %>
<%= f.hidden_field :group_id %>
<div class="fields horizontal">
<%= f.label :username %>
<%= f.text_field :username %>
</div>
<div class="fields horizontal">
<%= f.label :task, "Role" %>
<%= f.text_field :task %>
</div>
<div class="controls">
<%= f.submit 'Add Member' %>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var tabber1 = new Yetii({id: 'groupTab'});
</script>
<%= link_to 'Show', @group %> |
<%= link_to 'Back', groups_path %>
<script type="text/javascript">
new Yetii({
id: 'group'
});
</script>
</div>

View file

@ -1,26 +1,26 @@
<h1>Listing groups</h1>
<h1 class="title">Listing Groups</h1>
<table class="data">
<table class="groups striped">
<tr>
<th>Name</th>
<th>Created</th>
<th>Founder</th>
<th>Options</th>
<th class="name">Name</th>
<th class="created">Created</th>
<th class="founder">Founder</th>
<th class="actions"></th>
</tr>
<% for group in @groups %>
<tr class="<%= cycle('even', 'odd') %>">
<% @groups.each do |group| %>
<tr>
<td><%= link_to (h group.name), group %></td>
<td><%= h group.created_at.strftime("%d %B %y") %></td>
<td><%= link_to (h group.founder.username), group.founder %></td>
<td>
<%= link_to 'Edit', edit_group_path(group) %>
<%= link_to 'Destroy', group, :confirm => 'Are you sure?', :method => :delete %>
<td class="actions">
<%= link_to icon('pencil'), edit_group_path(group) %>
<% if group.can_destroy? cuser %>
<%= link_to icon('times'), group, confirm: 'Are you sure?', method: :delete %>
<% end %>
</td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New group', new_group_path %>
<%= link_to 'New Group', new_group_path, class: 'button' %>

View file

@ -1,28 +1,25 @@
<h1 class="center">
<%=h @group.name %>
</h1>
<div id="group">
<h1><%=h @group.name %></h1>
<h3 class="title">Founder: <%=h @group.founder.username %></h3>
<p>
<b>Founder:</b>
<%=h @group.founder.username %>
</p>
<table class="data">
<tr>
<th>Username</th>
<th>Real Name</th>
<th>SteamID</th>
</tr>
<% for user in @group.users %>
<tr class="<%= cycle('even', 'odd') %>">
<td><%=link_to (h user.username), user %></td>
<td><%=h user.firstname %> <%=h user.lastname %></td>
<td><%=h user.steamid %></td>
<table class="striped">
<tr>
<th>Username</th>
<th>Real Name</th>
<th>SteamID</th>
</tr>
<% end %>
</table>
<% if cuser and cuser.admin? %>
<%= link_to 'Edit', edit_group_path(@group) %>
<% end %>
<% @group.users.each do |user| %>
<tr>
<td><%=link_to (h user.username), user %></td>
<td><%=h user.firstname %> <%=h user.lastname %></td>
<td><%=h user.steamid %></td>
</tr>
<% end %>
</table>
<% if cuser and cuser.admin? %>
<%= link_to 'Edit Group', edit_group_path(@group), class: 'button' %>
<% end %>
</div>

View file

@ -29,6 +29,7 @@ en:
scores_recalc: "All scores recalculated."
groups_added: "Group added to the list."
groups_acl_update: "Group ACL updated."
groups_user_update: "Group member updated."
forums_create: "Forum was successfully created."
forums_update: "Forum was successfully updated."
errors: "Errors: "