osem-fcy/app/views/admin/votable_fields/index.html.haml

43 lines
2.2 KiB
Text
Raw Normal View History

2016-09-22 20:06:46 -04:00
.row
.col-md-12
.page-header
%h1 Votable Fields
%p.text-muted
Select the criteria of rating in conference
- if @conference.votable_fields.any?
.row
.col-md-12
%table.table.table-striped.table-bordered.table-hover.datatable
%thead
%th Enabled?
%th Title
%th Votable Type
%th Actions
%tbody
- @conference.votable_fields.each do |votable_field|
%tr
%td
- if can? :update, votable_field
= check_box_tag @conference.short_title, votable_field.id , votable_field.enabled,
method: :patch, url: "/admin/conferences/#{@conference.short_title}/votable_fields/#{votable_field.id}?votable_field[enabled]=",
class: 'switch-checkbox', readonly: false, data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
- else
= check_box_tag @conference.short_title, votable_field.id , votable_field.enabled,
method: :patch, url: "/admin/conferences/#{@conference.short_title}/votable_fields/#{votable_field.id}?votable_field[enabled]=",
class: 'switch-checkbox', readonly: true,data: { size: 'small', on_color: 'success', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
%td
= votable_field.title
%td
= votable_field.votable_type
%td
.btn-group
= link_to 'Edit', edit_admin_conference_votable_field_path(@conference.short_title, votable_field),
method: :get, class: 'btn btn-primary', disabled: !(can? :update, votable_field)
= link_to 'Delete', admin_conference_votable_field_path(@conference.short_title, votable_field),
method: :delete, class: 'btn btn-danger', disabled: !(can? :destroy, votable_field),
data: { confirm: "Do you really want to delete #{votable_field.title}?" }
.row
.col-md-12
= link_to 'Add Votable Field', new_admin_conference_votable_field_path, class: 'btn btn-success pull-right', disabled: !(can? :create, @conference.votable_fields.new)