forked from OpenNeo/impress
stop using radio and label for pet states, to fix ie bug
This commit is contained in:
parent
50f0adaa4d
commit
bcffdc0630
4 changed files with 16 additions and 22 deletions
|
@ -42,6 +42,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.points_required_to_pass_top_contributor(offset)
|
def self.points_required_to_pass_top_contributor(offset)
|
||||||
User.top_contributors.select(:points).limit(1).offset(offset).first.points
|
user = User.top_contributors.select(:points).limit(1).offset(offset).first
|
||||||
|
user ? user.points : 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -144,7 +144,7 @@ body.outfits-edit
|
||||||
label
|
label
|
||||||
+awesome-button
|
+awesome-button
|
||||||
margin: 0 .25em
|
margin: 0 .25em
|
||||||
li.selected label
|
li.selected button
|
||||||
+awesome-button-color($marked_button_color)
|
+awesome-button-color($marked_button_color)
|
||||||
&.hidden
|
&.hidden
|
||||||
visibility: hidden
|
visibility: hidden
|
||||||
|
|
|
@ -718,42 +718,35 @@ View.PetStateForm = function (wardrobe) {
|
||||||
var INPUT_NAME = 'pet_state_id', form_query = '#pet-state-form',
|
var INPUT_NAME = 'pet_state_id', form_query = '#pet-state-form',
|
||||||
form = $(form_query),
|
form = $(form_query),
|
||||||
ul = form.children('ul'),
|
ul = form.children('ul'),
|
||||||
radio_query = form_query + ' input[name=' + INPUT_NAME + ']';
|
button_query = form_query + ' button';
|
||||||
$(radio_query).live('click', function () {
|
$(button_query).live('click', function (e) {
|
||||||
wardrobe.outfit.setPetStateById(+this.value);
|
e.preventDefault();
|
||||||
|
wardrobe.outfit.setPetStateById(+$(this).data('value'));
|
||||||
});
|
});
|
||||||
|
|
||||||
function updatePetState(pet_state) {
|
function updatePetState(pet_state) {
|
||||||
if(pet_state) {
|
if(pet_state) {
|
||||||
ul.children('li.selected').removeClass('selected');
|
ul.children('li.selected').removeClass('selected');
|
||||||
$(radio_query + '[value=' + pet_state.id + ']')
|
$(button_query + '[data-value=' + pet_state.id + ']').parent().addClass('selected');
|
||||||
.attr('checked', 'checked').parent().addClass('selected');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wardrobe.outfit.bind('petTypeLoaded', function (pet_type) {
|
wardrobe.outfit.bind('petTypeLoaded', function (pet_type) {
|
||||||
var ids = pet_type.pet_state_ids, i, id, li, radio, label;
|
var ids = pet_type.pet_state_ids, i, id, li, button, label;
|
||||||
ul.children().remove();
|
ul.children().remove();
|
||||||
if(ids.length == 1) {
|
if(ids.length == 1) {
|
||||||
form.addClass('hidden');
|
form.addClass('hidden');
|
||||||
} else {
|
} else {
|
||||||
form.removeClass('hidden');
|
form.removeClass('hidden');
|
||||||
for(var i = 0; i < ids.length; i++) {
|
for(var i = 0; i < ids.length; i++) {
|
||||||
id = 'pet-state-radio-' + i;
|
id = 'pet-state-button-' + i;
|
||||||
li = $('<li/>');
|
li = $('<li/>');
|
||||||
radio = $('<input/>', {
|
button = $('<button/>', {
|
||||||
id: id,
|
id: id,
|
||||||
name: INPUT_NAME,
|
text: i + 1,
|
||||||
type: 'radio',
|
"data-value": ids[i]
|
||||||
value: ids[i]
|
|
||||||
});
|
});
|
||||||
label = $('<label/>', {
|
button.appendTo(li);
|
||||||
'for': id,
|
|
||||||
text: i + 1
|
|
||||||
});
|
|
||||||
if(i == 0) radio.attr('checked', 'checked');
|
|
||||||
radio.appendTo(li);
|
|
||||||
label.appendTo(li);
|
|
||||||
li.appendTo(ul);
|
li.appendTo(ul);
|
||||||
}
|
}
|
||||||
updatePetState(wardrobe.outfit.getPetState());
|
updatePetState(wardrobe.outfit.getPetState());
|
||||||
|
|
|
@ -824,11 +824,11 @@ body.outfits-edit #pet-state-form label:active {
|
||||||
top: 1px;
|
top: 1px;
|
||||||
}
|
}
|
||||||
/* line 147, ../../../app/stylesheets/outfits/_edit.sass */
|
/* line 147, ../../../app/stylesheets/outfits/_edit.sass */
|
||||||
body.outfits-edit #pet-state-form li.selected label {
|
body.outfits-edit #pet-state-form li.selected button {
|
||||||
background: #0b61a4 url('/images/alert-overlay.png?1296599919') repeat-x;
|
background: #0b61a4 url('/images/alert-overlay.png?1296599919') repeat-x;
|
||||||
}
|
}
|
||||||
/* line 34, ../../../app/stylesheets/partials/clean/_mixins.sass */
|
/* line 34, ../../../app/stylesheets/partials/clean/_mixins.sass */
|
||||||
body.outfits-edit #pet-state-form li.selected label:hover {
|
body.outfits-edit #pet-state-form li.selected button:hover {
|
||||||
background-color: #005093;
|
background-color: #005093;
|
||||||
}
|
}
|
||||||
/* line 149, ../../../app/stylesheets/outfits/_edit.sass */
|
/* line 149, ../../../app/stylesheets/outfits/_edit.sass */
|
||||||
|
|
Loading…
Reference in a new issue