Mudancas no dashboard, calendario e noticias

This commit is contained in:
2008-03-04 07:05:15 -03:00
parent 9461dcaf66
commit 11473aa23a
16 changed files with 155 additions and 216 deletions

View File

@@ -8,13 +8,14 @@
.box
%ul
- if logged_in?
- unless @current_user.courses.empty?
%h3 Disciplinas matriculadas
- for course in @current_user.courses
%li{highlight(course.id)}
.right
= action_icon('subtract', 'Desmatricular-se', unenroll_course_url(course))
= link_to h(course.full_name), course_url(course)
%h3 Disciplinas Matriculadas
- if @current_user.courses.empty?
%li.no_itens Nenhuma disciplina matriculada
- for course in @current_user.courses
%li{highlight(course.id)}
.right
= action_icon('subtract', 'Desmatricular-se', unenroll_course_url(course))
= link_to h(course.full_name), course_url(course)
- old_period = 0
- for course in @courses

View File

@@ -6,12 +6,12 @@
%dd= text_field 'event', 'title'
%dt
%label{:for => "event_date"} Data
%dd= date_select 'event', 'date', :order => [:day, :month, :year]
%label{:for => "event_time"} Data
%dd= date_select 'event', 'time', :order => [:day, :month, :year]
%dt
%label{:for => "event_time"} Horário
%dd= time_select 'event', 'time'
%dd= time_select 'event', 'time', { :minute_step => 5 }
%dt
%label{:for => "event_description"} Descrição

View File

@@ -1,6 +1,8 @@
= javascript_include_tag 'events'
- cache do
- last_event = nil
- last_date = nil
.cmd
= action_icon 'add', 'Adicionar evento', new_course_event_url
@@ -9,31 +11,27 @@
%h1.title Calendário
.box.div_calendario
- if !@events.empty?
%table
- @events.each do |event|
%tr[event]
%td.top.aright{:width => '1%'}
= event.time.strftime("%d de %B") #unless event.time == last_date
%td.top{:width => '1%'}
= event.time.strftime("%H:%M")
%td.top
.title=link_to h(event.title), course_event_url(@course, event)
.description{:style => (event.id == params[:id].to_i ? '' : 'display: none')}
%div.cmd
= action_icon 'edit', 'Editar', edit_course_event_url(@course, event)
= action_icon 'trash', 'Excluir', course_event_url(@course, event), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
= h(event.description)
= "Sem descrição" if event.description.empty?
- @events.each do |event|
- if last_event != event.date
= "</ul></div>" if last_event
.date= event.date.strftime("%d de %B")
= "<div><ul>"
%li[event]
.time= event.time.strftime("%H:%M")
= link_to h(event.title), course_event_url(@course, event)
%div.description{:style => (event.id == params[:id].to_i ? '' : 'display: none')}
%div.cmd{:style => "height: 27px; margin-top: -27px;"}
= action_icon 'edit', 'Editar', edit_course_event_url(@course, event)
= action_icon 'trash', 'Excluir', course_event_url(@course, event), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
= h(event.description)
= "Sem descrição" if event.description.empty?
- last_event = event.date
= "</ul></div>" if !@events.empty?
- if @events.empty?
.box
%ul
%li.grey Nenhum evento
- last_date = event.time
- else
.box
%ul
%li.no_itens Nenhum evento
%br

View File

