Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presentations page without database #52

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ public/assets

# Ignore application configuration
/config/application.yml

# Ignore .swp files
*.swp
11 changes: 11 additions & 0 deletions app/assets/stylesheets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,14 @@ ul.members-list li span.name {
font-weight: bold;
}

.sort_header {
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 10px;
background: #373737;
color: #fff;
}

.sort_header:hover, .sort_header:focus {
text-decoration: underline;
}

13 changes: 13 additions & 0 deletions app/controllers/presentations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class PresentationsController < ApplicationController

def index
@presentations = Presentation.all
if params[:sort_by] == 'title'
@presentations = @presentations.sort {|ppt1, ppt2| ppt1.title <=> ppt2.title}
elsif params[:sort_by] == 'date'
@presentations = @presentations.sort {|ppt1, ppt2| ppt1.date_presented <=> ppt2.date_presented}
elsif params[:sort_by] == 'presenter'
@presentations = @presentations.sort {|ppt1, ppt2| ppt1.presenter <=> ppt2.presenter}
end
end
end
30 changes: 30 additions & 0 deletions app/models/presentation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class Presentation
attr_accessor :title, :url, :date_presented, :presenter

def initialize(attributes)
@title = attributes[:title]
@url = attributes[:url]
@date_presented = Date.strptime(attributes[:date_presented], "%d/%m/%Y")
@presenter = attributes[:presenter]
end

def self.all
presentations = [{:title => 'git and GitHub', :url => 'https://github.com/thessrb/meetup/blob/master/meetups/2/presentations/gitAndGithub/AppCampGr2011Preso.pdf?raw=true', :date_presented => '06/09/2011', :presenter => 'Petros Amiridis'},
{:title => 'Simple Web Apps with Sinatra', :url => 'http://prezi.com/de5yqj9sa9zq/simple-webapps-with-sinatra/', :date_presented => '06/09/2011', :presenter => 'Vassilis Rizopoulos'},
{:title => "Ruby Gems are Pragmatic Programmer's Best Friends", :url => 'https://github.com/thessrb/meetup/blob/master/meetups/3/Ruby%2Bgems%2Bare%2Bpragmatic%2Bprogrammer%2527s%2Bbest%2Bfriends.pdf', :date_presented => '01/11/2011', :presenter => 'Konstantinos Kostopoulos'},
{:title => 'Codigia - a dispersed team example', :url => 'https://github.com/thessrb/meetup/blob/master/meetups/4/presentations/Codigia-DispersedTeamExample/meetup_4_slides.pdf', :date_presented => '29/11/2011', :presenter => 'Stefanos Togoulidis'},
{:title => 'Introduction to configuration management with Puppet', :url => 'https://speakerdeck.com/robbyt/introduction-to-puppet', :date_presented => '24/09/2013', :presenter => 'Robert Terhaar'},
{:title => 'Introduction to Functional Programming with Elixir', :url => 'https://docs.google.com/presentation/d/1Bku0-9Eu9k_lTMnAQOYpsbiRGlSaMXxo_7MPEl7bm0s/edit?pli=1#slide=id.p', :date_presented => '29/10/2013', :presenter => 'Vassilis Rizopoulos'},
{:title => 'Decreasing technical debt with SonarQube', :url => 'http://www.slideshare.net/ppapapetrou/thessaloniki-rb24', :date_presented => '28/01/2014', :presenter => 'Patroklos Papapetrou'},
{:title => 'Lambda calculus for programmers', :url => 'https://drive.google.com/file/d/0B2yeyDGqvZRQTnpxRmRjYTVQRnM/edit?usp=sharing', :date_presented => '18/02/2014', :presenter => 'Kostas Lolas'},
{:title => 'Agile Methodologies — Manage and code without losing your head', :url => 'https://speakerdeck.com/krap/agile-methodologies-manage-and-code-without-losing-your-head', :date_presented => '18/03/2014', :presenter => 'Apostolos Kritikos'},
{:title => 'Ruby Basics', :url => 'http://xarisd.io/presentations/ruby-basics-ii/#/', :date_presented => '19/06/2014', :presenter => 'Haris Dimitriou'},
{:title => 'Introduction to Ruby on Rails', :url => 'https://speakerdeck.com/petros/thessaloniki-ruby-meetup-and-rubyzino-number-30', :date_presented => '30/09/2014', :presenter => 'Petros Amiridis'},
{:title => 'Create the first pages of our Rails app and deploy to Heroku', :url => 'http://xarisd.io/presentations/rails-basics-01/#/', :date_presented => '25/10/2014', :presenter => 'Haris Dimitriou'},
]

presentations.map do |presentation|
Presentation.new presentation
end
end
end
21 changes: 14 additions & 7 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@
<h2 id="project_tagline">Official Thessaloniki Ruby Meetup Home</h2>

<section id="menu">
<% if @current_page == 'home' %>
<span class="current">Home</span>
<a class="" href="members">Members</a>
<% elsif @current_page == 'members' %>
<a class="" href="/">Home</a>
<span class="current">Members</span>
<% end %>
<% case @current_page
when 'home' %>
<span class="current">Home</span>
<a class="" href="members">Members</a>
<a class="" href="presentations">Presentations</a>
<% when 'members' %>
<a class="" href="/">Home</a>
<span class="current">Members</span>
<a class="" href="presentations">Presentations</a>
<% when 'presentations' %>
<a class="" href="/">Home</a>
<a class="" href="members">Members</a>
<span class="current" href="presentations">Presentations</span>
<% end %>
</section>
</header>
</div>
Expand Down
29 changes: 29 additions & 0 deletions app/views/presentations/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<%

@current_page = "presentations"
@title = ""

%>

<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<p>We like open-source. We also like Ruby and Rails framework. We love fiddling around with technology.</p>
<p>This is the very reason we want our presentations base to be open for everyone</p>
<p>Below, you can find our presentations, up until now</p>

<table>
<tr>
<th><%= link_to 'Title', {:controller => 'presentations', :action => 'index', :sort_by => 'title'}, :class => 'sort_header'%></th>
<th><%= link_to 'Date', {:controller => 'presentations', :action => 'index', :sort_by => 'date'}, :class => 'sort_header'%></th>
<th><%= link_to 'Details', {:controller => 'presentations', :action => 'index', :sort_by => 'presenter'}, :class => 'sort_header'%></th>
</tr>
<% @presentations.each do |presentation|%>
<tr>
<td><%= link_to presentation.title, presentation.url %></td>
<td><%= presentation.date_presented.strftime("%d/%m/%Y") %></td>
<td>Presented by <%= presentation.presenter %>.</td>
</tr>
<% end %>
</table>
</section>
</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Rails.application.routes.draw do
root 'home#index'
get 'members', :to => 'members#index'
get 'presentations', :to => 'presentations#index'



Expand Down