diff --git a/.hgignore b/.hgignore index 34bec3d..e312c88 100644 --- a/.hgignore +++ b/.hgignore @@ -3,4 +3,5 @@ public/images/sanscons/* public/upload/* *.db *.log +*.orig config/database.yml diff --git a/app/controllers/application.rb b/app/controllers/application_controller.rb similarity index 93% rename from app/controllers/application.rb rename to app/controllers/application_controller.rb index e0f6391..379fac2 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application_controller.rb @@ -21,7 +21,7 @@ class ApplicationController < ActionController::Base include AuthenticationSystem before_filter :startup - around_filter :set_timezone + before_filter :set_timezone # Força o login para algumas áreas do sistema before_filter :require_login, :only => [ :edit, :new, :create, :update, :delete, :destroy, :download ] @@ -62,10 +62,8 @@ class ApplicationController < ActionController::Base end def set_timezone - #TzTime.zone = session[:user].tz - TzTime.zone = TZInfo::Timezone.get("America/Fortaleza") - yield - TzTime.reset! + #Time.zone = session[:user].tz + Time.zone = "America/Fortaleza" end def startup diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 367620d..1619803 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -89,7 +89,7 @@ class AttachmentsController < ApplicationController def undelete @attachment = Attachment.find_with_deleted(params[:id]) - @attachment.update_attribute(:deleted_at, nil) + @attachment.recover! flash[:notice] = 'Attachment restored'[] AttachmentRestoreLogEntry.create!(:target_id => @attachment.id, :user => @current_user, :course => @attachment.course) redirect_to course_attachment_url(@attachment.course, @attachment) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 3bd5697..89c47a7 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -31,7 +31,6 @@ class CoursesController < ApplicationController @courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ?', @period]) end - respond_to do |format| format.html format.xml { render :xml => @courses } @@ -54,7 +53,7 @@ class CoursesController < ApplicationController respond_to do |format| format.html { redirect_to course_path(@course) } - format.xml { head :created, :location => formatted_course_url(@course, :xml) } + format.xml { head :created, :location => course_url(@course, :format => :xml) } end end diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index d9dbc1a..f301dde 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -51,7 +51,7 @@ class EventsController < ApplicationController respond_to do |format| format.html { redirect_to course_event_path(@course, @event) } - format.xml { head :created, :location => formatted_course_event_url(@course, @event, :xml) } + format.xml { head :created, :location => course_event_url(@course, @event, :format => :xml) } end end @@ -61,7 +61,7 @@ class EventsController < ApplicationController def update @event.attributes = params[:event] - dirty = @event.dirty? + dirty = @event.changed? @event.save! flash[:notice] = 'Event updated'[] @@ -69,7 +69,7 @@ class EventsController < ApplicationController respond_to do |format| format.html { redirect_to course_event_path(@course, @event) } - format.xml { head :created, :location => formatted_course_event_url(@course, @event, :xml) } + format.xml { head :created, :location => course_event_url(@course, @event, :format => :xml) } end end @@ -100,7 +100,7 @@ class EventsController < ApplicationController def undelete @event = Event.find_with_deleted(params[:id]) - @event.restore! + @event.recover! flash[:notice] = "Event restored"[] EventRestoreLogEntry.create!(:target_id => @event.id, :user => @current_user, :course => @event.course, :version => @event.version) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index e381aa0..ecf90dc 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -53,8 +53,8 @@ class NewsController < ApplicationController NewsCreateLogEntry.create!(:target_id => @news.id, :user => @current_user, :course => @course, :version => @news.version) respond_to do |format| - format.html { redirect_to course_news_path(@course, @news) } - format.xml { head :created, :location => formatted_course_news_url(@course, @news, :xml) } + format.html { redirect_to course_news_instance_path(@course, @news) } + format.xml { head :created, :location => course_news_instance_url(@course, @news, :format => :xml) } end end @@ -65,40 +65,40 @@ class NewsController < ApplicationController def update @news.attributes = params[:news] @news.timestamp = Time.now.utc - dirty = @news.dirty? + dirty = @news.changed? @news.save! flash[:notice] = 'News updated'[] NewsEditLogEntry.create!(:target_id => @news.id, :user => @current_user, :course => @course, :version => @news.version) if dirty respond_to do |format| - format.html { redirect_to course_news_path(@course, @news) } - format.xml { head :created, :location => formatted_course_news_url(@course, @news, :xml) } + format.html { redirect_to course_news_instance_path(@course, @news) } + format.xml { head :created, :location => course_news_instance_url(@course, @news, :format => :xml) } end end def destroy @news.destroy flash[:notice] = 'News removed'[] - flash[:undo] = undelete_course_news_url(@course, @news) + flash[:undo] = undelete_course_news_instance_url(@course, @news) NewsDeleteLogEntry.create!(:target_id => @news.id, :user => @current_user, :course => @course, :version => @news.version) respond_to do |format| - format.html { redirect_to course_news_index_path(@course) } + format.html { redirect_to course_news_path(@course) } format.xml { head :ok } end end def undelete @news = News.find_with_deleted(params[:id]) - @news.restore! + @news.recover! flash[:notice] = "News restored"[] NewsRestoreLogEntry.create!(:target_id => @news.id, :user => @current_user, :course => @news.course, :version => @news.version) respond_to do |format| - format.html { redirect_to course_news_url(@news.course, @news) } + format.html { redirect_to course_news_instance_url(@news.course, @news) } end end @@ -113,6 +113,6 @@ class NewsController < ApplicationController def cache_sweep expire_fragment(course_path(@course.id, :part => :right)) - expire_fragment(course_news_index_path(@course.id)) + expire_fragment(course_news_path(@course.id)) end end diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 88e8ab7..6366bc0 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -49,8 +49,8 @@ class WikiController < ApplicationController WikiCreateLogEntry.create!(:target_id => @wiki_page.id, :user => @current_user, :course => @course) respond_to do |format| - format.html { redirect_to course_wiki_path(@course, @wiki_page) } - format.xml { head :created, :location => formatted_course_wiki_url(@course, @wiki_page, :xml) } + format.html { redirect_to course_wiki_instance_url(@course, @wiki_page) } + format.xml { head :created, :location => course_wiki_instance_url(@course, @wiki_page, :format => :xml) } end end @@ -73,7 +73,7 @@ class WikiController < ApplicationController @wiki_page.attributes = params[:wiki_page] @wiki_page.user_id = session[:user_id] @wiki_page.course_id = @course.id - dirty = @wiki_page.dirty? + dirty = @wiki_page.changed? @wiki_page.save! WikiEditLogEntry.create!(:target_id => @wiki_page.id, :user => @current_user, :course => @course, :version => @wiki_page.version) if dirty @@ -81,15 +81,15 @@ class WikiController < ApplicationController flash[:notice] = "Wiki page updated"[] respond_to do |format| - format.html { redirect_to course_wiki_path(@course, @wiki_page) } - format.xml { head :created, :location => formatted_course_wiki_url(@course, @wiki_page, :xml) } + format.html { redirect_to course_wiki_instance_url(@course, @wiki_page) } + format.xml { head :created, :location => course_wiki_instance_url(@course, @wiki_page, :format => :xml) } end end def destroy @wiki_page.destroy flash[:notice] = "Wiki page removed"[] - flash[:undo] = url_for(:course_id => @course, :id => @wiki_page.id, :action => 'undelete') + flash[:undo] = undelete_course_wiki_instance_url(@course, @wiki_page.id) WikiDeleteLogEntry.create!(:target_id => @wiki_page.id, :user => @current_user, :course => @course) @@ -120,8 +120,9 @@ class WikiController < ApplicationController end def diff - @to = WikiPage.find_version(params[:id], params[:to]) - @from = WikiPage.find_version(params[:id], params[:from]) + @wiki_page = WikiPage.find(params[:id]) + @to = @wiki_page.versions.find_by_version(params[:to]) + @from = @wiki_page.versions.find_by_version(params[:from]) @diff = WikiPage.diff(@from, @to) end @@ -147,13 +148,13 @@ class WikiController < ApplicationController def undelete @wiki_page = WikiPage.find_with_deleted(params[:id]) - @wiki_page.update_attribute(:deleted_at, nil) + @wiki_page.recover! flash[:notice] = "Wiki page restored"[] WikiRestoreLogEntry.create!(:target_id => @wiki_page.id, :user => @current_user, :course => @wiki_page.course) respond_to do |format| - format.html { redirect_to course_wiki_url(@wiki_page.course, @wiki_page) } + format.html { redirect_to course_wiki_instance_url(@wiki_page.course, @wiki_page) } end end @@ -167,7 +168,7 @@ class WikiController < ApplicationController end def cache_sweep - expire_fragment course_path(@course.id) - expire_fragment course_wiki_path(@course.id, @wiki_page.id) + expire_fragment course_url(@course.id) + expire_fragment course_wiki_instance_url(@course.id, @wiki_page.id) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5956880..e058b5c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -20,7 +20,9 @@ module ApplicationHelper # Converte para o timezone local def tz(time_at) - TzTime.zone.utc_to_local(time_at.utc) + #FIXME + #TzTime.zone.utc_to_local(time_at.utc) + time_at end FLASH_NAMES = [:notice, :warning, :message] @@ -59,6 +61,7 @@ module ApplicationHelper def highlight(name) return {:class => 'highlight'} if (flash[:highlight] == name) + return {} end def spinner(name) @@ -84,4 +87,8 @@ module ApplicationHelper html_options.merge!({:class => 'icon', :alt => description, :title => description}) link_to(image_tag("action/#{action_name}.gif", :title => description), options, html_options) end + + def format_period(period) + return "20#{period[0..1]}.#{period[2..2]}" + end end diff --git a/app/models/course.rb b/app/models/course.rb index b2e68e3..9e29db6 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -58,6 +58,6 @@ class Course < ActiveRecord::Base def to_param return self.short_name if self.period == App.current_period - return self.id + return self.id.to_s end end diff --git a/app/models/event.rb b/app/models/event.rb index e93efdc..3ff1948 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -19,7 +19,7 @@ class Event < ActiveRecord::Base # Plugins acts_as_paranoid acts_as_versioned :if_changed => [ :title, :description, :time ] - self.non_versioned_fields << 'deleted_at' + self.non_versioned_columns << 'deleted_at' # Associacoes belongs_to :course diff --git a/app/models/message.rb b/app/models/message.rb index 2d2e88d..52a5efc 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -19,7 +19,7 @@ class Message < ActiveRecord::Base # Plugins acts_as_paranoid acts_as_versioned :if_changed => [ :title, :body ] - self.non_versioned_fields << 'deleted_at' + self.non_versioned_columns << 'deleted_at' # Associacoes belongs_to :user, diff --git a/app/models/user.rb b/app/models/user.rb index ea561d7..ed288db 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -80,7 +80,7 @@ class User < ActiveRecord::Base end def to_param - self.login.match(/^[-_a-z0-9]*$/i).nil? ? self.id : self.login + self.login.match(/^[-_a-z0-9]*$/i).nil? ? self.id.to_s : self.login end protected diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index c4ee2e1..67be7cd 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -23,7 +23,8 @@ class WikiPage < ActiveRecord::Base acts_as_paranoid acts_as_list :scope => 'course_id = #{course_id}' acts_as_versioned :if_changed => [ :content, :description, :title ] - self.non_versioned_fields << 'position' + self.non_versioned_columns << 'position' + self.non_versioned_columns << 'deleted_at' # Associacoes belongs_to :course @@ -34,7 +35,6 @@ class WikiPage < ActiveRecord::Base validates_uniqueness_of :title, :scope => :course_id validates_format_of :title, :with => /^[^0-9]/ - def validate begin to_html @@ -48,7 +48,7 @@ class WikiPage < ActiveRecord::Base end def to_param - self.title.match(/^[-_a-z0-9]*$/i).nil? ? self.id : self.title + self.title.match(/^[-_a-z0-9]*$/i).nil? ? self.id.to_id : self.title end def WikiPage.diff(from, to) diff --git a/app/views/courses/_right_panel.html.haml b/app/views/courses/_right_panel.html.haml index 23f86b3..f768643 100644 --- a/app/views/courses/_right_panel.html.haml +++ b/app/views/courses/_right_panel.html.haml @@ -1,3 +1,3 @@ -# cache(course_path(@course.id, :part => :right)) do -= render 'widgets/calendario' -= render 'widgets/news' += render :file => 'widgets/calendario' += render :file => 'widgets/news' diff --git a/app/views/courses/new.html.haml b/app/views/courses/new.html.haml index 286b3d3..ab64add 100644 --- a/app/views/courses/new.html.haml +++ b/app/views/courses/new.html.haml @@ -1,6 +1,6 @@ %h4.title= App.title %h1.title Adicionar disciplina -- form_tag course_url(@course.id), :method => :post do +- form_tag courses_url, :method => :post do = render :partial => 'form' = submit_tag "Cadastrar" diff --git a/app/views/courses/show.html.haml b/app/views/courses/show.html.haml index fc0bda4..83bfad2 100644 --- a/app/views/courses/show.html.haml +++ b/app/views/courses/show.html.haml @@ -12,18 +12,18 @@ .box .cmd - = action_icon 'add', 'Adicionar página wiki', new_course_wiki_url(@course) + = action_icon 'add', 'Adicionar página wiki', new_course_wiki_instance_url(@course) %h3 Páginas Wiki %ul.wiki - @course.wiki_pages.each do |wiki| %li{highlight(wiki.id)} .cmd{:style => 'margin-bottom: -27px; margin-top: -9px;'} - =action_icon 'arrow2_n', 'Mover para cima', move_up_course_wiki_url(@course, wiki) unless wiki.first? - =action_icon 'arrow2_s', 'Mover para baixo', move_down_course_wiki_url(@course, wiki) unless wiki.last? + =action_icon 'arrow2_n', 'Mover para cima', move_up_course_wiki_instance_url(@course, wiki) unless wiki.first? + =action_icon 'arrow2_s', 'Mover para baixo', move_down_course_wiki_instance_url(@course, wiki) unless wiki.last? - if wiki.last? %span{:style => 'margin-right: 14px'}   - =link_to h(wiki.title), course_wiki_url(@course, wiki) + =link_to h(wiki.title), course_wiki_instance_url(@course, wiki) - if @course.wiki_pages.empty? %li.no_itens Nenhuma página wiki diff --git a/app/views/events/new.html.haml b/app/views/events/new.html.haml index 881a181..711de09 100644 --- a/app/views/events/new.html.haml +++ b/app/views/events/new.html.haml @@ -2,6 +2,6 @@ %h1.title Adicionar evento %p - - form_tag course_event_url(@course, @event), :method => :post do + - form_tag course_events_url(@course), :method => :post do = render :partial => 'form' = submit_tag "Adicionar" diff --git a/app/views/events/show.html.haml b/app/views/events/show.html.haml index 4371609..f032578 100644 --- a/app/views/events/show.html.haml +++ b/app/views/events/show.html.haml @@ -1,2 +1,2 @@ - @events = @course.events -= render 'events/index' += render :file => 'events/index' diff --git a/app/views/layouts/base.html.haml b/app/views/layouts/_base.html.haml similarity index 100% rename from app/views/layouts/base.html.haml rename to app/views/layouts/_base.html.haml diff --git a/app/views/layouts/attachments.html.haml b/app/views/layouts/attachments.html.haml index 00077b3..f65513c 100644 --- a/app/views/layouts/attachments.html.haml +++ b/app/views/layouts/attachments.html.haml @@ -8,8 +8,8 @@ = "›" + link_to(truncate(h(@attachment.file_name)), course_attachment_url) - @title = @title + " - #{truncate(h(@attachment.file_name))}" -- @left_panel = render 'courses/_left_panel' -- @right_panel = render 'courses/_right_panel' +- @left_panel = render 'courses/left_panel' +- @right_panel = render 'courses/right_panel' - @content = yield = render 'layouts/base' diff --git a/app/views/layouts/courses.html.haml b/app/views/layouts/courses.html.haml index 44d0a76..877b85f 100644 --- a/app/views/layouts/courses.html.haml +++ b/app/views/layouts/courses.html.haml @@ -9,11 +9,10 @@ - @title = @title + " - Disciplinas" - if @course and @course.id -- @left_panel = render 'courses/_left_panel' -- @right_panel = render 'courses/_right_panel' + - @left_panel = render 'courses/left_panel' + - @right_panel = render 'courses/right_panel' - else -- @left_panel = render('widgets/menu_navigation') + render('widgets/menu_user') -- end + - @left_panel = render('widgets/menu_navigation') + render('widgets/menu_user') - @content = yield diff --git a/app/views/layouts/events.html.haml b/app/views/layouts/events.html.haml index fbb0b26..536a9ad 100644 --- a/app/views/layouts/events.html.haml +++ b/app/views/layouts/events.html.haml @@ -5,8 +5,8 @@ = link_to(h(@course.full_name), course_url(@course)) + "›" = link_to("Calendário", course_events_url) -- @left_panel = render 'courses/_left_panel' -- @right_panel = render 'courses/_right_panel' +- @left_panel = render 'courses/left_panel' +- @right_panel = render 'courses/right_panel' - @content = yield = render 'layouts/base' diff --git a/app/views/layouts/log.html.haml b/app/views/layouts/log.html.haml index aa08e8f..1a1a3b1 100644 --- a/app/views/layouts/log.html.haml +++ b/app/views/layouts/log.html.haml @@ -6,7 +6,7 @@ = link_to(h(@course.full_name), course_url(@course)) + "›" = link_to("Log", course_log_url(@course)) - - @left_panel = render 'courses/_left_panel' + - @left_panel = render 'courses/left_panel' - @content = yield - else diff --git a/app/views/layouts/news.html.haml b/app/views/layouts/news.html.haml index 87a7760..7ef6e2f 100644 --- a/app/views/layouts/news.html.haml +++ b/app/views/layouts/news.html.haml @@ -3,9 +3,9 @@ = 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)) + = link_to("Noticias", course_news_url(@course)) -- @left_panel = render 'courses/_left_panel' +- @left_panel = render 'courses/left_panel' - @content = yield = render 'layouts/base' diff --git a/app/views/layouts/wiki.html.haml b/app/views/layouts/wiki.html.haml index 761338e..3ce1a45 100644 --- a/app/views/layouts/wiki.html.haml +++ b/app/views/layouts/wiki.html.haml @@ -5,10 +5,10 @@ = link_to(h(@course.full_name), course_url(@course)) + "›" = link_to("Wiki", course_url(@course)) - if @wiki_page.title - = "›" + link_to(h(@wiki_page.title), course_wiki_url(@course, @wiki_page)) + = "›" + link_to(h(@wiki_page.title), course_wiki_instance_url(@course, @wiki_page)) - @title = @title + " - #{h(@wiki_page.title)}" -- @left_panel = render 'courses/_left_panel' +- @left_panel = render 'courses/left_panel' - @content = yield = render 'layouts/base' diff --git a/app/views/log/_news_log_entry.html.haml b/app/views/log/_news_log_entry.html.haml index 4e62139..fa50ade 100644 --- a/app/views/log/_news_log_entry.html.haml +++ b/app/views/log/_news_log_entry.html.haml @@ -1,4 +1,4 @@ -= "Notícia " + link_to(h(entry.news.title), course_news_url(entry.course, entry.news, :version => entry.version)) += "Notícia " + link_to(h(entry.news.title), course_news_instance_url(entry.course, entry.news, :version => entry.version)) = "criada " if entry.kind_of?(NewsCreateLogEntry) = "editada " if entry.kind_of?(NewsEditLogEntry) diff --git a/app/views/log/_wiki_log_entry.html.haml b/app/views/log/_wiki_log_entry.html.haml index 0a07d9f..322c759 100644 --- a/app/views/log/_wiki_log_entry.html.haml +++ b/app/views/log/_wiki_log_entry.html.haml @@ -1,24 +1,24 @@ - if entry.version - = "Página " + link_to(h(entry.wiki_page.title), course_wiki_url(entry.course, entry.wiki_page.id, :version => entry.version)) + = "Página " + link_to(h(entry.wiki_page.title), course_wiki_instance_url(entry.course, entry.wiki_page.id, :version => entry.version)) - else - = "Página " + link_to(h(entry.wiki_page.title), course_wiki_url(entry.course, entry.wiki_page.id)) + = "Página " + link_to(h(entry.wiki_page.title), course_wiki_instance_url(entry.course, entry.wiki_page.id)) = "criada " if entry.kind_of?(WikiCreateLogEntry) = "editada " if entry.kind_of?(WikiEditLogEntry) = "excluída " if entry.kind_of?(WikiDeleteLogEntry) = "restaurada " if entry.kind_of?(WikiRestoreLogEntry) -- current_version = WikiPage.find_version(entry.wiki_page.id, entry.version) -- previous_version = entry.wiki_page.previous_version(entry.version) +- current_version = entry.wiki_page.versions.find_by_version(entry.version) +- previous_version = current_version.previous - if entry.kind_of?(WikiEditLogEntry) - if current_version.description and !current_version.description.empty? = "(#{h(current_version.description)})" - unless previous_version.nil? - = "(" + link_to("diff", diff_course_wiki_url(entry.course, entry.wiki_page.id, :from => previous_version.version, :to => entry.version)) + ")" + = "(" + link_to("diff", diff_course_wiki_instance_url(entry.course, entry.wiki_page.id, :from => previous_version.version, :to => entry.version)) + ")" - = "(" + link_to("edit", edit_course_wiki_url(entry.course, entry.wiki_page.id, :description => "Revertendo para versão #{entry.version}", :version => entry.version)) + ")" + = "(" + link_to("edit", edit_course_wiki_instance_url(entry.course, entry.wiki_page.id, :description => "Revertendo para versão #{entry.version}", :version => entry.version)) + ")" - unless previous_version.nil? - = "(" + link_to("undo", edit_course_wiki_url(entry.course, entry.wiki_page.id, :description => "Revertendo para versão #{previous_version.version}", :version => previous_version.version)) + ")" + = "(" + link_to("undo", edit_course_wiki_instance_url(entry.course, entry.wiki_page.id, :description => "Revertendo para versão #{previous_version.version}", :version => previous_version.version)) + ")" diff --git a/app/views/log/index.html.haml b/app/views/log/index.html.haml index b0a38b1..c5b522b 100644 --- a/app/views/log/index.html.haml +++ b/app/views/log/index.html.haml @@ -1,8 +1,8 @@ %h4.title= @course ? h(@course.full_name) : App.title %h1.title Mudanças recentes -- if @course - = auto_discovery_link_tag :rss, formatted_course_log_url(@course, :rss) +-# if @course + =# auto_discovery_link_tag :rss, course_log_url(@course.id, :format => :rss) .box %table @@ -15,7 +15,7 @@ - @log_entries.each do |entry| %tr %td= tz(entry.created_at).strftime("%d/%m/%y %H:%M:%S") - %td= link_to truncate(h(entry.user.display_name), 20), user_path(entry.user) + %td= link_to truncate(h(entry.user.display_name), :length => 20), user_url(entry.user.id) - unless @course %td= link_to h(entry.course.short_name), course_url(entry.course) %td= render(:partial => 'log/log_entry', :locals => { :entry => entry }) diff --git a/app/views/news/edit.html.haml b/app/views/news/edit.html.haml index 9bb1c9d..1a1a1a2 100644 --- a/app/views/news/edit.html.haml +++ b/app/views/news/edit.html.haml @@ -2,6 +2,6 @@ %h1.title Editar noticia %p - - form_tag course_news_url(@course, @news), :method => :put do + - form_tag course_news_instance_url(@course, @news), :method => :put do = render :partial => 'form' = submit_tag 'Editar' diff --git a/app/views/news/index.html.haml b/app/views/news/index.html.haml index 577c144..0ccff31 100644 --- a/app/views/news/index.html.haml +++ b/app/views/news/index.html.haml @@ -1,14 +1,14 @@ = javascript_include_tag 'news' --# cache(course_news_index_path(@course.id)) do +-# cache(course_news_path(@course.id)) do .cmd - = action_icon 'add', 'Adicionar', new_course_news_url + = action_icon 'add', 'Adicionar', new_course_news_instance_url %h4.title= h(@course.full_name) %h1.title Notícias -= auto_discovery_link_tag :rss, formatted_course_news_index_url(@course, :rss) += auto_discovery_link_tag :rss, course_news_url(@course, :format => :rss) .box.div_news - if !@course.news.empty? @@ -21,11 +21,11 @@ %td.top.aright{:width => '1%'} = n.timestamp.strftime("%d de %B") %td - .title= link_to h(n.title), course_news_url(@course, n) + .title= link_to h(n.title), course_news_instance_url(@course, n) .description{:style => (n.id == params[:id].to_i ? '' : 'display: none')} .cmd - = action_icon 'edit', 'Editar', edit_course_news_url(@course, n, :version => n.version) - = action_icon 'trash', 'Excluir', course_news_url(@course, n), :confirm => 'Tem certeza que deseja excluir?', :method => :delete + = action_icon 'edit', 'Editar', edit_course_news_instance_url(@course, n, :version => n.version) + = action_icon 'trash', 'Excluir', course_news_instance_url(@course, n), :confirm => 'Tem certeza que deseja excluir?', :method => :delete = formatted(n.body) = "Sem descrição" if n.body.empty? - else diff --git a/app/views/news/index.rss.builder b/app/views/news/index.rss.builder index 9f37a2a..fd562ff 100644 --- a/app/views/news/index.rss.builder +++ b/app/views/news/index.rss.builder @@ -2,7 +2,7 @@ xml.instruct! :xml, :version=>"1.0" xml.rss(:version=>"2.0") do xml.channel do xml.title("#{App.title} - #{@course.full_name} - " + "News"[].titleize) - xml.link(course_news_index_url(@course)) + xml.link(course_news_url(@course)) xml.language(App.language) xml.description("{course} news"[:news_about, @course.full_name]) for news_item in @news @@ -10,8 +10,8 @@ xml.rss(:version=>"2.0") do xml.title(news_item.title) xml.description(formatted(news_item.body)) xml.pubDate(news_item.timestamp.rfc2822) - xml.link(course_news_url(@course, news_item)) - xml.guid(course_news_url(@course, news_item)) + xml.link(course_news_instance_url(@course, news_item)) + xml.guid(course_news_instance_url(@course, news_item)) end end end diff --git a/app/views/news/new.html.haml b/app/views/news/new.html.haml index 976a34b..5f915b2 100644 --- a/app/views/news/new.html.haml +++ b/app/views/news/new.html.haml @@ -1,6 +1,6 @@ %h4.title= @course.full_name %h1.title Adicionar notícia -- form_tag course_news_url(@course, @news), :method => :post do +- form_tag course_news_url, :method => :post do = render :partial => 'form' = submit_tag "Enviar" diff --git a/app/views/news/show.html.haml b/app/views/news/show.html.haml index c04d401..f69348c 100644 --- a/app/views/news/show.html.haml +++ b/app/views/news/show.html.haml @@ -1 +1 @@ -= render 'news/index' += render :file => 'news/index' diff --git a/app/views/user/show.html.erb b/app/views/user/show.html.erb index 87fa740..5b3c850 100644 --- a/app/views/user/show.html.erb +++ b/app/views/user/show.html.erb @@ -13,7 +13,7 @@ <% @news_messages.each do |n| %>

<%= n.timestamp.strftime("%d de %B") %>

-

<%= link_to h(n.course.full_name) , course_news_url(n.course, n) %> › +

<%= link_to h(n.course.full_name) , course_news_instance_url(n.course, n) %> › <%= h(n.title) %>

Disciplina

diff --git a/app/views/widgets/menu_navigation.html.haml b/app/views/widgets/_menu_navigation.html.haml similarity index 100% rename from app/views/widgets/menu_navigation.html.haml rename to app/views/widgets/_menu_navigation.html.haml diff --git a/app/views/widgets/menu_user.html.haml b/app/views/widgets/_menu_user.html.haml similarity index 100% rename from app/views/widgets/menu_user.html.haml rename to app/views/widgets/_menu_user.html.haml diff --git a/app/views/widgets/news.html.erb b/app/views/widgets/news.html.erb index 01a7924..74a4ef6 100644 --- a/app/views/widgets/news.html.erb +++ b/app/views/widgets/news.html.erb @@ -1,19 +1,19 @@