Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
admin halls fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyfrank committed Mar 31, 2013
1 parent ff4226b commit 81b2664
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
9 changes: 9 additions & 0 deletions app/assets/javascripts/admin/halls.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ class TimeSlotEditWidget
@event_type_dropdown.select2 @select2_options
@event_id_dropdown.select2 @select2_options
@item.find('.datetimepicker').datetimepicker format: "yyyy-MM-dd hh:mm:ss"
@start_time_picker = @item.find('.start_time').closest('.datetimepicker')
@start_time_picker.on 'changeDate', (e) =>
start_date = e.localDate
console.log(start_date)
finish_date = new Date(Date.parse(start_date))
finish_date = finish_date.setHours(finish_date.getHours() + 1)
console.log(finish_date)
picker = @item.find('.finish_time').closest('.datetimepicker').data('datetimepicker')
picker.setLocalDate(new Date(finish_date))

bind: ->
@event_type_dropdown.on 'change', (e) =>
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/web/admin/halls_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def create
@hall.changed_by = current_user
if @hall.save
flash_success
redirect_to admin_halls_path
redirect_to edit_admin_hall_path(@hall)
else
flash_error
render :new
Expand All @@ -30,7 +30,7 @@ def update
@hall.changed_by = current_user
if @hall.update_attributes params[:hall]
flash_success
redirect_to admin_halls_path
redirect_to edit_admin_hall_path(@hall)
else
flash_error
render :edit
Expand Down
4 changes: 2 additions & 2 deletions app/views/web/admin/halls/_slot_fields.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.span9.well
= f.input :event_type, collection: Slot.event_type.options, include_blank: true, input_html: { class: 'span7 event-type-select span-nomargin' }
= f.input :event_id, as: :events, include_blank: true, input_html: { class: 'span7 event-id-select span-nomargin' }
= f.input :start_time, as: :date_time_picker, input_html: { class: 'span7' }
= f.input :finish_time, as: :date_time_picker, input_html: { class: 'span7' }
= f.input :start_time, as: :date_time_picker, input_html: { class: 'span7 start_time' }
= f.input :finish_time, as: :date_time_picker, input_html: { class: 'span7 finish_time' }
.controls
.span7.span-nomargin
= link_to_remove_association t('.delete'), f, class: 'btn btn-danger pull-right'
4 changes: 2 additions & 2 deletions app/views/web/admin/halls/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
.pull-right.btn-group
= link_to edit_admin_hall_path(hall), class: 'btn btn-mini' do
%i.icon-pencil
= link_to admin_hall_path(hall), class: 'btn btn-mini', method: :delete do
%i.icon-trash
-#= link_to admin_hall_path(hall), class: 'btn btn-mini', method: :delete do
-# %i.icon-trash
4 changes: 2 additions & 2 deletions app/views/web/admin/workshops/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
.pull-right.btn-group
= link_to edit_admin_workshop_path(workshop), class: 'btn btn-mini' do
%i.icon-pencil
= link_to admin_workshop_path(workshop), class: 'btn btn-mini', method: :delete do
%i.icon-trash
-#= link_to admin_workshop_path(workshop), class: 'btn btn-mini', method: :delete do
-# %i.icon-trash

0 comments on commit 81b2664

Please sign in to comment.