Paginas wiki, arquivos e disciplinas ocultas
This commit is contained in:
@@ -35,6 +35,7 @@ class AttachmentsController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
@attachment.course_id = @course.id
|
@attachment.course_id = @course.id
|
||||||
@attachment.path = params[:attachment][:path]
|
@attachment.path = params[:attachment][:path]
|
||||||
|
@attachment.front_page = params[:attachment][:front_page]
|
||||||
@attachment.description = params[:attachment][:description]
|
@attachment.description = params[:attachment][:description]
|
||||||
@attachment.file_name = "blank"
|
@attachment.file_name = "blank"
|
||||||
unless params[:attachment][:file].nil?
|
unless params[:attachment][:file].nil?
|
||||||
@@ -58,6 +59,7 @@ class AttachmentsController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
@attachment.path = params[:attachment][:path]
|
@attachment.path = params[:attachment][:path]
|
||||||
|
@attachment.front_page = params[:attachment][:front_page]
|
||||||
@attachment.description = params[:attachment][:description]
|
@attachment.description = params[:attachment][:description]
|
||||||
unless params[:attachment][:file].nil?
|
unless params[:attachment][:file].nil?
|
||||||
@attachment.file = params[:attachment][:file]
|
@attachment.file = params[:attachment][:file]
|
||||||
@@ -93,10 +95,11 @@ class AttachmentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
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 => 'attachment',
|
:disposition => 'inline',
|
||||||
:streaming => 'true')
|
:streaming => 'true')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ class CoursesController < ApplicationController
|
|||||||
@period = params[:period] || App.current_period
|
@period = params[:period] || App.current_period
|
||||||
|
|
||||||
if logged_in? and !@current_user.courses.empty?
|
if logged_in? and !@current_user.courses.empty?
|
||||||
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ? and id not in (?)', @period, @current_user.courses])
|
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ? and hidden = ? and id not in (?)', @period, false, @current_user.courses])
|
||||||
else
|
else
|
||||||
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ?', @period])
|
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ? and hidden = ?', @period, false])
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ class LogController < ApplicationController
|
|||||||
if @course
|
if @course
|
||||||
@log_entries = @course.log_entries.paginate(:page => params[:page], :per_page => 30, :order => "created_at desc")
|
@log_entries = @course.log_entries.paginate(:page => params[:page], :per_page => 30, :order => "created_at desc")
|
||||||
else
|
else
|
||||||
@log_entries = LogEntry.paginate(:page => params[:page], :per_page => 30, :order => "created_at desc")
|
@log_entries = LogEntry.paginate(:page => params[:page], :per_page => 30,
|
||||||
|
:conditions => [ "course_id not in (select id from courses where hidden = ?)", true],
|
||||||
|
:order => "created_at desc")
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class WikiController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to course_url(@course) }
|
format.html
|
||||||
format.xml { render :xml => @wiki_pages }
|
format.xml { render :xml => @wiki_pages }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ class Attachment < ActiveRecord::Base
|
|||||||
# Validacao
|
# Validacao
|
||||||
generate_validations
|
generate_validations
|
||||||
|
|
||||||
|
def self.find_front_page
|
||||||
|
Attachment.find(:all, :conditions => [ "front_page = ?", true ])
|
||||||
|
end
|
||||||
|
|
||||||
# Atributo virtual file
|
# Atributo virtual file
|
||||||
def file=(new_file)
|
def file=(new_file)
|
||||||
@tmp_file = new_file
|
@tmp_file = new_file
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ class Course < ActiveRecord::Base
|
|||||||
Course.find(:all, :conditions => [ 'short_name = ?', self.short_name], :limit => 4, :order => 'period desc')
|
Course.find(:all, :conditions => [ 'short_name = ?', self.short_name], :limit => 4, :order => 'period desc')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def recent_news
|
||||||
|
self.news.find(:all, :conditions => [ 'timestamp > ?', 7.days.ago ])
|
||||||
|
end
|
||||||
|
|
||||||
def after_create
|
def after_create
|
||||||
App.inital_wiki_pages.each do |page_title|
|
App.inital_wiki_pages.each do |page_title|
|
||||||
wiki_page = WikiPage.new(:title => page_title, :version => 1, :content => App.initial_wiki_page_content)
|
wiki_page = WikiPage.new(:title => page_title, :version => 1, :content => App.initial_wiki_page_content)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class NewsDeleteLogEntry < NewsLogEntry
|
|||||||
news.deleted?
|
news.deleted?
|
||||||
end
|
end
|
||||||
def undo!(current_user)
|
def undo!(current_user)
|
||||||
news.restore!
|
news.recover!
|
||||||
NewsRestoreLogEntry.create!(:target_id => news.id, :user_id => current_user.id, :course => news.course, :version => news.version)
|
NewsRestoreLogEntry.create!(:target_id => news.id, :user_id => current_user.id, :course => news.course, :version => news.version)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class WikiPage < ActiveRecord::Base
|
|||||||
acts_as_list :scope => 'course_id = #{course_id}'
|
acts_as_list :scope => 'course_id = #{course_id}'
|
||||||
acts_as_versioned :if_changed => [ :content, :description, :title ]
|
acts_as_versioned :if_changed => [ :content, :description, :title ]
|
||||||
acts_as_paranoid_versioned
|
acts_as_paranoid_versioned
|
||||||
|
self.non_versioned_columns << 'front_page'
|
||||||
self.non_versioned_columns << 'position'
|
self.non_versioned_columns << 'position'
|
||||||
self.non_versioned_columns << 'deleted_at'
|
self.non_versioned_columns << 'deleted_at'
|
||||||
self.non_versioned_columns << 'canonical_title'
|
self.non_versioned_columns << 'canonical_title'
|
||||||
@@ -43,6 +44,14 @@ class WikiPage < ActiveRecord::Base
|
|||||||
self.canonical_title = self.title.pretty_url
|
self.canonical_title = self.title.pretty_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def before_save
|
||||||
|
if !self.front_page
|
||||||
|
self.remove_from_list
|
||||||
|
elsif self.position.nil?
|
||||||
|
self.insert_at(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def validate
|
def validate
|
||||||
begin
|
begin
|
||||||
self.content.format_wiki
|
self.content.format_wiki
|
||||||
@@ -55,6 +64,10 @@ class WikiPage < ActiveRecord::Base
|
|||||||
self.canonical_title
|
self.canonical_title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.find_front_page
|
||||||
|
WikiPage.find(:all, :conditions => [ "front_page = ?", true ])
|
||||||
|
end
|
||||||
|
|
||||||
def WikiPage.diff(from, to)
|
def WikiPage.diff(from, to)
|
||||||
# Cria um arquivo com o conteudo da versao antiga
|
# Cria um arquivo com o conteudo da versao antiga
|
||||||
original_content_file = Tempfile.new("old")
|
original_content_file = Tempfile.new("old")
|
||||||
|
|||||||
@@ -13,4 +13,6 @@
|
|||||||
|
|
||||||
%dt
|
%dt
|
||||||
%label{:for => "attachment_description"} Descrição
|
%label{:for => "attachment_description"} Descrição
|
||||||
%dd= preserve(text_area 'attachment', 'description')
|
%dd= preserve(text_area 'attachment', 'description', {:rows => 10})
|
||||||
|
|
||||||
|
%dt= check_box('attachment', 'front_page') + " Exibir arquivo na página inicial do curso"
|
||||||
|
|||||||
15
app/views/attachments/index.html.haml
Normal file
15
app/views/attachments/index.html.haml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
.cmd
|
||||||
|
= action_icon 'add', 'Adicionar', new_course_attachment_url(@course)
|
||||||
|
|
||||||
|
%h4.title= h(@course.full_name)
|
||||||
|
%h1.title Repositório de Arquivos
|
||||||
|
|
||||||
|
.box.repositorio
|
||||||
|
- if !@course.attachments.empty?
|
||||||
|
%ul
|
||||||
|
= nested_attachments_to_html(attachments_to_nested_hash(@course.attachments))
|
||||||
|
|
||||||
|
- else
|
||||||
|
.box
|
||||||
|
%ul
|
||||||
|
%li.no_itens Nenhum arquivo
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
= action_icon 'trash', 'Excluir', course_attachment_url, :confirm => 'Tem certeza que deseja excluir o arquivo?', :method => :delete
|
= action_icon 'trash', 'Excluir', course_attachment_url, :confirm => 'Tem certeza que deseja excluir o arquivo?', :method => :delete
|
||||||
|
|
||||||
%h4.title= h(@attachment.course.full_name)
|
%h4.title= h(@attachment.course.full_name)
|
||||||
%h1.title Repositório
|
%h1.title Repositório de Arquivos
|
||||||
|
|
||||||
%p
|
%p
|
||||||
%dl
|
%dl
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
%label{:for => "course_period"} Data
|
%label{:for => "course_period"} Data
|
||||||
%dd= text_field 'course', 'period'
|
%dd= text_field 'course', 'period'
|
||||||
|
|
||||||
|
%dt
|
||||||
|
%label{:for => "course_hidden"} Ocultar
|
||||||
|
%dd= check_box 'course', 'hidden'
|
||||||
|
|
||||||
%dt
|
%dt
|
||||||
%label{:for => "course_description"} Descrição
|
%label{:for => "course_description"} Descrição
|
||||||
%dd= preserve(text_area('course', 'description', :cols => 60, :rows => 10))
|
%dd= preserve(text_area('course', 'description', :cols => 60, :rows => 10))
|
||||||
|
|||||||
@@ -10,13 +10,32 @@
|
|||||||
|
|
||||||
%p= @course.description.format_wiki
|
%p= @course.description.format_wiki
|
||||||
|
|
||||||
|
-#.box
|
||||||
|
-# .cmd
|
||||||
|
-# = action_icon 'add', 'Adicionar notícia', new_course_news_instance_url(@course)
|
||||||
|
-#
|
||||||
|
-# %h3 Notícias Recentes
|
||||||
|
-# %ul.news
|
||||||
|
-# - @course.recent_news.each do |news|
|
||||||
|
-# %li{highlight(news.id)}
|
||||||
|
-# .cmd{:style => 'margin-top: -9px;'}
|
||||||
|
-# = action_icon 'edit', 'Editar', edit_course_news_instance_url(@course, news, :version => news.version)
|
||||||
|
-# = action_icon 'trash', 'Excluir', course_news_instance_url(@course, news), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||||
|
-# = link_to h(news.title), course_news_instance_url(@course, news)
|
||||||
|
-# = formatted(news.body)
|
||||||
|
-# = "Enviada por %s há %s." % [link_to(news.user.display_name, user_url(news.user)), distance_of_time_in_words(Time.now, news.timestamp)]
|
||||||
|
-# - if @course.news.empty?
|
||||||
|
-# %li.no_itens Nenhuma notícia recente
|
||||||
|
-# - else
|
||||||
|
-# %li.see_all= link_to "Ver todas as noticias", course_news_url(@course)
|
||||||
|
|
||||||
.box
|
.box
|
||||||
.cmd
|
.cmd
|
||||||
= action_icon 'add', 'Adicionar página wiki', new_course_wiki_instance_url(@course)
|
= action_icon 'add', 'Adicionar página wiki', new_course_wiki_instance_url(@course)
|
||||||
|
|
||||||
%h3 Páginas Wiki
|
%h3 Páginas Wiki
|
||||||
%ul.wiki
|
%ul.wiki
|
||||||
- @course.wiki_pages.each do |wiki|
|
- @course.wiki_pages.find_front_page.each do |wiki|
|
||||||
%li{highlight(wiki.id)}
|
%li{highlight(wiki.id)}
|
||||||
.cmd{:style => 'margin-bottom: -27px; margin-top: -9px;'}
|
.cmd{:style => 'margin-bottom: -27px; margin-top: -9px;'}
|
||||||
=action_icon 'arrow2_n', 'Mover para cima', move_up_course_wiki_instance_url(@course, wiki) unless wiki.first?
|
=action_icon 'arrow2_n', 'Mover para cima', move_up_course_wiki_instance_url(@course, wiki) unless wiki.first?
|
||||||
@@ -26,14 +45,18 @@
|
|||||||
=link_to h(wiki.title), course_wiki_instance_url(@course, wiki)
|
=link_to h(wiki.title), course_wiki_instance_url(@course, wiki)
|
||||||
- if @course.wiki_pages.empty?
|
- if @course.wiki_pages.empty?
|
||||||
%li.no_itens Nenhuma página wiki
|
%li.no_itens Nenhuma página wiki
|
||||||
|
- else
|
||||||
|
%li.show_all= link_to "Ver todas as páginas wiki", course_wiki_url(@course)
|
||||||
|
|
||||||
.box
|
.box
|
||||||
.cmd= action_icon 'add', 'Adicionar anexo', new_course_attachment_url(@course)
|
.cmd= action_icon 'add', 'Adicionar anexo', new_course_attachment_url(@course)
|
||||||
|
|
||||||
%h3 Repositório de Arquivos
|
%h3 Repositório de Arquivos
|
||||||
.repositorio
|
.repositorio
|
||||||
= nested_attachments_to_html(attachments_to_nested_hash(@course.attachments))
|
= nested_attachments_to_html(attachments_to_nested_hash(@course.attachments.find_front_page))
|
||||||
- if @course.attachments.empty?
|
- if @course.attachments.empty?
|
||||||
%ul.wiki
|
%ul.wiki
|
||||||
%li.no_itens Nenhum arquivo
|
%li.no_itens Nenhum arquivo
|
||||||
|
- else
|
||||||
|
%li.show_all= link_to "Ver todos os arquivos", course_attachments_url(@course)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
= link_to(App.title, index_url) + "›"
|
= link_to(App.title, index_url) + "›"
|
||||||
= link_to("Disciplinas", courses_url) + "›"
|
= link_to("Disciplinas", courses_url) + "›"
|
||||||
= link_to(h(@course.full_name), course_url(@course)) + "›"
|
= link_to(h(@course.full_name), course_url(@course)) + "›"
|
||||||
= link_to("Arquivos", course_url(@course))
|
= link_to("Arquivos", course_attachments_url(@course))
|
||||||
- if @attachment.id
|
- if @attachment.id
|
||||||
= "›" + 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))}"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
= link_to(App.title, index_url) + "›"
|
= link_to(App.title, index_url) + "›"
|
||||||
= link_to("Disciplinas", courses_url) + "›"
|
= link_to("Disciplinas", courses_url) + "›"
|
||||||
= link_to(h(@course.full_name), course_url(@course)) + "›"
|
= link_to(h(@course.full_name), course_url(@course)) + "›"
|
||||||
= link_to("Wiki", course_url(@course))
|
= link_to("Wiki", course_wiki_url(@course))
|
||||||
- if @wiki_page.title
|
- if @wiki_page.title
|
||||||
= "›" + 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)}"
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
= javascript_include_tag 'news'
|
= javascript_include_tag 'news'
|
||||||
|
|
||||||
-# cache(course_news_path(@course.id)) do
|
|
||||||
|
|
||||||
.cmd
|
.cmd
|
||||||
= action_icon 'add', 'Adicionar', new_course_news_instance_url
|
= action_icon 'add', 'Adicionar', new_course_news_instance_url
|
||||||
|
|
||||||
@@ -22,7 +20,7 @@
|
|||||||
= n.timestamp.strftime("%d de %B")
|
= n.timestamp.strftime("%d de %B")
|
||||||
%td
|
%td
|
||||||
.title= link_to h(n.title), course_news_instance_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')}
|
.description
|
||||||
.cmd
|
.cmd
|
||||||
= action_icon 'edit', 'Editar', edit_course_news_instance_url(@course, n, :version => n.version)
|
= 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
|
= action_icon 'trash', 'Excluir', course_news_instance_url(@course, n), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ body {
|
|||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu li, .news li, #shoutbox li {
|
.menu li, #shoutbox li {
|
||||||
border-top: 1px solid #eee;
|
border-top: 1px solid #eee;
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
padding: 9px 10px;
|
padding: 9px 10px;
|
||||||
@@ -295,17 +295,10 @@ body {
|
|||||||
border-bottom: 0px solid #ccc;
|
border-bottom: 0px solid #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.widget_users li, .widget_news li, .widget_events li {
|
.widget_users li {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.widget_news li, #shoutbox li {
|
|
||||||
line-height: 18px;
|
|
||||||
margin: 0px; margin-top: -1px;
|
|
||||||
padding: 9px 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#shoutbox textarea {
|
#shoutbox textarea {
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
@@ -559,10 +552,16 @@ textarea {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.no_itens {
|
.no_itens, .see_all {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.box .see_all {
|
||||||
|
font-size: 11px;
|
||||||
|
background-image: none;
|
||||||
|
border-bottom-width: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.history input {
|
.history input {
|
||||||
margin: 0px 10px 0px 0px;
|
margin: 0px 10px 0px 0px;
|
||||||
@@ -889,6 +888,12 @@ ul.nested li {
|
|||||||
padding: 0px 0px 0px 18px;
|
padding: 0px 0px 0px 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.box li.show_all {
|
||||||
|
background-image: none;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*body { background-image: url(<%= App.base_path %>/prototype/line.png); background-repeat: repeat; }
|
/*body { background-image: url(<%= App.base_path %>/prototype/line.png); background-repeat: repeat; }
|
||||||
html * { background-color: transparent !important; }*/
|
html * { background-color: transparent !important; }*/
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
<h1>Disciplina</h1>
|
<h1>Disciplina</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li><%= link_to "Visão Geral", course_url(@course) %></li>
|
<li><%= link_to "Visão Geral", course_url(@course) %></li>
|
||||||
<li><%= link_to "Participantes", course_events_url(@course) %></li>
|
<li><%= link_to "Arquivos", course_attachments_url(@course) %></li>
|
||||||
<li><%= link_to "Notícias", course_news_url(@course) %></li>
|
|
||||||
<li><%= link_to "Calendário", course_events_url(@course) %></li>
|
<li><%= link_to "Calendário", course_events_url(@course) %></li>
|
||||||
|
<li><%= link_to "Notícias", course_news_url(@course) %></li>
|
||||||
|
<li><%= link_to "Participantes", course_events_url(@course) %></li>
|
||||||
|
<li><%= link_to "Páginas Wiki", course_wiki_url(@course) %></li>
|
||||||
<li><%= link_to "Mudanças recentes", course_log_url(@course) %></li>
|
<li><%= link_to "Mudanças recentes", course_log_url(@course) %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,3 +15,5 @@
|
|||||||
%dt
|
%dt
|
||||||
%label{:for => 'wiki_page_description'} Descrição das alterações
|
%label{:for => 'wiki_page_description'} Descrição das alterações
|
||||||
%dd= text_field('wiki_page', 'description', { :size => '80' })
|
%dd= text_field('wiki_page', 'description', { :size => '80' })
|
||||||
|
|
||||||
|
%dt= check_box('wiki_page', 'front_page') + " Exibir página wiki na página inicial do curso"
|
||||||
|
|||||||
16
app/views/wiki/index.html.haml
Normal file
16
app/views/wiki/index.html.haml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
.cmd
|
||||||
|
= action_icon 'add', 'Adicionar', new_course_wiki_instance_url(@course)
|
||||||
|
|
||||||
|
%h4.title= h(@course.full_name)
|
||||||
|
%h1.title Páginas Wiki
|
||||||
|
|
||||||
|
.box.div_news
|
||||||
|
- if !@course.wiki_pages.empty?
|
||||||
|
%ul
|
||||||
|
- @course.wiki_pages.find(:all, :order => 'title').each do |w|
|
||||||
|
%li= link_to(w.title, course_wiki_instance_url(@course, w))
|
||||||
|
|
||||||
|
- else
|
||||||
|
.box
|
||||||
|
%ul
|
||||||
|
%li.no_itens Nenhuma página wiki
|
||||||
13
db/migrate/20090908200528_hidden.rb
Normal file
13
db/migrate/20090908200528_hidden.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class Hidden < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
add_column :courses, :hidden, :boolean, :null => false, :default => false
|
||||||
|
add_column :wiki_pages, :front_page, :boolean, :null => false, :default => true
|
||||||
|
add_column :attachments, :front_page, :boolean, :null => false, :default => true
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
remove_column :courses, :hidden
|
||||||
|
remove_column :wiki_pages, :front_page
|
||||||
|
remove_column :attachments, :front_page
|
||||||
|
end
|
||||||
|
end
|
||||||
19
db/schema.rb
19
db/schema.rb
@@ -9,10 +9,10 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20090907095812) do
|
ActiveRecord::Schema.define(:version => 20090908200528) do
|
||||||
|
|
||||||
create_table "attachments", :force => true do |t|
|
create_table "attachments", :force => true do |t|
|
||||||
t.string "file_name", :null => false
|
t.string "file_name", :null => false
|
||||||
t.string "content_type"
|
t.string "content_type"
|
||||||
t.datetime "last_modified"
|
t.datetime "last_modified"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
@@ -20,6 +20,7 @@ ActiveRecord::Schema.define(:version => 20090907095812) do
|
|||||||
t.integer "course_id"
|
t.integer "course_id"
|
||||||
t.datetime "deleted_at"
|
t.datetime "deleted_at"
|
||||||
t.string "path"
|
t.string "path"
|
||||||
|
t.boolean "front_page", :default => true, :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "courses", :force => true do |t|
|
create_table "courses", :force => true do |t|
|
||||||
@@ -30,6 +31,7 @@ ActiveRecord::Schema.define(:version => 20090907095812) do
|
|||||||
t.datetime "deleted_at"
|
t.datetime "deleted_at"
|
||||||
t.integer "grade", :default => 1
|
t.integer "grade", :default => 1
|
||||||
t.string "period"
|
t.string "period"
|
||||||
|
t.boolean "hidden", :default => false, :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "courses", ["short_name"], :name => "index_courses_on_short_name"
|
add_index "courses", ["short_name"], :name => "index_courses_on_short_name"
|
||||||
@@ -137,17 +139,18 @@ ActiveRecord::Schema.define(:version => 20090907095812) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
create_table "wiki_pages", :force => true do |t|
|
create_table "wiki_pages", :force => true do |t|
|
||||||
t.integer "course_id", :null => false
|
t.integer "course_id", :null => false
|
||||||
t.integer "user_id", :null => false
|
t.integer "user_id", :null => false
|
||||||
t.integer "version", :null => false
|
t.integer "version", :null => false
|
||||||
t.string "description", :null => false
|
t.string "description", :null => false
|
||||||
t.string "title", :null => false
|
t.string "title", :null => false
|
||||||
t.text "content", :null => false
|
t.text "content", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "position"
|
t.integer "position"
|
||||||
t.datetime "deleted_at"
|
t.datetime "deleted_at"
|
||||||
t.string "canonical_title"
|
t.string "canonical_title"
|
||||||
|
t.boolean "front_page", :default => true, :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user