Suporte a enderecos relativos

master
Alinson S. Xavier 18 years ago
parent 5e4951fa47
commit c5cb69f277

@ -82,7 +82,7 @@ class UsersController < ApplicationController
@user.save! @user.save!
@color = @user.pref_color @color = @user.pref_color
flash[:message] = 'Settings updated'[] flash[:message] = 'Settings updated'[]
redirect_to '/' redirect_to index_path
end end
end end
@ -103,7 +103,7 @@ class UsersController < ApplicationController
def logout def logout
destroy_session destroy_session
flash[:message] = 'You have logged out'[:logout_success] flash[:message] = 'You have logged out'[:logout_success]
redirect_to '/' redirect_to index_path
end end
def dashboard def dashboard

@ -1,6 +1,6 @@
- @title = "#{App.title} - #{h(@course.full_name)}" - @title = "#{App.title} - #{h(@course.full_name)}"
- @location = capture do - @location = capture do
= link_to(App.title, "/") + "&rsaquo;" = link_to(App.title, index_url) + "&rsaquo;"
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + "&rsaquo;"
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;"
= link_to("Arquivos", course_url(@course)) = link_to("Arquivos", course_url(@course))

@ -6,8 +6,12 @@
%title= @title || App.title %title= @title || App.title
%meta{'name' => 'robots', :content => 'noindex,nofollow'} %meta{'name' => 'robots', :content => 'noindex,nofollow'}
%meta{'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8'} %meta{'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8'}
%link{'href' => "/stylesheets/wiki.css", 'rel' => 'Stylesheet', 'type' => %'text/css'}
%link#css_color{'href' => "/stylesheets/themes/color.#@color.css", 'rel' => 'Stylesheet', 'type' => %'text/css'} %link{'href' => "#{App.base_path}/stylesheets/wiki.css", 'rel' => 'Stylesheet', 'type' => %'text/css'}
%link#css_color{'href' => "#{App.base_path}/stylesheets/themes/color.#@color.css", 'rel' => 'Stylesheet', 'type' => %'text/css'}
%script{:type => 'text/javascript'}
== BASE_PATH = "#{App.base_path}";
= javascript_include_merged :base = javascript_include_merged :base
%body{'onload' => 'javascript: startup()'} %body{'onload' => 'javascript: startup()'}

@ -1,6 +1,6 @@
- @title = "#{App.title}" - @title = "#{App.title}"
- @location = capture do - @location = capture do
= link_to(App.title, "/") + "&rsaquo;"; = link_to(App.title, index_url) + "&rsaquo;";
= 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) = "&rsaquo; " + link_to(h(@course.full_name), course_url)

@ -1,6 +1,6 @@
- @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, "/") + "&rsaquo;" = link_to(App.title, index_url) + "&rsaquo;"
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + "&rsaquo;"
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;"
= link_to("Calendário", course_events_url) = link_to("Calendário", course_events_url)

@ -1,6 +1,6 @@
- @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, "/") + "&rsaquo;" = link_to(App.title, index_url) + "&rsaquo;"
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + "&rsaquo;"
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;"
= link_to("Log", course_log_url(@course)) = link_to("Log", course_log_url(@course))

@ -1,6 +1,6 @@
- @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, "/") + "&rsaquo;" = link_to(App.title, index_url) + "&rsaquo;"
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + "&rsaquo;"
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;"
= link_to("Noticias", course_news_index_url(@course)) = link_to("Noticias", course_news_index_url(@course))

@ -1,6 +1,6 @@
- @title = App.title - @title = App.title
- @location = capture do - @location = capture do
= link_to(App.title, "/") + "&rsaquo;"; = link_to(App.title, index_url) + "&rsaquo;";
= 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)) = "&rsaquo; " + link_to(h(@user.name), user_url(@user))

@ -1,6 +1,6 @@
- @title = "#{App.title} - #{h(@course.full_name)}" - @title = "#{App.title} - #{h(@course.full_name)}"
- @location = capture do - @location = capture do
= link_to(App.title, "/") + "&rsaquo;" = link_to(App.title, index_url) + "&rsaquo;"
= link_to("Disciplinas", courses_url) + "&rsaquo;" = link_to("Disciplinas", courses_url) + "&rsaquo;"
= link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;" = link_to(h(@course.full_name), course_url(@course)) + "&rsaquo;"
= link_to("Wiki", course_url(@course)) = link_to("Wiki", course_url(@course))

