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/bans";
@import "pages/issues"; @import "pages/issues";
@import "pages/servers"; @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

@ -136,4 +136,32 @@ form.article {
.button.new { .button.new {
margin-top: em(20); 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 end
def can_destroy? cuser def can_destroy? cuser
cuser and cuser.admin? cuser and cuser.admin? and id != Group::ADMINS
end end
def self.staff def self.staff

View file

@ -1,34 +1,30 @@
<h1> <div class="admin articles">
Draft Articles <h1 class="title">Articles Admin</h1>
</h1>
<% @articles.each do |key, articles| %> <% @articles.each do |key, articles| %>
<div class="box wide"> <h3 class="title"><%=h key %></h3>
<h3>
<%= h key %>
</h3>
<table class="data"> <table class="striped">
<tr> <tr>
<th>Title</th> <th class="title">Title</th>
<th>Category</th> <th class="category">Category</th>
<th>Created</th> <th class="created">Created</th>
<th>Author</th> <th class="author">Author</th>
<th>Options</th> <th class="actions"></th>
</tr> </tr>
<% for article in articles %> <% for article in articles %>
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<td><%= namelink article %></td> <td><%= namelink article %></td>
<td><%= h article.category %></td> <td><%= h article.category %></td>
<td><%= shorttime article.created_at %></td> <td><%= shorttime article.created_at %></td>
<td><%= namelink article.user %></td> <td><%= namelink article.user %></td>
<td> <td class="actions">
<%= link_to 'Edit', edit_article_path(article) %> <%= link_to icon('pencil'), edit_article_path(article) %>
<%= link_to 'Destroy', article, :confirm => 'Are you sure?', :method => :delete %> <%= link_to icon('times'), article, confirm: 'Are you sure?', method: :delete %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</table> </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"> <div id="group" class="tabbed">
<ul id="groupTab-nav" class="tabs"> <ul id="group-nav" class="tabs">
<li><a href="#groupTabGeneral">General</a></li> <li><a href="#general">General</a></li>
<li><a href="#groupTabMembers">Members</a></li> <li><a href="#members">Members</a></li>
</ul> </ul>
<div class="box wide tabs"> <div class="tabbed-contents">
<div class="tab" id="groupTabGeneral"> <div class="tab" id="general">
<%= form_for(@group) do |f| %> <%= form_for(@group, html: { class: 'square' }) do |f| %>
<%= f.error_messages %> <%= render 'shared/errors', messages: @group.errors.full_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.submit "Update" %>
</p>
<% end %>
</div>
<div class="tab" id="groupTabMembers"> <div class="fields horizontal">
<table class="data"> <%= f.label :name %>
<tr> <%= f.text_field :name %>
<th>Username</th> </div>
<th>Real Name</th>
<th>Task</th> <div class="controls">
<th>Options</th> <%= f.submit 'Update' %>
</tr> </div>
<% end %>
</div>
<% # TODO fixaa tämä <div class="tab" id="members">
@group.groupers.each do |grouper| %> <table class="roles striped">
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<%= form_for grouper do |g| %> <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><%= namelink grouper.user %></td>
<td><%= h grouper.user.realname %></td> <td><%= h grouper.user.realname %></td>
<td> <td class="actions">
<%= g.text_field :task, :size => 20 %> <%= 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>
<td> </tr>
<%#= link_to_function "Update", "$('edit_grouper_#{grouper.id}').submit()" %> <% end %>
<%#= link_to "Update", group_path(@group, grouper => { :task => "truc" }), :method => :put %> </table>
<%= g.submit "Update" %>
<%= link_to "Remove", grouper, :method => :delete %>
</td>
<% end %>
</tr>
<% end %>
</table>
<%= form_for @group.groupers.build do |f| %> <div class="add">
<%= f.hidden_field :group_id %> <h3>Add a Member</h3>
<p>
Add a <%= link_to_function 'user', "findUser('username')" %>: <%= form_for @group.groupers.build, html: { class: 'square' } do |f| %>
<%= f.text_field :username %></p> <%= f.hidden_field :group_id %>
<%= f.label :task %>
<%= f.text_field :task %> <div class="fields horizontal">
<%= f.submit "Add" %> <%= f.label :username %>
</p> <%= f.text_field :username %>
<% end %> </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>
</div>
<script type="text/javascript"> <script type="text/javascript">
var tabber1 = new Yetii({id: 'groupTab'}); new Yetii({
</script> id: 'group'
});
<%= link_to 'Show', @group %> | </script>
<%= link_to 'Back', groups_path %> </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> <tr>
<th>Name</th> <th class="name">Name</th>
<th>Created</th> <th class="created">Created</th>
<th>Founder</th> <th class="founder">Founder</th>
<th>Options</th> <th class="actions"></th>
</tr> </tr>
<% for group in @groups %> <% @groups.each do |group| %>
<tr class="<%= cycle('even', 'odd') %>"> <tr>
<td><%= link_to (h group.name), group %></td> <td><%= link_to (h group.name), group %></td>
<td><%= h group.created_at.strftime("%d %B %y") %></td> <td><%= h group.created_at.strftime("%d %B %y") %></td>
<td><%= link_to (h group.founder.username), group.founder %></td> <td><%= link_to (h group.founder.username), group.founder %></td>
<td> <td class="actions">
<%= link_to 'Edit', edit_group_path(group) %> <%= link_to icon('pencil'), edit_group_path(group) %>
<%= link_to 'Destroy', group, :confirm => 'Are you sure?', :method => :delete %> <% if group.can_destroy? cuser %>
<%= link_to icon('times'), group, confirm: 'Are you sure?', method: :delete %>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<br /> <%= link_to 'New Group', new_group_path, class: 'button' %>
<%= link_to 'New group', new_group_path %>

View file

@ -1,28 +1,25 @@
<h1 class="center"> <div id="group">
<%=h @group.name %> <h1><%=h @group.name %></h1>
</h1> <h3 class="title">Founder: <%=h @group.founder.username %></h3>
<p> <table class="striped">
<b>Founder:</b> <tr>
<%=h @group.founder.username %> <th>Username</th>
</p> <th>Real Name</th>
<th>SteamID</th>
<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>
</tr> </tr>
<% end %>
</table>
<% if cuser and cuser.admin? %> <% @group.users.each do |user| %>
<%= link_to 'Edit', edit_group_path(@group) %> <tr>
<% end %> <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." scores_recalc: "All scores recalculated."
groups_added: "Group added to the list." groups_added: "Group added to the list."
groups_acl_update: "Group ACL updated." groups_acl_update: "Group ACL updated."
groups_user_update: "Group member updated."
forums_create: "Forum was successfully created." forums_create: "Forum was successfully created."
forums_update: "Forum was successfully updated." forums_update: "Forum was successfully updated."
errors: "Errors: " errors: "Errors: "