rails 3 fixes

master
Alinson S. Xavier 12 years ago
parent e563725dc5
commit 0991d7af8e

@ -6,3 +6,7 @@ public/upload/*
*.orig *.orig
config/database.yml config/database.yml
config/application.rb config/application.rb
tmp/cache/*
*.rails2
*.sqlite3
*.pid

@ -10,17 +10,18 @@ group :assets do
gem 'uglifier', '>= 1.0.3' gem 'uglifier', '>= 1.0.3'
end end
gem 'jquery-rails' gem 'acts_as_list', '~>0.2'
gem 'acts_as_paranoid', '~>0.4'
gem 'acts_as_versioned', :git => 'https://github.com/jwhitehorn/acts_as_versioned.git'
gem 'bluecloth', '1.0.0', :path => './vendor/gems/bluecloth' gem 'bluecloth', '1.0.0', :path => './vendor/gems/bluecloth'
gem 'calendar_helper', "~>0.2"
gem 'dynamic_form'
gem 'haml', '~>3.1' gem 'haml', '~>3.1'
gem 'hpricot', '~>0.8' gem 'hpricot', '~>0.8'
gem 'icalendar', '~>1.0' gem 'icalendar', '~>1.0'
gem 'will_paginate', "~>3.0" gem 'jquery-rails'
gem 'calendar_helper', "~>0.2"
gem 'shoulda', "~>2.11" gem 'shoulda', "~>2.11"
gem 'acts_as_paranoid', '~>0.4' gem 'will_paginate', "~>3.0"
gem 'acts_as_versioned', :git => 'https://github.com/jwhitehorn/acts_as_versioned.git'
gem 'acts_as_list', '~>0.2'
group :development, :production do group :development, :production do
gem 'brazilian-rails', '3.3.0', :path => './vendor/gems/brazilian-rails/brI18n/' gem 'brazilian-rails', '3.3.0', :path => './vendor/gems/brazilian-rails/brI18n/'

@ -62,6 +62,7 @@ GEM
execjs execjs
coffee-script-source (1.6.3) coffee-script-source (1.6.3)
daemons (1.1.9) daemons (1.1.9)
dynamic_form (1.1.4)
erubis (2.7.0) erubis (2.7.0)
execjs (1.4.0) execjs (1.4.0)
multi_json (~> 1.0) multi_json (~> 1.0)
@ -148,6 +149,7 @@ DEPENDENCIES
brazilian-rails (= 3.3.0)! brazilian-rails (= 3.3.0)!
calendar_helper (~> 0.2) calendar_helper (~> 0.2)
coffee-rails (~> 3.2.1) coffee-rails (~> 3.2.1)
dynamic_form
haml (~> 3.1) haml (~> 3.1)
hpricot (~> 0.8) hpricot (~> 0.8)
icalendar (~> 1.0) icalendar (~> 1.0)

@ -35,7 +35,7 @@ class ApplicationController < ActionController::Base
respond_to do |format| respond_to do |format|
format.html { format.html {
if logged_in? if logged_in?
render :file => "#{RAILS_ROOT}/public/401.html", :status => 401 render :file => "#{Rails.root}/public/401.html", :status => 401
else else
login_by_html login_by_html
end end
@ -53,7 +53,7 @@ class ApplicationController < ActionController::Base
# Registro nao encontrado # Registro nao encontrado
elsif (RAILS_ENV == 'production') and exception.is_a?(ActiveRecord::RecordNotFound) elsif (RAILS_ENV == 'production') and exception.is_a?(ActiveRecord::RecordNotFound)
respond_to do |format| respond_to do |format|
format.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => 404 } format.html { render :file => "#{Rails.root}/public/404.html", :status => 404 }
format.xml { head 404 } format.xml { head 404 }
end end

@ -98,7 +98,7 @@ class AttachmentsController < ApplicationController
def download def download
send_file("#{RAILS_ROOT}/public/upload/#{@course.id}/#{@attachment.id}", send_file("#{Rails.root}/public/upload/#{@course.id}/#{@attachment.id}",
:filename => @attachment.file_name, :filename => @attachment.file_name,
:type => @attachment.content_type, :type => @attachment.content_type,
:disposition => 'inline', :disposition => 'inline',

@ -18,8 +18,8 @@
class WikiController < ApplicationController class WikiController < ApplicationController
verify :params => :text, :only => :preview, :redirect_to => { :action => :show } #verify :params => :text, :only => :preview, :redirect_to => { :action => :show }
verify :params => [:from, :to], :only => :diff, :redirect_to => { :action => :versions } #verify :params => [:from, :to], :only => :diff, :redirect_to => { :action => :versions }
#after_filter :cache_sweep, :only => [ :create, :update, :destroy, :move_up, #after_filter :cache_sweep, :only => [ :create, :update, :destroy, :move_up,
# :move_down, :undelete ] # :move_down, :undelete ]

@ -73,7 +73,7 @@ module ApplicationHelper
def markup_help def markup_help
return "<div id='markup_help' style='display: none'>" + return "<div id='markup_help' style='display: none'>" +
File.read("#{RAILS_ROOT}/public/static/markup_help.mkd").format_wiki + File.read("#{Rails.root}/public/static/markup_help.mkd").format_wiki +
"</div>" "</div>"
end end

@ -16,10 +16,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
class String class String
include ActionView::Helpers::SanitizeHelper
def format_wiki def format_wiki
text = BlueCloth.new(self).to_html text = BlueCloth.new(self).to_html
text = Hpricot(text, :xhtml_strict => true).to_s text = Hpricot(text, :xhtml_strict => true).to_s
return text.sanitize unless text.blank? return sanitize text
end end
end end

@ -62,7 +62,7 @@ class Attachment < ActiveRecord::Base
# Salva o arquivo fisicamente no HD # Salva o arquivo fisicamente no HD
def after_save def after_save
@file_path = "#{RAILS_ROOT}/public/upload/#{course.id}/#{self.id}" @file_path = "#{Rails.root}/public/upload/#{course.id}/#{self.id}"
FileUtils.mkdir_p(File.dirname(@file_path)) FileUtils.mkdir_p(File.dirname(@file_path))
if @tmp_file if @tmp_file
@ -75,7 +75,7 @@ class Attachment < ActiveRecord::Base
# Deleta o arquivo # Deleta o arquivo
#def after_destroy #def after_destroy
# @file_path = "#{RAILS_ROOT}/public/upload/#{course.id}/#{self.id}" # @file_path = "#{Rails.root}/public/upload/#{course.id}/#{self.id}"
# File.delete(@file_path) if File.exists?(@file_path) # File.delete(@file_path) if File.exists?(@file_path)
#end #end

@ -21,6 +21,8 @@ require 'tempfile'
class WikiPage < ActiveRecord::Base class WikiPage < ActiveRecord::Base
attr_accessible :title, :front_page, :content, :description
# Plugins # Plugins
acts_as_paranoid acts_as_paranoid
acts_as_list :scope => 'course_id = #{course_id}' acts_as_list :scope => 'course_id = #{course_id}'

@ -2,6 +2,6 @@
%h1.title Modificar arquivo %h1.title Modificar arquivo
%p %p
- form_for :attachment, @attachment, :url => course_attachment_url, :html => { :method => 'put', :multipart => 'true' } do = form_for @attachment, :url => course_attachment_url, :html => { :method => 'put', :multipart => 'true' } do
= render :partial => 'form' = render :partial => 'form'
= submit_tag 'Editar', :accesskey => 'e' = submit_tag 'Editar', :accesskey => 'e'

@ -2,6 +2,6 @@
%h1.title Adicionar arquivo %h1.title Adicionar arquivo
%p %p
- form_for :attachment, @attachment, :url => course_attachments_url, :html => { :method => 'post', :multipart => 'true' } do = form_for @attachment, :url => course_attachments_url, :html => { :method => 'post', :multipart => 'true' } do
= render :partial => 'form' = render :partial => 'form'
= submit_tag "Criar", :accesskey => 'e' = submit_tag "Criar", :accesskey => 'e'

@ -2,6 +2,6 @@
%h1.title Editar disciplina %h1.title Editar disciplina
%p %p
- form_tag course_path(@course.id), :method => :put do = form_tag course_path(@course.id), :method => :put do
= render :partial => 'form' = render :partial => 'form'
= submit_tag 'Editar', :accesskey => 'e' = submit_tag 'Editar', :accesskey => 'e'

@ -1,6 +1,6 @@
%h4.title= App.title %h4.title= App.title
%h1.title Adicionar disciplina %h1.title Adicionar disciplina
- form_tag courses_url, :method => :post do = form_tag courses_url, :method => :post do
= render :partial => 'form' = render :partial => 'form'
= submit_tag "Cadastrar", :accesskey => 'e' = submit_tag "Cadastrar", :accesskey => 'e'

@ -2,6 +2,6 @@
%h1.title Editar evento %h1.title Editar evento
%p %p
- form_tag course_event_url(@course, @event), :method => :put do = form_tag course_event_url(@course, @event), :method => :put do
= render :partial => 'form' = render :partial => 'form'
= submit_tag 'Editar', :accesskey => 'e' = submit_tag 'Editar', :accesskey => 'e'

@ -2,6 +2,6 @@
%h1.title Adicionar evento %h1.title Adicionar evento
%p %p
- form_tag course_events_url(@course), :method => :post do = form_tag course_events_url(@course), :method => :post do
= render :partial => 'form' = render :partial => 'form'
= submit_tag "Adicionar", :accesskey => 'e' = submit_tag "Adicionar", :accesskey => 'e'

@ -1,11 +1,11 @@
- @title = "#{App.title} - #{h(@course.full_name)}" - @title = "#{App.title} - #{h(@course.full_name)}"
- @location = capture do - @location = capture do
= link_to(App.title, index_url, :accesskey => 'z') + "&rsaquo;" = link_to(App.title, index_url, :accesskey => 'z') + ""
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + ""
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + ""
= link_to("Arquivos", course_attachments_url(@course)) = link_to("Arquivos", course_attachments_url(@course))
- if @attachment.id - if @attachment.id
= "&rsaquo;" + link_to(truncate(h(@attachment.file_name)), course_attachment_url) = "" + link_to(truncate(h(@attachment.file_name)), course_attachment_url)
- @title = @title + " - #{truncate(h(@attachment.file_name))}" - @title = @title + " - #{truncate(h(@attachment.file_name))}"
- @left_panel = render 'courses/left_panel' - @left_panel = render 'courses/left_panel'

@ -1,9 +1,9 @@
- @title = "#{App.title}" - @title = "#{App.title}"
- @location = capture do - @location = capture do
= link_to(App.title, index_url, :accesskey => 'z') + "&rsaquo;"; = link_to(App.title, index_url, :accesskey => 'z') + "";
= link_to("Disciplinas", courses_url) = link_to("Disciplinas", courses_url)
- if @course and @course.id - if @course and @course.id
= "&rsaquo; " + link_to(h(@course.full_name), course_url) = " " + link_to(h(@course.full_name), course_url)
- @title = @title + " - #{h(@course.full_name)}" - @title = @title + " - #{h(@course.full_name)}"
- else - else
- @title = @title + " - Disciplinas" - @title = @title + " - Disciplinas"

@ -1,8 +1,8 @@
- @title = "#{App.title} - #{h(@course.full_name)} - Calendário" - @title = "#{App.title} - #{h(@course.full_name)} - Calendário"
- @location = capture do - @location = capture do
= link_to(App.title, index_url, :accesskey => 'z') + "&rsaquo;" = link_to(App.title, index_url, :accesskey => 'z') + ""
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + ""
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + ""
= link_to("Calendário", course_events_url) = link_to("Calendário", course_events_url)
- @left_panel = render 'courses/left_panel' - @left_panel = render 'courses/left_panel'

@ -1,9 +1,9 @@
- if @course - if @course
- @title = "#{App.title} - #{h(@course.full_name)} - Mudanças recentes" - @title = "#{App.title} - #{h(@course.full_name)} - Mudanças recentes"
- @location = capture do - @location = capture do
= link_to(App.title, index_url, :accesskey => 'z') + "&rsaquo;" = link_to(App.title, index_url, :accesskey => 'z') + ""
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + ""
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + ""
= link_to("Mudanças Recentes", course_log_url(@course)) = link_to("Mudanças Recentes", course_log_url(@course))
- @left_panel = render 'courses/left_panel' - @left_panel = render 'courses/left_panel'
@ -12,7 +12,7 @@
- else - else
- @title = "#{App.title} - Mudanças recentes" - @title = "#{App.title} - Mudanças recentes"
- @location = capture do - @location = capture do
= link_to(App.title, index_url) + "&rsaquo;" = link_to(App.title, index_url) + ""
= link_to("Mudanças recentes", log_url) = link_to("Mudanças recentes", log_url)
- @content = yield - @content = yield

@ -1,8 +1,8 @@
- @title = "#{App.title} - #{h(@course.full_name)} - Notícias" - @title = "#{App.title} - #{h(@course.full_name)} - Notícias"
- @location = capture do - @location = capture do
= link_to(App.title, index_url, :accesskey => 'z') + "&rsaquo;" = link_to(App.title, index_url, :accesskey => 'z') + ""
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + ""
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + ""
= link_to("Noticias", course_news_url(@course)) = link_to("Noticias", course_news_url(@course))
- @left_panel = render 'courses/left_panel' - @left_panel = render 'courses/left_panel'

@ -1,9 +1,9 @@
- @title = App.title - @title = App.title
- @location = capture do - @location = capture do
= link_to(App.title, index_url, :accesskey => 'z') + "&rsaquo;"; = link_to(App.title, index_url, :accesskey => 'z') + "";
= link_to("Usuários", users_path) = link_to("Usuários", users_path)
- if @user and @user.id - if @user and @user.id
= "&rsaquo; " + link_to(h(@user.name), user_url(@user)) = " " + link_to(h(@user.name), user_url(@user))
- @title = @title + " - #{h(@user.display_name)}" - @title = @title + " - #{h(@user.display_name)}"
- @left_panel = render('widgets/menu_navigation') + render('widgets/menu_user') - @left_panel = render('widgets/menu_navigation') + render('widgets/menu_user')

@ -1,11 +1,11 @@
- @title = "#{App.title} - #{h(@course.full_name)}" - @title = "#{App.title} - #{h(@course.full_name)}"
- @location = capture do - @location = capture do
= link_to(App.title, index_url, :accesskey => 'z') + "&rsaquo;" = link_to(App.title, index_url, :accesskey => 'z') + ""
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + ""
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + ""
= link_to("Wiki", course_wiki_url(@course)) = link_to("Wiki", course_wiki_url(@course))
- if @wiki_page.title? - if @wiki_page.title?
= "&rsaquo;" + link_to(h(@wiki_page.title), course_wiki_instance_url(@course, @wiki_page)) = "" + link_to(h(@wiki_page.title), course_wiki_instance_url(@course, @wiki_page))
- @title = @title + " - #{h(@wiki_page.title)}" - @title = @title + " - #{h(@wiki_page.title)}"
- @left_panel = render 'courses/left_panel' - @left_panel = render 'courses/left_panel'

@ -2,6 +2,6 @@
%h1.title Editar noticia %h1.title Editar noticia
%p %p
- form_tag course_news_instance_url(@course, @news), :method => :put do = form_tag course_news_instance_url(@course, @news), :method => :put do
= render :partial => 'form' = render :partial => 'form'
= submit_tag 'Editar', :accesskey => 'e' = submit_tag 'Editar', :accesskey => 'e'

@ -1,6 +1,6 @@
%h4.title= @course.full_name %h4.title= @course.full_name
%h1.title Adicionar notícia %h1.title Adicionar notícia
- form_tag course_news_url, :method => :post do = form_tag course_news_url, :method => :post do
= render :partial => 'form' = render :partial => 'form'
= submit_tag "Adicionar", :accesskey => 'e' = submit_tag "Adicionar", :accesskey => 'e'

@ -4,7 +4,7 @@
<p> <p>
<%= error_messages_for 'user' %><br/> <%= error_messages_for 'user' %><br/>
<% form_tag :action => 'change_password' do %> <%= form_tag :action => 'change_password' do %>
<label for="user_password">Nova senha</label><br/> <label for="user_password">Nova senha</label><br/>
<%= password_field "user", "password", :size => 20, :value=>"" %><br/> <%= password_field "user", "password", :size => 20, :value=>"" %><br/>

@ -4,7 +4,7 @@
<p> <p>
<%= error_messages_for 'user' %><br/> <%= error_messages_for 'user' %><br/>
<% form_tag :action => 'update', :id => @user do %> <%= form_tag :action => 'update', :id => @user do %>
<label for="user_name">Nome</label><br/> <label for="user_name">Nome</label><br/>
<%= text_field "user", "name", :size => 20 %><br/> <%= text_field "user", "name", :size => 20 %><br/>

@ -4,7 +4,7 @@
<p> <p>
<%= error_messages_for 'user' %><br/> <%= error_messages_for 'user' %><br/>
<% form_tag :action=>'forgot_password' do %> <%= form_tag :action=>'forgot_password' do %>
Email<br/> Email<br/>
<%= text_field "user","email" %><br/><br/> <%= text_field "user","email" %><br/><br/>

@ -4,7 +4,7 @@
<p> <p>
<%= error_messages_for 'user' %><br/> <%= error_messages_for 'user' %><br/>
<% form_tag :action=> "login" do %> <%= form_tag :action=> "login" do %>
<label for="user_login">Login:</label><br/> <label for="user_login">Login:</label><br/>
<%= text_field "user", "login", :size => 20 %><br/> <%= text_field "user", "login", :size => 20 %><br/>

@ -13,7 +13,7 @@
<% @news_messages.each do |n| %> <% @news_messages.each do |n| %>
<div class="line"> <div class="line">
<h4 class="left"><%= n.timestamp.strftime("%d de %B") %></h4> <h4 class="left"><%= n.timestamp.strftime("%d de %B") %></h4>
<h4><%= link_to h(n.course.full_name) , course_news_instance_url(n.course, n) %> &rsaquo; <h4><%= link_to h(n.course.full_name) , course_news_instance_url(n.course, n) %>
<a href="#" id="new_<%=n.id%>"><%= h(n.title) %></a></h4> <a href="#" id="new_<%=n.id%>"><%= h(n.title) %></a></h4>
<p id="new_desc_<%= n.id %>" style="display:none"> <p id="new_desc_<%= n.id %>" style="display:none">
@ -48,7 +48,7 @@
<% end %> <% end %>
<li> <li>
<div class="time"><%= event.time.strftime("%H:%M") %></div> <div class="time"><%= event.time.strftime("%H:%M") %></div>
<%= link_to h(event.course.full_name), course_event_url(event.course, event) %> &rsaquo; <%= link_to h(event.course.full_name), course_event_url(event.course, event) %>
<a href="#" id="event_<%= event.id %>"><%= h(event.title) %></a> <a href="#" id="event_<%= event.id %>"><%= h(event.title) %></a>
<div id="desc_<%= event.id %>" class="description" style="display:none"> <div id="desc_<%= event.id %>" class="description" style="display:none">

@ -2,7 +2,7 @@
<h1 class="title">Criar conta</h1> <h1 class="title">Criar conta</h1>
<p> <p>
<% form_tag :action=> "signup" do %> <%= form_tag :action=> "signup" do %>
<%= error_messages_for 'user' %><br/> <%= error_messages_for 'user' %><br/>

@ -19,7 +19,7 @@
%td.top.aright %td.top.aright
= n.timestamp.strftime("%d&nbsp;de&nbsp;%B") = n.timestamp.strftime("%d&nbsp;de&nbsp;%B")
%td %td
= link_to(h(n.course.full_name), course_url(n.course)) + " &rsaquo;" = link_to(h(n.course.full_name), course_url(n.course)) + " "
= link_to(h(n.title), course_news_instance_url(n.course, n)) = link_to(h(n.title), course_news_instance_url(n.course, n))
- unless n.body.empty? - unless n.body.empty?
%p= truncate(h(n.body), :length => 300) %p= truncate(h(n.body), :length => 300)
@ -42,7 +42,7 @@
%td.top %td.top
= n.time.strftime("%H:%M") = n.time.strftime("%H:%M")
%td.top %td.top
= link_to(h(n.course.full_name), course_url(n.course)) + " &rsaquo;" = link_to(h(n.course.full_name), course_url(n.course)) + " "
= link_to(h(n.title), course_event_url(n.course, n)) = link_to(h(n.title), course_event_url(n.course, n))
.box .box

@ -4,7 +4,7 @@
%h1.title Editar perfil %h1.title Editar perfil
%p %p
- form_tag user_path(@user.id), :method => 'put' do = form_tag user_path(@user.id), :method => 'put' do
= render :partial => 'form_profile' = render :partial => 'form_profile'
= submit_tag 'Editar', :accesskey => 'e' = submit_tag 'Editar', :accesskey => 'e'
%button#show_preview{:type => "button", :accesskey => 'v'} %button#show_preview{:type => "button", :accesskey => 'v'}

@ -4,7 +4,7 @@
%p %p
= error_messages_for :user = error_messages_for :user
- form_tag login_path do = form_tag login_path do
%dl %dl
%dt %dt
%label{:for => 'user_login'} Login %label{:for => 'user_login'} Login

@ -3,7 +3,7 @@
- if params[:key] - if params[:key]
%p= error_messages_for :user %p= error_messages_for :user
- form_tag recover_password_with_key_path(params[:key]) do = form_tag recover_password_with_key_path(params[:key]) do
%dl %dl
%dt %dt
%label{:for => 'user_login'} Login %label{:for => 'user_login'} Login
@ -27,7 +27,7 @@
%p Uma mensagem de confirmacão foi enviado para o seu email. %p Uma mensagem de confirmacão foi enviado para o seu email.
- else - else
- form_tag recover_password_path do = form_tag recover_password_path do
%dl %dl
%dt %dt
%label{:for => 'user_email'} Email %label{:for => 'user_email'} Email

@ -2,6 +2,6 @@
%h1.title Editar configurações %h1.title Editar configurações
%p %p
- form_tag settings_url do = form_tag settings_url do
= render :partial => 'form_settings' = render :partial => 'form_settings'
= submit_tag 'Editar', :accesskey => 'e' = submit_tag 'Editar', :accesskey => 'e'

@ -2,6 +2,6 @@
%h1.title Nova conta %h1.title Nova conta
%p %p
- form_tag signup_path do = form_tag signup_path do
= render :partial => 'form_settings', :locals => { :signup => true } = render :partial => 'form_settings', :locals => { :signup => true }
= submit_tag 'Criar' = submit_tag 'Criar'

@ -7,7 +7,7 @@
<li>Carregando...</li> <li>Carregando...</li>
</ul> </ul>
<% if session[:user] %> <% if session[:user] %>
<% form_tag( <%= form_tag(
{:controller => 'message', :action => 'create'}, {:id => 'shoutbox_form' }) do %> {:controller => 'message', :action => 'create'}, {:id => 'shoutbox_form' }) do %>
<div> <div>
<%= text_area :message, :body %> <%= text_area :message, :body %>

@ -4,7 +4,7 @@
%h1.title= "Editar #{h(@wiki_page.title)}" %h1.title= "Editar #{h(@wiki_page.title)}"
%p %p
- form_tag course_wiki_instance_url(@course, @wiki_page.id), :method => :put do = form_tag course_wiki_instance_url(@course, @wiki_page.id), :method => :put do
= render :partial => 'form' = render :partial => 'form'
= submit_tag 'Salvar', :accesskey => 'e' = submit_tag 'Salvar', :accesskey => 'e'
%button#show_preview{:type => "button", :accesskey => 'v'} %button#show_preview{:type => "button", :accesskey => 'v'}

@ -4,7 +4,7 @@
%h1.title Adicionar página wiki %h1.title Adicionar página wiki
%p %p
- form_tag course_wiki_url(@course) do = form_tag course_wiki_url(@course) do
= render :partial => 'form' = render :partial => 'form'
= submit_tag "Criar", :accesskey => 'e' = submit_tag "Criar", :accesskey => 'e'
%button#show_preview{:type => "button", :accesskey => 'v'} %button#show_preview{:type => "button", :accesskey => 'v'}

@ -8,7 +8,7 @@
== radios_to = #{h(@history_to)}; == radios_to = #{h(@history_to)};
== radios_from = #{h(@history_from)}; == radios_from = #{h(@history_from)};
- form_tag diff_course_wiki_instance_url(@course, @wiki_page), :method => :get do = form_tag diff_course_wiki_instance_url(@course, @wiki_page), :method => :get do
%button{:type => "submit"}= "Comparar as versões selecionadas" %button{:type => "submit"}= "Comparar as versões selecionadas"
.box .box
%table %table

@ -10,6 +10,9 @@ end
module WikiUFC module WikiUFC
class Application < Rails::Application class Application < Rails::Application
#set :haml, { :escape_html => false }
config.encoding = "utf-8" config.encoding = "utf-8"
config.filter_parameters += [:password] config.filter_parameters += [:password]
config.active_support.escape_html_entities_in_json = true config.active_support.escape_html_entities_in_json = true
@ -76,3 +79,9 @@ module WikiUFC
end end
App = WikiUFC::Application.config App = WikiUFC::Application.config
require "haml"
require "haml/template"
Haml::Template.options[:escape_attrs] = false
Haml::Template.options[:escape_html] = false

@ -3,3 +3,8 @@ require File.expand_path('../application', __FILE__)
# Initialize the rails application # Initialize the rails application
WikiUFC::Application.initialize! WikiUFC::Application.initialize!
#
# Carrega as classes Message e LogEntry. O lazy loading do Rails gera
# problemas se voce definir varias classes por arquivos.
require "./app/models/message.rb"
require "./app/models/log_entry.rb"

@ -1,64 +0,0 @@
class Fixnum
def is_numeric?
true
end
end
class String
def is_numeric?
Float self rescue false
end
def html_escape
ERB::Util::html_escape(self)
end
%w[auto_link excerpt highlight sanitize simple_format strip_tags truncate word_wrap].each do |method|
eval "def #{method}(*args); ActionController::Base.helpers.#{method}(self, *args); end"
end
def pretty_url
self.mb_chars.normalize(:kd).
gsub(/[^\x00-\x7F]/n,'').
gsub(/[^a-z._0-9 -]/i,"").
gsub(/ +/,"_").
downcase.to_s
end
end
class Array
def add_condition! (condition, conjunction = 'AND')
if String === condition
add_condition!([condition])
elsif Hash === condition
add_condition!([condition.keys.map { |attr| "#{attr}=?" }.join(' AND ')] + condition.values)
elsif Array === condition
self[0] = "(#{self[0]}) #{conjunction} (#{condition.shift})" unless empty?
(self << condition).flatten!
else
raise "don't know how to handle this condition type"
end
self
end
end
module ActiveRecord
module Acts
module Versioned
module ClassMethods
def acts_as_paranoid_versioned
# protect the versioned model
self.versioned_class.class_eval do
def self.delete_all(conditions = nil); return; end
end
end
end
end
end
end
# Carrega as classes Message e LogEntry. O lazy loading do Rails gera
# problemas se voce definir varias classes por arquivos.
#require "#{RAILS_ROOT}/app/models/message.rb"
#require "#{RAILS_ROOT}/app/models/log_entry.rb"

@ -16,7 +16,7 @@ module AuthenticationSystem
def login_by_html def login_by_html
if !logged_in? if !logged_in?
flash[:warning] = 'You must be logged in to access this section of the site'[:login_required] flash[:warning] = 'You must be logged in to access this section of the site'[:login_required]
session[:return_to] = request.request_uri session[:return_to] = request.fullpath
redirect_to login_url redirect_to login_url
end end
end end

@ -0,0 +1,75 @@
class Fixnum
def is_numeric?
true
end
end
class String
def is_numeric?
Float self rescue false
end
#def html_escape
# ERB::Util::html_escape(self)
#end
#%w[auto_link excerpt highlight sanitize simple_format strip_tags truncate word_wrap].each do |method|
# eval "def #{method}(*args); ActionController::Base.helpers.#{method}(self, *args); end"
#end
def pretty_url
self.mb_chars.normalize(:kd).
gsub(/[^\x00-\x7F]/n,'').
gsub(/[^a-z._0-9 -]/i,"").
gsub(/ +/,"_").
downcase.to_s
end
end
#class Array
# def add_condition! (condition, conjunction = 'AND')
# if String === condition
# add_condition!([condition])
# elsif Hash === condition
# add_condition!([condition.keys.map { |attr| "#{attr}=?" }.join(' AND ')] + condition.values)
# elsif Array === condition
# self[0] = "(#{self[0]}) #{conjunction} (#{condition.shift})" unless empty?
# (self << condition).flatten!
# else
# raise "don't know how to handle this condition type"
# end
# self
# end
#end
#module ActiveRecord
# module Acts
# module Versioned
# module ClassMethods
# def acts_as_paranoid_versioned
# # protect the versioned model
# self.versioned_class.class_eval do
# def self.delete_all(conditions = nil); return; end
# end
# end
# end
# end
# end
#end
# disable XSS protection
module CustomHtmlSafe
def html_safe?
true
end
end
class ActionView::OutputBuffer
include CustomHtmlSafe
end
class ActionView::SafeBuffer
include CustomHtmlSafe
end
class String
include CustomHtmlSafe
end