| @@ -0,0 +1,49 @@ | ||
| (function() | ||
| { | ||
| var plugin_name = 'submit'; | ||
|
|
||
| CKEDITOR.plugins.add( plugin_name, | ||
| { | ||
| icons: plugin_name, | ||
| hidpi: false, | ||
|
|
||
| init: function( editor ) | ||
| { | ||
| var iconcPath = this.path + 'icons/'; | ||
| var $form = $(editor.element.$.form); | ||
|
|
||
| $form.bind('ajax:success', function() { | ||
| if($('.site_imap_anchor')[0]) { | ||
| location.reload(); | ||
| } | ||
| }) | ||
| editor.addCommand( 'submit', { | ||
| exec: function( editor ) { | ||
| editor.updateElement() | ||
| $form.submit() | ||
| editor.destroy(false) | ||
| } | ||
| }); | ||
|
|
||
| editor.addCommand( 'cancel', { | ||
| exec: function( editor ) { | ||
| editor.destroy(true) | ||
| } | ||
| }); | ||
|
|
||
| editor.ui.addButton( 'Submit', | ||
| { | ||
| label: 'Сохранить', | ||
| command: 'submit', | ||
| icon: iconcPath + 'submit.png' | ||
| } ); | ||
|
|
||
| editor.ui.addButton( 'Cancel', | ||
| { | ||
| label: 'Закрыть', | ||
| command: 'cancel', | ||
| icon: iconcPath + 'cancel.png' | ||
| } ); | ||
| }, | ||
| } ); | ||
| } )(); |
| @@ -0,0 +1,21 @@ | ||
| //= require jquery | ||
| //= require bootstrap.min | ||
| //= require tooltip | ||
|
|
||
| $(function () { | ||
| $("[data-toggle='tooltip']").tooltip(); | ||
| }); | ||
|
|
||
| $("#menu-toggle").click(function(e) { | ||
| e.preventDefault(); | ||
| $("#wrapper").toggleClass("toggled"); | ||
| }); | ||
|
|
||
| $("#menu-toggle-2").click(function(e) { | ||
| e.preventDefault(); | ||
| $("#wrapper").toggleClass("toggled"); | ||
| }); | ||
|
|
||
| // $( document ).ready(function(){ | ||
| // CKEDITOR.inline("lol"); | ||
| // }); |
| @@ -0,0 +1,52 @@ | ||
| //= require jquery_ujs | ||
| //= require ckeditor/init | ||
|
|
||
| $(document).on('click', '.inline-content', function(evt) { | ||
| $div = $(this); | ||
| $textArea = $(this).prev(); | ||
| $div.hide(); | ||
| $textArea.show().val($div.html()); | ||
| CKEDITOR.inline($textArea[0], { | ||
| on: { | ||
| 'destroy': function (evt) { | ||
| $div.show().html($textArea.val()) | ||
| } | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| $(document).on('click', '.mm-edit-name-off', function(evt) { | ||
| $this = $(this); | ||
| $a = $this.closest('li').find('.mm-name'); | ||
| $this.text('Ок').removeClass('mm-edit-name-off').addClass('mm-edit-name-on'); | ||
| $a.attr('contenteditable', 'true'); | ||
| }); | ||
|
|
||
| $(document).on('click', '.mm-edit-name-on', function(evt) { | ||
| $this = $(this); | ||
| $a = $this.closest('li').find('.mm-name'); | ||
| $this.text('Правка').removeClass('mm-edit-name-on').addClass('mm-edit-name-off'); | ||
| $a.attr('contenteditable', 'false'); | ||
|
|
||
| $.ajax({ | ||
| type: "patch", | ||
| url: "/methodical_materials/" + $this.data('id'), | ||
| data: { | ||
| methodical_material: {name: $a.text()} | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| $(document).on('click', '.mm-delete-remote', function(evt) { | ||
| $li = $(this).closest('li'); | ||
| $.ajax({ | ||
| type: "DELETE", | ||
| url: "/methodical_materials/" + $(this).data('id'), | ||
| data: { | ||
| current_id: $('#current_id').val() | ||
| }, | ||
| success: function() { | ||
| $li.remove(); | ||
| } | ||
| }); | ||
| }); |
| @@ -0,0 +1,86 @@ | ||
| .row { | ||
| margin-bottom: 15px; | ||
| padding: 5px 10px; | ||
| } | ||
|
|
||
| .aling-center { | ||
| text-align: center; | ||
| } | ||
|
|
||
| .button-right { | ||
| margin-left: 35px; | ||
| } | ||
|
|
||
| .no-margin { | ||
| margin: 0px; | ||
| } | ||
|
|
||
| .indent { | ||
| text-indent: 1.5em; | ||
| text-align: justify; | ||
| } | ||
|
|
||
| .indent-2 { | ||
| text-indent: 3em; | ||
| text-align: justify; | ||
| } | ||
|
|
||
| .tooltip-inner{ | ||
| text-align: left; | ||
| text-indent: 0em; | ||
| } | ||
|
|
||
| p { | ||
| margin-top: 10px; | ||
| margin-bottom: 10px; | ||
| padding: 3px 30px; | ||
| } | ||
|
|
||
| .img-responsive{ | ||
| max-width: 100%; | ||
| height: auto; | ||
| } | ||
|
|
||
| .font-lg { | ||
| font-size: 1.1em; | ||
| } | ||
|
|
||
| .inline-area { | ||
| display: none; | ||
| } | ||
|
|
||
| .btn { | ||
| text-indent: 0px; | ||
| } | ||
|
|
||
| .inline-content { | ||
| width: 100%; | ||
| min-height: 1em; | ||
| } | ||
| .inline-content:hover { | ||
| -webkit-box-shadow: 0 0 5px 1px rgba(51,122,183,1); | ||
| box-shadow: 0 0 5px 1px rgba(51,122,183,1); | ||
| } | ||
| .sidebar-nav li { | ||
| position: relative; | ||
| } | ||
| .mm-edit-name { | ||
| position: absolute; | ||
| text-decoration: underline; | ||
| color: #337AB7; | ||
| font-size: 0.7em; | ||
| right: 34px; | ||
| top:1px; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .mm-delete { | ||
| position: absolute; | ||
| color: #FF4444; | ||
| font-size: 0.7em; | ||
| width: 5px; | ||
| right: 30px; | ||
| top:2px; | ||
| cursor: pointer; | ||
| text-decoration: none; | ||
| } |
| @@ -0,0 +1,125 @@ | ||
| /*! | ||
| * Start Bootstrap - Simple Sidebar HTML Template (http://startbootstrap.com) | ||
| * Code licensed under the Apache License v2.0. | ||
| * For details, see http://www.apache.org/licenses/LICENSE-2.0. | ||
| */ | ||
|
|
||
| /* Toggle Styles */ | ||
|
|
||
| #wrapper { | ||
| padding-left: 0; | ||
| -webkit-transition: all 0.5s ease; | ||
| -moz-transition: all 0.5s ease; | ||
| -o-transition: all 0.5s ease; | ||
| transition: all 0.5s ease; | ||
| } | ||
|
|
||
| #wrapper.toggled { | ||
| padding-left: 250px; | ||
| } | ||
|
|
||
| #sidebar-wrapper { | ||
| z-index: 1000; | ||
| position: fixed; | ||
| left: 250px; | ||
| width: 0; | ||
| height: 100%; | ||
| margin-left: -250px; | ||
| overflow-y: auto; | ||
| background: #000; | ||
| -webkit-transition: all 0.5s ease; | ||
| -moz-transition: all 0.5s ease; | ||
| -o-transition: all 0.5s ease; | ||
| transition: all 0.5s ease; | ||
| } | ||
|
|
||
| #wrapper.toggled #sidebar-wrapper { | ||
| width: 250px; | ||
| } | ||
|
|
||
| #page-content-wrapper { | ||
| width: 100%; | ||
| position: absolute; | ||
| padding: 15px; | ||
| } | ||
|
|
||
| #wrapper.toggled #page-content-wrapper { | ||
| position: absolute; | ||
| margin-right: -250px; | ||
| } | ||
|
|
||
| /* Sidebar Styles */ | ||
|
|
||
| .sidebar-nav { | ||
| position: absolute; | ||
| top: 0; | ||
| width: 250px; | ||
| margin: 0; | ||
| padding: 0; | ||
| list-style: none; | ||
| } | ||
|
|
||
| .sidebar-nav li { | ||
| text-indent: 20px; | ||
| line-height: 40px; | ||
| } | ||
|
|
||
| .sidebar-nav li a { | ||
| display: block; | ||
| text-decoration: none; | ||
| color: #999999; | ||
| } | ||
|
|
||
| .sidebar-nav li a:hover { | ||
| text-decoration: none; | ||
| color: #fff; | ||
| background: rgba(255,255,255,0.2); | ||
| } | ||
|
|
||
| .sidebar-nav li a:active, | ||
| .sidebar-nav li a:focus { | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .sidebar-nav > .sidebar-brand { | ||
| height: 65px; | ||
| font-size: 18px; | ||
| line-height: 60px; | ||
| } | ||
|
|
||
| .sidebar-nav > .sidebar-brand a { | ||
| color: #999999; | ||
| } | ||
|
|
||
| .sidebar-nav > .sidebar-brand a:hover { | ||
| color: #fff; | ||
| background: none; | ||
| } | ||
|
|
||
| @media(min-width:768px) { | ||
| #wrapper { | ||
| padding-left: 250px; | ||
| } | ||
|
|
||
| #wrapper.toggled { | ||
| padding-left: 0; | ||
| } | ||
|
|
||
| #sidebar-wrapper { | ||
| width: 250px; | ||
| } | ||
|
|
||
| #wrapper.toggled #sidebar-wrapper { | ||
| width: 0; | ||
| } | ||
|
|
||
| #page-content-wrapper { | ||
| padding: 20px; | ||
| position: relative; | ||
| } | ||
|
|
||
| #wrapper.toggled #page-content-wrapper { | ||
| position: relative; | ||
| margin-right: 0; | ||
| } | ||
| } |
| @@ -0,0 +1,43 @@ | ||
| #coding=utf-8 | ||
| class MethodicalMaterialsController < ApplicationController | ||
| layout 'methodical_materials' | ||
|
|
||
| def index | ||
| @page = MethodicalMaterial.find_by name: 'Components' | ||
| unless @page | ||
| @page = MethodicalMaterial.create name: 'Components' | ||
| end | ||
| end | ||
|
|
||
| def update | ||
| @page = MethodicalMaterial.find params[:id] | ||
| @page.update(m_params) | ||
| render nothing: true | ||
| end | ||
|
|
||
| def new | ||
| @page = MethodicalMaterial.create name: 'Новый компонент', title: 'Заголовок', description: 'Описание' | ||
| render 'show' | ||
| end | ||
|
|
||
| def show | ||
| @page = MethodicalMaterial.find params[:id] | ||
| end | ||
|
|
||
| def destroy | ||
| MethodicalMaterial.find(params[:id]).destroy | ||
| respond_to do |format| | ||
| format.js { | ||
| render nothing: true | ||
| } | ||
| format.any { | ||
| redirect_to methodical_materials_path, status: 303 | ||
| } | ||
| end | ||
| end | ||
|
|
||
| private | ||
| def m_params | ||
| params.require(:methodical_material).permit(:name, :title, :description, :theoretical_part, :practical_part) | ||
| end | ||
| end |
| @@ -1,3 +1,4 @@ | ||
| #coding=utf-8 | ||
| class PersonalitiesController < ApplicationController | ||
| layout 'personality_tests' | ||
| before_action :check_admin | ||
| @@ -1,3 +1,4 @@ | ||
| #coding=utf-8 | ||
| class PersonalityTestAnswersController < ApplicationController | ||
| before_action :check_admin | ||
|
|
||
| @@ -1,3 +1,4 @@ | ||
| #coding=utf-8 | ||
| class PersonalityTestQuestionsController < ApplicationController | ||
| before_action :check_admin | ||
|
|
||
| @@ -0,0 +1,21 @@ | ||
| class PersonalityTraitIntervalsController < ApplicationController | ||
| def new | ||
| respond_to do |format| | ||
| format.js { @interval = PersonalityTraitInterval.create(begin_at:0, end_at: 1, personality_id: params[:personality_id], personality_trait_id: PersonalityTrait.first) } | ||
| end | ||
| end | ||
|
|
||
| def update | ||
| PersonalityTraitInterval.find(params[:id]).update(params[:name] => params[:value]) | ||
| render nothing: true | ||
| end | ||
|
|
||
| def destroy | ||
| respond_to do |format| | ||
| format.js { | ||
| PersonalityTraitInterval.find(params[:id]).destroy | ||
| } | ||
| format.any | ||
| end | ||
| end | ||
| end |
| @@ -1,3 +1,4 @@ | ||
| #coding=utf-8 | ||
| class PersonalityTraitsController < ApplicationController | ||
| layout 'personality_tests' | ||
| before_action :check_admin | ||
| @@ -0,0 +1,2 @@ | ||
| class MethodicalMaterial < ActiveRecord::Base | ||
| end |
| @@ -1,7 +1,12 @@ | ||
| class Personality < ActiveRecord::Base | ||
| has_many :personality_traits, through: :personality_trait_intervals | ||
| has_many :personality_trait_intervals | ||
|
|
||
| def traits | ||
| personality_traits | ||
| end | ||
|
|
||
| def intervals | ||
| personality_trait_intervals | ||
| end | ||
| end |
| @@ -1,3 +1,8 @@ | ||
| class PersonalityTrait < ActiveRecord::Base | ||
| has_many :personalities, through: :personality_trait_intervals | ||
| has_many :personality_trait_intervals | ||
|
|
||
| def intervals | ||
| personality_trait_intervals | ||
| end | ||
| end |
| @@ -0,0 +1,8 @@ | ||
| class PersonalityTraitInterval < ActiveRecord::Base | ||
| belongs_to :personality | ||
| belongs_to :personality_trait | ||
|
|
||
| def trait | ||
| personality_trait | ||
| end | ||
| end |
| @@ -0,0 +1,89 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
|
|
||
| <meta charset="utf-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <meta name="description" content=""> | ||
| <meta name="author" content=""> | ||
|
|
||
| <title><%= yield :title %></title> | ||
|
|
||
| <!-- Bootstrap Core CSS --> | ||
| <%= stylesheet_link_tag "bootstrap-standart.min", media: "all", "data-turbolinks-track" => true %> | ||
|
|
||
| <!-- Custom CSS --> | ||
| <%= stylesheet_link_tag "simple-sidebar", media: "all", "data-turbolinks-track" => true %> | ||
| <%= stylesheet_link_tag "methodical_materials", media: "all", "data-turbolinks-track" => true %> | ||
| <%= csrf_meta_tags %> | ||
|
|
||
| <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> | ||
| <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | ||
| <!--[if lt IE 9]> | ||
| <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> | ||
| <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> | ||
| <![endif]--> | ||
|
|
||
| </head> | ||
|
|
||
| <body> | ||
|
|
||
| <div id="wrapper"> | ||
|
|
||
| <!-- Sidebar --> | ||
| <div id="sidebar-wrapper"> | ||
| <ul class="sidebar-nav"> | ||
| <li class="sidebar-brand"> | ||
| <%= link_to 'Компоненты', methodical_materials_path %> | ||
| </li> | ||
|
|
||
| <% MethodicalMaterial.where.not(name: 'Components').each do |material| %> | ||
| <li> | ||
| <%= link_to material.name, material, class: 'mm-name' %> | ||
| <% if @user.role == 'admin' %> | ||
| <span data-id="<%= material.id %>" class="mm-edit-name mm-edit-name-off">Правка</span> | ||
| <% if @page && @page.id == material.id %> | ||
| <%= link_to "×".html_safe, methodical_material_path(@page.id), :method => :delete, :class => "mm-delete" %> | ||
| <% else %> | ||
| <span data-id="<%= material.id %>" class="mm-delete mm-delete-remote">×</span> | ||
| <% end %> | ||
| <% end %> | ||
| </li> | ||
| <% end %> | ||
| <% if @user.role == 'admin' %> | ||
| <li> | ||
| <div class="row"> | ||
| <div class="col-sm-offset-1 col-sm-9"> | ||
| <%= link_to 'Добавить компонент', new_methodical_material_path, class: 'btn btn-default' %> | ||
|
|
||
| </div> | ||
| </div> | ||
| </li> | ||
| <% end %> | ||
| </ul> | ||
| </div> | ||
| <!-- /#sidebar-wrapper --> | ||
|
|
||
| <!-- Page Content --> | ||
| <div id="page-content-wrapper"> | ||
| <div class="container"> | ||
| <%= yield %> | ||
| </div> | ||
| </div> | ||
| <!-- /#page-content-wrapper --> | ||
|
|
||
| </div> | ||
| <!-- /#wrapper --> | ||
|
|
||
| <!-- Bootstrap Core JavaScript --> | ||
| <%= javascript_include_tag "methodical_materials", "data-turbolinks-track" => true %> | ||
| <%= javascript_include_tag "bootstrap.min", "data-turbolinks-track" => true %> | ||
| <% if @user.role == 'admin' %> | ||
| <%= javascript_include_tag "methodical_materials_admin", "data-turbolinks-track" => true %> | ||
| <% end %> | ||
| </body> | ||
|
|
||
| </html> |
| @@ -0,0 +1,35 @@ | ||
| <div class="row"> | ||
| <div class="col-md-12"> | ||
| <blockquote> | ||
| <% if @user.role == 'admin' %> | ||
| <%= form_for @page, remote:true do |f| %> | ||
| <%= f.text_area :title, class: "inline-area" %> | ||
| <div class="inline-content"> | ||
| <%= @page.title.try(:html_safe) %> | ||
| </div> | ||
| <% end %> | ||
| <% else %> | ||
| <%= @page.title.try(:html_safe) %> | ||
| <% end %> | ||
| </blockquote> | ||
| <div class="jumbotron"> | ||
| <% if @user.role == 'admin' %> | ||
| <%= form_for @page, remote: true do |f| %> | ||
| <%= f.text_area :description, class: "inline-area" %> | ||
| <div class="inline-content"> | ||
| <%= @page.description.try(:html_safe) %> | ||
| </div> | ||
| <% end %> | ||
| <% else %> | ||
| <%= @page.description.try(:html_safe) %> | ||
| <% end %> | ||
| <div class="row no-margin"> | ||
| <div class="col-md-3 col-md-offset-9"><a href="#menu-toggle" class="btn btn-primary pull-right" id="menu-toggle">Активировать панель</a></div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <% content_for :title do %> | ||
| <%= strip_tags(@page.title) %> | ||
| <% end %> |
| @@ -0,0 +1,100 @@ | ||
| <div class="row"> | ||
| <div class="col-md-12"> | ||
| <blockquote> | ||
| <% if @user.role == 'admin' %> | ||
| <%= form_for @page, remote: true do |f| %> | ||
| <%= f.text_area :title, class: "inline-area" %> | ||
| <div class="inline-content"> | ||
| <%= @page.title.try(:html_safe) %> | ||
| </div> | ||
| <% end %> | ||
| <% else %> | ||
| <%= @page.title.try(:html_safe) %> | ||
| <% end %> | ||
| </blockquote> | ||
| <div class="jumbotron"> | ||
| <% if @user.role == 'admin' %> | ||
| <%= form_for @page, remote: true do |f| %> | ||
| <%= f.text_area :description, class: "inline-area" %> | ||
| <div class="inline-content"> | ||
| <%= @page.description.try(:html_safe) %> | ||
| </div> | ||
| <% end %> | ||
| <% else %> | ||
| <%= @page.description.try(:html_safe) %> | ||
| <% end %> | ||
| <div class="row no-margin"> | ||
| <div class="col-md-3 col-md-offset-9"><a href="#menu-toggle" class="btn btn-primary pull-right" id="menu-toggle">Активировать панель</a></div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="col-md-12"> | ||
| <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> | ||
| <!-- Первая панель --> | ||
| <div class="panel panel-primary"> | ||
| <div class="panel-heading" role="tab" id="headingOne"> | ||
| <h4 class="panel-title"> | ||
| <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> | ||
| Теоретическая часть | ||
| </a> | ||
| </h4> | ||
| </div> | ||
| <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne"> | ||
| <div class="panel-body"> | ||
| <% if @user.role == 'admin' %> | ||
| <%= form_for @page, remote: true do |f| %> | ||
| <%= f.text_area :theoretical_part, class: "inline-area" %> | ||
| <div class="inline-content"> | ||
| <%= @page.theoretical_part.try(:html_safe) %> | ||
| </div> | ||
| <% end %> | ||
| <% else %> | ||
| <%= @page.theoretical_part.try(:html_safe) %> | ||
| <% end %> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <!-- Вторая панель --> | ||
| <div class="panel panel-success"> | ||
| <div class="panel-heading" role="tab" id="headingTwo"> | ||
| <h4 class="panel-title"> | ||
| <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="true" aria-controls="collapseOne"> | ||
| Практическая часть | ||
| </a> | ||
| </h4> | ||
| </div> | ||
| <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo"> | ||
| <div class="panel-body"> | ||
| <% if @user.role == 'admin' %> | ||
| <%= form_for @page, remote: true do |f| %> | ||
| <%= f.text_area :practical_part, class: "inline-area" %> | ||
| <div class="inline-content"> | ||
| <%= @page.practical_part.try(:html_safe) %> | ||
| </div> | ||
| <% end %> | ||
| <% else %> | ||
| <%= @page.practical_part.try(:html_safe) %> | ||
| <% end %> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="col-md-1 col-md-offset-9"> | ||
| <%= link_to 'На главную', methodical_materials_path, class: 'btn btn-primary pull-right' %> | ||
| </div> | ||
| <div class="col-md-2"> | ||
| <a href="#menu-toggle" class="btn btn-primary pull-right" id="menu-toggle-2">Активировать панель</a> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <%= hidden_field_tag :current_id, @page.id %> | ||
| <% content_for :title do %> | ||
| <%= strip_tags(@page.title) %> | ||
| <% end %> |
| @@ -0,0 +1,26 @@ | ||
| <div id="pt_stud_<%= stud.id %>" class="panel-collapse collapse"> | ||
| <div class="panel-body"> | ||
| <% if stud.passed_personality_tests.any? %> | ||
| <h3>Пройденные тесты:</h3> | ||
| <ul class="list-group"> | ||
| <% stud.passed_personality_tests.each do |test| %> | ||
| <li class="list-group-item"> | ||
|
|
||
| <%= test.name %> | ||
| </li> | ||
| <% end %> | ||
| </ul> | ||
| <% end %> | ||
| <h3>Результаты студента:</h3> | ||
| <% if stud.personalities.any? %> | ||
| <% stud.personalities.each do |personality| %> | ||
| <h4><%= personality.name %></h4> | ||
| <p> | ||
| <%= personality.description %> | ||
| </p> | ||
| <% end %> | ||
| <% else %> | ||
| <p>Студент не прошел еще ни одного теста</p> | ||
| <% end %> | ||
| </div> | ||
| </div> |
| @@ -1,55 +1,41 @@ | ||
| <% if @user.role == 'admin' %> | ||
| <div class="col-sm-10"> | ||
| <% Group.all.each do |group| %> | ||
| <div class="panel panel-default"> | ||
| <div class="panel-heading"> | ||
| <h4 class="panel-title"> | ||
| <%= link_to group.number, '#pt_group_' + group.id.to_s, data: {toggle:'collapse'}, class: 'a-title-text' %> | ||
| </h4> | ||
| </div> | ||
| <div id="pt_group_<%= group.id %>" class="panel-collapse collapse"> | ||
| <div class="panel-body"> | ||
| <% Student.where(group_id: group.id).order(:fio).each do |stud| %> | ||
| <div class="panel panel-default"> | ||
| <div class="panel-heading"> | ||
| <h4 class="panel-title"> | ||
| <%= link_to stud.fio, '#pt_stud_' + stud.id.to_s, data: {toggle:'collapse'}, class: 'a-title-text' %> | ||
| </h4> | ||
| </div> | ||
| <%= render partial: 'student_results', locals: {stud: stud} %> | ||
| </div> | ||
| <% end %> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <% end %> | ||
| </div> | ||
| <% else %> | ||
| <div class="col-sm-10"> | ||
| <h1>Ваши результаты:</h1> | ||
| <% if @personalities.any? %> | ||
| <% @personalities.each do |personality| %> | ||
| <h2><%= personality.name %></h2> | ||
| <p> | ||
| <%= personality.description %> | ||
| </p> | ||
| <% end %> | ||
| <% else %> | ||
| <p>У вас еще нет результатов</p> | ||
| <% end %> | ||
| </div> | ||
| <% end %> |
| @@ -0,0 +1,33 @@ | ||
| <tr id="personality_trait_interval_<%= int.id %>"> | ||
| <td class="trait"> | ||
| <%= link_to int.trait.try(:name), '#', class: 'x-editable', | ||
| data: { name: 'personality_trait_id', | ||
| type: 'select', | ||
| pk: int.id, | ||
| source: PersonalityTrait.all.map {|t| {value: t.id, text: t.name }}, | ||
| url: personality_trait_interval_path(int), | ||
| value: int.try(:id) | ||
| } %> | ||
| </td> | ||
| <td class="trait"> | ||
| <%= link_to int.begin_at, '#', class: 'x-editable', | ||
| data: { name: 'begin_at', | ||
| type: 'number', | ||
| pk: int.id, | ||
| step: 'any', | ||
| url: personality_trait_interval_path(int), | ||
| } %> | ||
| </td> | ||
| <td class="trait"> | ||
| <%= link_to int.end_at, '#', class: 'x-editable', | ||
| data: { name: 'end_at', | ||
| type: 'number', | ||
| pk: int.id, | ||
| step: 'any', | ||
| url: personality_trait_interval_path(int), | ||
| } %> | ||
| </td> | ||
| <td> | ||
| <%= link_to '', personality_trait_interval_path(int), method: :delete, remote: true, data: { confirm: 'Вы уверены?'}, class: 'glyphicon glyphicon-remove pull-right' %> | ||
| </td> | ||
| </tr> |
| @@ -0,0 +1 @@ | ||
| $('#personality_trait_interval_<%= params[:id] %>').remove(); |
| @@ -0,0 +1,3 @@ | ||
| $tr = $(' <%= escape_javascript render( partial: "personality_trait_interval", locals: {int: @interval}) %>'); | ||
| $('#trait_interval_<%= params[:personality_id] %>').before($tr); | ||
| $tr.find('.x-editable').editable(); |
| @@ -0,0 +1,5 @@ | ||
| Rails.application.config.assets.precompile += %w( ckeditor/* ) | ||
|
|
||
| Ckeditor.setup do |config| | ||
| config.assets_languages = ['ru'] | ||
| end |
| @@ -0,0 +1,17 @@ | ||
| class CreatePersonalityTraitIntervals < ActiveRecord::Migration | ||
| def change | ||
| create_table :personality_trait_intervals do |t| | ||
| t.float :begin_at | ||
| t.float :end_at | ||
| t.references :personality, index: true | ||
| t.references :personality_trait, index: true | ||
|
|
||
| t.timestamps | ||
| end | ||
|
|
||
| Personality.all.each do |p| | ||
| PersonalityTraitInterval.create begin_at: p.begin_at, end_at: p.end_at, | ||
| personality_id: p.id, personality_trait_id: p.personality_trait_id | ||
| end | ||
| end | ||
| end |
| @@ -0,0 +1,13 @@ | ||
| class CreateMethodicalMaterials < ActiveRecord::Migration | ||
| def change | ||
| create_table :methodical_materials do |t| | ||
| t.string :name | ||
| t.string :title | ||
| t.text :description | ||
| t.text :theoretical_part | ||
| t.text :practical_part | ||
|
|
||
| t.timestamps | ||
| end | ||
| end | ||
| end |