Implement Event Ratings

This commit is contained in:
shlok007 2016-09-22 20:06:46 -04:00 committed by Shlok Srivastava
parent 5be1ad52ee
commit 20f4853487
67 changed files with 1298 additions and 378 deletions

View file

@ -0,0 +1,16 @@
.row
.col-md-12
.page-header
%h1
- if @votable_field.new_record?
New
Votable Field
.row
.col-md-8
= semantic_form_for(@votable_field, :url => (@votable_field.new_record? ? admin_conference_votable_fields_path : admin_conference_votable_field_path(@conference.short_title, @votable_field))) do |f|
= f.input :title
= f.input :votable_type, collection: options_for_select(['Event'])
= f.input :stars, label: 'Add the total number of stars for the field'
= f.input :for_admin, label: 'Add this field for voting in admin side only'
%p.text-right
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }

View file

@ -0,0 +1,42 @@
.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)

View file

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