Permalink
Browse files

general form cleanup to work with the Blueprint CSS framework and add…

…ed a Delete button for Assignments
  • Loading branch information...
1 parent 19e81de commit bc8736d7ee68bdef0804b84e760539aab85e7232 @rnhurt committed Feb 4, 2009
@@ -77,8 +77,7 @@ def destroy
@assignment.destroy
respond_to do |format|
- format.html { redirect_to(assignments_url) }
- format.xml { head :ok }
+ format.html { redirect_to :action => 'show', :id => @assignment.course_id }
end
end
@@ -1,21 +1,23 @@
<table class='master sortable'>
<thead>
<tr>
- <th><%= link_to 'New', new_assignment_path( :course_id => @course.id ), :class => 'positive mini' %>
- Assignment Name <%= h '(' + @assignments.count.to_s + ')'%></th>
+ <th>Assignment Name <%= h '(' + @assignments.count.to_s + ')'%></th>
<th>Possible points</th>
<th>Due Date</th>
+ <th width='1'></th>
</tr>
</thead>
<tbody>
+ <tr><td colspan='0'><%= link_to 'Add New', new_assignment_path( :course_id => @course.id ), :class => 'standard' %></td></tr>
<% if @assignments.blank? %>
- <tr><td colspan='3'>No Assignments Found</td></tr>
+ <tr><td colspan='0'>No Assignments Found</td></tr>
<% else %>
<% for assignment in @assignments %>
<tr class="<%= cycle('odd', 'even') %>" onclick="location.href='<%= url_for( :action => :edit, :id => assignment.id ) %>'"/>
<%= content_tag :td, assignment.name %>
<%= content_tag :td, assignment.possible_points %>
<%= content_tag :td, assignment.due_date_formated %>
+ <td><%= button_to 'Delete', assignment, :method => :delete, :confirm => "Are you sure you want to delete\n\n '" + assignment.name + "'?" %></td>
</tr>
<% end %>
<% end %>
@@ -1,11 +1,13 @@
<div id='course_list'>
<table id='courses' class='master'>
<thead>
- <th><%= link_to '+', new_course_path, :class => 'positive mini' if current_controller?("courses")%> Name
- <%= "(#{@courses.length})" unless @courses.blank? %></th>
+ <th>Name <%= "(#{@courses.length})" unless @courses.blank? %></th>
<th>Term</th>
</thead>
<tbody>
+ <% if current_controller?('courses') then %>
+ <tr><td colspan='0'><%= link_to 'Add New Course', new_course_path, :class=>'standard' %></td></tr>
+ <% end %>
<% for course in @courses %>
<tr class="<%= cycle('odd', 'even') + (current_page?(:id => course) ? ' current' : '') %>"
onclick="location.href='<%= url_for( :action => :show, :id => course.id ) %>'"/>
@@ -9,7 +9,7 @@
<tr><th>Enrolled Students</th><tr>
</thead>
<tbody>
- <tr class='help'><td><--&nbsp; Choose a course from the list at the left</td></tr>
+ <tr class='help'><td><--&nbsp; Choose a course from the list at the left or add a new one</td></tr>
</tbody>
</table>
</div>
@@ -7,19 +7,19 @@
<div class="box">
<% form_for (@course) do |f| %>
<div class="spacer">
- <%= content_tag( :h1, "New Course" ) %>
+ <%= content_tag( :h1, "New Course" ) %>
</div>
<label><span>Name</span>
- <%= f.text_field :name, :class=>'input-text' %>
+ <%= f.text_field :name, :class=>'input-text' %>
</label>
<label><span>Grading Term</span>
- <%= collection_select :course, :term_id, Term.find(:all), :id, :name %>
+ <%= collection_select :course, :term_id, Term.find(:all), :id, :name %>
</label>
<label><span>Grading Scale</span>
- <%= collection_select :course, :grading_scale_id, GradingScale.find(:all), :id, :name %>
+ <%= collection_select :course, :grading_scale_id, GradingScale.find(:all), :id, :name %>
</label>
<div class="spacer">
@@ -4,28 +4,29 @@
<%= error_messages_for :course, :header_message => "Please Try Again!", :message => "We had some problems saving your changes:" %>
-<div class='span-10 last'>
+<div class='span-12 last box'>
<% form_for( @course, :url => {}, :html => {:id => 'edit_course'} ) do |f| %>
- <%#= content_tag( :h1, "#{@course.name}" ) %>
+ <label><span class='required'>Name</span>
+ <%= f.text_field :name %>
+ </label>
- <%= f.text_field :name %>
+ <label><span class='required'>Term</span>
+ <%= collection_select :course, :term_id, Term.find(:all), :id, :name %>
+ </label>
- <%#= collection_select :course, :course_type_id, CourseType.find(:all), :id, :name %>
-
- <%= collection_select :course, :term_id, Term.find(:all), :id, :name %>
-
- <%= collection_select :course, :grading_scale_id, GradingScale.find(:all), :id, :name %>
-
+ <label><span class='required'>Grading Scale</span>
+ <%= collection_select :course, :grading_scale_id, GradingScale.find(:all), :id, :name %>
+ </label>
<% end %>
- <%= observe_form :edit_course, :url => {:action => :update} %>
-</div>
+
+ <div class="spacer">
+ <%= button_to 'Delete Course', @course, :confirm => 'Are you sure?', :method => :delete, :class=>'negative' %>
+ <%#= link_to 'Cancel', {:action=> 'index', :controller=> 'users/'+user.class.name.tableize}, :class => 'standard' %>
+ </div>
-<div class='span-3 last'>
- <%= button_to 'Delete Course', @course, :confirm => 'Are you sure?', :method => :delete %>
+ <%= observe_form :edit_course, :url => {:action => :update} %>
</div>
-<hr>
-
<div class='span-16 last'>
<form id='class_of_form'>
<%= select_tag 'class_of', options_for_select(class_range.insert(0, 'Class Of ...'), ' '),
@@ -11,8 +11,6 @@
<%= stylesheet_link_tag 'menu' -%>
<%= stylesheet_link_tag 'local' -%>
- <%#= stylesheet_link_tag 'forms' -%>
- <%#= stylesheet_link_tag 'tables' -%>
<%= javascript_include_tag :defaults -%>
<%#= javascript_include_tag 'tablekit' -%>
@@ -1,117 +1,141 @@
-a{
- color:#0033CC;
-}
-input{
- font-family:"Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
- font-size:12px;
-}
-div.main{
- margin:30px auto;
- width:350px;
-}
-div.ox{
- border: solid 2px #c6cfe1;
- background: #dfe4ee;
- padding: 10px;
- color: #333333;
- margin-bottom: 20px;
- width: 420px;
-}
-div.ox h1 {
- font-size:14px;
- color:#000000;
- padding-bottom:4px;
-}
-div.ox p{
- padding-bottom:14px;
-}
-div.ox input .input-text{
- border:1px solid #3b6e22;
- color:#666666;
- width:190px;
+.spacer {
+ margin-left:80px;
+ margin-bottom:10px;
+ font-size:11px;
+ color:#555555;
+ padding: 4px;
}
-div.ox label{
- display:block;
- margin-bottom:10px;
- color:#555555;
+div.form label {
+ display: block;
+ width: 190px;
}
-div.ox label span{
+div.form label span {
display:block;
float:left;
padding-right:15px;
width:140px;
text-align:right;
font-weight:bold;
}
-.spacer{
- margin-left:80px;
- margin-bottom:10px;
- font-size:11px;
- color:#555555;
- padding: 4px;
-}
-.positive{
- background-color: green;
- padding:0px 6px;
- border:1px outset #3b6e22;
- height:24px;
- line-height:24px;
- color:#FFFFFF;
- font-size:12px;
- margin-right:10px;
- display:inline-block;
- text-decoration:none;
- width: 100px;
- text-align: center;
-}
-.negative{
- background: red;
- padding:0px 6px;
- border:1px outset #3b6e22;
- height:24px;
- line-height:24px;
- color: #111;
- font-size:12px;
- margin-right:10px;
- display:inline-block;
- text-decoration:none;
- width: 100px;
- text-align: center;
-}
-.standard{
- background: grey;
- padding:0px 6px;
- border:1px outset #3b6e22;
- height:24px;
- line-height:24px;
- color:#FFFFFF;
- font-size:12px;
- margin-right:10px;
- display:inline-block;
- text-decoration:none;
- width: 100px;
- text-align: center;
-}
-.mini {
- width: auto;
- height: auto;
-}
-.required {
+
+
+
+
+
+
+
+
+
+
+
+/*a{*/
+/* color:#0033CC;*/
+/*}*/
+/*input{ */
+/* font-family:"Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; */
+/* font-size:12px;*/
+/*}*/
+/*div.main{*/
+/* margin:30px auto; */
+/* width:350px;*/
+/*}*/
+/*div.ox{*/
+/* border: solid 2px #c6cfe1;*/
+/* background: #dfe4ee;*/
+/* padding: 10px;*/
+/* color: #333333;*/
+/* margin-bottom: 20px;*/
+/* width: 420px;*/
+/*}*/
+/*div.ox h1 {*/
+/* font-size:14px;*/
+/* color:#000000;*/
+/* padding-bottom:4px;*/
+/*}*/
+/*div.ox p{*/
+/* padding-bottom:14px;*/
+/*}*/
+/*div.ox input .input-text{*/
+/* border:1px solid #3b6e22;*/
+/* color:#666666;*/
+/* width:190px;*/
+/*}*/
+/*div.ox label{*/
+/* display:block;*/
+/* margin-bottom:10px;*/
+/* color:#555555;*/
+/*}*/
+/*div.ox label span{*/
+/* display:block;*/
+/* float:left;*/
+/* padding-right:15px;*/
+/* width:140px;*/
+/* text-align:right;*/
+/* font-weight:bold;*/
+/*}*/
+
+/*.positive{*/
+/* background-color: green;*/
+/* padding:0px 6px;*/
+/* border:1px outset #3b6e22;*/
+/* height:24px; */
+/* line-height:24px;*/
+/* color:#FFFFFF;*/
+/* font-size:12px;*/
+/* margin-right:10px;*/
+/* display:inline-block;*/
+/* text-decoration:none;*/
+/* width: 100px;*/
+/* text-align: center;*/
+/*}*/
+/*.negative{*/
+/* background: red;*/
+/* padding:0px 6px;*/
+/* border:1px outset #3b6e22;*/
+/* height:24px; */
+/* line-height:24px;*/
+/* color: #111;*/
+/* font-size:12px;*/
+/* margin-right:10px;*/
+/* display:inline-block;*/
+/* text-decoration:none;*/
+/* width: 100px;*/
+/* text-align: center;*/
+/*}*/
+/*.standard{*/
+/* background: grey;*/
+/* padding:0px 6px;*/
+/* border:1px outset #3b6e22;*/
+/* height:24px; */
+/* line-height:24px;*/
+/* color:#FFFFFF;*/
+/* font-size:12px;*/
+/* margin-right:10px;*/
+/* display:inline-block;*/
+/* text-decoration:none;*/
+/* width: 100px;*/
+/* text-align: center;*/
+/*}*/
+/*.mini {*/
+/* width: auto;*/
+/* height: auto;*/
+/*}*/
+/*.required {*/
/* border-right: solid 2px red;*/
- background: transparent url(/images/bullet_red.png) no-repeat scroll right center;
-}
+/* background: transparent url(/images/bullet_red.png) no-repeat scroll right center;*/
+/*}*/
-.select_form {
- float: right;
- width: 35%;
- padding-left: 10px;
-}
-.select_form select {
- width: 85%;
- margin: auto;
- display: block;
-}
-.main_form {
- width: 60%;
- float: left;
-}
+/*.select_form {*/
+/* float: right; */
+/* width: 35%; */
+/* padding-left: 10px;*/
+/*}*/
+/*.select_form select {*/
+/* width: 85%;*/
+/* margin: auto;*/
+/* display: block;*/
+/*}*/
+/*.main_form {*/
+/* width: 60%; */
+/* float: left;*/
+/*}*/
Oops, something went wrong.

0 comments on commit bc8736d

Please sign in to comment.