Permalink
Browse files

Merge branch 'develop' into bek

  • Loading branch information...
2 parents 31e32a5 + 0134db1 commit 35b483aee1f36845c523054e2b2accee3e775ab9 @bek0nik bek0nik committed Mar 28, 2012
Showing with 441 additions and 230 deletions.
  1. +1 −0 README
  2. BIN app/assets/images/customer_act.gif
  3. BIN app/assets/images/customer_pot.gif
  4. +128 −133 app/assets/javascripts/app.js
  5. +8 −0 app/assets/stylesheets/style.css.scss
  6. +23 −20 app/assets/stylesheets/subjects.css.scss
  7. +8 −0 app/assets/stylesheets/users.css.scss
  8. +10 −0 app/controllers/application_controller.rb
  9. +1 −0 app/controllers/customers_controller.rb
  10. +1 −0 app/controllers/help_controller.rb
  11. +2 −0 app/controllers/potentials_controller.rb
  12. +1 −1 app/controllers/results_controller.rb
  13. +1 −0 app/controllers/subjects_controller.rb
  14. +2 −0 app/controllers/tasks_controller.rb
  15. +2 −0 app/controllers/transactions_controller.rb
  16. +3 −2 app/controllers/users_controller.rb
  17. +8 −0 app/helpers/application_helper.rb
  18. +16 −18 app/helpers/subjects_helper.rb
  19. +1 −1 app/models/condition_field.rb
  20. +14 −1 app/models/subject.rb
  21. +18 −1 app/models/transaction.rb
  22. +2 −2 app/models/user.rb
  23. +7 −6 app/views/customers/_allcustomers.html.erb
  24. +3 −0 app/views/customers/_customers.html.erb
  25. +6 −5 app/views/customers/show.html.erb
  26. +7 −0 app/views/potentials/_potentials.html.erb
  27. +28 −24 app/views/subjects/_form.html.erb
  28. +4 −0 app/views/subjects/show.html.erb
  29. +1 −1 app/views/tasks/show.html.erb
  30. +8 −3 app/views/users/edit.html.erb
  31. +13 −2 app/views/users/index.html.erb
  32. +3 −3 config/deploy.rb
  33. +5 −0 db/migrate/20120326164302_add_floor_all_to_subject.rb
  34. +5 −0 db/migrate/20120327053810_add_fired_to_user.rb
  35. +5 −3 db/schema.rb
  36. BIN public/favicon.ico
  37. +3 −0 spec/controllers/subjects_controller_spec.rb
  38. +33 −3 spec/controllers/users_controller_spec.rb
  39. +11 −0 spec/factories/customers.rb
  40. +2 −0 spec/factories/subjects.rb
  41. +15 −0 spec/factories/users.rb
  42. +17 −1 spec/models/subject_spec.rb
  43. +15 −0 spec/models/transaction_spec.rb
