From 96813a5e508a54257ef03be613a704f1f71af53d Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 21 Oct 2023 00:25:50 -0400 Subject: Added quotes database --- app/views/quotes/_quote.html.haml | 16 ++++++++++++++++ app/views/quotes/index.atom.builder | 11 +++++++++++ app/views/quotes/index.html.haml | 8 ++++++++ app/views/quotes/list.html.haml | 4 ++++ app/views/quotes/new.html.erb | 2 ++ app/views/quotes/show.html.haml | 1 + app/views/quotes/tags.html.haml | 4 ++++ app/views/quotes/voted.js.erb | 12 ++++++++++++ 8 files changed, 58 insertions(+) create mode 100644 app/views/quotes/_quote.html.haml create mode 100644 app/views/quotes/index.atom.builder create mode 100644 app/views/quotes/index.html.haml create mode 100644 app/views/quotes/list.html.haml create mode 100644 app/views/quotes/new.html.erb create mode 100644 app/views/quotes/show.html.haml create mode 100644 app/views/quotes/tags.html.haml create mode 100644 app/views/quotes/voted.js.erb (limited to 'app/views/quotes') diff --git a/app/views/quotes/_quote.html.haml b/app/views/quotes/_quote.html.haml new file mode 100644 index 0000000..2a9fb37 --- /dev/null +++ b/app/views/quotes/_quote.html.haml @@ -0,0 +1,16 @@ +%article.quote{ :id => "quote-#{quote.id}" } + %header.quote-header{ :id => "quote-header-#{quote.id}" } + = link_to_unless (quote.new_record? or current_page?(quote)), "\##{quote.id}", quote, :class => "quote-link" + %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 + %span.quote-rating{ :id => "quote-rating-#{quote.id}" }= "+#{quote.upvotes}/-#{quote.downvotes}" + %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 + %datetime= quote.published_date + %blockquote.quote-body= raw quote_format(h(quote.content)) + - if !quote.new_record? and quote.has_extra? + .quote-footer + - if quote.has_notes? + .quote-notes= auto_link(quote.notes, :link => :urls) + - if quote.has_tags? + %ul.quote-tags + - quote.tags.each do |tag| + %li= link_to tag.name, tag_quotes_path(tag.name) diff --git a/app/views/quotes/index.atom.builder b/app/views/quotes/index.atom.builder new file mode 100644 index 0000000..66849cc --- /dev/null +++ b/app/views/quotes/index.atom.builder @@ -0,0 +1,11 @@ +atom_feed do |feed| + feed.title("The Four Island Quotes DB") + feed.updated(@quotes.first.created_at) + + @quotes.each do |quote| + feed.entry(quote) do |entry| + entry.title("##{quote.id}") + entry.content(quote.content, :type => 'text') + end + end +end diff --git a/app/views/quotes/index.html.haml b/app/views/quotes/index.html.haml new file mode 100644 index 0000000..d2f667e --- /dev/null +++ b/app/views/quotes/index.html.haml @@ -0,0 +1,8 @@ +#about-left + #quotes= render @quote + %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. +#about-right + %h3 About + %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. + %p.normal The quotes database, in its first incarnation, was created on #{link_to "April 25th 2008", "http://www.fourisland.com/2008/04/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 "quotes.fourisland.com". It was rewritten by hand and integrated into Four Island (at the URL "fourisland.com/quotes") by hatkirby on #{link_to "June 13th 2008", "http://www.fourisland.com/2008/06/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/2011/09/four-island-3/"}, it was rewritten in Ruby on Rails, disassociated from Four Island and returned to its original URL. +.cleardiv 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 @@ +%section#quotes + .pagination= will_paginate @quotes + = render @quotes + .pagination= will_paginate @quotes diff --git a/app/views/quotes/new.html.erb b/app/views/quotes/new.html.erb new file mode 100644 index 0000000..a4c6a0a --- /dev/null +++ b/app/views/quotes/new.html.erb @@ -0,0 +1,2 @@ +

Quotes#new

+

Find me in app/views/quotes/new.html.erb

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/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 @@ +%h2 Tag Cloud +%ul#tags-container + - tag_cloud(@tags, %w(css1 css1_5 css2 css2_5 css3 css3_5 css4 css4_5 css5 css5_5 css6)) do |tag, css_class| + %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 @@ +$("#quote-rating-<%= @quote.id %>").html('<%= escape_javascript("+#{@quote.upvotes}/-#{@quote.downvotes}") %>'); + +<% if @quote.already_upvoted? request.remote_ip %> + $("#quote-upvote-link-<%= @quote.id %>").html("Up"); +<% elsif @quote.already_downvoted? request.remote_ip %> + $("#quote-downvote-link-<%= @quote.id %>").html("Down"); +<% else %> + $("#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)) %>'); + $("#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)) %>'); +<% end %> + +$("#quote-header-<%= @quote.id %>").effect('highlight', {}, 2000); -- cgit 1.4.1