Introduce Booths for admin
This commit is contained in:
parent
29aee82a14
commit
f7c0b64eb5
22 changed files with 534 additions and 1 deletions
29
app/views/admin/booths/_change_state_dropdown.html.haml
Normal file
29
app/views/admin/booths/_change_state_dropdown.html.haml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
- if booth.transition_possible? :accept
|
||||
%li= link_to 'Accept booth',
|
||||
accept_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, id: "accept_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :reject
|
||||
%li= link_to 'Reject booth',
|
||||
reject_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, confirm: 'Are you sure?', id: "reject_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :to_reject
|
||||
%li= link_to 'To reject booth',
|
||||
to_reject_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, confirm: 'Are you sure?', id: "to_reject_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :restart
|
||||
%li= link_to 'Start review',
|
||||
restart_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, id: "restart_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :to_accept
|
||||
%li= link_to 'To accept booth',
|
||||
to_accept_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, id: "to_accept_booth_#{booth.id}"
|
||||
|
||||
- if booth.transition_possible? :cancel
|
||||
%li= link_to 'Cancel booth',
|
||||
cancel_admin_conference_booth_path(@conference.short_title, booth),
|
||||
method: :patch, id: "cancel_booth_#{booth.id}"
|
||||
33
app/views/admin/booths/_form.html.haml
Normal file
33
app/views/admin/booths/_form.html.haml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%title Request a Booth
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@booth, url: @booth.new_record? ? admin_conference_booths_path(@conference.short_title) : admin_conference_booth_path(@conference.short_title, @booth.id), html: { multipart: true }) do |f|
|
||||
= f.input :title, as: :string, required: true
|
||||
= f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
||||
hint: 'This field becomes public upon request acceptance'
|
||||
= f.input :reasoning, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
||||
label: 'How it fits the conference'
|
||||
= f.input :submitter_relationship, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
||||
label: 'Your personal relationship with the organization you are applying for',
|
||||
hint: 'e.g. employee, member of the open source community etc'
|
||||
= f.input :website_url
|
||||
= responsibles_selector_input f
|
||||
= image_tag f.object.picture.thumb.url if f.object.picture?
|
||||
= f.input :picture
|
||||
|
||||
%p.text-right
|
||||
- if @booth.new_record?
|
||||
= f.submit 'Create Booth Request', class: 'btn btn-success'
|
||||
- else
|
||||
= f.submit 'Update Booth Request', class: 'btn btn-success'
|
||||
|
||||
:javascript
|
||||
$(document).ready(function() {
|
||||
$('#booth_responsible_ids').selectize({
|
||||
plugins: ['remove_button'],
|
||||
minItems: 2
|
||||
} )
|
||||
});
|
||||
5
app/views/admin/booths/edit.html.haml
Normal file
5
app/views/admin/booths/edit.html.haml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
%h1
|
||||
Editing
|
||||
= @booth.title
|
||||
|
||||
= render 'form'
|
||||
58
app/views/admin/booths/index.html.haml
Normal file
58
app/views/admin/booths/index.html.haml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
Booths
|
||||
= "(#{@booths.length})" if @booths.any?
|
||||
.pull-right
|
||||
- if can? :create, Booth
|
||||
= link_to 'Add Booth', new_admin_conference_booth_path(@conference.short_title), class: 'button btn btn-primary'
|
||||
%p.text-muted
|
||||
All the booth requests
|
||||
.row
|
||||
.col-md-12
|
||||
.margin-booth-table
|
||||
%table.table.table-striped.table-bordered.table-hover.datatable
|
||||
%thead
|
||||
%th
|
||||
%b ID
|
||||
%th
|
||||
%b Logo
|
||||
%th
|
||||
%b Title
|
||||
%th
|
||||
%b Submitter
|
||||
%th
|
||||
%b Responsibles
|
||||
%th
|
||||
%b State
|
||||
%th
|
||||
%b Actions
|
||||
- @booths.each do |booth|
|
||||
%tr
|
||||
%td
|
||||
= booth.id
|
||||
%td
|
||||
= image_tag(booth.picture.thumb.url, width: '20%')
|
||||
%td
|
||||
= link_to booth.title, admin_conference_booth_path(@conference.short_title, booth)
|
||||
%td
|
||||
= link_to booth.submitter.name, admin_user_path(booth.submitter) if booth.submitter
|
||||
%td
|
||||
.responsibles
|
||||
- booth.responsibles.each do |responsible|
|
||||
= link_to responsible.name, admin_user_path(responsible)
|
||||
%td
|
||||
.btn-group
|
||||
%button{ type: 'button', class: 'btn btn-link dropdown-toggle', 'data-toggle' => 'dropdown' }
|
||||
= booth.state.humanize
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
= render 'change_state_dropdown', booth: booth
|
||||
%td
|
||||
.btn-group{ role: "group" }
|
||||
= link_to 'Edit', edit_admin_conference_booth_path(@conference.short_title, booth.id),
|
||||
class: 'btn btn-primary'
|
||||
= link_to 'Delete', admin_conference_booth_path(@conference.short_title, booth.id),
|
||||
method: :delete, class: 'btn btn-danger',
|
||||
data: {confirm: "Do you really want to delete this booth request?"}
|
||||
3
app/views/admin/booths/new.html.haml
Normal file
3
app/views/admin/booths/new.html.haml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
%h1 New booth
|
||||
|
||||
= render 'form'
|
||||
57
app/views/admin/booths/show.html.haml
Normal file
57
app/views/admin/booths/show.html.haml
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
.row
|
||||
.col-md-12
|
||||
%h3
|
||||
= image_tag(@booth.picture.thumb.url, size: '20%', alt: '')
|
||||
= @booth.title
|
||||
.btn-group.pull-right
|
||||
= link_to 'Edit', edit_admin_conference_booth_path(@conference.short_title, @booth), class: 'btn btn-mini btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Description
|
||||
%td
|
||||
= markdown(@booth.description)
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Reasoning
|
||||
%td
|
||||
= markdown(@booth.reasoning)
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Website
|
||||
%td
|
||||
- if @booth.website_url.present?
|
||||
= link_to @booth.website_url, @booth.website_url
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Submitter
|
||||
%td
|
||||
= link_to @booth.submitter.name, admin_user_path(@booth.submitter)
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Submitter's relationship
|
||||
%td
|
||||
= @booth.submitter_relationship
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Responsibles
|
||||
%td
|
||||
- @booth.responsibles.each do |responsibles|
|
||||
.responsibles
|
||||
= link_to responsibles.name, admin_user_path(responsibles)
|
||||
(
|
||||
= responsibles.email
|
||||
)
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Submitted on
|
||||
%td
|
||||
= @booth.created_at
|
||||
%tr
|
||||
%td.col-md-2
|
||||
%b Last updated on
|
||||
%td
|
||||
= @booth.updated_at
|
||||
Loading…
Add table
Add a link
Reference in a new issue