View
1 README
@@ -0,0 +1 @@
+#TODO: во вьюхе задачи изменить "ответственный: email" на "ответственный: lastname"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -359,139 +359,7 @@ $(document).ready(function() {
});
});
-// subject -> resident
-$(document).ready(function() {
- if ($("form").find("#exist-resident-subject").length != 0) {
- $("#resident-subject-block :input").attr("disabled", true);
- };
-
- $("#subject_typesubject_id").change(function(event) {
- var typesubject_id = $(this).attr("value");
- $.ajax({
- url: '/subjects/findtypesubject',
- type: 'POST',
- dataType: 'json',
- data: {id: typesubject_id},
- success: function(data, textStatus, xhr) {
- if((data['resident'] == true) && ($("form").find("#exist-resident-subject").length == 0)){
- $("#resident-subject-block :input").removeAttr('disabled');
- $("#resident-subject-block").slideDown('fast');
- }
- else if((data['resident'] == false) && ($("form").find("#exist-resident-subject").length != 0)){
-
- $("#exist-resident-subject")
- .slideUp('fast')
- .remove();
-
- $("#resident-subject-block :input").attr('disabled', true);
- $("#resident-subject-block").slideUp('fast');
- }
- else if(data['resident'] == false){
- $("#resident-subject-block :input").attr('disabled', true);
- $("#resident-subject-block").slideUp('fast');
- }
- }
- });
- });
-});
-
-// residents:
-$(document).ready(function() {
- // districts(subject form)
- $("#add_resident")
- .attr("disabled", true)
- .hide();
- $("#add-resident-button").click(function(event) {
- $("#subject_resident_id").attr("disabled", true);
- $(".resident-operations").slideUp('fast');
- $("#add_resident")
- .attr("disabled", false)
- .show('fast');
- $("#back-resident-select").show();
- });
-
- // back to list districts
- $("#back-resident-select").click(function(event) {
- $("#add_resident")
- .attr("disabled", true)
- .hide('fast');
- $("#subject_resident_id").attr("disabled", false);
- $(".resident-operations").slideDown('fast');
- $("#back-resident-select").hide();
- });
-
-});
-// residents load(subject form)
-$(document).ready(function() {
- // functions :
- function disabled_resident(){
- $("#subject_resident_id")
- .attr("disabled", true)
- .html("<option>Нет ЖК</option>");
- }
-
- function enable_resident(){
- $("#subject_resident_id")
- .attr("disabled", false)
- }
-
- // all resident :
- var residents = $("#subject_resident_id").html();
-
- // first state
- var city_first = $("#subject_city_id :selected").text();
- var opt_fir = $(residents).filter("optgroup[label='"+city_first+"']").html();
- $("#subject_resident_id").html(opt_fir);
- if (!opt_fir) {
- disabled_resident();
- };
-
- // change city
- $("#subject_city_id").change(function(event) {
- var city = $("#subject_city_id :selected").text();
- var options = $(residents).filter("optgroup[label='"+city+"']").html();
- if (options) {
- enable_resident();
- $("#subject_resident_id").html(options);
- }
- else{
- disabled_resident();
- };
- });
-});
-
-// // subject -> change subject (load attr)
-// $(document).ready(function() {
-//
-// // если в дальнейшем будет зависеть от subject
-// // var subject_id = $("#subject-id").attr("data-subject-id");
-// // console.log(subject_id);
-//
-// $("#subject_typesubject_id").change(function(event) {
-// // initialize
-// var typesubject_id = $(this).attr('value');
-// // end initialize
-//
-// // ajax
-// $.ajax({
-// url: '/subjects/load_attr',
-// type: 'POST',
-// dataType: 'json',
-// data: {id: typesubject_id},
-// success: function(data, textStatus, xhr) {
-// console.log(data);
-// },
-// error: function(xhr, textStatus, errorThrown) {
-// alert("Упс...что-то пошло не так.")
-// }
-// });
-// // end ajax
-//
-// });
-//
-//
-// });
// users mobile phone autotab
$(document).ready(function(){
@@ -601,6 +469,10 @@ $(document).ready(function() {
required: true,
digits: true
},
+ "subject[floorall]" : {
+ required: true,
+ digits: true
+ },
"subject[room]" : {
required: true,
digits: true
@@ -620,6 +492,10 @@ $(document).ready(function() {
required: "Введите этаж",
digits: "Только цифры"
},
+ "subject[floorall]" : {
+ required: "Введите этажность",
+ digits: "Только цифры"
+ },
"subject[room]" : {
required: "Введите этаж",
digits: "Только цифры"
@@ -795,6 +671,7 @@ $(document).ready(function() {
// search:
+
// change city - load districts
$(document).ready(function() {
// functions :
@@ -937,7 +814,7 @@ $(document).ready(function() {
});
});
-// change city - load residents
+// search - change city - load residents
$(document).ready(function() {
// functions :
function disabled_resident(){
@@ -979,3 +856,121 @@ $(document).ready(function() {
};
});
});
+
+
+
+// subject -> residents
+$(document).ready(function() {
+ if($("form").is(".subject-form")){
+ $("#add_resident")
+ .attr("disabled", true)
+ .hide();
+ var first_typesubject = $("#subject_typesubject_id option:selected").val();
+ $("#resident-block #subject_resident_id").attr('disabled', true);
+ $.ajax({
+ url: '/subjects/findtypesubject',
+ type: 'POST',
+ dataType: 'json',
+ data: {id: first_typesubject},
+ success: function(data, textStatus, xhr) {
+ if (data['resident'] == true) {
+ // $("#resident-block :input").removeAttr('disabled');
+ $("#resident-block #subject_resident_id").removeAttr('disabled');
+ $("#resident-block").show();
+ }
+ else if (data['resident'] == false){
+ // $("#resident-block :input").attr('disabled', true);
+ $("#resident-block #subject_resident_id").attr('disabled', true);
+ $("#resident-block").hide();
+ };
+ }
+ });
+ }
+
+ $("#subject_typesubject_id").change(function(event) {
+ var typesubject_id = $(this).attr("value");
+ $.ajax({
+ url: '/subjects/findtypesubject',
+ type: 'POST',
+ dataType: 'json',
+ data: {id: typesubject_id},
+ success: function(data, textStatus, xhr) {
+ if (data['resident'] == true) {
+ // $("#resident-block :input").removeAttr('disabled');
+ $("#resident-block #subject_resident_id").removeAttr('disabled');
+ $("#resident-block").show();
+ }
+ else if (data['resident'] == false){
+ // $("#resident-block :input").attr('disabled', true);
+ $("#resident-block #subject_resident_id").attr('disabled', true);
+ $("#resident-block").hide();
+ };
+ }
+ });
+ });
+
+});
+
+// residents:
+$(document).ready(function() {
+ // residents(subject form)
+ $("#add-resident-button").click(function(event) {
+ $("#subject_resident_id").attr("disabled", true);
+ $(".resident-operations").slideUp('fast');
+ $("#add_resident")
+ .attr("disabled", false)
+ .show('fast');
+ $("#back-resident-select").show();
+ });
+
+ // back to list residents
+ $("#back-resident-select").click(function(event) {
+ $("#add_resident")
+ .attr("disabled", true)
+ .hide('fast');
+ $("#subject_resident_id").attr("disabled", false);
+ $(".resident-operations").slideDown('fast');
+ $("#back-resident-select").hide();
+ });
+
+});
+
+// residents load(subject form)
+$(document).ready(function() {
+ // functions :
+ function disabled_resident(){
+ $("#subject_resident_id")
+ .attr("disabled", true)
+ .html("<option>Нет ЖК</option>");
+ }
+
+ function enable_resident(){
+ $("#subject_resident_id")
+ .attr("disabled", false)
+ }
+
+ // all residents :
+ var residents = $("#subject_resident_id").html();
+
+ // first state
+ var city_first = $("#subject_city_id :selected").text();
+ var opt_fir = $(residents).filter("optgroup[label='"+city_first+"']").html();
+ $("#subject_resident_id").html(opt_fir);
+ if (!opt_fir) {
+ disabled_resident();
+ };
+
+ // change city
+ $("#subject_city_id").change(function(event) {
+ var city = $("#subject_city_id :selected").text();
+ var options = $(residents).filter("optgroup[label='"+city+"']").html();
+ if (options) {
+ enable_resident();
+ $("#subject_resident_id").html(options);
+ }
+ else{
+ disabled_resident();
+ };
+ });
+});
+// end subject -> residents
@@ -134,4 +134,12 @@ form{
background:none !important;
color:#ccc !important;
}
+}
+
+// small inputs
+.sm-inp{
+ width:40px;
+}
+.norm-inp{
+ width:80px;
}
@@ -122,26 +122,6 @@ form{
display:none;
}
-// for resident
-#resident-subject-block{
- display:none;
-}
-.resident-operations{
- // margin-top:15px;
- .title{
- color:#6F6F6F;
- margin:15px 0px 5px 0px;
- font-size:11px;
- }
-}
-#add-resident-button{
- float:left;
-}
-#back-resident-select{
- display:none;
- margin-left:10px;
-}
-
// address
#ad-street{
width:110px;
@@ -270,4 +250,27 @@ form{
input{
width:500px;
}
+}
+// residents:
+#resident-block{
+ display:none;
+ .resident-operations{
+ // margin-top:15px;
+ .title{
+ color:#6F6F6F;
+ margin:15px 0px 5px 0px;
+ font-size:11px;
+ }
+ }
+ #add-resident-button{
+ float:left;
+ }
+ #back-resident-select{
+ display:none;
+ margin-left:10px;
+ }
+}
+.icon-trans-status{
+ display: inline-block;
+ margin-right:5px;
}
@@ -35,3 +35,11 @@
font-size:16px;
}
}
+.user-fired{
+ color:#B8503A;
+ font-weight:bold;
+}
+.user-not-fired{
+ color:#9DD06F;
+ font-weight:bold;
+}
Oops, something went wrong.

0 comments on commit 35b483a

Please sign in to comment.