Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…ed a Delete button for Assignments
  • Loading branch information...
commit bc8736d7ee68bdef0804b84e760539aab85e7232 1 parent 19e81de
@rnhurt authored
View
3  app/controllers/assignments_controller.rb
@@ -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
View
8 app/views/assignments/_assignment_list.erb
@@ -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 %>
View
6 app/views/courses/_course_list.html.erb
@@ -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 ) %>'"/>
View
2  app/views/courses/index.html.erb
@@ -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>
View
8 app/views/courses/new.html.erb
@@ -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">
View
31 app/views/courses/show.html.erb
@@ -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 ...'), ' '),
View
2  app/views/layouts/standard.html.erb
@@ -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' -%>
View
236 public/stylesheets/forms.css
@@ -1,41 +1,15 @@
-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;
@@ -43,75 +17,125 @@ div.ox label span{
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;*/
+/*}*/
View
82 public/stylesheets/local.css
@@ -20,6 +20,13 @@ body {
#flash {
text-align: center;
}
+#footer {
+ margin: auto;
+ padding-top: 20px;
+ text-align: center;
+ font-size: 0.8em;
+}
+
.container .error, .container .notice, .container .success {padding:.5em;margin-bottom:1.1em;border:2px solid #ddd;}
.container .error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
.container .notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
@@ -28,12 +35,7 @@ body {
.container .notice a {color:#514721; background:none; padding:0; margin:0; }
.container .success a {color:#264409; background:none; padding:0; margin:0; }
-#footer {
- margin: auto;
- padding-top: 20px;
- text-align: center;
- font-size: 0.8em;
-}
+div.box { border: 2px solid #D2DDFE; padding: 0.5em; }
/*** Tables ***/
table {
@@ -71,6 +73,74 @@ tr.help:hover td{background-color: #009900;}
}
+/*** Forms ***/
+.spacer {
+ margin-left:80px;
+ margin-bottom:10px;
+ font-size:11px;
+ color:#555555;
+ padding: 4px;
+}
+form label {
+ display: block;
+ margin-top: 4px;
+}
+form label span {
+ display:block;
+ float:left;
+ padding-right:15px;
+ width:140px;
+ text-align:right;
+ font-weight:bold;
+}
+form .required {
+/* border-right: solid 2px red;*/
+ background: transparent url(/images/bullet_red.png) no-repeat scroll right center;
+}
+
+/*** Buttons ***/
+.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{
+ border:2px outset #fbc2c4;
+ background:#FBE3E4;color:#8a1f11;
+ padding:0px 6px;
+ height:24px;
+ line-height:24px;
+ 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;
+}
+
/*** Scaffold defaults ***/
.fieldWithErrors {
padding: 2px;
Please sign in to comment.
Something went wrong with that request. Please try again.