Added polls styling

This commit is contained in:
Luke Barratt 2014-04-27 02:35:13 +01:00
parent 607159807e
commit 2b4f0ad50f
8 changed files with 104 additions and 50 deletions

View file

@ -56,6 +56,7 @@
@import "pages/matches";
@import "pages/files";
@import "pages/bans";
@import "pages/polls";
@import "pages/issues";
@import "pages/servers";
@import "pages/groups";

View file

@ -145,6 +145,7 @@ form {
font-family: $open-sans;
}
.inputs label.checkbox,
> label.checkbox {
position: relative;
width: em(40);

View file

@ -0,0 +1,52 @@
/*
Polls List
*/
table.polls {
.questions {
width: 30%;
}
.date {
width: 30%;
}
.votes,
.user {
width: 15%;
}
.actions {
width: 10%;
text-align: right;
}
}
/*
Poll Forms
*/
#poll {
.inputs {
.question {
@include span-columns(9);
}
.destroy {
@include span-columns(3);
@include omega;
.checkbox {
float: left;
}
.remove {
display: inline-block;
line-height: em(40);
margin-left: em(10);
}
}
}
}

View file

@ -11,6 +11,7 @@
<%= f.label :domain %>
<%= f.select :domain, @category.domains.invert %>
</div>
<div class="controls">
<%= f.submit 'Create Category' %>
</div>

View file

@ -1,26 +1,22 @@
<%= form_for(@poll) do |f| %>
<%= f.error_messages %>
<div id="poll">
<%= form_for(@poll, html: { class: 'square' }) do |f| %>
<%= render 'shared/errors', messages: @poll.errors.full_messages %>
<div class="box wide">
<p>
<%= f.label :question %><br />
<div class="fields horizontal">
<%= f.label :question %>
<%= f.text_field :question %>
</p>
<p>
<%= f.label :end_date %><br />
<%= f.datetime_select :end_date %>
</p>
<br />
</div>
</div>
<div class="wide box">
<h3>
Options
</h3>
<div class="fields horizontal">
<%= f.label :end_date %>
<%= f.datetime_select :end_date, datetime_separator: '', time_separator: '' %>
</div>
<h3 class="title">Options</h3>
<div id="options">
<%= f.fields_for :options do |opt| %>
<%= render "option", :f => opt %>
<%= render 'option', f: opt %>
<% end %>
</div>
@ -28,11 +24,9 @@
<%= link_to_add_fields "Add an Option", f, :options %>
</p>
</div>
<p>
<%= f.submit 'Save' %>
</p>
<% end %>
<%= link_to 'Back', polls_path %>
<div class="controls">
<%= f.submit 'Save' %>
</div>
<% end %>
</div>

View file

@ -1,8 +1,15 @@
<div class="option">
<p>
<%= f.hidden_field :poll_id %>
<%= f.text_field :option %>
<%= f.check_box :_destroy %>
<%= link_to_function "remove", "$(this).up('.option').remove()" %>
</p>
<div class="fields horizontal">
<%= f.label :option, "Question" %>
<div class="inputs">
<div class="question">
<%= f.hidden_field :poll_id %>
<%= f.text_field :option %>
</div>
<div class="destroy">
<%= f.check_box :_destroy %>
<%= f.label :_destroy, class: 'checkbox' %>
<%= f.label :_destroy, "Remove", class: 'remove' %>
</div>
</div>
</div>

View file

@ -1,34 +1,32 @@
<h1>Listing polls</h1>
<h1>Listing Polls</h1>
<table class="data">
<table class="polls striped">
<tr>
<th>Question</th>
<th>End date</th>
<th>Votes</th>
<th>User</th>
<th class="question">Question</th>
<th class="date">End date</th>
<th class="votes">Votes</th>
<th class="user">User</th>
<% if cuser and cuser.admin? %>
<th>Options</th>
<th class="actions"></th>
<% end %>
</tr>
<% @polls.reverse_each do |poll| %>
<tr class="<%= cycle('even', 'odd') %>">
<tr>
<td><%= link_to (h poll.question), poll %></td>
<td><%= longtime poll.end_date %></td>
<td><%= h poll.votes %></td>
<td><%= h poll.user %></td>
<td><%=h poll.votes %></td>
<td><%=h poll.user %></td>
<% if cuser and cuser.admin? %>
<td>
<%= link_to 'Edit', edit_poll_path(poll) %>
<%= link_to 'Destroy', poll, :confirm => 'Are you sure?', :method => :delete %>
<td class="actions">
<%= link_to icon('pencil'), edit_poll_path(poll) %>
<%= link_to icon('times'), poll, confirm: 'Are you sure?', method: :delete %>
</td>
<% end %>
</tr>
<% end %>
</table>
<br />
<% if cuser and cuser.admin? %>
<%= link_to 'New poll', new_poll_path %>
<%= link_to 'New Poll', new_poll_path, class: 'button' %>
<% end %>

View file

@ -1,3 +1,3 @@
<h1>New poll</h1>
<h1>New Poll</h1>
<%= render :partial => "form" %>
<%= render partial: 'form' %>