forked from hacketyhack/hackety-hack.com
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'melancholyfleur/master' into rss
Conflicts: config/routes.rb
- Loading branch information
Showing
10 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
atom_feed :language => 'en-US' do |feed| | ||
feed.title @title | ||
feed.updated @updated | ||
|
||
@questions.each do |item| | ||
next if item.created_at.blank? | ||
|
||
feed.entry item do |entry| | ||
entry.url questions_url(item) | ||
entry.title item.title | ||
entry.content item.description, :type => 'html' | ||
entry.updated(item.created_at.strftime("%Y-%m-%dT%H:%M:%SZ")) | ||
entry.author item.user | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
%section.support | ||
%p Subscribe to the #{link_to "Questions Atom Feed", feed_path}. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
%section.support | ||
%h2 Support | ||
%p Having a problem running Hackety Hack? Found a bug? Check out the #{link_to "support section", support_questions_path} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#This is the 'admins' controller | ||
|
||
# Show how many users there are | ||
get '/admin' do | ||
admin_only! | ||
#get usercount | ||
@usercount = Hacker.all.length | ||
today = Date.today | ||
@newusers = Hacker.all(:created_at => {'$gt' => today.to_time, '$lt' => (today + 1.day).to_time}).length | ||
@newusernames = Hacker.all(:created_at => {'$gt' => today.to_time, '$lt' => (today + 1.day).to_time}) | ||
@forumposts = Discussion.all(:created_at => {'$gt' => today.to_time, '$lt' => (today + 1.day).to_time}).length | ||
@postlinks = Discussion.all(:created_at => {'$gt' => today.to_time, '$lt' => (today + 1.day).to_time}) | ||
@forumreplies = Discussion.all(:updated_at => {'$gt' => today.to_time, '$lt' => (today + 1.day).to_time}).length | ||
|
||
haml :"admin/index" | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Feature: Admin functionality | ||
Scenario: Admin page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
%h1= current_user.username + "'s admin page" | ||
%img{:src => current_user.gravatar_url} | ||
|
||
%p Total Hacker Count: #{@usercount} | ||
|
||
%p New Users Today: #{@newusers} | ||
%ul | ||
- @newusernames.each do |name| | ||
%li | ||
%a{:href => "/hackers/#{name.username}"}= name.username | ||
|
||
%p New Forum Discussions: #{@forumposts} | ||
%ul | ||
- @postlinks.each do |postlink| | ||
%li | ||
%a{:href => "/forums/#{postlink.forum}/#{postlink.slug}"}= postlink.title | ||
|
||
%p New Forum Replies: #{@forumreplies} | ||
%ul | ||
- @postlinks.each do |replylink| | ||
%li | ||
%a{:href => "/forums/#{replylink.forum}/#{replylink.slug}"}= replylink.slug | ||
|
||
|