mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 16:31:38 -04:00
Merge pull request #118 from ilya-konanykhin/issue-105-106
Issue #105, #106: photo upload for User & Bike
This commit is contained in:
@@ -4,70 +4,77 @@
|
||||
|
||||
.row
|
||||
.col-xs-12.col-sm-6.col-lg-4
|
||||
%fieldset
|
||||
.form-group
|
||||
= number_field_tag nil, nil, id: 'shop_id', placeholder: 'Shop ID', min: 0, class: 'form-control'
|
||||
.help-block
|
||||
= form_for @bike, as: 'bikes', index: '', url: api_create_bike_path, method: :post, enctype: 'multipart/form-data', html: {id: 'add_bike_form'} do |f|
|
||||
= f.hidden_field 'bike_purpose_id'
|
||||
%fieldset
|
||||
.form-group
|
||||
= f.number_field 'shop_id', placeholder: 'Shop ID', min: 0, class: 'form-control', id: 'shop_id'
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= select_tag :bike_brand_id, options_for_select(@brands), class: 'form-control'
|
||||
.help-block
|
||||
.form-group
|
||||
= f.select 'bike_brand_id', options_for_select(@brands), {}, class: 'form-control', id: 'bike_brand_id'
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= text_field_tag nil, nil, id: 'model', placeholder: 'Model', class: 'form-control'
|
||||
.help-block
|
||||
.form-group
|
||||
= f.text_field 'model', placeholder: 'Model', class: 'form-control', id: 'model'
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= text_field_tag nil, nil, id: 'serial_number', placeholder: 'Serial Number', class: 'form-control'
|
||||
.help-block
|
||||
.form-group
|
||||
= f.text_field 'serial_number', placeholder: 'Serial Number', class: 'form-control', id: 'serial_number'
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
.btn-group(data-toggle="buttons")
|
||||
%label.btn.btn-default
|
||||
= radio_button_tag 'bike_style', 3
|
||||
RD
|
||||
%label.btn.btn-default
|
||||
= radio_button_tag 'bike_style', 1
|
||||
MTN
|
||||
%label.btn.btn-default
|
||||
= radio_button_tag 'bike_style', 2
|
||||
HYB
|
||||
%label.btn.btn-default
|
||||
= radio_button_tag 'bike_style', 4
|
||||
OTHER
|
||||
= hidden_field_tag nil, nil, id: 'bike_style_id'
|
||||
.help-block
|
||||
.form-group
|
||||
.btn-group(data-toggle="buttons")
|
||||
%label.btn.btn-default
|
||||
= f.radio_button 'bike_style_id', 3
|
||||
RD
|
||||
%label.btn.btn-default
|
||||
= f.radio_button 'bike_style_id', 1
|
||||
MTN
|
||||
%label.btn.btn-default
|
||||
= f.radio_button 'bike_style_id', 2
|
||||
HYB
|
||||
%label.btn.btn-default
|
||||
= f.radio_button 'bike_style_id', 4
|
||||
OTHER
|
||||
= hidden_field_tag nil, nil, id: 'bike_style_id'
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= select_tag :bike_wheel_size_id, options_for_select(@wheel_sizes), id: :bike_wheel_size_id, class: 'form-control'
|
||||
.help-block
|
||||
.form-group
|
||||
= f.select 'bike_wheel_size_id', options_for_select(@wheel_sizes), {}, class: 'form-control', id: 'bike_wheel_size_id'
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
.btn-group(data-toggle="buttons")
|
||||
%label.btn.btn-default
|
||||
= radio_button_tag 'bike_condition', 2
|
||||
Poor
|
||||
%label.btn.btn-default
|
||||
= radio_button_tag 'bike_condition', 3
|
||||
Fair
|
||||
%label.btn.btn-default
|
||||
= radio_button_tag 'bike_condition', 4
|
||||
Good
|
||||
%label.btn.btn-default
|
||||
= radio_button_tag 'bike_condition', 5
|
||||
Excellent
|
||||
= hidden_field_tag nil, nil, id: 'bike_condition_id'
|
||||
.help-block
|
||||
.form-group
|
||||
.btn-group(data-toggle="buttons")
|
||||
%label.btn.btn-default
|
||||
= f.radio_button 'bike_condition_id', 2
|
||||
Poor
|
||||
%label.btn.btn-default
|
||||
= f.radio_button 'bike_condition_id', 3
|
||||
Fair
|
||||
%label.btn.btn-default
|
||||
= f.radio_button 'bike_condition_id', 4
|
||||
Good
|
||||
%label.btn.btn-default
|
||||
= f.radio_button 'bike_condition_id', 5
|
||||
Excellent
|
||||
= hidden_field_tag nil, nil, id: 'bike_condition_id'
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
.input-group
|
||||
= number_field_tag nil, nil, id: 'seat_tube_height', placeholder: 'Seat Tube', min: 0, max: 100, class: 'form-control'
|
||||
.input-group-addon cm
|
||||
.help-block
|
||||
.form-group
|
||||
.input-group
|
||||
= f.number_field 'seat_tube_height', placeholder: 'Seat Tube', min: 0, max: 100, class: 'form-control', id: 'seat_tube_height'
|
||||
.input-group-addon cm
|
||||
.help-block
|
||||
|
||||
-# Commenting this out until description is added to Bike
|
||||
/.form-group
|
||||
%input{id: "bike_description", placeholder: "Short description", type: "text", class: "input-lg" }
|
||||
.form-group
|
||||
%label Bike photo (optional)
|
||||
= f.file_field 'photo', id: 'photo'
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= button_tag 'Add Bike', id: 'add_bike_submit', class: 'btn btn-primary', data: {url: api_create_bike_path}
|
||||
-# Commenting this out until description is added to Bike
|
||||
/.form-group
|
||||
%input{id: "bike_description", placeholder: "Short description", type: "text", class: "input-lg" }
|
||||
|
||||
.form-group
|
||||
= button_tag 'Add Bike', class: 'btn btn-primary'
|
||||
@@ -9,34 +9,49 @@
|
||||
%h1 #{@bike.shop_id}: #{@bike.bike_brand}
|
||||
%h4= @bike.model
|
||||
|
||||
%dl.dl-horizontal
|
||||
%dt Type
|
||||
%dd= @bike.bike_style
|
||||
.form-horizontal
|
||||
- if @bike.photo?
|
||||
.form-group
|
||||
%label.col-sm-2.control-label Photo
|
||||
.col-sm-10
|
||||
= link_to @bike.photo.url, target: '_blank' do
|
||||
%img{src: @bike.photo.url(:thumb), class: 'img-thumbnail'}
|
||||
|
||||
%dt Wheel Size
|
||||
%dd= @bike.bike_wheel_size.display_string
|
||||
.form-group
|
||||
%label.col-sm-2.control-label Type
|
||||
.col-sm-10.form-control-static= @bike.bike_style
|
||||
|
||||
%dt Condition
|
||||
%dd= @bike.bike_condition
|
||||
.form-group
|
||||
%label.col-sm-2.control-label Wheel Size
|
||||
.col-sm-10.form-control-static= @bike.bike_wheel_size.display_string
|
||||
|
||||
%dt Seat Tube (cm)
|
||||
%dd= @bike.seat_tube_height
|
||||
.form-group
|
||||
%label.col-sm-2.control-label Condition
|
||||
.col-sm-10.form-control-static= @bike.bike_condition
|
||||
|
||||
%dt Purpose
|
||||
%dd= @bike.bike_purpose
|
||||
.form-group
|
||||
%label.col-sm-2.control-label Seat Tube (cm)
|
||||
.col-sm-10.form-control-static= @bike.seat_tube_height
|
||||
|
||||
.form-group
|
||||
%label.col-sm-2.control-label Purpose
|
||||
.col-sm-10.form-control-static= @bike.bike_purpose
|
||||
|
||||
- unless @bike.value.nil?
|
||||
%dt Value
|
||||
%dd= @bike.value
|
||||
.form-group
|
||||
%label.col-sm-2.control-label Value
|
||||
.col-sm-10.form-control-static= @bike.value
|
||||
|
||||
- unless @bike.color.nil?
|
||||
%dt Color
|
||||
%dd
|
||||
.bike-color(style="background-color: ##{@bike.color}")= @bike.color
|
||||
.form-group
|
||||
%label.col-sm-2.control-label Color
|
||||
.col-sm-10.form-control-static
|
||||
.bike-color(style="background-color: ##{@bike.color}")= @bike.color
|
||||
|
||||
- if @task_list
|
||||
- tasks = @task_list.tasks.to_a
|
||||
%dt Task list
|
||||
%dd
|
||||
= link_to edit_task_list_path(@task_list.id) do
|
||||
#{tasks.select(&:done).count}/#{tasks.count}
|
||||
.form-group
|
||||
%label.col-sm-2.control-label Task list
|
||||
.col-sm-10.form-control-static
|
||||
= link_to edit_task_list_path(@task_list.id) do
|
||||
#{tasks.select(&:done).count}/#{tasks.count}
|
||||
@@ -7,13 +7,16 @@
|
||||
|
||||
%fieldset
|
||||
.form-group
|
||||
= f.text_field :username, placeholder: 'Username', class: 'form-control'
|
||||
= f.text_field :username, placeholder: 'Username', class: 'form-control', required: true
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= f.text_field :first_name, placeholder: 'First Name', class: 'form-control'
|
||||
= f.text_field :first_name, placeholder: 'First Name', class: 'form-control', required: true
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= f.text_field :last_name, placeholder: 'Last Name', class: 'form-control'
|
||||
= f.text_field :last_name, placeholder: 'Last Name', class: 'form-control', required: true
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= f.email_field :email, placeholder: 'E-mail', class: 'form-control'
|
||||
@@ -25,10 +28,18 @@
|
||||
|
||||
%fieldset
|
||||
.form-group
|
||||
= f.password_field :password, placeholder: 'Password', class: 'form-control'
|
||||
%label You may upload your photo to be used as an avatar
|
||||
= f.file_field :avatar
|
||||
.help-block #{User::MAX_AVATAR_SIZE_KB} Kb max
|
||||
|
||||
%fieldset
|
||||
.form-group
|
||||
= f.password_field :password, placeholder: 'Password', class: 'form-control', required: true
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= f.password_field :password_confirmation, placeholder: 'Password Confirmation', class: 'form-control'
|
||||
= f.password_field :password_confirmation, placeholder: 'Password Confirmation', class: 'form-control', required: true
|
||||
.help-block
|
||||
|
||||
.form-group
|
||||
= f.submit 'Sign up', class: 'btn btn-primary'
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
%h4= @task_list.item.model
|
||||
|
||||
- if @task_list.item.photo?
|
||||
%p
|
||||
%img{src: @task_list.item.photo.url(:thumb), class: 'img-thumbnail'}
|
||||
|
||||
%fieldset
|
||||
.form-group
|
||||
- @task_list.tasks.each do |task|
|
||||
|
||||
Reference in New Issue
Block a user