Add button to hide dagschotel on koelkast
This commit is contained in:
parent
8e05b48ca0
commit
c718b56562
6 changed files with 14 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
ready = function() {
|
||||
$('[data-switch]').bootstrapSwitch({ onText: "private", offText: "public" });
|
||||
$("[id='user_private']").bootstrapSwitch({ onText: "private", offText: "public"});
|
||||
$("[id='user_quickpay_hidden']").bootstrapSwitch({ onText: "hide", offText: "show" });
|
||||
$('[data-switch]').on('switchChange.bootstrapSwitch', function(event, state) {
|
||||
$(this).closest('form').submit();
|
||||
});
|
||||
|
|
|
@ -55,7 +55,7 @@ class UsersController < ApplicationController
|
|||
private
|
||||
|
||||
def user_params
|
||||
params.fetch(:user, {}).permit(:avatar, :private, :dagschotel_id)
|
||||
params.fetch(:user, {}).permit(:avatar, :private, :dagschotel_id, :quickpay_hidden)
|
||||
end
|
||||
|
||||
def init
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
= f_form_for @user, remote: true do |f|
|
||||
.center
|
||||
= f.check_box :private, skip_label: true, data: { switch: true }
|
||||
.center
|
||||
= f.label "Show dagschotel on koelkast"
|
||||
= f.check_box :quickpay_hidden, skip_label: true, data: { switch: true }
|
||||
%li.list-group-item.text-muted
|
||||
= f_form_for @user do |f|
|
||||
= f.file_field :avatar, skip_label: true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.col-md-2.overviewthumbnail
|
||||
- unless user.dagschotel.nil?
|
||||
- if user.dagschotel && user.quickpay_hidden == false
|
||||
= 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)
|
||||
|
|
5
db/migrate/20160304192839_add_quickpay_hidden_to_user.rb
Normal file
5
db/migrate/20160304192839_add_quickpay_hidden_to_user.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddQuickpayHiddenToUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :quickpay_hidden, :boolean, default:false
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160216133104) do
|
||||
ActiveRecord::Schema.define(version: 20160304192839) do
|
||||
|
||||
create_table "barcodes", force: :cascade do |t|
|
||||
t.integer "product_id"
|
||||
|
@ -86,6 +86,7 @@ ActiveRecord::Schema.define(version: 20160216133104) do
|
|||
t.string "name"
|
||||
t.boolean "private", default: false
|
||||
t.integer "frecency", default: 0, null: false
|
||||
t.boolean "quickpay_hidden"
|
||||
end
|
||||
|
||||
add_index "users", ["koelkast"], name: "index_users_on_koelkast"
|
||||
|
|
Loading…
Reference in a new issue