Retire semantic_form_for

Also a buttload of form cleanups...
This commit is contained in:
Henne Vogelsang 2022-02-23 17:52:16 +01:00
parent 350b1ebbbe
commit 81853d1ef9
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
136 changed files with 1825 additions and 1441 deletions

View file

@ -1,74 +1,70 @@
.container
.row
.col-md-8
= form_for(@booth, url: @url) do |f|
.form-group
= f.label :title, 'Title'
%abbr{title: 'This field is required'} *
= f.text_field :title, autofocus: true, required: true, class: 'form-control', placeholder: 'Title'
.form-group
= f.label :description, 'Description'
%abbr{title: 'This field is required'} *
= f.text_area :description, rows: 5, data: { provide: 'markdown' }, required: true, class: 'form-control'
%span.help-block
This field becomes public upon request acceptance
.form-group
= f.label :reasoning, 'How it fits the conference'
%abbr{title: 'This field is required'} *
= f.text_area :reasoning, rows: 5, data: { provide: 'markdown' }, required: true, class: 'form-control'
.form-group
= f.label :submitter_relationship, 'Submitter\'s relation'
%abbr{title: 'This field is required'} *
= f.text_field :submitter_relationship, rows: 5, required: true, class: 'form-control'
%span.help-block
e.g. employee, comunity manager, etc
.form-group
= f.label :website_url, 'Website URL'
%abbr{title: 'This field is required'} *
= f.text_field :website_url, class: 'form-control', required: true, placeholder: 'URL'
.form-group
= f.text_field :responsible_ids, multiple: true, class: "form-control", id: "booth_responsibles", placeholder: "Responsibles"
%span.help-block
= "The people responsible for the #{t 'booth'}. You can only select existing users."
.form-group
= image_tag f.object.picture.thumb.url if f.object.picture?
= f.label :picture, 'Picture'
= f.file_field :picture
= form_for(@booth, url: @url) do |f|
.form-group
= f.label :title, 'Title'
%abbr{title: 'This field is required'} *
= f.text_field :title, autofocus: true, required: true, class: 'form-control', placeholder: 'Title'
.form-group
= f.label :description, 'Description'
%abbr{title: 'This field is required'} *
= f.text_area :description, rows: 5, data: { provide: 'markdown' }, required: true, class: 'form-control'
%span.help-block
This field becomes public upon request acceptance
.form-group
= f.label :reasoning, 'How it fits the conference'
%abbr{title: 'This field is required'} *
= f.text_area :reasoning, rows: 5, data: { provide: 'markdown' }, required: true, class: 'form-control'
.form-group
= f.label :submitter_relationship, 'Submitter\'s relation'
%abbr{title: 'This field is required'} *
= f.text_field :submitter_relationship, rows: 5, required: true, class: 'form-control'
%span.help-block
e.g. employee, comunity manager, etc
.form-group
= f.label :website_url, 'Website URL'
%abbr{title: 'This field is required'} *
= f.text_field :website_url, class: 'form-control', required: true, placeholder: 'URL'
.form-group
= f.text_field :responsible_ids, multiple: true, class: "form-control", id: "booth_responsibles", placeholder: "Responsibles"
%span.help-block
The people responsible for the `t('booth')`. You can only select existing users.
.form-group
= image_tag f.object.picture.thumb.url if f.object.picture?
= f.label :picture, 'Picture'
= f.file_field :picture
%p.text-right
%button{type: 'submit', class: 'btn btn-success'}
- if @booth.new_record?
Create `(t'booth').capitalize` Request
- else
Update `(t'booth').capitalize` Request
%p.text-right
%button{type: 'submit', class: 'btn btn-success'}
- if @booth.new_record?
= "Create #{(t'booth').capitalize } Request"
- else
= "Update #{(t'booth').capitalize } Request"
:javascript
$(document).ready(function() {
$('#booth_responsibles').selectize({
persist: false,
create: false,
valueField: 'id',
labelField: 'username',
searchField: 'username',
load: function(query, callback) {
if (!query.length) return callback();
$.ajax({
url: "#{search_users_path}.json",
type: 'GET',
dataType: 'json',
data: {
query: query,
},
error: function(res) {
console.log("selectize error");
callback();
},
success: function(res) {
console.log("selectize success");
// console.log(res);
callback(res.users);
}
});
}
});
:javascript
$(document).ready(function() {
$('#booth_responsibles').selectize({
persist: false,
create: false,
valueField: 'id',
labelField: 'username',
searchField: 'username',
load: function(query, callback) {
if (!query.length) return callback();
$.ajax({
url: "#{search_users_path}.json",
type: 'GET',
dataType: 'json',
data: {
query: query,
},
error: function(res) {
console.log("selectize error");
callback();
},
success: function(res) {
console.log("selectize success");
// console.log(res);
callback(res.users);
}
});
}
});
});

View file

@ -1,6 +1,9 @@
.container
%h1
Editing
= @booth.title
= render 'form'
.row
.col-md-12
.page-header
%h1
Edit Booth
= @booth.title
.row
.col-md-8
= render 'form'

View file

@ -1,51 +1,50 @@
.container
.row
.col-md-12.page-header
%h1
Your #{t'booth'} requests for
= @conference.title
.row
.col-md-12
.margin-booth-table
%table.table.table-striped.table-hover
%thead
%th
%b State
%th
%b Logo
%th
%b Title
%th
%b Actions
- @booths.each do |booth|
%tr
%td{ style: "padding:20px 8px 20px 8px;" }
- if (booth.state == 'to_accept' || booth.state == 'to_reject')
- show_state = 'new'
- else
- show_state = booth.state
%span{ title: show_state, class: "fa #{status_icon(booth)}" }
%td
- if booth.logo_link
= image_tag(booth.picture.thumb.url, width: '20%')
%td
= link_to booth.title, conference_booth_path(@conference.short_title, booth)
%td
-if can? :edit, booth
= link_to 'Edit', edit_conference_booth_path(@conference.short_title, booth.id),
class: 'btn btn-default'
- if booth.transition_possible? :withdraw
= link_to 'Withdraw',
withdraw_conference_booth_path(@conference.short_title, booth),
method: :patch, class: 'btn btn-mini btn-warning', id: "withdraw_booth_#{booth.id}",
data: { confirm: 'Are you sure you really want to withdraw this request?' }
- if booth.transition_possible? :confirm
= link_to 'Confirm',
confirm_conference_booth_path(@conference.short_title, booth),
method: :patch, class: 'btn btn-mini btn-success', id: "confirm_booth_#{booth.id}"
- if booth.transition_possible? :restart
= link_to 'Re-submit',
restart_conference_booth_path(@conference.short_title, booth),
method: :patch, class: 'btn btn-mini btn-success', id: "restart_booth_#{booth.id}"
.pull-right
= link_to "Add #{(t'booth').capitalize }", new_conference_booth_path(@conference.short_title), class: 'button btn btn-primary'
.row
.col-md-12.page-header
%h1
Your #{t'booth'} requests for
= @conference.title
.row
.col-md-12
.margin-booth-table
%table.table.table-striped.table-hover
%thead
%th
%b State
%th
%b Logo
%th
%b Title
%th
%b Actions
- @booths.each do |booth|
%tr
%td{ style: "padding:20px 8px 20px 8px;" }
- if (booth.state == 'to_accept' || booth.state == 'to_reject')
- show_state = 'new'
- else
- show_state = booth.state
%span{ title: show_state, class: "fa #{status_icon(booth)}" }
%td
- if booth.logo_link
= image_tag(booth.picture.thumb.url, width: '20%')
%td
= link_to booth.title, conference_booth_path(@conference.short_title, booth)
%td
-if can? :edit, booth
= link_to 'Edit', edit_conference_booth_path(@conference.short_title, booth.id),
class: 'btn btn-default'
- if booth.transition_possible? :withdraw
= link_to 'Withdraw',
withdraw_conference_booth_path(@conference.short_title, booth),
method: :patch, class: 'btn btn-mini btn-warning', id: "withdraw_booth_#{booth.id}",
data: { confirm: 'Are you sure you really want to withdraw this request?' }
- if booth.transition_possible? :confirm
= link_to 'Confirm',
confirm_conference_booth_path(@conference.short_title, booth),
method: :patch, class: 'btn btn-mini btn-success', id: "confirm_booth_#{booth.id}"
- if booth.transition_possible? :restart
= link_to 'Re-submit',
restart_conference_booth_path(@conference.short_title, booth),
method: :patch, class: 'btn btn-mini btn-success', id: "restart_booth_#{booth.id}"
.pull-right
= link_to "Add #{(t'booth').capitalize }", new_conference_booth_path(@conference.short_title), class: 'button btn btn-primary'

View file

@ -1,4 +1,8 @@
.container
%h1 Request a #{t'booth'}
= render 'form'
.row
.col-md-12
.page-header
%h1
Request a #{t'booth'}
.row
.col-md-8
= render 'form'