Skip to content

Commit

Permalink
fix admin ui and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Chebulaev committed Jul 10, 2013
1 parent 604524a commit f21b0f7
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 21 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Expand Up @@ -15,6 +15,7 @@
//= require twitter/bootstrap
//= require bootstrap-datetimepicker.min
// NOTE: найти почему не работает turbolinks
// FIXME: вытащить все что касается админки в отдельный js
//= require cocoon
//= require select2
//= require_tree .
8 changes: 8 additions & 0 deletions app/assets/stylesheets/web/admin/application.css
@@ -0,0 +1,8 @@
/*
* FIXME: вытащить стили админки сюда
*
*/

.span-nomargin {
margin-left: 0 !important;
}
1 change: 1 addition & 0 deletions app/models/slot.rb
Expand Up @@ -6,4 +6,5 @@ class Slot < ActiveRecord::Base

validates :start_time, presence: true
validates :finish_time, presence: true
validates :lecture, presence: true
end
4 changes: 2 additions & 2 deletions app/views/web/admin/halls/_form.html.haml
@@ -1,6 +1,6 @@
= simple_form_for [:admin, @hall], html: { class: 'form-horizontal hall-form' } do |f|
= f.input :name, input_html: { class: 'input-block-level' }
= f.input :state_event, as: :state_event, input_html: { class: 'input-block-level' }
= f.input :name, input_html: { class: 'span5' }
= f.input :state_event, as: :state_event, input_html: { class: 'span5' }

%h3= t '.timeslots'
#slots
Expand Down
25 changes: 11 additions & 14 deletions app/views/web/admin/halls/_slot_fields.html.haml
@@ -1,16 +1,13 @@
.row.nested-fields
.well
.control-group
= f.association :lecture, collection: Lecture.in_schedule, label_method: :name, value_method: :id, as: :choosen_select, input_html: { class: 'input-block-level' }
.control-group
.control-label
= t('.time_from_till')
.controls
.row-fluid
.span4
= f.input_field :start_time, as: :date_time_picker, class: 'span9'
.span4
= f.input_field :finish_time, as: :date_time_picker, class: 'span9'
.span4
= link_to_remove_association t('.delete'), f, class: 'btn btn-danger'
.span7
.well
.control-group
= f.association :lecture, collection: Lecture.in_schedule, label_method: :name, value_method: :id, as: :choosen_select, input_html: { class: 'span4 span-nomargin' }
.control-group
.control-label
= t('.time_from_till')
.controls
= f.input_field :start_time, as: :date_time_picker, input_html: {class: 'span2'}
= f.input_field :finish_time, as: :date_time_picker
= link_to_remove_association t('.delete'), f, class: 'btn btn-danger pull-right'

10 changes: 6 additions & 4 deletions app/views/web/admin/lectures/_form.html.haml
@@ -1,8 +1,10 @@
= simple_form_for [:admin, @lecture], html: { class: 'form-horizontal hall-form' } do |f|
= f.input :name, input_html: { class: 'input-block-level' }
= f.association :user, collection: User.active.asc_by_last_name.decorate, label_method: :full_name, value_method: :id, as: :choosen_select, input_html: { class: 'input-block-level' }
= f.input :state_event, as: :state_event, input_html: { class: 'input-block-level' }
= f.input :thesis, as: :text, input_html: { class: 'input-block-level' }
= f.input :name, input_html: { class: 'span5' }
.row
.span5
= f.association :user, collection: User.active.asc_by_last_name.decorate, label_method: :full_name, value_method: :id, as: :choosen_select, input_html: { class: 'span5 span-nomargin' }
= f.input :state_event, as: :state_event, input_html: { class: 'span5' }
= f.input :thesis, as: :text, input_html: {rows: 20, class: 'span7' }
.form-actions
= f.button :submit, class: 'btn btn-primary'
= link_to t('.cancel'), admin_lectures_path, class: 'btn'
2 changes: 1 addition & 1 deletion test/controllers/web/admin/users_controller_test.rb
Expand Up @@ -36,7 +36,7 @@ class Web::Admin::UsersControllerTest < ActionController::TestCase

assert_response :redirect

user = User.find_by_email @attrs[:email]
user = User.where(@attrs.extract(:first_name)).first
assert user
end
end

0 comments on commit f21b0f7

Please sign in to comment.