@ -38,7 +38,7 @@ ul ul, ol ol {
} }
.content ul li { .content ul li {
background-image: url(/images/bullet.gif); background-image: url(<%= App.base_path %>/images/bullet.gif);
background-position: 0px 7px; background-position: 0px 7px;
background-repeat: no-repeat; background-repeat: no-repeat;
padding-left: 15px; padding-left: 15px;
@ -120,7 +120,7 @@ body {
font-weight: normal; font-weight: normal;
min-width: 780px; min-width: 780px;
background-image: url(/images/bg_body.png); background-image: url(<%= App.base_path %>/images/bg_body.png);
background-repeat: repeat-x; background-repeat: repeat-x;
background-color: #f4f4f4; background-color: #f4f4f4;
} }
@ -130,7 +130,7 @@ body {
} }
#header { #header {
background-image: url(/images/header_bg.png); background-image: url(<%= App.base_path %>/images/header_bg.png);
background-position: top; background-position: top;
background-repeat: repeat-x; background-repeat: repeat-x;
color: #eee; color: #eee;
@ -199,7 +199,7 @@ body {
#footer { #footer {
display: none; display: none;
background-image: url(/images/footer_bg.png); background-image: url(<%= App.base_path %>/images/footer_bg.png);
background-position: top; background-position: top;
background-repeat: repeat-x; background-repeat: repeat-x;
margin: 0em; margin: 0em;
@ -465,11 +465,11 @@ h4.title, h1.title {
line-height: 18px; line-height: 18px;
} }
.repositorio .mime_plain_text { background-image: url(/images/tango/text-x-generic.png); } .repositorio .mime_plain_text { background-image: url(<%= App.base_path %>/images/tango/text-x-generic.png); }
.repositorio .mime_presentation { background-image: url(/images/tango/x-office-presentation.png); } .repositorio .mime_presentation { background-image: url(<%= App.base_path %>/images/tango/x-office-presentation.png); }
.repositorio .mime_document { background-image: url(/images/tango/x-office-document.png); } .repositorio .mime_document { background-image: url(<%= App.base_path %>/images/tango/x-office-document.png); }
.repositorio .mime_binary { background-image: url(/images/tango/application-x-executable.png); } .repositorio .mime_binary { background-image: url(<%= App.base_path %>/images/tango/application-x-executable.png); }
.repositorio .mime_zip { background-image: url(/images/tango/package-x-generic.png); } .repositorio .mime_zip { background-image: url(<%= App.base_path %>/images/tango/package-x-generic.png); }
.spinner { .spinner {
float: right; float: right;
@ -607,7 +607,7 @@ textarea {
#wiki_preview { #wiki_preview {
background-image: url(/images/rascunho.png); background-image: url(<%= App.base_path %>/images/rascunho.png);
border: 2px solid #e4e4e4; border: 2px solid #e4e4e4;
padding: 10px; padding: 10px;
overflow: auto; overflow: auto;
@ -662,7 +662,7 @@ textarea {
border-top: 1px solid #bbb; border-top: 1px solid #bbb;
} }
xbody { background-image: url(/prototype/line.png); } xbody { background-image: url(<%= App.base_path %>/prototype/line.png); }
xhtml * { background-color: transparent !important; } xhtml * { background-color: transparent !important; }
.menu, .content, #location { .menu, .content, #location {

@ -57,7 +57,7 @@
} }
<% if @course %> <% if @course %>
url = '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month; url = BASE_PATH + '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month;
<% end %> <% end %>
spinner_start('calendar'); spinner_start('calendar');
@ -76,7 +76,7 @@
} }
<% if @course %> <% if @course %>
url = '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month; url = BASE_PATH + '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month;
<% end %> <% end %>
spinner_start('calendar'); spinner_start('calendar');

