Skip to content

Instantly share code, notes, and snippets.

View sidtri's full-sized avatar
🎯
Focusing

sid d sidtri

🎯
Focusing
View GitHub Profile
diff --git a/app/assets/javascripts/angular/moves/edit/moves-edit.coffee b/app/assets/javascripts/angular/moves/edit/moves-edit.coffee
index a70810c..3f66cad 100644
--- a/app/assets/javascripts/angular/moves/edit/moves-edit.coffee
+++ b/app/assets/javascripts/angular/moves/edit/moves-edit.coffee
@@ -103,7 +103,7 @@ angular.module('moves.edit',['uiGmapgoogle-maps'])
MovesFactory.handleResponse('save', 'success', 'move')
handleError = (resp) ->
- render_form_errors($("#move_form"), resp.data.errors)
+ render_form_errors($("#moves_form"), resp.data.errors)
diff --git a/app/assets/javascripts/angular/form_templates/form/form-template-form.tmpl.html.haml b/app/assets/javascripts/angular/form_templates/form/form-template-form.tmpl.html.haml
index 93c2e9b..c51a7ff 100644
--- a/app/assets/javascripts/angular/form_templates/form/form-template-form.tmpl.html.haml
+++ b/app/assets/javascripts/angular/form_templates/form/form-template-form.tmpl.html.haml
@@ -88,7 +88,7 @@
%label.col-xs-4.col-sm-4.col-md-4.control-label.valtype{"data-valtype" => "label"} Textarea
.col-xs-8.col-sm-8.col-md-4
.textarea
- %textarea.form-control.valtype{"data-valtype" => "checkbox"}
+ %textarea.form-control.valtype{"data-valtype" => "checkbox", "type" => "textarea"}
diff --git a/app/models/order.rb b/app/models/order.rb
index da923c9..be8171d 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -1,6 +1,6 @@
class Order < ActiveRecord::Base
-
- # ---------- ASSOCIATIONS ----------
+
+ # ---------- ASSOCIATIONS ----------
diff --git a/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee b/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee
index 3dafa4f..8f5451c 100644
--- a/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee
+++ b/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee
@@ -55,6 +55,8 @@ angular.module('form-template.form',['schemaForm', 'ui.codemirror'])
$scope.saveTemplate = ->
$scope.template.builder_html = $("#build").html()
+ if ($("#build .btn[type='button'][onclick='submitForm()']").length == 0)
+ return $('#submit_button_error').modal('toggle')
diff --git a/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee b/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee
index 3dafa4f..f57d4dc 100644
--- a/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee
+++ b/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee
@@ -55,6 +55,8 @@ angular.module('form-template.form',['schemaForm', 'ui.codemirror'])
$scope.saveTemplate = ->
$scope.template.builder_html = $("#build").html()
+ if ($("#build .btn[type='button'][onclick='submitForm()']").length == 0)
+ return alert("Please try to add submit button, as it is mandatory for drivers to submit the form you have designed.")
diff --git a/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee b/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee
index 3dafa4f..f57d4dc 100644
--- a/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee
+++ b/app/assets/javascripts/angular/form_templates/form/form-template-form.coffee
@@ -55,6 +55,8 @@ angular.module('form-template.form',['schemaForm', 'ui.codemirror'])
$scope.saveTemplate = ->
$scope.template.builder_html = $("#build").html()
+ if ($("#build .btn[type='button'][onclick='submitForm()']").length == 0)
+ return alert("Please try to add submit button, as it is mandatory for drivers to submit the form you have designed.")
diff --git a/app/assets/javascripts/angular/documents/list/documents-list.coffee b/app/assets/javascripts/angular/documents/list/documents-list.coffee
index 8fb0df3..d9ba0ba 100644
--- a/app/assets/javascripts/angular/documents/list/documents-list.coffee
+++ b/app/assets/javascripts/angular/documents/list/documents-list.coffee
@@ -4,14 +4,27 @@ angular.module('documents.list',['ngTable'])
.state('documents-list',{
url: '/admin/documents'
templateUrl: "angular/documents/list/documents-list.tmpl.html"
- controller: ['$scope', 'NgTableParams', 'DocumentService',
- ($scope, NgTableParams, DocumentService) ->
diff --git a/app/assets/javascripts/angular/documents/list/documents-list.coffee b/app/assets/javascripts/angular/documents/list/documents-list.coffee
index 8fb0df3..d9ba0ba 100644
--- a/app/assets/javascripts/angular/documents/list/documents-list.coffee
+++ b/app/assets/javascripts/angular/documents/list/documents-list.coffee
@@ -4,14 +4,27 @@ angular.module('documents.list',['ngTable'])
.state('documents-list',{
url: '/admin/documents'
templateUrl: "angular/documents/list/documents-list.tmpl.html"
- controller: ['$scope', 'NgTableParams', 'DocumentService',
- ($scope, NgTableParams, DocumentService) ->
diff --git a/app/models/trip.rb b/app/models/trip.rb
index 49c0315..1446c3a 100644
--- a/app/models/trip.rb
+++ b/app/models/trip.rb
@@ -11,7 +11,7 @@ class Trip < ActiveRecord::Base
# Small hack to load associated object with dynamic conditions
has_many :driver_moves, ->{where(date: RequestStore.store[:current_date])}, class_name: "Move"
- has_many :driver_events, through: :driver_moves
+ has_many :driver_events, -> { order 'moves.sequence' }, through: :driver_moves
diff --git a/app/models/trip.rb b/app/models/trip.rb
index 49c0315..1446c3a 100644
--- a/app/models/trip.rb
+++ b/app/models/trip.rb
@@ -11,7 +11,7 @@ class Trip < ActiveRecord::Base
# Small hack to load associated object with dynamic conditions
has_many :driver_moves, ->{where(date: RequestStore.store[:current_date])}, class_name: "Move"
- has_many :driver_events, through: :driver_moves
+ has_many :driver_events, -> { order 'moves.sequence' }, through: :driver_moves