VRFS-2795 styling and descriptions
This commit is contained in:
parent
e0d2feb84d
commit
086b3bc3c4
|
|
@ -34,29 +34,28 @@ module JamRuby
|
|||
GIG_COUNTS = [ANY_VAL_INT, 0, 1, 2, 3, 4]
|
||||
GIG_LABELS = {
|
||||
GIG_COUNTS[0] => 'Any',
|
||||
GIG_COUNTS[1] => 'More than 0',
|
||||
GIG_COUNTS[2] => 'More than 10',
|
||||
GIG_COUNTS[3] => 'More than 50',
|
||||
GIG_COUNTS[4] => 'More than 100'
|
||||
GIG_COUNTS[1] => 'under 10',
|
||||
GIG_COUNTS[2] => '10 to 50',
|
||||
GIG_COUNTS[3] => '50 to 100',
|
||||
GIG_COUNTS[4] => 'over 100'
|
||||
}
|
||||
|
||||
STUDIO_COUNTS = [ANY_VAL_INT, 0, 1, 2, 3, 4]
|
||||
STUDIOS_LABELS = {
|
||||
STUDIO_COUNTS[0] => 'Any',
|
||||
STUDIO_COUNTS[1] => 'More than 0',
|
||||
STUDIO_COUNTS[2] => 'More than 10',
|
||||
STUDIO_COUNTS[3] => 'More than 50',
|
||||
STUDIO_COUNTS[4] => 'More than 100'
|
||||
STUDIO_COUNTS[1] => 'under 10',
|
||||
STUDIO_COUNTS[2] => '10 to 50',
|
||||
STUDIO_COUNTS[3] => '50 to 100',
|
||||
STUDIO_COUNTS[4] => 'over 100'
|
||||
}
|
||||
|
||||
AGE_COUNTS = [ANY_VAL_INT, 10, 20, 30, 40, 50]
|
||||
AGE_COUNTS = [10, 20, 30, 40, 50]
|
||||
AGES = {
|
||||
AGE_COUNTS[0] => 'Any',
|
||||
AGE_COUNTS[1] => 'Teens',
|
||||
AGE_COUNTS[2] => "20's",
|
||||
AGE_COUNTS[3] => "30's",
|
||||
AGE_COUNTS[4] => "40's",
|
||||
AGE_COUNTS[5] => "50+"
|
||||
AGE_COUNTS[0] => 'Teens',
|
||||
AGE_COUNTS[1] => "20's",
|
||||
AGE_COUNTS[2] => "30's",
|
||||
AGE_COUNTS[3] => "40's",
|
||||
AGE_COUNTS[4] => "50+"
|
||||
}
|
||||
|
||||
INTEREST_VALS = [ANY_VAL_STR,
|
||||
|
|
@ -89,7 +88,7 @@ module JamRuby
|
|||
KEY_GIGS => GIG_COUNTS[0].to_s,
|
||||
KEY_STUDIOS => STUDIO_COUNTS[0].to_s,
|
||||
KEY_SKILL => SKILL_VALS[0].to_s,
|
||||
KEY_AGES => [AGE_COUNTS[0]]
|
||||
KEY_AGES => []
|
||||
}
|
||||
JSON_SCHEMA_KEYS = JSON_SCHEMA.keys
|
||||
MULTI_VALUE_KEYS = JSON_SCHEMA.collect { |kk,vv| vv.is_a?(Array) ? kk : nil }.compact
|
||||
|
|
@ -210,8 +209,8 @@ module JamRuby
|
|||
if SORT_VALS[1] == val
|
||||
locidispid = self.user.last_jam_locidispid || 0
|
||||
my_locid = locidispid / 1000000
|
||||
rel = rel.joins("INNER JOIN geoiplocations AS my_geo ON my_geo.locid = #{my_locid}")
|
||||
rel = rel.joins("INNER JOIN geoiplocations AS other_geo ON users.last_jam_locidispid/1000000 = other_geo.locid")
|
||||
rel = rel.joins("LEFT JOIN geoiplocations AS my_geo ON my_geo.locid = #{my_locid}")
|
||||
rel = rel.joins("LEFT JOIN geoiplocations AS other_geo ON users.last_jam_locidispid/1000000 = other_geo.locid")
|
||||
rel = rel.group("users.id, my_geo.geog, other_geo.geog")
|
||||
rel = rel.order('st_distance(my_geo.geog, other_geo.geog)')
|
||||
else
|
||||
|
|
@ -372,9 +371,9 @@ module JamRuby
|
|||
if (val = jj[KEY_GIGS].to_i) != GIG_COUNTS[0]
|
||||
str += "; Concert Gigs = #{GIG_LABELS[val]}"
|
||||
end
|
||||
val = jj[KEY_AGES]
|
||||
val = jj[KEY_AGES].map(&:to_i)
|
||||
val.sort!
|
||||
if !val.blank? && val[0] != AGE_COUNTS[0]
|
||||
if !val.blank?
|
||||
str += "; Ages = "
|
||||
val.each_with_index do |vv, idx|
|
||||
str += "#{AGES[vv]}"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ describe 'Musician Search Model' do
|
|||
@users = []
|
||||
today = Date.today
|
||||
MusicianSearch::AGE_COUNTS.each_with_index do |age, idx|
|
||||
age = 0==idx ? MusicianSearch::AGE_COUNTS[1] : age
|
||||
dd = today - age.years - 1.day
|
||||
@users << FactoryGirl.create(:austin_user, :birth_date => dd)
|
||||
@users << FactoryGirl.create(:dallas_user, :birth_date => dd)
|
||||
|
|
@ -49,18 +48,18 @@ describe 'Musician Search Model' do
|
|||
end
|
||||
|
||||
it "filters by one age" do
|
||||
age = MusicianSearch::AGE_COUNTS[1]
|
||||
age = MusicianSearch::AGE_COUNTS[0]
|
||||
search.update_json_value(MusicianSearch::KEY_AGES, [age])
|
||||
today = Date.today.to_time
|
||||
search.do_search.all.each do |uu|
|
||||
diff = TimeDifference.between(uu.birth_date.to_time, today).in_years
|
||||
expect(diff).to be >= age
|
||||
expect(diff).to be < MusicianSearch::AGE_COUNTS[2]
|
||||
expect(diff).to be < MusicianSearch::AGE_COUNTS[1]
|
||||
end
|
||||
end
|
||||
|
||||
it "filters by multiple ages" do
|
||||
ages = MusicianSearch::AGE_COUNTS[1..3]
|
||||
ages = MusicianSearch::AGE_COUNTS[0..2]
|
||||
search.update_json_value(MusicianSearch::KEY_AGES, ages[0..1])
|
||||
today = Date.today.to_time
|
||||
search.do_search.all.each do |uu|
|
||||
|
|
@ -244,13 +243,6 @@ describe 'Musician Search Model' do
|
|||
expect(search.description).to match(/^Click search button to look for musicians/)
|
||||
end
|
||||
|
||||
it 'has sort order description for default filter' do
|
||||
search.reset_filter
|
||||
search.update_json_value(MusicianSearch::KEY_SORT_ORDER, MusicianSearch::SORT_VALS[0])
|
||||
str = MusicianSearch::SORT_ORDERS[MusicianSearch::SORT_VALS[0]]
|
||||
expect(search.description).to match(/^Current Search: Sort = #{str}$/)
|
||||
end
|
||||
|
||||
it 'has correct sort order description' do
|
||||
search.update_json_value(MusicianSearch::KEY_SORT_ORDER, MusicianSearch::SORT_VALS[1])
|
||||
str = MusicianSearch::SORT_ORDERS[search.json_value(MusicianSearch::KEY_SORT_ORDER)]
|
||||
|
|
@ -295,8 +287,8 @@ describe 'Musician Search Model' do
|
|||
end
|
||||
|
||||
it 'has correct description for ages' do
|
||||
search.update_json_value(MusicianSearch::KEY_AGES, [MusicianSearch::AGE_COUNTS[1],MusicianSearch::AGE_COUNTS[2]])
|
||||
expect(search.description).to match(/; Ages = #{MusicianSearch::AGES[MusicianSearch::AGE_COUNTS[1]]}, #{MusicianSearch::AGES[MusicianSearch::AGE_COUNTS[2]]}/)
|
||||
search.update_json_value(MusicianSearch::KEY_AGES, [MusicianSearch::AGE_COUNTS[0],MusicianSearch::AGE_COUNTS[1]])
|
||||
expect(search.description).to match(/; Ages = #{MusicianSearch::AGES[MusicianSearch::AGE_COUNTS[0]]}, #{MusicianSearch::AGES[MusicianSearch::AGE_COUNTS[1]]}/)
|
||||
end
|
||||
|
||||
it 'has correct description for instruments' do
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ group :development, :test do
|
|||
gem 'factory_girl_rails', '4.1.0' # in dev because in use by rake task
|
||||
gem 'database_cleaner', '1.3.0' #in dev because in use by rake task
|
||||
gem 'teaspoon'
|
||||
gem 'puma'
|
||||
end
|
||||
group :unix do
|
||||
gem 'therubyracer' #, '0.11.0beta8'
|
||||
|
|
@ -132,7 +133,6 @@ group :test, :cucumber do
|
|||
# gem 'growl', '1.0.3'
|
||||
gem 'poltergeist'
|
||||
gem 'resque_spec'
|
||||
# gem 'puma'
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter
|
|||
constructor: () ->
|
||||
@rest = context.JK.Rest()
|
||||
@logger = context.JK.logger
|
||||
@userId = null
|
||||
@searchFilter = null
|
||||
@profileUtils = context.JK.ProfileUtils
|
||||
@helpBubble = context.JK.HelpBubbleHelper
|
||||
|
|
@ -18,7 +17,7 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter
|
|||
|
||||
|
||||
init: (app) =>
|
||||
@screenBindings = { 'beforeShow': this.beforeShow, 'afterShow': this.afterShow }
|
||||
@screenBindings = { 'afterShow': this.afterShow, 'afterHide': this.afterHide }
|
||||
app.bindScreen('musicians', @screenBindings)
|
||||
|
||||
@screen = $('#musicians-screen')
|
||||
|
|
@ -39,9 +38,6 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter
|
|||
@screen.find('#btn-musician-search-cancel').on 'click', =>
|
||||
this.cancelFilter()
|
||||
|
||||
beforeShow: (data) =>
|
||||
userId = data.id
|
||||
|
||||
afterShow: () =>
|
||||
@screen.find('#musician-search-filter-results').show()
|
||||
@screen.find('#musician-search-filter-builder').hide()
|
||||
|
|
@ -52,6 +48,9 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter
|
|||
@screen.find('#musician-search-filter-builder').show()
|
||||
@resultsListContainer.empty()
|
||||
|
||||
afterHide: () =>
|
||||
@resultsListContainer.empty()
|
||||
|
||||
renderSearchFilter: () =>
|
||||
$.when(this.rest.getMusicianSearchFilter()).done (sFilter) =>
|
||||
this.loadSearchFilter(sFilter)
|
||||
|
|
@ -128,10 +127,8 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter
|
|||
if 0 < @searchFilter.ages.length
|
||||
key_val = key.toString()
|
||||
ageMatch = $.grep(@searchFilter.ages, (n, i) ->
|
||||
n == key_val
|
||||
)
|
||||
if ageMatch.length > 0
|
||||
selected = 'checked'
|
||||
n == key_val)
|
||||
selected = 'checked' if ageMatch.length > 0
|
||||
ageHtml = context.JK.fillTemplate(ageTemplate,
|
||||
id: key
|
||||
description: ageLabel
|
||||
|
|
@ -146,12 +143,10 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter
|
|||
$.each genres, (index, genre) =>
|
||||
if 0 < @searchFilter.genres.length
|
||||
genreMatch = $.grep(@searchFilter.genres, (n, i) ->
|
||||
n == genre.id
|
||||
)
|
||||
n == genre.id)
|
||||
else
|
||||
genreMatch = []
|
||||
if genreMatch.length > 0
|
||||
selected = 'checked'
|
||||
selected = 'checked' if genreMatch.length > 0
|
||||
genreHtml = context.JK.fillTemplate(genreTemplate,
|
||||
id: genre.id
|
||||
description: genre.description
|
||||
|
|
@ -169,14 +164,12 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter
|
|||
instMatch = $.grep(@searchFilter.instruments, (inst, i) ->
|
||||
yn = inst.instrument_id == instrument.id
|
||||
proficiency = inst.proficiency_level if yn
|
||||
yn
|
||||
)
|
||||
selected = instMatch.length > 0 ? 'checked' : ''
|
||||
yn)
|
||||
selected = 'checked' if instMatch.length > 0
|
||||
instrumentHtml = context.JK.fillTemplate(instrumentTemplate,
|
||||
id: instrument.id
|
||||
description: instrument.description
|
||||
checked: selected
|
||||
)
|
||||
checked: selected)
|
||||
@screen.find('#search-filter-instruments').append instrumentHtml
|
||||
profsel = '#search-filter-instruments tr[data-instrument-id="'+instrument.id+'"] select'
|
||||
@screen.find(profsel).val(proficiency)
|
||||
|
|
@ -242,9 +235,9 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter
|
|||
renderResultsHeader: () =>
|
||||
@screen.find('#musician-search-filter-description').html(@searchResults.description)
|
||||
if @searchResults.is_blank_filter
|
||||
@screen.find('#btn-perform-musician-search-reset').show()
|
||||
@screen.find('#btn-musician-search-reset').hide()
|
||||
else
|
||||
@screen.find('#btn-perform-musician-search-reset').hide()
|
||||
@screen.find('#btn-musician-search-reset').show()
|
||||
|
||||
renderMusicians: () =>
|
||||
this.renderResultsHeader() if @pageNumber == 1
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@
|
|||
|
||||
.button-row {
|
||||
float:none;
|
||||
.result-list-button-wrapper {
|
||||
margin:3px;
|
||||
}
|
||||
}
|
||||
|
||||
.latency-holder {
|
||||
|
|
@ -138,6 +141,39 @@
|
|||
#musician-filter-results {
|
||||
margin: 0 10px 0px 10px;
|
||||
}
|
||||
|
||||
#musician-search-filter-results-header {
|
||||
padding: 10px 10px 10px 10px;
|
||||
}
|
||||
|
||||
#btn-musician-search-builder {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#musician-search-filter-description {
|
||||
padding: 5px 5px 5px 5px;
|
||||
display: inline;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
#btn-musician-search-reset {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#musician-search-filter-results-list-blank {
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin: 30px 10px 10px 10px;
|
||||
}
|
||||
|
||||
#musician-search-filter-spinner {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.filter-element {
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@
|
|||
div#musician-search-filter-results.content-wrapper
|
||||
div#musician-search-filter-results-header
|
||||
a#btn-musician-search-builder.button-orange href="#" SEARCH
|
||||
div#musician-search-filter-description
|
||||
a#btn-musician-search-reset.button-grey href="#" RESET
|
||||
div#musician-search-filter-description
|
||||
div.clearall
|
||||
div#musician-search-filter-spinner.spinner-large
|
||||
|
||||
div#musician-search-filter-results-wrapper
|
||||
div#musician-search-filter-results-list-blank
|
||||
div#musician-search-filter-results-list.content-wrapper
|
||||
|
|
@ -56,14 +58,15 @@ script#template-musician-search-filter type="text/template"
|
|||
table#search-filter-genres cellpadding="10" cellspacing="6" width="100%"
|
||||
|
||||
.field
|
||||
label for="search-filter-instruments" Instruments:
|
||||
label for="search-filter-instruments"
|
||||
| Instruments & Skill Level:
|
||||
.search-filter-setup-instruments.w90.band-setup-genres
|
||||
table#search-filter-instruments cellpadding="10" cellspacing="6" width="100%"
|
||||
|
||||
script#template-search-filter-setup-instrument type="text/template"
|
||||
tr data-instrument-id="{id}"
|
||||
td <input type="checkbox" {checked} />{description}
|
||||
td align="right" width="50%" id="{proficiency_id}"
|
||||
td align="right" width="50%"
|
||||
select.proficiency_selector name="proficiency"
|
||||
option value="1" Beginner
|
||||
option value="2" Intermediate
|
||||
|
|
|
|||
Loading…
Reference in New Issue