@ -3,5 +3,5 @@
%h1= "User"[].titleize %h1= "User"[].titleize
%ul %ul
/%li= link_to "Dashboard"[].titleize, dashboard_path /%li= link_to "Dashboard"[].titleize, dashboard_path
%li= link_to("User profile"[].titleize, user_url(session[:user_id])) %li= link_to("User profile"[].titleize, user_url(@current_user))
%li= link_to("Edit settings"[].titleize, settings_url) %li= link_to("Edit settings"[].titleize, settings_url)

@ -1,16 +1,17 @@
# Geral # Geral
App.language = "pt-br" App.language = "pt-br"
App.title = "Wiki UFC" App.title = "Wiki UFC"
App.base_path = ""
# Limites # Limites
App.max_upload_file_size = 5.megabytes App.max_upload_file_size = 5.megabytes
# Forum # Forum
App.forum_uri = "http://127.0.0.1:3001/" #App.forum_uri = "http://127.0.0.1:3001/"
# Tema # Tema
App.default_color = 6 App.default_color = 6
App.default_avatar = "http://engsoft.isoron.org/images/avatar.png" App.default_avatar = "http://wikiufc.gelsol.org/images/avatar.png"
App.color_schemes = [ App.color_schemes = [
# Default # Default
[ "#000", "#069", "#455", "#455" ], [ "#000", "#069", "#455", "#455" ],

@ -7,7 +7,6 @@ required_fields = %w(
language language
max_upload_file_size max_upload_file_size
default_color default_color
forum_uri
) )
# Carrega as configuracoes personalizadas # Carrega as configuracoes personalizadas

@ -1,4 +1,4 @@
require 'hpricot' require 'hpricot'
require 'icalendar' require 'icalendar'
require 'tzinfo' require 'tzinfo'
require 'assert_valid_xhtml' #require 'assert_valid_xhtml'

@ -1,7 +1,7 @@
# Carrega as classes Message e LogEntry. O lazy loading do Rails gera # Carrega as classes Message e LogEntry. O lazy loading do Rails gera
# problemas se voce definir varias classes por arquivos. # problemas se voce definir varias classes por arquivos.
require "app/models/message.rb" require "#{RAILS_ROOT}/app/models/message.rb"
require "app/models/log_entry.rb" require "#{RAILS_ROOT}/app/models/log_entry.rb"
class String class String
def is_numeric? def is_numeric?

@ -74,8 +74,9 @@ ActionController::Routing::Routes.draw do |map|
map.dashboard '/dashboard', :controller => 'users', :action => 'dashboard' map.dashboard '/dashboard', :controller => 'users', :action => 'dashboard'
# Stylesheets # Stylesheets
map.connect 'stylesheets/:action.:format', :controller => 'stylesheets'
map.connect 'stylesheets/themes/:action.:color.:format', :controller => 'stylesheets' map.connect 'stylesheets/themes/:action.:color.:format', :controller => 'stylesheets'
# Front page # Front page
map.connect '', :controller => 'courses', :action => 'index' map.index '', :controller => 'courses', :action => 'index'
end end

@ -29,7 +29,7 @@ RewriteEngine On
RewriteRule ^$ index.html [QSA] RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L] RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
# In case Rails experiences terminal errors # In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead # Instead of displaying this message you can supply a file here which will be rendered instead

@ -1,6 +1,6 @@
events['.color_radio:click'] = function(element, e) { events['.color_radio:click'] = function(element, e) {
style = document.createElement('link'); style = document.createElement('link');
style.rel = 'Stylesheet'; style.rel = 'Stylesheet';
style.href = "/stylesheets/themes/color." + element.value + ".css"; style.href = BASE_PATH + "/stylesheets/themes/color." + element.value + ".css";
$$('head')[0].appendChild(style); $$('head')[0].appendChild(style);
} }

@ -2,7 +2,7 @@ events['#show_preview:click'] = function(element, e)
{ {
spinner_start("preview"); spinner_start("preview");
new Ajax.Updater('wiki_preview', '/services/preview', { new Ajax.Updater('wiki_preview', BASE_PATH + '/services/preview', {
parameters: { parameters: {
text: $$('textarea')[0].value text: $$('textarea')[0].value
}, },