Merge pull request #1261 from shlok007/resources

Ability to track resources
This commit is contained in:
Ana María Martínez Gómez 2017-02-09 10:45:51 +01:00 committed by GitHub
commit f42e4adc45
17 changed files with 265 additions and 2 deletions

View file

@ -0,0 +1,16 @@
.row
.col-md-12
.page-header
%h1
- if @resource.new_record?
New
Resource
.row
.col-md-8
= semantic_form_for(@resource, :url => (@resource.new_record? ? admin_conference_resources_path : admin_conference_resource_path(@conference.short_title, @resource))) do |f|
= f.input :name
= f.input :description, input_html: { rows: 5, data: { provide: "markdown-editable" } }
= f.input :used
= f.input :quantity
%p.text-right
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }

View file

@ -0,0 +1,36 @@
.row
.col-md-12
.page-header
%h1 Resources
%p.text-muted
Manage resources in conference
- if @conference.resources.any?
.row
.col-md-12
%table.table.table-hover.datatable
%thead
%th Name
%th Left( Left/Total )
%th Used
%th Actions
%tbody
- @conference.resources.each do |resource|
%tr
%td
= link_to(admin_conference_resource_path(@conference.short_title, resource.id)) do
= resource.name
%td
= quantity_left_of(resource)
%td
= resource.used
%td
.btn-group
= link_to 'Edit', edit_admin_conference_resource_path(@conference.short_title, resource.id),
method: :get, class: 'btn btn-primary', disabled: !(can? :update, resource)
= link_to 'Delete', admin_conference_resource_path(@conference.short_title, resource.id),
method: :delete, class: 'btn btn-danger', disabled: !(can? :destroy, resource),
data: { confirm: "Do you really want to delete #{resource.name}?" }
.row
.col-md-12
= link_to 'Add Resource', new_admin_conference_resource_path, class: 'btn btn-success pull-right', disabled: !(can? :create, Resource.new(conference_id: @conference_id))

View file

@ -0,0 +1 @@
= render 'form'

View file

@ -0,0 +1,26 @@
.row
.col-md-12
%h3
= @resource.name
.btn-group.pull-right
= link_to 'Edit', edit_admin_conference_resource_path(@conference.short_title, @resource), class: 'btn btn-mini btn-primary'
%br
.row
.col-md-12
%table.table
%tr
%td.col-md-2
%b Description
%td
= @resource.description
%tr
%td
%b Total Quantity
%td
= @resource.quantity
%tr
%td
%b Quantity left
%td
= quantity_left_of(@resource)