@@ -1,18 +1,19 @@
%h4.title= h(@course.full_name)
%h1.title Mudanças recentes
%table.log
%tr
%th Data
%th Usuário
%th Descrição
- @log_entries.each do |entry|
.box
%table
%tr
%td= entry.created_at.strftime("%d/%m/%y&nbsp;%H:%M:%S")
%td= link_to truncate(h(entry.user.display_name), 20), user_path(entry.user)
%td
= render(:partial => 'log/attachment_log_entry', :locals => { :entry => entry }) if entry.kind_of?(AttachmentLogEntry)
= render(:partial => 'log/event_log_entry', :locals => { :entry => entry }) if entry.kind_of?(EventLogEntry)
= render(:partial => 'log/news_log_entry', :locals => { :entry => entry }) if entry.kind_of?(NewsLogEntry)
= render(:partial => 'log/wiki_log_entry', :locals => { :entry => entry }) if entry.kind_of?(WikiLogEntry)
= "(" + link_to("undo", undo_course_log_url(@course, entry)) + ")" if entry.reversible?
%th Data
%th Usuário
%th Descrição
- @log_entries.each do |entry|
%tr
%td= entry.created_at.strftime("%d/%m/%y&nbsp;%H:%M:%S")
%td= link_to truncate(h(entry.user.display_name), 20), user_path(entry.user)
%td
= render(:partial => 'log/attachment_log_entry', :locals => { :entry => entry }) if entry.kind_of?(AttachmentLogEntry)
= render(:partial => 'log/event_log_entry', :locals => { :entry => entry }) if entry.kind_of?(EventLogEntry)
= render(:partial => 'log/news_log_entry', :locals => { :entry => entry }) if entry.kind_of?(NewsLogEntry)
= render(:partial => 'log/wiki_log_entry', :locals => { :entry => entry }) if entry.kind_of?(WikiLogEntry)
= "(" + link_to("undo", undo_course_log_url(@course, entry)) + ")" if entry.reversible?

View File

@@ -1,3 +1,5 @@
= javascript_include_tag 'news'
- cache do
.cmd
@@ -8,21 +10,22 @@
= auto_discovery_link_tag :rss, formatted_course_news_index_url(@course, :rss)
.news
- @course.news.each do |n|
.line{:class => 'new', :id => "news_#{n.id}"}
.cmd{:style => (n.id == params[:id].to_i ? '' : 'display: none')}
= action_icon 'edit', 'Editar', edit_course_news_url(@course, n)
= action_icon 'trash', 'Excluir', course_news_url(@course, n), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
.left= n.timestamp.strftime("%d de %B")
%h4
= link_to h(n.title), course_news_url(@course, n)
%p{:style => (n.id == params[:id].to_i ? '' : 'display: none')}
= h(n.body)
- if @course.news.empty?
.box.div_news
- if !@course.news.empty?
%table
- @course.news.each do |n|
%tr[n]
%td.top.aright
= n.timestamp.strftime("%d&nbsp;de&nbsp;%B")
%td
.title= link_to h(n.title), course_news_url(@course, n)
.description{:style => (n.id == params[:id].to_i ? '' : 'display: none')}
.cmd
= action_icon 'edit', 'Editar', edit_course_news_url(@course, n)
= action_icon 'trash', 'Excluir', course_news_url(@course, n), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
= h(n.body)
= "Sem descrição" if n.body.empty?
- else
.box
%ul
%li.grey Nenhuma notícia
%li.no_itens Nenhuma notícia

View File

