Initial import
This commit is contained in:
4
app/views/widgets/_color.html.haml
Normal file
4
app/views/widgets/_color.html.haml
Normal file
@@ -0,0 +1,4 @@
|
||||
.color_theme
|
||||
= radio_button('user', 'pref_color', App.color_schemes.index(color), :class => 'color_radio')
|
||||
- color.each do |c|
|
||||
.color_box{:style => "background-color: #{c}"}
|
||||
100
app/views/widgets/calendario.html.erb
Normal file
100
app/views/widgets/calendario.html.erb
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
<% if not @ajax %>
|
||||
<!-- Calendario -->
|
||||
<div class="menu">
|
||||
<%= image_tag "loading.gif", :id => "spinner_calendar",
|
||||
:class => "spinner", :style => "display:none" %>
|
||||
<div class="cmd">
|
||||
<%= action_icon 'add', 'Adicionar evento', new_course_event_url(@course) %>
|
||||
</div>
|
||||
<h1>Calendário</h1>
|
||||
<div id="calendar">
|
||||
<% end -%>
|
||||
<%=
|
||||
@year ||= Time.now.year
|
||||
@month ||= Time.now.month
|
||||
@events ||= @course.events
|
||||
|
||||
calendar({:year => @year, :month => @month, :table_class => 'calendario',
|
||||
:abbrev => (0..1) }) do |d|
|
||||
|
||||
cell_text = d.mday
|
||||
cell_attrs = {:class => 'day'}
|
||||
@events.each do |e|
|
||||
if e.date == d
|
||||
cell_attrs[:onclick] = "show_events('#{d.to_s}')"
|
||||
cell_attrs[:class] = 'specialDay'
|
||||
cell_text = link_to d.mday, "#"
|
||||
end
|
||||
end
|
||||
[cell_text, cell_attrs]
|
||||
end
|
||||
%>
|
||||
<% if not @ajax -%>
|
||||
</div>
|
||||
<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) %>.
|
||||
<%= h(e.title) %>. <%= h(e.description) %>
|
||||
</li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<% if not @ajax -%>
|
||||
<script type="text/javascript">
|
||||
calendar_year = <%= @year %>;
|
||||
calendar_month = <%= @month %>;
|
||||
|
||||
events['#calendar_next:click'] = function(element, e) {
|
||||
if(++calendar_month > 12) {
|
||||
calendar_month = 1;
|
||||
calendar_year++;
|
||||
}
|
||||
|
||||
<% if @course %>
|
||||
url = '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month;
|
||||
<% end %>
|
||||
|
||||
spinner_start('calendar');
|
||||
new Ajax.Updater('calendar', url, {
|
||||
onComplete: function() {
|
||||
spinner_stop('calendar');
|
||||
}
|
||||
});
|
||||
Event.stop(e);
|
||||
};
|
||||
|
||||
events['#calendar_prev:click'] = function(element, e) {
|
||||
if(--calendar_month < 1) {
|
||||
calendar_month = 12;
|
||||
calendar_year--;
|
||||
}
|
||||
|
||||
<% if @course %>
|
||||
url = '/widgets/calendar/<%= @course.id %>/' + calendar_year + '/' + calendar_month;
|
||||
<% end %>
|
||||
|
||||
spinner_start('calendar');
|
||||
new Ajax.Updater('calendar', url, {
|
||||
onComplete: function() {
|
||||
spinner_stop('calendar');
|
||||
}
|
||||
});
|
||||
|
||||
Event.stop(e);
|
||||
};
|
||||
|
||||
function show_events(e) {
|
||||
$$('.event_item').each(function(x) {
|
||||
if(x.match('.events_' + e)) x.show();
|
||||
else x.hide();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<% end -%>
|
||||
|
||||
10
app/views/widgets/menu_disciplina.html.erb
Normal file
10
app/views/widgets/menu_disciplina.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<!-- Menu Disciplina -->
|
||||
<div class="menu">
|
||||
<h1>Disciplina</h1>
|
||||
<ul>
|
||||
<li><%= link_to "Visão Geral", course_url(@course) %></li>
|
||||
<li><%= link_to "Noticias", course_news_index_url(@course) %></li>
|
||||
<li><%= link_to "Calendário", course_events_url(@course) %></li>
|
||||
<li><%= link_to "Mudanças recentes", course_log_url(@course) %></li>
|
||||
</ul>
|
||||
</div>
|
||||
5
app/views/widgets/menu_navigation.html.haml
Normal file
5
app/views/widgets/menu_navigation.html.haml
Normal file
@@ -0,0 +1,5 @@
|
||||
.menu
|
||||
%h1= App.title
|
||||
%ul
|
||||
%li= link_to "Courses"[].titleize, courses_url
|
||||
%li= link_to "Users"[].titleize, users_url
|
||||
7
app/views/widgets/menu_user.html.haml
Normal file
7
app/views/widgets/menu_user.html.haml
Normal file
@@ -0,0 +1,7 @@
|
||||
- if session[:user_id]
|
||||
.menu
|
||||
%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("Edit settings"[].titleize, settings_url)
|
||||
22
app/views/widgets/news.html.erb
Normal file
22
app/views/widgets/news.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<!-- Mural -->
|
||||
<div class="menu">
|
||||
<div class="cmd">
|
||||
<%= action_icon 'add', 'Adicionar notícia', new_course_news_url(@course) %>
|
||||
</div>
|
||||
<h1>Noticias</h1>
|
||||
<ul class="widget_news">
|
||||
<% @course.news[0..3].each do |msg| %>
|
||||
<li>
|
||||
<h4><%= tz(msg.timestamp).strftime("%d/%m") %></h4>
|
||||
<%= link_to msg.title, course_news_url(@course, msg) %>.
|
||||
<%= truncate(msg.body, 80) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if @course.news.size > 4 %>
|
||||
<li><%= link_to("Ver todas as notícias", course_news_index_url(@course)) %></li>
|
||||
<% end %>
|
||||
<% if @course.news.empty? %>
|
||||
<li class="no_itens">Nenhuma notícia</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
44
app/views/widgets/shoutbox.html.erb
Normal file
44
app/views/widgets/shoutbox.html.erb
Normal file
@@ -0,0 +1,44 @@
|
||||
<% receiver = @user ? @user : @course %>
|
||||
<!-- Shoutbox -->
|
||||
<div class="menu">
|
||||
<h1>Shoutbox</h1>
|
||||
<div id="shoutbox">
|
||||
<ul id="shoutbox_messages">
|
||||
<li>Carregando...</li>
|
||||
</ul>
|
||||
<% if session[:user] %>
|
||||
<% form_tag(
|
||||
{:controller => 'message', :action => 'create'}, {:id => 'shoutbox_form' }) do %>
|
||||
<div>
|
||||
<%= text_area :message, :body %>
|
||||
<%= hidden_field :message, :message_type, :value => (@user ? Message::USER_SHOUTBOX_MESSAGE : Message::SHOUTBOX_MESSAGE) %>
|
||||
<%= hidden_field :message, :receiver_id, :value => receiver.id %>
|
||||
<%= submit_tag 'Enviar', :id => 'shoutbox_send' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<i>Para enviar mensagens, é preciso fazer <%= link_to 'login', :controller => 'user', :action => 'login' %>.</i>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var updater = new Ajax.PeriodicalUpdater('shoutbox_messages',
|
||||
'<%= url_for :controller => 'message', :action => 'show_shoutbox' + (@user?'_user':''), :id => receiver.id %>',
|
||||
{ method: 'get', frequency: 10, decay: 1.5}
|
||||
);
|
||||
|
||||
events['#shoutbox_send:click'] = function(button, e) {
|
||||
Event.stop(e);
|
||||
button.disabled = true;
|
||||
$('shoutbox_form').request({
|
||||
method: 'post',
|
||||
onSuccess: function(t) {
|
||||
button.disabled = false;
|
||||
updater.stop();
|
||||
updater.start();
|
||||
$('shoutbox_form').reset();
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user