about summary refs log tree commit diff stats
path: root/app/views/quotes
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/quotes')
-rw-r--r--app/views/quotes/_quote.html.haml22
-rw-r--r--app/views/quotes/index.html.haml8
-rw-r--r--app/views/quotes/latest.atom.builder11
-rw-r--r--app/views/quotes/list.html.haml4
-rw-r--r--app/views/quotes/new.html.haml24
-rw-r--r--app/views/quotes/search_form.html.haml6
-rw-r--r--app/views/quotes/show.html.haml1
-rw-r--r--app/views/quotes/stats.html.haml41
-rw-r--r--app/views/quotes/tags.html.haml4
-rw-r--r--app/views/quotes/voted.js.erb12
10 files changed, 133 insertions, 0 deletions
diff --git a/app/views/quotes/_quote.html.haml b/app/views/quotes/_quote.html.haml new file mode 100644 index 0000000..acbab10 --- /dev/null +++ b/app/views/quotes/_quote.html.haml
@@ -0,0 +1,22 @@
1%article.quote.h-entry{ :id => "quote-#{quote.id}" }
2 %data.p-name{ value: "\##{quote.id}" }
3 %data.u-url{ value: url_for(quote) }
4 %header.quote-header{ :id => "quote-header-#{quote.id}" }
5 = link_to_unless (quote.new_record? or current_page?(quote)), "\##{quote.id}", quote, :class => "quote-link"
6 %span.vote-link{ :id => "quote-upvote-link-#{quote.id}" }= link_to_unless (quote.new_record? or quote.already_upvoted?(request.remote_ip)), "Up", upvote_quote_path(quote.id), :remote => true, :rel => "nofollow", :class => "quote-upvote-link", method: :post
7 %span.quote-rating{ :id => "quote-rating-#{quote.id}" }= "+#{quote.upvotes}/-#{quote.downvotes}"
8 %span.vote-link{ :id => "quote-downvote-link-#{quote.id}" }= link_to_unless (quote.new_record? or quote.already_downvoted?(request.remote_ip)), "Down", downvote_quote_path(quote.id), :remote => true, :rel => "nofollow", :class => "quote-downvote-link", method: :post
9 %time.dt-published{ datetime: quote.created_at.strftime("%Y-%m-%dT%H:%M:%SZ%z") }= quote.published_date
10 - if user_signed_in? and !quote.new_record?
11 = link_to "Edit", edit_admin_quote_path(quote), :class => "quote-edit-link"
12 - if quote.audio.attached?
13 .audioplayer= audio_tag(rails_blob_url(quote.audio), controls: true)
14 %blockquote.quote-body.e-content= raw quote_format(h(quote.content))
15 - if !quote.new_record? and quote.has_extra?
16 .quote-footer
17 - if quote.has_notes?
18 .quote-notes= auto_link(quote.notes, :link => :urls)
19 - if quote.has_tags?
20 %ul.quote-tags
21 - quote.tags.each do |tag|
22 %li= link_to tag.name, tag_quotes_path(tag.name)
diff --git a/app/views/quotes/index.html.haml b/app/views/quotes/index.html.haml new file mode 100644 index 0000000..0c804d1 --- /dev/null +++ b/app/views/quotes/index.html.haml
@@ -0,0 +1,8 @@
1#about-left
2 #quotes= render @quote
3 %p.normal Welcome to the Four Island Quotes Database! Here you can find many strange and hopefully humorous Four Island quotes. There are currently #{@qnumber} quotes in the database, and there are #{@mnumber} quotes awaiting moderation.
4#about-right
5 %h3 About
6 %p.normal The Four Island Quotes DB is a repository for humorous and memorable quotes from #{link_to "FourNet", "http://irc.fourisland.com/"} channels, instant messaging sessions, real life situations, and more.
7 %p.normal The quotes database, in its first incarnation, was created on #{link_to "April 25th 2008", "http://www.fourisland.com/blog/quote-time/"} by hatkirby, who was inspired by #{link_to "bash.org", "http://bash.org/"} and his obsession with record-keeping to create a quotes database for Four Island. It ran on the now-defunct PHP quote management system, #{link_to "rash", "http://rqms.sourceforge.net/"}, on the subdomain "<code>quotes.fourisland.com</code>". It was rewritten by hand and integrated into Four Island (at the URL "<code>fourisland.com/quotes</code>") by hatkirby on #{link_to "June 13th 2008", "http://www.fourisland.com/blog/the-new-four-island/"} with the release of Four Island 2, dubbed The New Four Island. With the release of Four Island 3 on #{link_to "September 22nd, 2011", "http://www.fourisland.com/blog/four-island-3/"}, it was rewritten in Ruby on Rails, disassociated from Four Island and returned to its original URL.
8.cleardiv
diff --git a/app/views/quotes/latest.atom.builder b/app/views/quotes/latest.atom.builder new file mode 100644 index 0000000..d389a58 --- /dev/null +++ b/app/views/quotes/latest.atom.builder
@@ -0,0 +1,11 @@
1atom_feed do |feed|
2 feed.title("The Four Island Quotes DB")
3 feed.updated(@quotes.first.created_at)
4
5 @quotes.each do |quote|
6 feed.entry(quote) do |entry|
7 entry.title("##{quote.id}")
8 entry.content(quote_format(quote.content), :type => 'html')
9 end
10 end
11end
diff --git a/app/views/quotes/list.html.haml b/app/views/quotes/list.html.haml new file mode 100644 index 0000000..12c95c0 --- /dev/null +++ b/app/views/quotes/list.html.haml
@@ -0,0 +1,4 @@
1%section#quotes
2 .pagination= will_paginate @quotes
3 = render @quotes
4 .pagination= will_paginate @quotes
diff --git a/app/views/quotes/new.html.haml b/app/views/quotes/new.html.haml new file mode 100644 index 0000000..887ff2c --- /dev/null +++ b/app/views/quotes/new.html.haml
@@ -0,0 +1,24 @@
1%p.normal You're about to submit a quote to the Four Island Quotes DB! This is great, but first, there are a few rules/guidelines/things you should know before submitting:
2%ul
3 %li Quotes should come from a chat involving one or more Four Island regulars. This is not a strict guideline, as quotes are often submitted from video chats or real life situations possibly involving only one Four Island regular, but just make sure before submitting that the quote you're submitting would be appreciated by other Four Island regulars.
4 %li Make sure to remove timestamps, if present in your quote, before submitting.
5 %li If your quote is extremely offensive, it will probably not be approved. This is not referring to profanity--you can leave profanity uncensored in your quotes.
6 %li If you want to, you can enter your username in the box below the quote labelled "Your username" (this is completely optional). This is mostly for record-keeping and statistical purposes; submitting a quote of yourself being awesome and then signing your name under it won't decrease the chances of it being accepted.
7 %li You can enter any notes about the quote that may be important (such as context, or if it's a memorable quote, why it's memorable) in the box below your quote.
8 %li You can also enter a list of comma-separated tags in the provided box. This is, again, optional, but it's suggested that you do tag your quote, especially with #{link_to "tags that already exist", tags_quotes_path}, though creating new tags is not frowned upon.
9%h3 Your Quote
10= form_for @quote do |f|
11 - if @quote.errors.any?
12 #error-messages
13 %h4 Errors were found!
14 %ul
15 - @quote.errors.full_messages.each do |msg|
16 %li= msg
17 .form-field= f.text_area :content
18 .form-field Your username (optional): #{f.text_field :submitter}
19 .form-field Notes (optional):
20 .form-field= f.text_area :notes
21 .form-field
22 Tags (optional):
23 .tags-input= f.text_field :tag_list, type: :tags, value: f.object.tag_list.join(",")
24 .form-field= f.submit
diff --git a/app/views/quotes/search_form.html.haml b/app/views/quotes/search_form.html.haml new file mode 100644 index 0000000..74cdd20 --- /dev/null +++ b/app/views/quotes/search_form.html.haml
@@ -0,0 +1,6 @@
1%h3 Search
2= search_form_for @q, url: search_quotes_url do |f|
3 .form-field
4 = f.label :content_or_notes_cont, "Query:"
5 = f.search_field :content_or_notes_cont
6 .form-field= f.submit
diff --git a/app/views/quotes/show.html.haml b/app/views/quotes/show.html.haml new file mode 100644 index 0000000..b28c879 --- /dev/null +++ b/app/views/quotes/show.html.haml
@@ -0,0 +1 @@
%section#quotes= render @quote
diff --git a/app/views/quotes/stats.html.haml b/app/views/quotes/stats.html.haml new file mode 100644 index 0000000..d7a8140 --- /dev/null +++ b/app/views/quotes/stats.html.haml
@@ -0,0 +1,41 @@
1%script{ :type => "text/javascript", :src => "https://www.gstatic.com/charts/loader.js" }
2%script{ :type => "text/javascript" }
3 google.charts.load('visualization', '1.0', {'packages':['corechart']});
4 google.charts.setOnLoadCallback(drawChart);
5 function drawChart()
6 {
7 var data = new google.visualization.DataTable();
8 data.addColumn('string', 'Month');
9 data.addColumn('number', 'Quotes Submitted');
10 data.addRows([
11 - @months.each do |month|
12 ['#{month[:name]}', #{month[:number]}],
13 ]);
14 var options = {'title':'Quotes Submitted in the Last 12 Months', 'width':1000, 'height':500, 'legend':'none', 'hAxis.maxAlternation':1};
15 var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
16 chart.draw(data, options);
17 //var data2 = new google.visualization.DataTable();
18 //data2.addColumn('string', 'Month');
19 //data2.addColumn('number', 'Quotes');
20 //data2.addRows([
21 //- @months2.each do |month|
22 // ['\#{month[:name]}', \#{month[:number]}],
23 //]);
24 //var options2 = {'title':'Number of Quotes', 'width':1000, 'height':500, 'legend':'none', 'hAxis.maxAlternation':1};
25 //var chart2 = new google.visualization.AreaChart(document.getElementById('chart2_div'));
26 //chart2.draw(data2, options2);
27 var data3 = new google.visualization.DataTable();
28 data3.addColumn('string', 'Speaker');
29 data3.addColumn('number', 'Quotes');
30 data3.addRows([
31 - @by_speaker.each do |speaker|
32 ['#{speaker[0]}', #{speaker[1]}],
33 ]);
34 var options3 = {'title':'Number of Quotes per Speaker', 'width':1000, 'height':500};
35 var chart3 = new google.visualization.ColumnChart(document.getElementById('chart3_div'));
36 chart3.draw(data3, options3);
37 }
38%p.normal Because charts are fun, we've compiled a few charts here containing statistics about the Four Island Quotes DB.
39#chart2_div
40#chart_div
41#chart3_div
diff --git a/app/views/quotes/tags.html.haml b/app/views/quotes/tags.html.haml new file mode 100644 index 0000000..e15b386 --- /dev/null +++ b/app/views/quotes/tags.html.haml
@@ -0,0 +1,4 @@
1%h2 Tag Cloud
2%ul#tags-container
3 - tag_cloud(@tags, %w(css1 css1_5 css2 css2_5 css3 css3_5 css4 css4_5 css5 css5_5 css6)) do |tag, css_class|
4 %li= link_to tag.name, tag_quotes_path(tag.name), :class => css_class
diff --git a/app/views/quotes/voted.js.erb b/app/views/quotes/voted.js.erb new file mode 100644 index 0000000..c697c7d --- /dev/null +++ b/app/views/quotes/voted.js.erb
@@ -0,0 +1,12 @@
1$("#quote-rating-<%= @quote.id %>").html('<%= escape_javascript("+#{@quote.upvotes}/-#{@quote.downvotes}") %>');
2
3<% if @quote.already_upvoted? request.remote_ip %>
4 $("#quote-upvote-link-<%= @quote.id %>").html("Up");
5<% elsif @quote.already_downvoted? request.remote_ip %>
6 $("#quote-downvote-link-<%= @quote.id %>").html("Down");
7<% else %>
8 $("#quote-upvote-link-<%= @quote.id %>").html('<%= escape_javascript(link_to("Up", upvote_quote_path(@quote.id), :remote => true, :rel => "nofollow", :class => "quote-upvote-link", method: :post)) %>');
9 $("#quote-downvote-link-<%= @quote.id %>").html('<%= escape_javascript(link_to("Down", downvote_quote_path(@quote.id), :remote => true, :rel => "nofollow", :class => "quote-downvote-link", method: :post)) %>');
10<% end %>
11
12$("#quote-header-<%= @quote.id %>").effect('highlight', {}, 2000);