@@ -254,9 +254,6 @@ body {
font-size: 24px;
}
.content p:first-child {
margin-top: 9px;
}
#innerwrapper_2column {
padding: 0em 0px 0em 208px;
@@ -388,7 +385,7 @@ h4.title, h1.title {
margin: 18px 0px;
}
.box h3, .box th {
.box h3 {
line-height: 34px;
margin: 0px;
border-bottom: 1px solid #eee;
@@ -408,37 +405,21 @@ h4.title, h1.title {
border-bottom: 1px solid #f4f4f4;
}
.div_calendario .date {
line-height: 36px;
width: 105px;
text-align: right;
float: left;
.div_calendario table, .div_news table {
width: 100%;
}
.div_calendario table tr td, .div_news table tr td {
padding-top: 9px;
padding-bottom: 9px;
}
.div_calendario ul {
padding-left: 115px;
margin-top: -1px;
margin-bottom: 0em;
border-top: 1px solid #eee;
list-style: none !important;
.div_calendario table tr td:first-child, .div_news table tr td:first-child {
padding-left: 18px;
}
.div_calendario li {
border-bottom: 1px solid #eee;
}
.div_calendario .time {
padding-right: 1em;
width: 3em;
float: left;
}
.div_calendario .description {
padding-left: 4em;
}
.news {
margin-top: 18px;
.div_calendario .cmd, .div_news .cmd {
margin-top: -9px;
line-weigth: 9px;
}
@@ -532,30 +513,6 @@ select {
margin-top: 9px;
}
.news .left {
float: left;
line-height: 18px;
margin: 0px;
width: 105px;
padding-top: 8px;
padding-right: 15px;
text-align: right;
}
.news h4 {
margin: 8px 0px;
padding: 0px;
}
.news p {
padding-left: 120px;
margin-top: 8px;
}
.news .line {
border-top: 1px solid #eee;
margin-bottom: 9px;
}
.history {
@@ -662,9 +619,6 @@ textarea {
border-top: 1px solid #bbb;
}
xbody { background-image: url(<%= App.base_path %>/prototype/line.png); }
xhtml * { background-color: transparent !important; }
.menu, .content, #location {
border-right: 2px solid #ddd;
border-bottom: 2px solid #ddd;
@@ -741,38 +695,40 @@ text-align: center;
margin-top: -1px;
}
ul.log li {
/*.box ul li {
border-top: 1px solid #eee;
padding: 4px 0px 4px 15px;
padding: 9px 0px 9px 15px;
background-position: 0px 12px;
}
}*/
table.log {
margin-top: 18px;
.box table {
margin-bottom: 2px;
border-collapse: collapse;
/*width: 100%;*/
}
table.log td {
.box table td {
border-top: 1px solid #eee;
padding: 4px 12px;
}
table.log th {
.box table th {
padding: 4px 12px;
border-top: 1px solid #eee;
font-weight: normal;
text-align: left;
}
.top { vertical-align: top; }
.center { text-align: center !important; }
.left { float: left !important; }
.right { float: right !important; }
.aright { text-align: right !important; }
.pagination {
margin: 18px 0px;
text-align: right;
}
.left { float: left !important; }
.right { float: right !important; }
.fieldWithErrors input, .fieldWithErrors textarea {
border: 2px solid #c00;
}
@@ -795,6 +751,13 @@ table.log th {
#wiki_text h3 { font-size: 12px; }
#wiki_text h4, #wiki_text h5, #wiki_text h6 { font-size: 11px; }
.box h3. {
margin-bottom: -9px;
margin-top: 18px;
padding-top: 9px;
font-weight: normal;
}
.content ol li {
background-image: none;
padding: 0px;
@@ -803,3 +766,24 @@ table.log th {
ul ul, ul ol, ol ul, ol ol {
margin: 0px;
}
li p, td p {
margin-top: 0px;
}
.dashboard td:first-child {
padding-left: 27px;
}
.dashboard table tr td {
padding-right: 9px;
}
.dashboard .box ul {
margin-bottom: 0px;
}
xbody { background-image: url(<%= App.base_path %>/prototype/line.png); background-repeat: repeat; }
xhtml * { background-color: transparent !important; }

View File

@@ -1,49 +0,0 @@
<% last_event = nil %>
<h4 class="title">Dashboard</h4>
<h1 class="title">Bem vindo, <%= h(@current_user.display_name) %></h1>
<!-- Noticias -->
<div class="news box">
<h3>Notícias recentes</h3>
<% @news.each do |n| %>
<div class="line">
<h4 class="left"><%= n.timestamp.strftime("%d de %B") %></h4>
<h4><%= link_to h(n.course.full_name) , course_url(n.course) %> &rsaquo;
<%= link_to h(n.title), course_news_url(n.course, n) %></h4>
</div>
<% end %>
</div>
<!-- Calendario -->
<div class="box div_calendario">
<h3>Próximos eventos</h3>
<% @events.each do |event| %>
<% if last_event != event.date %>
<% if last_event %></ul></div><% end %>
<div class="date"><%= event.date.strftime("%d de %B") %></div>
<div><ul>
<% end %>
<li>
<div class="time"><%= event.time.strftime("%H:%M") %></div>
<%= link_to h(event.course.full_name), course_url(event.course) %> &rsaquo;
<%= link_to h(event.title), course_event_url(event.course, event) %>
</li>
<% last_event = event.date %>
<% end %>
<%= "</ul></div>" if !@events.empty? %>
</div>
<!-- Disciplinas Matriculadas -->
<div class="box">
<h3>Disciplinas Matriculadas</h3>
<ul class="wiki">
<% @current_user.courses.each do |course| %>
<li><%= link_to h(course.full_name), course_url(course) %></li>
<% end %>
</ul>
</div>
<h4><%#= link_to 'Descadastrar usuário', :action => 'destroy'%></h4>

View File

@@ -21,7 +21,7 @@
cell_text = d.mday
cell_attrs = {:class => 'day'}
@events.each do |e|
if e.date == d
if e.time == d
cell_attrs[:onclick] = "show_events('#{d.to_s}')"
cell_attrs[:class] = 'specialDay'
cell_text = link_to d.mday, "#"
@@ -35,8 +35,8 @@
<div class="widget_events">
<ul>
<% @events.each do |e| -%>
<li style="display: none" class="event_item events_<%=e.date.to_s%>">
<%= link_to e.date.strftime("%d de %B"), course_event_url(@course, e) %>.
<li style="display: none" class="event_item events_<%=e.time.to_s%>">
<%= link_to e.time.strftime("%d de %B"), course_event_url(@course, e) %>.
<%= h(e.title) %>. <%= h(e.description) %>
</li>
<% end -%>

View File

@@ -2,6 +2,6 @@
.menu
%h1= "User"[].titleize
%ul
/%li= link_to "Dashboard"[].titleize, dashboard_path
%li= link_to "Dashboard"[].titleize, dashboard_path
%li= link_to("User profile"[].titleize, user_url(@current_user))
%li= link_to("Edit settings"[].titleize, settings_url)

View File

@@ -10,25 +10,26 @@
- form_tag diff_course_wiki_url(@course, @wiki_page), :method => :get do
%button{:type => "submit"}= "Comparar as versões selecionadas"
%table.log
%tr
%th.narrow &nbsp;
%th.narrow &nbsp;
%th Data
%th Usuário
%th Descrição
- @wiki_page.versions.reverse.each do |entry|
.box
%table
%tr
%td.narrow
%input{:type => "radio", :name => "from", :value => entry.version, :onclick => "history_from(#{entry.version})"}
%td.narrow
%input{:type => "radio", :name => "to", :value => entry.version, :onclick => %"history_to(#{entry.version})"}
%td= link_to(entry.updated_at.strftime("%d/%m/%y&nbsp;%H:%M:%S"), course_wiki_url(@course, @wiki_page, :version => entry.version))
%td= link_to truncate(h(entry.user.display_name), 20), user_path(entry.user)
%td
= entry.description
- if (entry.version > @wiki_page.versions.minimum(:version))
= "(" + link_to("diff", diff_course_wiki_url(@course, @wiki_page, :from => entry.version - 1, :to => entry.version)) + ")"
= "(" + link_to("edit", edit_course_wiki_url(@course, @wiki_page, :description => "Revertendo para versão #{entry.version}", :version => entry.version)) + ")"
%th.narrow &nbsp;
%th.narrow &nbsp;
%th Data
%th Usuário
%th Descrição
- @wiki_page.versions.reverse.each do |entry|
%tr
%td.narrow
%input{:type => "radio", :name => "from", :value => entry.version, :onclick => "history_from(#{entry.version})"}
%td.narrow
%input{:type => "radio", :name => "to", :value => entry.version, :onclick => %"history_to(#{entry.version})"}
%td= link_to(entry.updated_at.strftime("%d/%m/%y&nbsp;%H:%M:%S"), course_wiki_url(@course, @wiki_page, :version => entry.version))
%td= link_to truncate(h(entry.user.display_name), 20), user_path(entry.user)
%td
= entry.description
- if (entry.version > @wiki_page.versions.minimum(:version))
= "(" + link_to("diff", diff_course_wiki_url(@course, @wiki_page, :from => entry.version - 1, :to => entry.version)) + ")"
= "(" + link_to("edit", edit_course_wiki_url(@course, @wiki_page, :description => "Revertendo para versão #{entry.version}", :version => entry.version)) + ")"
/= will_paginate @versions