Clean up job

This commit is contained in:
tl3ilaxu 2016-03-08 15:30:32 +01:00
parent 676cb00884
commit 87a383bfd2
4 changed files with 8 additions and 6 deletions

View file

@ -1,6 +1,8 @@
ready = function() {
$("[id='user_private']").bootstrapSwitch({ onText: "private", offText: "public"});
$("[id='user_quickpay_hidden']").bootstrapSwitch({ onText: "hide", offText: "show" });
$.each($('[data-switch]'), function(key, value){
console.log(value.getAttribute('data-offText'));
$(this).bootstrapSwitch({ offText: value.getAttribute('data-offText'), onText: value.getAttribute('data-onText')});
});
$('[data-switch]').on('switchChange.bootstrapSwitch', function(event, state) {
$(this).closest('form').submit();
});

View file

@ -34,12 +34,12 @@
%p Orders can be placed on koelkast for every public account. Private accounts can only order products by logging in here.
= f_form_for @user, remote: true do |f|
.center
= f.check_box :private, skip_label: true, data: { switch: true }
= f.check_box :private, skip_label: true, data: { switch: true, offText: "public", onText: "private" }
%li.list-group-item.text-muted
= f_form_for @user, remote: true do |f|
.center
= f.label "Show dagschotel on koelkast"
= f.check_box :quickpay_hidden, skip_label: true, data: { switch: true }
= f.check_box :quickpay_hidden, skip_label: true, data: { switch: true, offText: "show", onText: "hide" }
%li.list-group-item.text-muted
= f_form_for @user do |f|
= f.file_field :avatar, skip_label: true

View file

@ -1,5 +1,5 @@
.col-md-2.overviewthumbnail
- if user.dagschotel && user.quickpay_hidden == false
- if user.dagschotel && !user.quickpay_hidden
= link_to quickpay_user_path(user), remote: true, data: { quickpay: true, type: "json" } do
= image_tag user.dagschotel.avatar(:dagschotel), class: "img-circle dagschotel"
= link_to image_tag(user.avatar(:large) , class: "img-circle avatar"), new_user_order_path(user)

View file

@ -1,5 +1,5 @@
class AddQuickpayHiddenToUser < ActiveRecord::Migration
def change
add_column :users, :quickpay_hidden, :boolean, default:false
add_column :users, :quickpay_hidden, :boolean, default: false
end
end