-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from argerim/master
Continuando Milestones Encontros, e inciando Palestras
- Loading branch information
Showing
57 changed files
with
10,056 additions
and
64 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
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,43 @@ | ||
# encoding: UTF-8 | ||
class LecturesController < ApplicationController | ||
|
||
respond_to :html | ||
|
||
def index | ||
@lectures = Lecture.all | ||
end | ||
|
||
def show | ||
@lecture = Lecture.find_by_slug(params[:id]) | ||
end | ||
|
||
def new | ||
@lecture = Lecture.new | ||
end | ||
|
||
def edit | ||
@lecture = Lecture.find_by_slug(params[:id]) | ||
end | ||
|
||
def create | ||
@event = Event.find_by_slug(params[:event_id]) | ||
@lecture = @event.lectures.create(params[:lecture]) | ||
flash[:notice] = 'Palestra criada com sucesso.' if @lecture.save | ||
respond_with @lecture, :location => event_path(@event) | ||
end | ||
|
||
def update | ||
@lecture = Lecture.find_by_slug(params[:id]) | ||
flash[:notice] = 'Palestra atualizada com sucesso.' if @lecture.update_attributes(params[:lecture]) | ||
respond_with @lecture | ||
end | ||
|
||
def destroy | ||
@event = Event.find_by_slug(params[:event_id]) | ||
@lecture = @event.lectures.find_by_slug(params[:id]).destroy | ||
flash[:notice] = 'Palestra deletada com sucesso' if @lecture.destroy | ||
respond_with @lecture, :location => event_path(@event) | ||
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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
# encoding: UTF-8 | ||
class SessionsController < ApplicationController | ||
|
||
def create | ||
auth = request.env["omniauth.auth"] | ||
user = User.find_by_provider_and_uid(auth["provider"], auth["uid"]) || User.create_with_omniauth(auth) | ||
session[:user_id] = user.id | ||
redirect_to root_url, :notice => "Seja Bem-vindo!" | ||
|
||
end | ||
|
||
def destroy | ||
session[:user_id] = nil | ||
redirect_to root_url, :notice => "Volte sempre… :)" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module LecturesHelper | ||
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 @@ | ||
module SessionsHelper | ||
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 @@ | ||
module WelcomeHelper | ||
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,17 @@ | ||
class Lecture < ActiveRecord::Base | ||
belongs_to :user | ||
belongs_to :event | ||
before_save :slugify | ||
validates :name, :presence => true, :uniqueness => true | ||
|
||
def to_param | ||
slug | ||
end | ||
|
||
private | ||
def slugify | ||
self.slug = name.parameterize.to_s | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,4 @@ def self.create_with_omniauth(auth) | |
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
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
<%= render 'form' %> | ||
|
||
<%= link_to 'Back', events_path %> | ||
<%= link_to t(:back), events_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,32 +1,34 @@ | ||
<p id="notice"><%= notice %></p> | ||
|
||
<p> | ||
<b>Name:</b> | ||
<b><%=Event.human_attribute_name(:name)%>:</b> | ||
<%= @event.name %> | ||
</p> | ||
|
||
<p> | ||
<b>Description:</b> | ||
<b><%=Event.human_attribute_name(:description)%>:</b> | ||
<p> | ||
<%= @event.description.gsub(/\n/,"<br />").html_safe %> | ||
</p> | ||
</p> | ||
|
||
<p> | ||
<b>Event date:</b> | ||
<b><%=Event.human_attribute_name(:event_date)%>:</b> | ||
<%=l @event.event_date %> | ||
</p> | ||
|
||
<p> | ||
<b>Hour:</b> | ||
<b><%=Event.human_attribute_name(:hour)%>:</b> | ||
<%= @event.hour %> | ||
</p> | ||
|
||
<p> | ||
<b>Place:</b> | ||
<b><%=Event.human_attribute_name(:place)%>:</b> | ||
<%= @event.place %> | ||
</p> | ||
<br /> | ||
<h2>Palestras</h2> | ||
|
||
<%= link_to 'Edit', edit_event_path(@event) %> | | ||
<%= link_to 'Back', events_path %> | ||
<%= render @event.lectures %> | ||
<br /> | ||
<h2>Add uma Palestra:</h2> | ||
<%= render "lectures/form" %> | ||
|
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,15 @@ | ||
<%= form_for([@event, @event.lectures.build]) do |f| %> | ||
<div class="field"> | ||
<%= f.label Lecture.human_attribute_name(:name) %><br /> | ||
<%= f.text_field :name %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label Lecture.human_attribute_name(:description) %><br /> | ||
<%= f.text_area :description %> | ||
<%= f.hidden_field :user_id, :value => current_user.id %> | ||
</div> | ||
<div class="actions"> | ||
<%= f.submit %> | ||
</div> | ||
<% 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,25 @@ | ||
<p> | ||
<b><%=Lecture.human_attribute_name(:name)%>:</b> | ||
<%= lecture.name %> | ||
</p> | ||
|
||
<p> | ||
<b><%=Lecture.human_attribute_name(:description)%>:</b> | ||
<p> | ||
<%= lecture.description.gsub(/\n/,"<br />").html_safe %> | ||
</p> | ||
</p> | ||
|
||
|
||
<p> | ||
<b><%=Lecture.human_attribute_name(:user)%>:</b> | ||
<%= lecture.user.name %> | ||
</p> | ||
|
||
<p> | ||
<%= link_to t(:destroy_lecture), [lecture.event, lecture], | ||
:confirm => t(:confirm), | ||
:method => :delete %> | ||
</p> | ||
<br /> | ||
|
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,7 @@ | ||
<h1>Editing lecture</h1> | ||
|
||
<%= render 'form' %> | ||
|
||
<%= link_to t(:show), @lecture %> | | ||
<%= link_to t(:back), lectures_path %> | ||
|
Oops, something went wrong.