Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
Merge branch 'feature/expiry-time-refactoring' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sutto committed Mar 13, 2011
2 parents f67075c + 3863422 commit b08b170
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 51 deletions.
18 changes: 9 additions & 9 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module ApplicationHelper

def ie_html(attrs={}, &block)
name = :html
attrs.symbolize_keys!
Expand All @@ -13,37 +13,37 @@ def ie_html(attrs={}, &block)
block.call
end
end

def css_class(klass, options)
options.merge :class => [options[:class], klass].join(' ').strip
end

def render_nested_form(form, association, partial_name)
object = form.object
child = object.class.reflect_on_association(association).klass.new
form.fields_for(association, child, :child_index => 'NEW_IDX') do |child_form|
render :partial => partial_name, :object => child_form
end
end

def from_radiant(name)
RadiantContent[name]
end

def email_for(position, options = {})
email_address = position.contact_emails.first
if email_address.present?
address = email_address.email
mail_to address, nil, options
end
end

def position_expiry_time(position)
return if position.expires_at.blank?
time = distance_of_time_in_words position.expires_at, Time.now
content_tag :span, tu(:position_expiry, :distance => time), :class => 'position-expires-in'
content_tag :span, tu(:position_expiry, :distance => time), :class => 'expiry-time tag'
end

def auto_link_options(options, *autolink_fields)
new_options = options.dup
autolink_fields.each do |field|
Expand All @@ -58,7 +58,7 @@ def auto_link_options(options, *autolink_fields)
def normalized_content_scope(key, scope = nil)
(Array(scope) + key.to_s.split(".")).flatten.join(".")
end

def options_with_class_merged(o, n)
css_klass = [o[:class], n[:class]].join(" ").strip.squeeze(" ")
o.merge(n).merge(:class => css_klass)
Expand Down
8 changes: 6 additions & 2 deletions app/stylesheets/recruitment_platform.sass
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
margin: -14px 0 14px
padding: 0.5em
border-bottom: 1px dotted #777
+clearfix
a
font-weight: bold
text-decoration: none
span.position-expires-in
color: #666
span.position-expiry-time
float: right
font-weight: bold

aside form.formtastic
margin-top: 0.35em
Expand Down Expand Up @@ -94,6 +96,8 @@ ol#all-positions
background-color: #384999
span.volunteer
background-color: #467A3E
span.expiry-time
background-color: #CE8D22

p.position-description
margin: 0 0 0.25em
Expand Down
5 changes: 3 additions & 2 deletions app/views/positions/_quick_links.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
%p.quick-links
= link_to 'Apply for this position', [@position, :position_applications], :method => :post
= position_expiry_time @position
or
= link_to 'View as a PDF', position_path(@position, :format => 'pdf')
= link_to 'View as a PDF', position_path(@position, :format => 'pdf')

%span.position-expiry-time #{position_expiry_time @position} until this position expires.
6 changes: 3 additions & 3 deletions app/views/positions/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
%h1 Get Involved with Youth Tree Inc.

= content_section :position_landing_page

%ol#all-positions
- @positions.each do |position|
%li.position
%span.team-name #{position.team.name}:
= link_to position.title, position
= position_expiry_time(position)
%p.position-description
= position.short_description
.position-tags
Expand All @@ -20,4 +19,5 @@
- else
%span.tag.volunteer Volunteer
- position.tags.each do |tag|
%span.tag= tag.name.titleize
%span.tag= tag.name.titleize
= position_expiry_time position
17 changes: 9 additions & 8 deletions app/views/positions/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
%h1
= link_to "#{@team.name}:", @team.website_url, :class => 'team-name', :target => '_blank'
%span.position-name= @position.title
= position_expiry_time @position


= partial 'quick_links'

%p#short-description= @position.short_description


%section#position-general-description
%h2 About this Position
%h2 About this Position
.embedded-content= @position.general_description_as_html

%section#position-details
%dl
%dt Contact email:
Expand All @@ -39,7 +38,7 @@
= @position.paid_description_as_html
- else
%p This is a volunteer position.


%section#position-position-description
%h2 What would I be doing?
Expand All @@ -48,9 +47,11 @@
%section#position-applicant-description
%h2 Who should apply?
.embedded-content= @position.applicant_description_as_html

%p#view-online.print-only
Apply online at #{request.host}
- if @position.expires_at.present?
\- Applications close #{l @position.expires_at, :format => :long}

%h2.no-print Interested?
= partial 'quick_links'
2 changes: 1 addition & 1 deletion config/locales/ui.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ en:
other: "%{count} hours"
hour_range: "%{min} to %{max} hours"
none: "Currently unknown"
position_expiry: "(%{distance} left to apply)"
position_expiry: "%{distance} left"
4 changes: 2 additions & 2 deletions public/javascripts/vendor/shuriken/shuriken.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/shuriken-0.2.1/coffeescripts/shuriken.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/shuriken-0.2.1/coffeescripts/shuriken.coffee
*/

var __slice = Array.prototype.slice, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/vendor/shuriken/shuriken/mixins.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/shuriken-0.2.1/coffeescripts/shuriken/mixins.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/shuriken-0.2.1/coffeescripts/shuriken/mixins.coffee
*/

Shuriken.defineExtension(function(baseNS) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/shuriken-0.2.1/coffeescripts/shuriken/mixins/callbacks.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/shuriken-0.2.1/coffeescripts/shuriken/mixins/callbacks.coffee
*/

var __slice = Array.prototype.slice;
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/vendor/youthtree/youth_tree.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree.coffee
*/

Shuriken.as('YouthTree');
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/vendor/youthtree/youth_tree/disqus.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/disqus.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/disqus.coffee
*/

YouthTree.withNS('Disqus', function(ns) {
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/vendor/youthtree/youth_tree/flickr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/flickr.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/flickr.coffee
*/

YouthTree.withNS('Flickr', function(ns) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/flickr/gallery.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/flickr/gallery.coffee
*/

var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/forms/ck_editor.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/forms/ck_editor.coffee
*/

YouthTree.withNS('Forms.CKEditor', function(ns) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/forms/convertable_editor.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/forms/convertable_editor.coffee
*/

var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/forms/date_picker.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/forms/date_picker.coffee
*/

YouthTree.withNS('Forms.DatePicker', function(ns) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/forms/value_cloner.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/forms/value_cloner.coffee
*/

YouthTree.withNS('Forms.ValueCloner', function(ns) {
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/vendor/youthtree/youth_tree/gallery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/gallery.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/gallery.coffee
*/

YouthTree.withNS('Gallery', function(ns) {
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/vendor/youthtree/youth_tree/util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* DO NOT MODIFY. This file was compiled Sat, 01 Jan 2011 13:56:33 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2010.02@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/util.coffee
/* DO NOT MODIFY. This file was compiled Sun, 13 Mar 2011 12:00:05 GMT from
* /Users/sutto/.rvm/gems/ree-1.8.7-2011.03@recruitment_platform/gems/youthtree-js-0.4.1/coffeescripts/youth_tree/util.coffee
*/

var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
config.before(:each) { Machinist.reset_before_test }
config.after(:all) { FileUtils.rm_rf Rails.root.join('index', Rails.env) }
config.around(:each) { |s| BHM::Admin.silence_attr_accessible(&s) }
end

def RadiantContent.[](name)
"PLACEHOLDER CONTENT FOR TESTS"
end

0 comments on commit b08b170

Please sign in to comment.