From 2b4f0ad50fd0e586de7dd0c95e653e8091e96aa7 Mon Sep 17 00:00:00 2001 From: Luke Barratt Date: Sun, 27 Apr 2014 02:35:13 +0100 Subject: [PATCH] Added polls styling --- app/assets/stylesheets/application.css.scss | 1 + app/assets/stylesheets/components/_forms.scss | 1 + app/assets/stylesheets/pages/_polls.scss | 52 +++++++++++++++++++ app/views/categories/new.html.erb | 1 + app/views/polls/_form.html.erb | 44 +++++++--------- app/views/polls/_option.html.erb | 21 +++++--- app/views/polls/index.html.erb | 30 +++++------ app/views/polls/new.html.erb | 4 +- 8 files changed, 104 insertions(+), 50 deletions(-) create mode 100644 app/assets/stylesheets/pages/_polls.scss diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 821c147..9e54cac 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -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"; diff --git a/app/assets/stylesheets/components/_forms.scss b/app/assets/stylesheets/components/_forms.scss index cab3868..1fa46d2 100644 --- a/app/assets/stylesheets/components/_forms.scss +++ b/app/assets/stylesheets/components/_forms.scss @@ -145,6 +145,7 @@ form { font-family: $open-sans; } + .inputs label.checkbox, > label.checkbox { position: relative; width: em(40); diff --git a/app/assets/stylesheets/pages/_polls.scss b/app/assets/stylesheets/pages/_polls.scss new file mode 100644 index 0000000..3355a08 --- /dev/null +++ b/app/assets/stylesheets/pages/_polls.scss @@ -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); + } + } + } +} \ No newline at end of file diff --git a/app/views/categories/new.html.erb b/app/views/categories/new.html.erb index 0ec56ff..de6408d 100644 --- a/app/views/categories/new.html.erb +++ b/app/views/categories/new.html.erb @@ -11,6 +11,7 @@ <%= f.label :domain %> <%= f.select :domain, @category.domains.invert %> +
<%= f.submit 'Create Category' %>
diff --git a/app/views/polls/_form.html.erb b/app/views/polls/_form.html.erb index 24ae536..515ec83 100644 --- a/app/views/polls/_form.html.erb +++ b/app/views/polls/_form.html.erb @@ -1,26 +1,22 @@ -<%= form_for(@poll) do |f| %> - <%= f.error_messages %> +
+ <%= form_for(@poll, html: { class: 'square' }) do |f| %> + <%= render 'shared/errors', messages: @poll.errors.full_messages %> -
-

- <%= f.label :question %>
+

+ <%= f.label :question %> <%= f.text_field :question %> -

-

- <%= f.label :end_date %>
- <%= f.datetime_select :end_date %> -

-
-
+
-
-

- Options -

+
+ <%= f.label :end_date %> + <%= f.datetime_select :end_date, datetime_separator: '', time_separator: '' %> +
+ +

Options

<%= f.fields_for :options do |opt| %> - <%= render "option", :f => opt %> + <%= render 'option', f: opt %> <% end %>
@@ -28,11 +24,9 @@ <%= link_to_add_fields "Add an Option", f, :options %>

-
- -

- <%= f.submit 'Save' %> -

-<% end %> - -<%= link_to 'Back', polls_path %> +
+ <%= f.submit 'Save' %> +
+ <% end %> +
+ \ No newline at end of file diff --git a/app/views/polls/_option.html.erb b/app/views/polls/_option.html.erb index ab87f17..02b0ebb 100644 --- a/app/views/polls/_option.html.erb +++ b/app/views/polls/_option.html.erb @@ -1,8 +1,15 @@ -
-

- <%= f.hidden_field :poll_id %> - <%= f.text_field :option %> - <%= f.check_box :_destroy %> - <%= link_to_function "remove", "$(this).up('.option').remove()" %> -

+
+ <%= f.label :option, "Question" %> +
+
+ <%= f.hidden_field :poll_id %> + <%= f.text_field :option %> +
+ +
+ <%= f.check_box :_destroy %> + <%= f.label :_destroy, class: 'checkbox' %> + <%= f.label :_destroy, "Remove", class: 'remove' %> +
+
\ No newline at end of file diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb index adce86c..eb7fb7a 100644 --- a/app/views/polls/index.html.erb +++ b/app/views/polls/index.html.erb @@ -1,34 +1,32 @@ -

Listing polls

+

Listing Polls

- +
- - - - + + + + <% if cuser and cuser.admin? %> - + <% end %> <% @polls.reverse_each do |poll| %> - + - - + + <% if cuser and cuser.admin? %> - <% end %> <% end %>
QuestionEnd dateVotesUserQuestionEnd dateVotesUserOptions
<%= link_to (h poll.question), poll %> <%= longtime poll.end_date %><%= h poll.votes %><%= h poll.user %><%=h poll.votes %><%=h poll.user %> - <%= link_to 'Edit', edit_poll_path(poll) %> - <%= link_to 'Destroy', poll, :confirm => 'Are you sure?', :method => :delete %> + + <%= link_to icon('pencil'), edit_poll_path(poll) %> + <%= link_to icon('times'), poll, confirm: 'Are you sure?', method: :delete %>
-
- <% if cuser and cuser.admin? %> - <%= link_to 'New poll', new_poll_path %> + <%= link_to 'New Poll', new_poll_path, class: 'button' %> <% end %> diff --git a/app/views/polls/new.html.erb b/app/views/polls/new.html.erb index 5064988..ed0c99d 100644 --- a/app/views/polls/new.html.erb +++ b/app/views/polls/new.html.erb @@ -1,3 +1,3 @@ -

New poll

+

New Poll

-<%= render :partial => "form" %> \ No newline at end of file +<%= render partial: 'form' %>