canvas-lms/app/views/sections/show.html.erb

253 lines
11 KiB
Plaintext
Raw Normal View History

2011-02-01 09:57:29 +08:00
<% content_for :page_title do %><%= @section.name %><% end %>
<% content_for :right_side do %>
<div class="rs-margin-all">
<% if can_do(@section, @current_user, :update) %>
<a href="#" class="button button-sidebar-wide edit_section_link"><%= image_tag "edit.png" %> <%= t('buttons.edit_section', 'Edit Section') %></a>
<% if @section.nonxlist_course_id %>
<% if can_do(@section.nonxlist_course, @current_user, :manage_sections) %>
<a href="#" class="button button-sidebar-wide uncrosslist_link"><%= image_tag "move.png" %> <%= t('buttons.uncrosslist_section', 'De-Cross-List this Section') %></a>
<% end %>
<a href="#" class="button button-sidebar-wide crosslist_link"><%= image_tag "move.png" %> <%= t('buttons.recrosslist_section', 'Re-Cross-List this Section') %></a>
<% else %>
<a href="#" class="button button-sidebar-wide crosslist_link"><%= image_tag "move.png" %> <%= t('buttons.crosslist_section', 'Cross-List this Section') %></a>
<% end %>
<% end %>
<a href="<%= context_url(@context, :context_details_url) %>" class="button button-sidebar-wide"><%= image_tag "back.png" %> <%= t('buttons.back_to_course', 'Back to Course Settings') %></a>
2011-02-01 09:57:29 +08:00
</div>
<% end %>
<% content_for :stylesheets do %>
<style>
#course_form .course_form {
display: none;
}
#course_form.editing .course_form {
display: inline;
}
#course_form.editing .course_info {
display: none;
}
#course_form .date_entry {
width: 100px;
}
ul.user_list {
list-style: none;
padding-left: 0px;
margin-top: 0px;
max-width: 400px;
}
ul.user_list li.user {
padding-left: 10px;
color: #444;
line-height: 1.5em;
-moz-border-radius: 5px;
}
ul.user_list li.user:hover {
background-color: #eee;
}
ul.user_list li.user .email {
font-size: 0.8em;
margin: -5px 10px 5px;
}
ul.user_list li.user .section {
font-size: 0.8em;
margin: -5px 10px 5px;
}
ul.user_list li.user .short_name {
font-size: 0.8em;
margin: -2px 10px 0px;
}
ul.user_list li.user .enrollment_type {
font-size: 0.8em;
margin: -2px 10px 0px;
}
ul.user_list li.user .links {
float: right;
padding-right: 20px;
padding-top: 5px;
visibility: hidden;
}
ul.user_list li.user .links a {
text-decoration: none;
}
ul.user_list li.user:hover .links {
float: right;
padding-right: 20px;
visibility: visible;
}
ul.user_list li.user.pending {
color: #888;
font-style: italic;
}
h3 .tally {
font-family: arial,sans-serif;
font-size: 12px;
padding-left: 5px;
}
.associated_user {
display: none;
}
#edit_section_form {
margin-bottom: 20px;
}
</style>
<% end %>
<% form_for @section, :url => context_url(@context, :context_section_url, @section), :html => {:id => "edit_section_form", :style => "display: none;"} do |f| %>
<table class="formtable">
<tr>
<td><%= f.blabel :name, :en => "Section Name" %></td>
2011-02-01 09:57:29 +08:00
<td><%= f.text_field :name %></td>
</tr>
<% if @section.sis_source_id || can_do(@context.root_account, @current_user, :manage_sis) %>
<tr>
<td><%= f.blabel :sis_source_id, :en => "SIS ID" %></td>
<td>
<span class="course_form">
<% if can_do(@context.root_account, @current_user, :manage_sis) %>
<%= f.text_field :sis_source_id, :style => "width: 50px;", :title => "SIS ID", :value => @section.sis_source_id %>
<% else %>
<%= @section.sis_source_id %>
<% end %>
</span>
</td>
</tr>
<% end %>
<tr>
<td><%= f.blabel :start_at, :en => "Starts" %></td>
<td><%= f.text_field :start_at, :class => "datetime_field", :value => datetime_string(@section.start_at), :style => 'width: 120px;' %></td>
</tr>
<tr>
<td><%= f.blabel :end_at, :en => "Ends" %></td>
<td><%= f.text_field :end_at, :class => "datetime_field", :value => datetime_string(@section.end_at), :style => 'width: 120px;' %></td>
</tr>
<tr>
<td colspan="2">
<%= f.check_box :restrict_enrollments_to_section_dates %>
<%= f.label :restrict_enrollments_to_section_dates, t('access_limit', "Users can only participate in the course between these dates") %>
<div style="font-size: 0.8em; padding-left: 25px;">
<%= t('override_settings', 'This will override any term or course date settings.') %>
</div>
</td>
</tr>
2011-02-01 09:57:29 +08:00
<tr>
<td colspan="2">
<div class="button-container">
<button type="submit" class="button submit_button"><%= t('buttons.update_section', 'Update Section') %></button>
<button type="button" class="button cancel_button button-secondary"><%= t('buttons.cancel', 'Cancel') %></button>
2011-02-01 09:57:29 +08:00
</div>
</td>
</tr>
</table>
<% end %>
<h2 id="section_name"><%= @section.name %></h2>
<div style="margin-bottom: 20px;">
<div>
<%= t('enrollment', 'Enrollment', :count => (@current_enrollments + @completed_enrollments).length) %>
</div>
<% if @section && ( @section.sis_source_id || can_do(@context.root_account, @current_user, :manage_sis))%>
<div><%= before_label('sis_id', "SIS ID") %> <span class="sis_source_id"><%= @section.sis_source_id %></span></div>
<% end %>
<% if @section.start_at || @section.end_at %>
<div>
<% if @section.start_at && @section.end_at %>
<%= t('run_dates', 'Runs from %{start_date} to %{end_date}', :start_date => datetime_string(@section.start_at), :end_date => datetime_string(@section.end_at)) %>
<% elsif @section.end_at %>
<%= t('runs_until', 'Runs until %{end_date}', :end_date => datetime_string(@section.end_at)) %>
<% elsif @section.start_at %>
<%= t('run_from', 'Runs from %{start_date} with no end date', :start_date => datetime_string(@section.start_at)) %>
<% end %>
</div>
<div style="margin-left: 10px; font-size: 0.8em;">
<%= t('student_access_dates', 'Students can only access the course between these dates') if @section.restrict_enrollments_to_section_dates %>
</div>
<% end %>
</div>
<% if can_do @context, @current_user, :read_roster, :manage_students, :manage_admin_users %>
<% unless @current_enrollments.empty? %>
<h3><%= t('titles.current_enrollments', 'Current Enrollments') %></h3>
<ul class="user_list">
<% @current_enrollments.each do |enrollment| %>
<%= render :partial => "shared/enrollment", :object => enrollment, :locals => {:include_type => true} %>
<% end %>
</ul>
<% end %>
<% unless @completed_enrollments.empty? %>
<h2><%= t('titles.completed_enrollments', 'Completed Enrollments') %></h2>
<ul class="user_list">
<% @completed_enrollments.each do |enrollment| %>
<%= render :partial => "shared/enrollment", :object => enrollment, :locals => {:include_type => true} %>
<% end %>
</ul>
<% end %>
2011-02-01 09:57:29 +08:00
<% end %>
AMD Conversion "Trivial" JavaScript / CoffeeScript changes -------------------------------------------------- For the most part, all javascript was simply wrapped in `require` or `define`. The dependencies were found with a script that matched regexes in the files, it errs on the side of listing too many dependencies, so its worth double checking each file's dependencies (over time, anyway). i18n API changes -------------------------------------------------- No longer have to do I18n.scoped calls, just list i18n as a dependency with the scope and it's imported already scoped require ['i18n!some_scope'], (I18n) -> I18n.t 'im_scoped', 'I'm scoped!' JS bundling now done with r.js, not Jammit -------------------------------------------------- We don't use jammit to bundle JS anymore. Simply list dependencies for your JS modules in the file and RequireJS handles the rest. To optimize the JavaScript, first make sure you have node.js 0.4.12+ installed and then run: $ rake js:build The app defaults to the optimized build in production. You can use non-optimized in production by putting ?debug_assets=true in the url just like before. You can also test the optimized JavaScript in development with ?optimized_js=true. Significant changes -------------------------------------------------- These files have "real" changes to them (unlike the JavaScript that is simply wrapped in require and define). Worth taking a really close look at: - app/helpers/application_helper.rb - app/views/layouts/application.html.erb - config/assets.yml - config/build.js - lib/handlebars/handlebars.rb - lib/i18n_extraction/js_extractor.rb - lib/tasks/canvas.rake - lib/tasks/i18n.rake - lib/tasks/js.rake Change-Id: I4bc5ecb1231f331aaded0fef2bcc1f3a9fe482a7 Reviewed-on: https://gerrit.instructure.com/6986 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Ryan Florence <ryanf@instructure.com>
2011-11-11 00:31:45 +08:00
<% js_bundle :section %>
<div style="display: none;">
<% form_tag context_url(@context, :context_section_crosslist_url, @section.id), :id => "crosslist_course_form", :title => t('titles.crosslist_this_section', 'Cross-List this Section'), :method => :post do %>
<h2><%= t('titles.cross_listed_sections', 'Cross-List Section') %></h2>
<p>
<%= t('crosslist_description', %{
Cross-listing allows you to create a section in one account and
then move it to a course on a different account.
To cross-list this course, you'll need to find the course you
want to move it to, either using the search tool or by
entering the course's ID. }) %>
</p>
<table class="formtable">
<tr>
<td><label for="course_autocomplete_id_lookup"><%= before_label('search_for_course', "Search for Course") %> </label></td>
<td>
<a href="<%= context_url(@current_user, :context_manageable_courses_url, :format => :json) %>" id="course_autocomplete_url" style="display: none;">&nbsp;</a>
<a href="<%= context_url(@context, :context_section_confirm_crosslist_url, @section.id, "{{ id }}") %>" id="course_confirm_crosslist_url" style="display: none;">&nbsp;</a>
<input type="hidden" name="new_course_id" id="course_autocomplete_id"/>
<input type="text" id="course_autocomplete_id_lookup" style="width: 250px;"/>
</td>
</tr><tr>
<td><label for="course_id"><%= before_label('enter_course_id', "Or Enter the Course's ID") %></label></td>
<td>
<input type="text" id="course_id" style="width: 75px;"/>
</td>
</tr><tr>
<td colspan="2">
<div id="course_autocomplete_name_holder" style="margin-top: 20px;">
<%= before_label('labels.selected_course', 'Selected Course') %>
<div style="margin-left: 20px;">
<div id="course_autocomplete_name" style="font-weight: bold;"></div>
<div id="sis_id_holder" style="display: none;"><%= before_label('labels.sis_id', 'SIS ID') %> <span class="sis_id">&nbsp;</span></div>
<div id="account_name_holder" style="display: none;"><%= before_label('labels.account', 'Account') %> <span class="account_name"></span></div>
</div>
<div class="button-container">
<button type="submit" class="button submit_button"><%= t('buttons.crosslist_this_section', 'Cross-List This Section') %></button>
<button type="button" class="button button-secondary cancel_button"><%= t('buttons.cancel', 'Cancel') %></button>
</div>
</div>
</td>
</tr>
</table>
<% end %>
<% form_tag context_url(@context, :context_section_uncrosslist_url, @section.id), :id => "uncrosslist_form", :title => t('titles.decrosslist_section', 'De-Cross-List this Section'), :method => :delete do %>
<h2><%= t('titles.decrosslist_section', 'De-Cross-List this Section') %></h2>
<p>
<%= t('prompts.are_you_sure_decrosslist', 'Are you sure you want to de-cross-list this section?') %>
<% if @section.nonxlist_course %>
<%= mt('decrosslist_description', 'This will move the section back to its original course, **%{course_name}**.', :course_name => @section.nonxlist_course.name) %>
<% end %>
</p>
<% if @student_enrollments.length > 0 %>
<p>
<%= t('decrosslist_long_description', %{
All grades for students in this course will no longer be visible.
You can retrieve the grades later by re-cross-listing the course,
but in the mean time the grades for these students will come from the original course.
}) %>
</p>
<% end %>
<div class="button-container">
<button type="submit" class="button submit_button"><%= t('buttons.decrosslit_section', 'De-Cross-List This Section') %></button>
<button type="button" class="button button-secondary cancel_button"><%= t('buttons.cancel', 'Cancel') %></button>
</div>
<% end %>
</div>