diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2c74d6b..1c0e739 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -82,7 +82,7 @@ class UsersController < ApplicationController @user.save! @color = @user.pref_color flash[:message] = 'Settings updated'[] - redirect_to '/' + redirect_to index_path end end @@ -103,7 +103,7 @@ class UsersController < ApplicationController def logout destroy_session flash[:message] = 'You have logged out'[:logout_success] - redirect_to '/' + redirect_to index_path end def dashboard diff --git a/app/views/layouts/attachments.html.haml b/app/views/layouts/attachments.html.haml index 099734b..00077b3 100644 --- a/app/views/layouts/attachments.html.haml +++ b/app/views/layouts/attachments.html.haml @@ -1,6 +1,6 @@ - @title = "#{App.title} - #{h(@course.full_name)}" - @location = capture do - = link_to(App.title, "/") + "›" + = link_to(App.title, index_url) + "›" = link_to("Disciplinas", courses_url) + "›" = link_to(h(@course.full_name), course_url(@course)) + "›" = link_to("Arquivos", course_url(@course)) diff --git a/app/views/layouts/base.html.haml b/app/views/layouts/base.html.haml index c31ec4a..74c061e 100644 --- a/app/views/layouts/base.html.haml +++ b/app/views/layouts/base.html.haml @@ -6,8 +6,12 @@ %title= @title || App.title %meta{'name' => 'robots', :content => 'noindex,nofollow'} %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 %body{'onload' => 'javascript: startup()'} diff --git a/app/views/layouts/courses.html.haml b/app/views/layouts/courses.html.haml index a3e0019..44d0a76 100644 --- a/app/views/layouts/courses.html.haml +++ b/app/views/layouts/courses.html.haml @@ -1,6 +1,6 @@ - @title = "#{App.title}" - @location = capture do - = link_to(App.title, "/") + "›"; + = link_to(App.title, index_url) + "›"; = link_to("Disciplinas", courses_url) - if @course and @course.id = "› " + link_to(h(@course.full_name), course_url) diff --git a/app/views/layouts/events.html.haml b/app/views/layouts/events.html.haml index a2efb03..fbb0b26 100644 --- a/app/views/layouts/events.html.haml +++ b/app/views/layouts/events.html.haml @@ -1,6 +1,6 @@ - @title = "#{App.title} - #{h(@course.full_name)} - Calendário" - @location = capture do - = link_to(App.title, "/") + "›" + = link_to(App.title, index_url) + "›" = link_to("Disciplinas", courses_url) + "›" = link_to(h(@course.full_name), course_url(@course)) + "›" = link_to("Calendário", course_events_url) diff --git a/app/views/layouts/log.html.haml b/app/views/layouts/log.html.haml index 56a8a39..dc155df 100644 --- a/app/views/layouts/log.html.haml +++ b/app/views/layouts/log.html.haml @@ -1,6 +1,6 @@ - @title = "#{App.title} - #{h(@course.full_name)} - Mudanças recentes" - @location = capture do - = link_to(App.title, "/") + "›" + = link_to(App.title, index_url) + "›" = link_to("Disciplinas", courses_url) + "›" = link_to(h(@course.full_name), course_url(@course)) + "›" = link_to("Log", course_log_url(@course)) diff --git a/app/views/layouts/news.html.haml b/app/views/layouts/news.html.haml index 0a1ae24..9a17172 100644 --- a/app/views/layouts/news.html.haml +++ b/app/views/layouts/news.html.haml @@ -1,6 +1,6 @@ - @title = "#{App.title} - #{h(@course.full_name)} - Notícias" - @location = capture do - = link_to(App.title, "/") + "›" + = link_to(App.title, index_url) + "›" = link_to("Disciplinas", courses_url) + "›" = link_to(h(@course.full_name), course_url(@course)) + "›" = link_to("Noticias", course_news_index_url(@course)) diff --git a/app/views/layouts/users.html.haml b/app/views/layouts/users.html.haml index ed2ce4e..cb624df 100644 --- a/app/views/layouts/users.html.haml +++ b/app/views/layouts/users.html.haml @@ -1,6 +1,6 @@ - @title = App.title - @location = capture do - = link_to(App.title, "/") + "›"; + = link_to(App.title, index_url) + "›"; = link_to("Usuários", users_path) - if @user and @user.id = "› " + link_to(h(@user.name), user_url(@user)) diff --git a/app/views/layouts/wiki.html.haml b/app/views/layouts/wiki.html.haml index 36fc72e..761338e 100644 --- a/app/views/layouts/wiki.html.haml +++ b/app/views/layouts/wiki.html.haml @@ -1,6 +1,6 @@ - @title = "#{App.title} - #{h(@course.full_name)}" - @location = capture do - = link_to(App.title, "/") + "›" + = link_to(App.title, index_url) + "›" = link_to("Disciplinas", courses_url) + "›" = link_to(h(@course.full_name), course_url(@course)) + "›" = link_to("Wiki", course_url(@course)) diff --git a/public/stylesheets/wiki.css b/app/views/stylesheets/wiki.css.erb similarity index 91% rename from public/stylesheets/wiki.css rename to app/views/stylesheets/wiki.css.erb index 91d3c57..31ef5e4 100644 --- a/public/stylesheets/wiki.css +++ b/app/views/stylesheets/wiki.css.erb @@ -38,7 +38,7 @@ ul ul, ol ol { } .content ul li { - background-image: url(/images/bullet.gif); + background-image: url(<%= App.base_path %>/images/bullet.gif); background-position: 0px 7px; background-repeat: no-repeat; padding-left: 15px; @@ -120,7 +120,7 @@ body { font-weight: normal; 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-color: #f4f4f4; } @@ -130,7 +130,7 @@ body { } #header { - background-image: url(/images/header_bg.png); + background-image: url(<%= App.base_path %>/images/header_bg.png); background-position: top; background-repeat: repeat-x; color: #eee; @@ -199,7 +199,7 @@ body { #footer { display: none; - background-image: url(/images/footer_bg.png); + background-image: url(<%= App.base_path %>/images/footer_bg.png); background-position: top; background-repeat: repeat-x; margin: 0em; @@ -465,11 +465,11 @@ h4.title, h1.title { line-height: 18px; } -.repositorio .mime_plain_text { background-image: url(/images/tango/text-x-generic.png); } -.repositorio .mime_presentation { background-image: url(/images/tango/x-office-presentation.png); } -.repositorio .mime_document { background-image: url(/images/tango/x-office-document.png); } -.repositorio .mime_binary { background-image: url(/images/tango/application-x-executable.png); } -.repositorio .mime_zip { background-image: url(/images/tango/package-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(<%= App.base_path %>/images/tango/x-office-presentation.png); } +.repositorio .mime_document { background-image: url(<%= App.base_path %>/images/tango/x-office-document.png); } +.repositorio .mime_binary { background-image: url(<%= App.base_path %>/images/tango/application-x-executable.png); } +.repositorio .mime_zip { background-image: url(<%= App.base_path %>/images/tango/package-x-generic.png); } .spinner { float: right; @@ -607,7 +607,7 @@ textarea { #wiki_preview { - background-image: url(/images/rascunho.png); + background-image: url(<%= App.base_path %>/images/rascunho.png); border: 2px solid #e4e4e4; padding: 10px; overflow: auto; @@ -662,7 +662,7 @@ textarea { 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; } .menu, .content, #location { diff --git a/app/views/widgets/calendario.html.erb b/app/views/widgets/calendario.html.erb index a9f2c72..640ba84 100644 --- a/app/views/widgets/calendario.html.erb +++ b/app/views/widgets/calendario.html.erb @@ -57,7 +57,7 @@ } <% if @course %> - url = '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month; + url = BASE_PATH + '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month; <% end %> spinner_start('calendar'); @@ -76,7 +76,7 @@ } <% if @course %> - url = '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month; + url = BASE_PATH + '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month; <% end %> spinner_start('calendar'); diff --git a/app/views/widgets/menu_user.html.haml b/app/views/widgets/menu_user.html.haml index 1655b9f..6421041 100644 --- a/app/views/widgets/menu_user.html.haml +++ b/app/views/widgets/menu_user.html.haml @@ -3,5 +3,5 @@ %h1= "User"[].titleize %ul /%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) diff --git a/config/application.rb b/config/application.rb index ce9b04c..8adf06a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,16 +1,17 @@ # Geral App.language = "pt-br" App.title = "Wiki UFC" +App.base_path = "" # Limites App.max_upload_file_size = 5.megabytes # Forum -App.forum_uri = "http://127.0.0.1:3001/" +#App.forum_uri = "http://127.0.0.1:3001/" # Tema 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 = [ # Default [ "#000", "#069", "#455", "#455" ], diff --git a/config/initializers/load_app_config.rb b/config/initializers/load_app_config.rb index 5e82e8d..aae4598 100644 --- a/config/initializers/load_app_config.rb +++ b/config/initializers/load_app_config.rb @@ -7,7 +7,6 @@ required_fields = %w( language max_upload_file_size default_color - forum_uri ) # Carrega as configuracoes personalizadas diff --git a/config/initializers/load_gems.rb b/config/initializers/load_gems.rb index bd55f4c..c3fddf5 100644 --- a/config/initializers/load_gems.rb +++ b/config/initializers/load_gems.rb @@ -1,4 +1,4 @@ require 'hpricot' require 'icalendar' require 'tzinfo' -require 'assert_valid_xhtml' +#require 'assert_valid_xhtml' diff --git a/config/initializers/nasty_hacks.rb b/config/initializers/nasty_hacks.rb index f9e82a7..b02a000 100644 --- a/config/initializers/nasty_hacks.rb +++ b/config/initializers/nasty_hacks.rb @@ -1,7 +1,7 @@ # 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" +require "#{RAILS_ROOT}/app/models/message.rb" +require "#{RAILS_ROOT}/app/models/log_entry.rb" class String def is_numeric? diff --git a/config/routes.rb b/config/routes.rb index b7be8a8..3df3dd1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -74,8 +74,9 @@ ActionController::Routing::Routes.draw do |map| map.dashboard '/dashboard', :controller => 'users', :action => 'dashboard' # Stylesheets + map.connect 'stylesheets/:action.:format', :controller => 'stylesheets' map.connect 'stylesheets/themes/:action.:color.:format', :controller => 'stylesheets' # Front page - map.connect '', :controller => 'courses', :action => 'index' + map.index '', :controller => 'courses', :action => 'index' end diff --git a/public/.htaccess b/public/.htaccess index d3c9983..2881e11 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -29,7 +29,7 @@ RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule ^(.*)$ dispatch.cgi [QSA,L] +RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] # In case Rails experiences terminal errors # Instead of displaying this message you can supply a file here which will be rendered instead @@ -37,4 +37,4 @@ RewriteRule ^(.*)$ dispatch.cgi [QSA,L] # Example: # ErrorDocument 500 /500.html -ErrorDocument 500 "